 	var $active=1;

$(document).ready(
	function(){ 

		 $("#videocarousel-nav-sel-1").addClass("selected");
		
	
		var $plates=4;	
		
		sleepp($active);
			 
			 $("a")
			   .filter(".videocarousel-jump-link")
			     .click(function(event){
			    	 event.preventDefault();
				    	 var which = $(this).attr('vcar');
				    	 
				   // 	 $active = which;
				    	 vc_show_plate(which);
			     })
			   .end()
			
			   .filter("#vcarleft")
			     .click(function(event){
			    	 event.preventDefault();
				    	 var which = $active-1;
				    	 if(which<=0)which=4;
				    	
				  //  	 $active = which;
				    	 vc_show_plate(which);
			     })
			   .end()
			   
			   .filter("#vcarright")
			     .click(function(event){
			    	 event.preventDefault();
				    	 var which = $active+1;
				    	 if(which>$plates)which=1;
				    	 
				   // 	 $active = which;
				    	 vc_show_plate(which);
			     })
			   .end()	
			   
	}
 );

function sleepp(){
		$active++;

		setTimeout("vc_show_plate("+$active+",true);", 5000);
	}
 
	function vc_show_plate($pid, $rec){	 
		
		if($rec==true){
		//	$pid = $active; 
			 if($pid>4) {
				 $pid=1;
				 $active=1;
			 }
			 $(".videocarousel-nav-sel").removeClass("selected");
			 $("#videocarousel-nav-sel-"+$pid).addClass("selected");
			 
			 $('.videocarousel-plate').css('display','none');
			 $('#videocarousel-plate-'+$pid).fadeIn("slow"); 

			 sleepp();
		 }else{
			 
			 if($pid>4) $pid=1;
			 $(".videocarousel-nav-sel").removeClass("selected");
			 $("#videocarousel-nav-sel-"+$pid).addClass("selected");
			 
			 $('.videocarousel-plate').css('display','none');
			 $('#videocarousel-plate-'+$pid).fadeIn("slow"); 
			 
			 $active=$pid;

			 
		 }
}
 
 

 
 
/*

#videocarousel-plate-2{
position :absolute;
left:306;

}

#videocarousel-plate-3{
position :absolute;
left:612;
}

#videocarousel-plate-4{
position :absolute;
left:918;
}

.last_one{
position :absolute;
left:1224;
}
  
*/