var minAncho = 1000;
var minAlto = 595;

var winName = "titulo";
var win = null;

function AbreN(theURL, ancho, alto)
{
    var h = (screen.width-ancho)/2;
    var v = (screen.height-alto)/2;
    var windowprops = "top=0,left=0,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes, resizable=no,width="+ancho+",height="+alto+",left="+h+", top="+v;
    if (win) {
        win.close();
    }
    win = window.open(theURL, winName, windowprops);
}

function Actualiza()
{
    w = document.getElementById ('flash');
    ancho = alto = 0;
    if (typeof (window.innerWidth) == 'number') {
        ancho = window.innerWidth;
        alto = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        ancho = document.documentElement.clientWidth;
        alto = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        ancho = document.body.clientWidth;
        alto = document.body.clientHeight;
    }
    w.style.width = ancho < minAncho ? minAncho + "px" : "100%";
    w.style.height = alto < minAlto ? minAlto + "px" : "100%";
}


function CambiaAlto(alto){
	minAlto = alto;
	Actualiza();
}
function CambiaCatalogo(estado)
{
	
	if(estado == 'over') {
		$("#online" ).stop().animate( {marginTop: "-120px" }, 250 );

	}
	
	if(estado == 'out') {
		$("#online" ).stop().animate( {marginTop: "0px" }, 250 );

	}
}

function CambiaDescarga( estado, cual) {
	if(estado == 'over') {
		$("#ico" + cual ).stop().animate( { marginLeft: "20px" }, "slow" );
	}
	if(estado == 'out') {
		$("#ico" + cual ).stop().animate( { marginLeft: "0px" }, "slow" );
	}
}

function CambiaFoto( estado, cual) {
	if(estado == 'over') {
		//$("#laFoto" + cual ).stop().animate( { width: "150%", marginLeft: "-40px", marginTop: "-40px" }, "slow" );
	}
	if(estado == 'out') {
		//$("#laFoto" + cual ).stop().animate( {width: "100%", marginLeft: "0px", marginTop: "0px" }, "slow" );
	}
}

function CambiaFot( estado, cual) {
	if(estado == 'over') {
		$("#imagen" + cual ).stop().animate( {opacity:"0"}, "slow" );
	}
	if(estado == 'out') {
		$("#imagen" + cual ).stop().animate( {opacity:"1"}, "slow" );
	}
}

function CambiaImg( idElemento, imagen )
{
    document.getElementById( idElemento ).src = imagen;
}

function CambiaParticipante(estado, participante, icono, titulo, datos, especialidad)
{
	
	if(estado == 'over') {
		$("#" + titulo ).stop().animate( { color: '#0167b2',  marginLeft: '40px' }, 150 );
		$("#" + datos ).stop().animate( { color: '#0167b2' }, 150 );
		var posicionReal = $("#"+participante).offset();
		var posicionY = posicionReal.top;
		var posicionX = posicionReal.left;
		
		$("#bocata" ).stop().animate( {opacity:"1", top: (posicionY - 170) + 'px', left: (posicionX) + 'px' }, 250 );

		document.getElementById("bocataTexto").innerHTML=especialidad;
		document.getElementById(icono).style.display="block";
	}
	
	if(estado == 'out') {
		$("#" + titulo ).stop().animate( { color: '#999', marginLeft: '20px' }, 150 );
		$("#" + datos ).stop().animate( { color: '#999' }, 150 );
		$("#bocata" ).stop().animate({opacity: "0", top: "-400px"}, 150);
		document.getElementById(icono).style.display="none";

	}
}

function CambiaPartner(estado, cual) {
	if(estado == 'over') {
		$("#tit" + cual ).stop().animate( { marginTop: '-80px' }, 150 );
		//$("#clip" + cual ).stop().animate( { border: "1px solid #FFFF55" }, 150 );
	}
	if(estado == 'out') {
		$("#tit" + cual ).stop().animate( { marginTop: '150px' }, 150 );
		//$("#clip" + cual ).stop().animate( { border: "1px dotted #cccccc" }, 150 );
	}
}

function CambiaVolver(estado) {
	if(estado == 'over') {
		$("#icoBack" ).stop().animate( { marginLeft: '-10px' }, 150 );
	}
	if(estado == 'out') {
			$("#icoBack" ).stop().animate( { marginLeft: '0px' }, 150 );
	}
}


function Cargador() {
	cargador = document.createElement("div");
	cargador.id ='miCargador';
	
	document.body.appendChild( cargador );

	document.getElementById( 'miCargador' ).className = "loading";
	document.getElementById( 'miCargador' ).innerHTML = "<img src='img/loading.gif'   > loading... please wait";
	
}

function CargadorNo()
{
	//parent.document.getElementById('miCargador').style.display = 'none';
	elementoAEliminar = parent.document.getElementById( 'miCargador' );
	padre = elementoAEliminar.parentNode;
	padre.removeChild(elementoAEliminar);
}

