$(document).ready(function() {
		Cufon.replace('h2');
		Cufon.replace('#cabecera ul li');		
		$("#cabecera img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.png$/ig,"_over.png");
			$("<img>").attr("src", rollON);
		});
		// Navigation rollovers
		$("#cabecera a").mouseover(function(){
			imgsrc = $(this).children("img").attr("src");
			matches = imgsrc.match(/_over/);
			
			// don't do the rollover if state is already ON
			if (!matches) {
			imgsrcON = imgsrc.replace(/.png$/ig,"_over.png"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
			
		});
		$("#cabecera a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});

		cuenta = 0;
		limite = 10;
		anchura = 900;
if(page == "proyectos")	controlaReel();

		$("#leftLink").mousedown(function(){
			cuenta --;
	      	controlaReel()
	    })
		$("#rightLink").mousedown(function(){
			cuenta ++;									
	    		controlaReel()  
	    })
	});



function controlaReel(){
 $("#contFichas").animate({ 
        marginLeft: "-450"*cuenta
      }, 800,"swing" );
	document.getElementById("rightLink").style.display = "block";			 
	document.getElementById("leftLink").style.display = "block";			 	
	if(cuenta == 0){
	document.getElementById("leftLink").style.display = "none";		

	}
	if(cuenta == limite){
	document.getElementById("rightLink").style.display = "none";				

	}
	

}


