//CHECKM8	
var chechkm8inactive = false; 

//MINIYA

var currenturl = window.location.href;

var envflag = currenturl.indexOf(".jif.es");
var redyaValidationHost = (envflag == -1 ? 'validacion.ya.com' : 'desarrollo.red.ya.jif.es'); 
var redyaRegistrationHost = (envflag == -1 ? 'red.ya.com' : 'desarrollo.red.ya.jif.es'); 
var redyaEValidationHost = (envflag == -1 ? 'evalidacion.ya.com' : 'desarrollo.red.ya.jif.es'); 
var redyaERegistrationHost = (envflag == -1 ? 'red.ya.com' : 'desarrollo.red.ya.jif.es'); 
var miniyaHost = (envflag == -1 ? 'miniya-new.ya.com' : 'desarrollo.miniya.ya.jif.es');

var miniyasite = "ya3";
if (currenturl.indexOf("tiendapc.") != -1) miniyasite = "tiendapc";
else if (currenturl.indexOf("trex.") != -1) miniyasite = "trex";
else if (currenturl.indexOf("desconecta.") != -1) miniyasite="desconecta";
else if (currenturl.indexOf("espacio.") != -1) miniyasite = "espacio";
else if (currenturl.indexOf("finanzas.") != -1) miniyasite = "finanzas";
else if (currenturl.indexOf("inicio.") != -1) miniyasite = "inicio";
else if (currenturl.indexOf("radio.") != -1) miniyasite = "radio";
else if (currenturl.indexOf("supermotor.") != -1) miniyasite = "supermotor";
else if (currenturl.indexOf("viajar.") != -1) miniyasite = "viajar";
else miniyasite= "ya3";	
function ConnectFromFinanzas()
 	{
	var f;
	f = document.forms["F_MINIYA"];
        var host = "validacion.ya.com";    
        f.URL_VOLVER.value = window.location.href;
	if (f.URL_VOLVER_ERROR != null) 
	{
         if (f.URL_VOLVER_ERROR.value == "")
             f.URL_VOLVER_ERROR.value = window.location.href;
     }          
     f.SITE.value = "finanzas";     
     //f.action = "http://" + host + "/SConnectWindowNoPopup";
     f.action = "http://" + host + "/SMain?M=login20";
     f.submit();  
}
function DisconnectFromFinanzas()
 { 
     var f;
     f = document.forms["F_MINIYA"];
     var host = "validacion.ya.com";    
     f.URL_VOLVER.value = window.location.href;
     if (f.URL_VOLVER_ERROR != null) {
         if (f.URL_VOLVER_ERROR.value == "")
             f.URL_VOLVER_ERROR.value = window.location.href;
     }          
     f.SITE.value = "finanzas";     
     f.action = "http://" + host + "/SDisconnectWindowNoPopup";
     f.submit(); 
}

function disconnect(externalForm)
{
    var f;
    if (arguments.length == 0) {
        f = document.forms["F_MINIYA"];
    } else {
        f = externalForm;
    }

    var host = redyaValidationHost;
    if (f.E_COMMERCE != null) {
        if (f.E_COMMERCE.value.toUpperCase().indexOf("YES") != -1)
            host = redyaEValidationHost;
    }

    var windowName = "windowFrom" + Math.round (Math.random()*1000);
    var urlDis = "http://" + host + "/jif/redya/SRedYaDesconectaVentana?NOMBRE_VENTANA=" + windowName;
    var urlInit = "http://" + host + "/redya/desconectaVentana.html";
        
    var windowDis = null;
    var bControlWindowDis = false;
    
    if (!bControlWindowDis) {
        
        if (f.URL_VOLVER != null) {
            if (f.URL_VOLVER.value == "")
                f.URL_VOLVER.value = window.location.href;
        }
        f.URL_VOLVER.value = ForumFilter(f.URL_VOLVER.value);
        if (f.URL_VOLVER_ERROR != null) {
            if (f.URL_VOLVER_ERROR.value == "")
                f.URL_VOLVER_ERROR.value = window.location.href;
        }
        
        f.target = "desconexion";
        f.action = urlDis;
        self.name = windowName;
        windowDis = window.open(urlInit, "desconexion", "width=122,height=165,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no");
        bControlWindowDis = true;
        f.submit();
    } else {
        if ((windowDis == null)||(windowDis.closed)) {
            bControlWindowDis = false;
            disconnect();
        }
    }
}

function connect2(externalForm)
{
    var f;
    if (arguments.length == 0) {
        f = document.forms["F_MINIYA"];
    } else {
        f = externalForm;
    }
    //var host = redyaValidationHost;
    var host = redyaRegistrationHost;
    if (f.URL_VOLVER != null) {
        if (f.URL_VOLVER.value == "")
            f.URL_VOLVER.value = window.location.href;
    }
    //f.URL_VOLVER.value = ForumFilter(f.URL_VOLVER.value);
    f.URL_VOLVER.value = window.location.href;
    if (f.URL_VOLVER_ERROR != null) {
        if (f.URL_VOLVER_ERROR.value == "")
            f.URL_VOLVER_ERROR.value = window.location.href;
    }
    f.UB.value = f.URL_VOLVER.value;
    f.action = "http://" + host + "/jsp/login/finanzas.jsp";
    f.submit();
}

