// FUNCIONES DE JQUERY
$(document).ready(function() {
				
	// Preload all rollovers
	$("#header img, #contenido .boton img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"-over.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$("#header a, #contenido a.boton").mouseover(function(){		
		imgsrc = $(this).children("img").attr("src");
		if (imgsrc.match(/-sel/))
			return;		
		matches = imgsrc.match(/-over/);
		
		// don't do the rollover if state is already ON
		if (!matches) {
			imgsrcON = imgsrc.replace(/.gif$/ig,"-over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			
			$("#header a, #contenido a.boton").mouseout(function(){
				$(this).children("img").attr("src", imgsrc);								 
			});		
		}
	});
	
	$("a.check").click(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(/.gif$/ig,"-over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			$(this).prev().attr("value",1);
		} else {
			imgsrcON = imgsrc.replace(/-over.gif$/ig,".gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);			
			$(this).prev().attr("value",0);
		}
	});
	
	
	
});

		