function CmpIE()
{
	if( navigator.appName == "Microsoft Internet Explorer" )
	{
		version = parseFloat( navigator.appVersion.split( "MSIE" )[ 1 ] );
		
		if( version < 8 )
		{
			document.getElementById( 'avisoIE' ).innerHTML = "<img src=\"img/error.png\" > Est&aacute; utilizando una versi&oacute;n obsoleta de Internet Explorer, de manera que algunos elementos de esta p&aacute;gina no se ver&aacute;n correctamente. Actual&iacute;cese gratu&iacute;tamente desde <a href=\"http://www.microsoft.com/spain/windows/internet-explorer/\" target=\"_blank\" style=\"color: #333\" >aqu&iacute;</a>.";
			document.getElementById( 'avisoIE' ).className = "avisoJS";
		}
	}
}


function DesactivaAtrasBt()
{
	window.history.forward();
}


function FormLogin(error1)
{

	var campo1 = document.getElementById( 'firstName' ).value;
	var campo2 = document.getElementById( 'lastName' ).value;

	if( campo1 == "" || campo2 == "" )
	{
		alert( error1 );
		return false;
	}

	else
	{
		return true;
	
	}
}

function FormPress(error1, error2)
{

	var campo1 = document.getElementById( 'firstName' ).value;
	var campo2 = document.getElementById( 'lastName' ).value;
	var campo3 = document.getElementById( 'mediaName' ).value;
	var campo4 = document.getElementById( 'language' ).value;
	var campo5 = document.getElementById( 'city' ).value;
	var campo6 = document.getElementById( 'country' ).value;
	var campo7 = document.getElementById( 'tel' ).value;
	var campo8 = document.getElementById( 'email' ).value;
	var campo9 = document.getElementById( 'web' ).value;
	
	if( campo1 == "" || campo2 == "" || campo3 == "" || campo4 == "" || campo5 == "" || campo6 == "" || campo7 == "" || campo8 == "" || campo9 == "" )
	{
		alert( error1 );
		return false;
	}
	else if( campo8.length <  8 || campo8.indexOf('@',0)==-1 || campo8.indexOf('@',0)==0 || campo8.indexOf('.',0)==-1 || campo8.indexOf('.',0)==0 )
	{
		alert( error2 );
		return false;
	}
	else
	{
		return true;
	
	}
}


function QuitaVideo()
{
	document.getElementById( 'flash' ).display = 'none';
}

function Inicia (ancho, alto, img, ver) {
    if (ver==0) {
        w = document.getElementById ('noFlash');
        w.innerHTML = "<img src=\""+img+"\" alt=\"logotipo\" border=\"0\"><br /><br />" +
            "Necesitas flash player para ver esta p&aacute;gina. " +
            "Desc&aacute;rgalo desde <a href=\"http://www.adobe.com/es/products/flashplayer/\" " +
            "target=\"_blank\">adobe.com</a>.<br>Need flash player to view this page. Please download it in " +
            "<a href=\"http://www.adobe.com/products/flashplayer/\" target=\"_blank\">" +
            "adobe.com</a>.";
    }
   
    minAncho = ancho;
    minAlto = alto;
    window.onresize=function(){Actualiza ();}
    Actualiza();
}



function PicaQuitaCargador()
{
	body.style.display = 'none';
}

function PonTamano(ancho, alto)
{
	if(ancho!="") {
		minAncho = ancho;
	}
	if(alto!="") {
		minAlto = alto;
	}
	Actualiza();
}

function RestauraBt() {
	$("#bG1_0").stop().animate( { marginTop: 0 }, 150 );
	$("#bG1_1").stop().animate( { marginTop: 0 }, 150 );
	$("#bG1_2").stop().animate( { marginTop: 0 }, 150 );
	$("#bG1_3").stop().animate( { marginTop: 0 }, 150 );
	
	
	$("#bG2_0").stop().animate( { marginTop: 0 }, 150 );
	$("#bG2_1").stop().animate( { marginTop: 0 }, 150 );
	$("#bG2_2").stop().animate( { marginTop: 0 }, 150 );
	$("#bG2_3").stop().animate( { marginTop: 0 }, 150 );
	
	
	$("#bG3_0").stop().animate( { marginTop: 0 }, 150 );
	$("#bG3_1").stop().animate( { marginTop: 0 }, 150 );
	$("#bG3_2").stop().animate( { marginTop: 0 }, 150 );
	$("#bG3_3").stop().animate( { marginTop: 0 }, 150 );
}


function MueveBt( cual, estado, distancia )
{
	if( estado == 'over' )
	{
		$("#" + cual ).stop().animate( { marginTop: distancia }, 150 );
	}
	else if( estado == 'out' )
	{
		$("#" + cual ).stop().animate( { marginTop: distancia }, 150 );
	}
}

function MueveIco(estado, cual) {
	if( estado == 'over' )
	{
		$("#" + cual ).stop().animate( { marginLeft: '5px' }, 150 );
	}
	else if( estado == 'out' )
	{
		$("#" + cual ).stop().animate( { marginLeft: '0px' }, 150 );
	}
}


function SacaContenido() {
	$("#contenido" ).stop().animate( { width:'980px' }, 300 );
}	

function SacaPastilla() {
	$("#indexPastilla" ).stop().animate( { width:'100%' }, 300 );
}

function SacaLeyenda() {
}

function SacaLogo() {
	$("#logotipo" ).stop().animate( { marginTop:15 }, 100 );
}


function Sube(){
	w = document.getElementById ('flash');
	w.scrollTo(0,0);
}
