// FUNCIONES DE JQUERY
document.write('<style type="text/css">body{display:none}</style>');
jQuery(function($) {
	$('body').css('display','block');
});
$(document).ready(function() {
			//mostramos ul de la seccion activo
			$("#mainNav ul.activo").css("visibility", "visible");
			// Preload all rollovers
			$("#cabecera #mainNav img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers

		$("#cabecera #mainNav a").mouseover(function(){
		//	$("#mainNav ul").css("visibility", "hidden");	
			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);
			}
			
		});
		
		$("#cabecera #mainNav a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		$("#cabecera #mainNav li").mousedown(function(){
			controlaNav($(this));

		});
		$("#cabecera .subNav li").mouseover(function(){
			$(this).parent("ul").css("visibility", "visible");
								 
		});

		$("#cabecera .subNav").mouseout(function(){
			//		$(this).css("visibility", "hidden");
								 
		});				
		
	});
//////////////////////////////////////
//- CONTROL DE LA NAVEGACIÓN PRINCIPAL
/////////////////////////////////////
function controlaNav(elem){
	$("#mainNav ul").css("visibility", "hidden");
//	$("#mainNav ul").fadeOut(400);


	elem.children("ul").css("visibility", "visible");

//	elem.children("ul").fadeIn(400);
	}
	
jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
}



//////////////////////////////////////
//- BOTON DE CONTACTO
/////////////////////////////////////
$(document).ready(function() {
		
		// Preload all rollovers
		$("#cabecera #contacto img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
			$("<img>").attr("src", rollON);
		});
		
		// Navigation rollovers
		$("#cabecera #contacto 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(/.gif$/ig,"_over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			
			$("#cabecera #contacto a").mouseout(function(){
				$(this).children("img").attr("src", imgsrc);
								 
		});		
			}
		});
	});


$(document).ready(function() {
		
		// Preload all rollovers
		$("#sidebar li img").each(function() {
			// Set the original src
			rollsrc = $(this).attr("src");
			rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
			$("<img>").attr("src", rollON);
		});
			$("#sidebar li a").mouseout(function(){
			$(this).children("img").attr("src", imgsrc);
		});
		
		// Navigation rollovers
		$("#sidebar li 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(/.gif$/ig,"_over.gif"); // strip off extension
			$(this).children("img").attr("src", imgsrcON);
			}
		});
	});



		
