// FUNCIONES DE JQUERY
document.write('<style type="text/css">body{display:none}</style>');
jQuery(function($) {
	$('body').css('display','block');
});
$(document).ready(function() {
		
	// Preload all rollovers
	$("#menu li img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$("#menu li 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);
		}		
	});	
	
	$("#menu li a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	
	// Preload all rollovers
	$("#avisoLegal img, #audios img").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$("#avisoLegal a, #audios 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);
		}		
	});	
	
	$("#avisoLegal a, #audios a").mouseout(function(){
		$(this).children("img").attr("src", imgsrc);
	});
	
	
	// Preload all rollovers
	$("#contacto .boton img.over").each(function() {
		// Set the original src
		rollsrc = $(this).attr("src");
		rollON = rollsrc.replace(/.gif$/ig,"_over.gif");
		$("<img>").attr("src", rollON);
	});
	
	// Navigation rollovers
	$("#contacto .boton a").mouseover(function(){
	//	$("#mainNav ul").css("visibility", "hidden");	
		imgsrc = $(this).children("img.over").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.over").attr("src", imgsrcON);
		}		
	});	
	
	$("#contacto .boton a").mouseout(function(){
		$(this).children("img.over").attr("src", imgsrc);
	});
	
	// Navigation rollovers
	$("#contacto .cPromos #checkTerminos").click(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);
		$("#promos").attr("value",1);
		}
		else {
		imgsrcOFF = imgsrc.replace(/_over.gif$/ig,".gif");			
		$(this).children("img").attr("src", imgsrcOFF);
		$("#promos").attr("value",0);
		}
	});	
	
});


function contactMail()
{
var usuario = "cio"
var dominio = "umh.es"
document.write("<a href=\"mailto:" + usuario + "@" + dominio + "\">" + usuario + "@" + dominio + "</a>")
}

function avisoLegal() 
{
	windowWidth = 600;
	windowHeight = 400;
	var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open('/avisolegal.html', 'Maps', 'scrollbars=1,resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
}

function basesConcurso() 
{
	windowWidth = 600;
	windowHeight = 400;
	var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open('/basesConcurso.html', 'Maps', 'scrollbars=1,resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);

    newWindow.focus();
}