 $(document).ready(function () {	
    
    rotateNews();
  
     $("img[id*=nid_]").click(function(){
       var elid=$(this).attr('id');
      
       rotate(elid);
       return false;
     });  
 
 });
 
 
 
 function rotateNews(){ 
     $("img[id*=nid_]").slowEach(7000, function(){
       var elid=$(this).attr('id');
      
       rotate(elid);
     
     });  
 
     setTimeout(rotateNews, 63000);

 } 


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("120x120","468x213");
   
   $("#bigpic_img").attr("src",src);
   $("#bigpic_title").attr("href",url);
   $("#bigpic_url").attr("href",url);
   $("#bigpic_title").html(title);
   $("#bigpic_teaser").html(teaser);
   
   $("img[id*=nid_]").each(function(){
    $(this).css("border","2px solid white");
   });
   
   $("#"+elem).css("border","4px solid red");
   $("#"+elem).css("border-bottom","2px solid red");
   $("#"+elem).css("border-top","2px solid red");
    
}  