 $(document).ready(function () {	
    
    rotateNews();
      
  
     $("img[id*=nid_]").click(function(){
       var elid=$(this).attr('id');
      
       rotate(elid);
       return false;
     });  
 
     
    $("img[id*=team_]").mouseover(function(){
        var src=($(this).attr("src")).replace(".jpg","_zoom.jpg");
        $(this).attr("src",src);
    }).mouseout(function(){
        var src=($(this).attr("src")).replace("_zoom.jpg",".jpg");
        $(this).attr("src",src);
    });

     
     
 
 });
 
 
 
 function rotateNews(){ 
     $("img[id*=nid_]").slowEach(7000, function(){
       var elid=$(this).attr('id');
      
       rotate(elid);
     
     });  
 
     setTimeout(rotateNews, 42000);

 } 


function rotate(elem){
   
   
   var nr=elem.split('_');
   var id=nr[1];
   var teaser = $("#teaser_"+id).val(); 
   var title = $("#title_"+id).val(); 
   var url = $("#url_"+id).val(); 
   
   var src=($("#"+elem).attr("src")).replace("60x60","250x250");
   
   $("#bigpic_img").attr("src",src);
   $("#bigpic_title").attr("href",url);
   $("#bigpic_url").attr("href",url);
   $("#bigpic_title").html(title);
   $("#bigpic_teaser").html(teaser);
   
   $("div[id*=small_]").each(function(){
      $(this).css("background","#363636");
      $(this).css("border-bottom","1px solid #2c4c00");
      $(this).css("border-right","1px solid #2c4c00");
   });
   
   $("#small_"+id).css("background","#777");
   $("#small_"+id).css("border-bottom","2px solid red");
   $("#small_"+id).css("border-right","2px solid red");
    
}  