function ForumFilter(url_volver)
{
    var url = window.location.href;
    if (url.indexOf("foros.inicio.com") != -1) {
        return "http://foros.inicio.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.viajar.com") != -1) {
        return "http://foros.viajar.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.supermotor.com") != -1) {
        return "http://foros.supermotor.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.chueca.com") != -1) {
        return "http://foros.chueca.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("chueca.com/foros") != -1) {
        return "http://foros.chueca.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("www.chueca.com/foros") != -1) {
        return "http://foros.chueca.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.yatv.com") != -1) {
        return "http://foros.yatv.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.finanzas.com") != -1) {
        return "http://foros.finanzas.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.inforchat.com") != -1) {
        return "http://foros.inforchat.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.discoweb.com") != -1) {
        return "http://foros.discoweb.com/JIdentification.jsp?Y=" + Math.random();
    } else if (url.indexOf("foros.spanien.com") != -1) {
        return "http://foros.spanien.com/JIdentification.jsp?Y=" + Math.random();
    } else {
        return url_volver;
    }
}



//AVISO

    function Aviso(URL)
	    {
		window.open(URL,'Aviso','width=620,height=210,resizable=yes,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no')
	    }

//VENTANAS
    
    function windowOpener(URL)
	    {
		window.open(URL,'','menubar=no,width=635,height=450,scrollbars=yes,status=no,location=no,resizable=yes')
	    }

    function windowOpener800x600(URL)
	    {
		window.open(URL,'','menubar=yes,width=800,height=600,scrollbars=yes,status=no,location=yes,resizable=yes')
	    }

//BANNERS GENERICOS

    function BannerGrande2(pd)
    {
	 sz = "468x60";
	 st = "es.finanzas.com";
	 std = "http://ad.es.doubleclick.net/";

	 var time = new Date();
	 randnum= (time.getTime());

	 document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';ord='+randnum+'?"></SCR'+'IPT>');
	}
function BannerGrande(pd)
{
   sz = "468x60";
   st = "es.finanzas.com";
   std = "http://ad.es.doubleclick.net/";
   isnt = "dcopt=ist";
   var time = new Date();
   randnum= (time.getTime());
   document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';'+isnt+';sz='+sz+';ord='+randnum+'?"></SCR'+'IPT>');
}

function BannerGrande_Inverline(pd)
{
   sz = "468x60";
   st = "es.finanzas.inverline.com";
   isnt = "dcopt=ist";
   vartext = "p=";
   std = "http://ad.es.doubleclick.net/";

   var time = new Date();
   randnum= (time.getTime());
   if (navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.substring(0,1)>=5) {
   document.write ('<a href="'+std+'jump/'+st+'/'+pd+';sz='+sz+'">');
   document.write ('<img src="'+std+'ad/'+st+'/'+pd+';sz='+sz+'" width="468" height="60" border="0"></a>'); }
   else {
   document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';'+isnt+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>'); }

}

    function BannerPequeno(pd)
	{
	 sz = "80x80";
	 st = "es.mbfinanzas.com";
	 vartext = "";
	  std = "http://ad.es.doubleclick.net/";

	 var time = new Date();
	 randnum= (time.getTime());

	document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>');
	//document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';ord='+randnum+'?"></SCR'+'IPT>');
	}


    function BannerDerecha(pd) {
	 sz = "190x60";
	 st = "es.mbfinanzas.com";
	 vartext = "p=";
	 std = "http://ad.es.doubleclick.net/";

	 var time = new Date();
	 randnum= (time.getTime());
	 if (document.cookie.length > 0) {
		cookies=unescape(document.cookie);
		offset = cookies.indexOf("YAKEYS=");
		if (offset != -1) {
			offset = cookies.indexOf("P1=");
			if (offset != -1) {
				end =cookies.indexOf("|", offset);
				vartext=cookies.substring(offset, end);
			}
		}
	}
	document.write ('<SCR'+'IPT language="JavaScript" SRC="'+std+'adj/'+st+'/'+pd+';sz='+sz+';'+vartext+';ord='+randnum+'?"></SCR'+'IPT>');
	}


//PERSONALIZACION

    function Personalizacion(URL)
	    {
		window.open(URL,'','menubar=no,width=535,height=465,scrollbars=no,status=no,location=no,resizable=yes')
	    }
  
//FOROS

   function MiniYa(){
	return;
    }    
    
    function VerPasaporte(usuario) {   
         window.open("http://www.ya.com/mi/pasaporte.cfm?nick="+usuario,"pasaporte", "width=400,height=300,resizable=no,scrollbars=no,menubar=no,toolbar=no,directories=no,location=no,status=no");
    }

//GENERAL
	function cerrar()
	{
		top.close();
	}

	function cc(nodo, posActual, clase)
	{
	    if ((posActual % 2)==0) {
	        nodo.parentNode.rows[posActual + 1].className = clase;
	    }
	    else {
	        nodo.parentNode.rows[posActual - 1].className = clase;
	    }
	    nodo.parentNode.rows[posActual].className = clase;
	}
	function cc3(nodo, posActual, clase)
	{
	    if ((posActual % 3)==0) {
	        nodo.parentNode.rows[posActual + 1].className = clase;
	    }
	    else {
	        nodo.parentNode.rows[posActual - 1].className = clase;
	    }
	    nodo.parentNode.rows[posActual].className = clase;
	}
	function ccf(nodo,clase)
	{
	    nodo.className = clase;
	}