base = location.protocol + '//galegos.caixagalicia.es/';	
baseHttps = 'https://galegos.caixagalicia.es/';
//Variables de Nilsen
var _rsCI='es-caixagalicia';
var _rsCG='0';
var _rsDT=1;
var _rsSI=escape(window.location);
var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';
var _rsRP=escape(document.referrer);
var _rsND=_rsLP+'//secure-uk.imrworldwide.com/';
var _rsDN='//secure-uk.imrworldwide.com/';
var _rsCC='0';

  if (parseInt(navigator.appVersion)>=4) {
    var _rsRD=(new Date()).getTime();
    var _rsSE=0;
    var _rsSV='';
    var _rsSM=0;
   }


var cookiesSubDominioEsp = location.protocol + '//www';
var cookiesSubDominioGal = location.protocol + '//galegos';


var protocolo = location.protocol.toUpperCase();
var explorer= (document.all) ? 1 : 0;
var documento= (explorer) ? "document.all." : "document.";
var IE4 = (document.all && !document.getElementById) ? true : false;
var IE5 = (document.all && document.getElementById) ? true : false;
var IE = IE4 || IE5;
var NS4 = (document.layers) ? true : false;
var NS5 = (!document.all && document.getElementById) ? true : false;
var NS6 = NS5;
var NS = NS4||NS5;

var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();

//netscape 6.0  netscape6/6.0
var n60=false;
//netscape 6.1  netscape6/6.01
var n61=false;
//netscape 6.2  netscape6/6.01
var n62=false;
//netscape 7.0  netscape/7.0
var n70=false;
//netscape 7.01  netscape/7.01
var n71=false;

var nav60Pos;
 nav60Pos = agt.indexOf('netscape6');
var nav71Pos;
 nav71Pos = agt.indexOf('netscape/7');
  
if (nav60Pos !=-1) {
   is_minor6 = agt.substring(nav60Pos+10);
   if (is_minor6 =='6.1') {n61=true;}
   if (is_minor6 =='6.0') {n60=true;}
   if (is_minor6 =='6.2') {n62=true;}
   //alert(is_minor6);
}

if (nav71Pos !=-1) {
   is_minor7 = agt.substring(nav71Pos+9);
   if (is_minor7 =='7.01') {n71=true;}
   if (is_minor7 =='7.0') {n70=true;}
   //alert(is_minor7);
}


if (NS5) document.all = new Function("n", "return document.getElementById(n);");


if(location.href.indexOf(base)!=-1)
{
	if (protocolo=='HTTP:')
	{
		if (typeof(parent.frames['contenido']) != 'undefined')
		{   

		//try{
		strUrl = new String(document.location);
		if(strUrl.indexOf('contactCenter')== -1)
		{
   			if (parent.TipoEstilo==3)//netclub1
    			{
        			if (this.name=="contenido")//contenido
        				document.write ('<link href="'+base+'includes/wvio006m_estilo_netclub.css" rel="stylesheet" type="text/css">'); 
    			}
			}
			//}
			//catch(e){}

		}
		else
		{
			if ((opener!=null & NS6) || (typeof(opener)!= 'undefined' & IE))//ventana fuera del frame
			{
				if (opener != null) {
					if (typeof(opener.parent) != 'undefined')
					{
						if ((typeof(opener.parent.TipoEstilo) != 'undefined') && (typeof(opener.parent.TipoEstilo) != 'unknown'))//no es un banner
						{
							if (opener.parent.TipoEstilo==3)//netclub2
							{
								document.write ('<link href="'+base+'includes/wvio006m_estilo_netclub.css" rel="stylesheet" type="text/css">'); 
							}
						}
					}   
				}
			} 
		}
	}
}

function combo(combo){

	if (combo.selectedIndex>0)
	{
		if (opciones[combo[combo.selectedIndex].value].indexOf('javascript')==-1)
			parent.frames['contenido'].location.href = opciones[combo[combo.selectedIndex].value];
		else
			eval(opciones[combo[combo.selectedIndex].value]);
	}	
}

function pintaCombo(opciones){
	var cad = '';
	var op = '';
	
	op +='<option selected class="camposFormulario">De compras, taquilla ...</option>';
	document.write (op);
	for (n=0; n<opciones.length; n+=2)
		cad += '<option class="camposFormulario" value="'+ (n+1) +'">'+ opciones[n] +'</option>';
		document.write (cad);
		
}

function objCapa(idCapa)	
{
    if (document.layers) return document.layers[idCapa];
    else return document.all(idCapa);
}

function abrirWnd(url)
{
    var tmp = url.substr(0, 5).toUpperCase();
    if (tmp != 'HTTP:' && tmp != 'HTTPS') url = base + url;

    window.open(url);
}

function abrirWnd2(url, ancho, alto, nombreVentana)
{
    var w;
    var h;
    if (ancho == null) w = 625;
    else w = ancho;
    if (alto == null) h = 400;
    else h = alto;

    var tmp = url.substr(0, 5).toUpperCase();

    if (tmp != 'HTTP:' && tmp != 'HTTPS') url = base + url;
    venta=window.open(url, nombreVentana, "top=0,left=0,toolbar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+ w +",height="+ h);
}

function abrirWnd3(url)
{
    venta=window.open(base+"WVIO006m_documentos.asp?fich="+url,"", "top=0,left=0,toolbar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=400");
}


function abrirWnd4(url, ancho, alto)
{
    var w;
    var h;
    if (ancho == null) w = 790;
    else w = ancho;
    if (alto == null) h = 590;
    else h = alto;

    var tmp = url.substr(0, 5).toUpperCase();
    if (tmp != 'HTTP:' && tmp != 'HTTPS') url = base + url;
    venta=window.open(url,"", "top=0,left=0,toolbar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no, width="+ w +",height="+ h);
}

function abrirWnd5(url, ancho, alto)
{
    var param;
    var w;
    var h;
    if (ancho == null) w = 790;
    else w = ancho;
    if (alto == null) h = 590;
    else h = alto;

    param="?contenido=" + url;
    var tmp = url.substr(0, 5).toUpperCase();
    if (tmp != 'HTTP:' && tmp != 'HTTPS') url = base + url;
    venta=window.open(url,'ventana_principal', "top=0,left=0,toolbar=yes,directories=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,copyhistory=no, width="+ w +",height="+ h);
}

//-- Recarga los frames de PARTICULAR con https
function abrirWnd6(url)
{
    top.location = baseHttps + 'wvio006m_particular.asp?contenido=' + url;
}

//-- Recarga los frames de EMPRESA con https
function abrirWnd7(url)
{
    top.location = baseHttps + 'wvio006m_empresa.asp?contenido=' + url;
}

//-- Recarga los frames de NETCLUB con https
function abrirWnd8(url)
{
    top.location = baseHttps + 'wvio006m_netclub.asp?contenido=' + url;
}
//-- Recarga los frames de NETCLUB 
function abrirWnd9(url)
{
    var tmp = url.substr(0, 5).toUpperCase();
    if (tmp != 'HTTP:' && tmp != 'HTTPS') url = base + url;
    venta=window.open(url, "", "top=0,left=0,toolbar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=400");
}



function abrirWndActiva(url, ancho, alto)
{
    var w;
    var h;
    if (ancho == null) w = 790;
    else w = ancho;
    if (alto == null) h = 590;
    else h = alto;

    var tmp = url.substr(0, 5).toUpperCase();
    if (tmp != 'HTTP:' && tmp != 'HTTPS') url = base + url;
    venta=window.open(url,"", "menubar=yes,top=0,left=0,toolbar=yes,directories=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,copyhistory=no, width="+ w +",height="+ h);
}

//-- Ventana nueva sin botones a 800x600
function abrirWnd6(url)
{
    abrirWnd2(url, 790, 553,'');
}


function abrir_ventana(url, titulo)
{
	venta=window.open(url,titulo);
	venta.focus();
}

function abrir_ventana_cdr(url, titulo)
{
	venta=window.open(url,titulo,"toolbar=no, location=no, directories=no, status=yes, menubar=no, scrollbars=yes, resizable=no, hotkeys=no, copyhistory=no,width=790,height=553,top=0,left=0",true);
	venta.focus();
}

function abrir_ventana4(url, titulo, ancho, alto)
{
	var w;
	if (ancho == null) w = 500;
	else w = ancho;
	if (alto == null) h = 400;
	else h = alto;
	venta=window.open(url,titulo, "top=0,left=0,toolbar=no,directories=no,location=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width="+ w +",height="+ h);
}

//redirecciona la pagina que inicialmente esta sin frames a la situación inicial dentro del frame contenido
function sinFrame()
{
	if(protocolo=='HTTP:')
	{
		if (typeof(buscaPagina) == 'undefined')
			buscaPagina="particular"

		if (typeof(parent.frames['contenido']) == 'undefined')
		{ 
		
	      	if (buscaPagina=="particular") 
			{
				//document.location.replace(base+"wvio006m_particular.asp?contenido="+ escape(location.href));
				document.location.replace(base+"wvio006m_particular.asp?contenido="+ encodeURI(location.href));
			}
      	  
			if (buscaPagina=="empresa") 
			{
				//document.location.replace(base+"wvio006m_empresa.asp?contenido="+ escape(location.href));
				document.location.replace(base+"wvio006m_empresa.asp?contenido="+ encodeURI(location.href));
			}
        
      		if (buscaPagina=="netclub") 
			{
				//document.location.replace(base+"wvio006m_netclub.asp?contenido="+ escape(location.href));
				document.location.replace(base+"wvio006m_netclub.asp?contenido="+ encodeURI(location.href));
			}
	
		}
		else 
		{
			if(location.href.indexOf(base)!=-1)
			{
				if(typeof(parent.opener)!= 'undefined')
				{
					if (document.all)
			 		parent.document.title = document.title;
				}
			}

		}
	}
}

//- ocultarAtras: si 'true' (por defecto) NO se muestra la imagen de volver. En caso contrario se muestra si hay algo
// en la historia
// conframes: si 'true' (por defecto) Se abrira la pagina con frames. 
// si 'false' Se abrira la pagina sola sin meterla dentro del frame de caixa
function crearPiePagina(ocultarAtras,conframes)
{

    var cad;
    var cont = (document.layers) ? 1 : 0;
   
    cad = '<br><table width="100%" border="0" cellpadding=0 cellspacing=2>';
    cad +='<tr><td width="100%">';

    if (history.length>cont && ocultarAtras!=true) cad += '<a href="javascript:history.back()"><span class="sepSeccion"><img border=0 src="'+base+'images/wvio006m_atras.gif"></span><span class="txtPie">Atr&aacute;s</span></a>';

    cad +='</td>';
    cad +='<td align=right>';
    cad +='<a href="javascript:void(0)" onclick="location.hash=\'top\';">';
    cad +='<span class="txtPie">Subir</span>';
    cad +='<span class="sepSeccion">';
    cad +='<img border="0" src="'+base+'images/wvio006m_arriba.gif">';
    cad +='</span>';
    cad +='</a>';
    cad +='</td>';
    cad +='</tr>';
    cad +='<tr><td colspan="2" class="linPiePag"><img src="'+base+'images/wvio006m_pto.gif"></td></tr>';
    cad +='<tr><td colspan="2" class="txtPiePag">'+ (new Date).getFullYear() +' Caixa Galicia. Todos los derechos reservados.</td></tr>';
    cad +='<tr><td align="middle" colspan="2"><a href="javascript:abrirWnd2(\'' + base + 'wvio006_contenido/gal/pags/wvio006m_AVISOLEGAL.htm\',null,null,null);" style="text-decoration:none"><span class="txtPiePag">Aviso Legal - </a></span>';
    cad +='<a href="javascript:abrirWnd2(\'' + base + 'wvio006_contenido/gal/pags/wvio006m_POLITICA_PRIVACIDAD.htm\',null,null,null);" style="text-decoration:none"><span class="txtPiePag">Pol&iacute;tica de Privacidad - </a>';    
    cad +='<a href="' + base + 'wvio006_contenido/gal/asp/wvio006c_mapaweb.asp" style="text-decoration:none"><span class="txtPiePag">Mapa Web</span></a></td></tr>';
    cad +='</table>';
    cad +='<script type="text/javascript" src="http://as00.estara.com/as/InitiateCall2.php?accountid=200106283305&amp;Template=68945"></script>';
    crearEstadistica();
    document.write(cad);
	//if (conframes!=false){sinFrame();}

}

function crearEstadistica()
{  
  	if (parseInt(navigator.appVersion)>=4) 
	{
		//_rsCL='<scr'+'ipt language="JavaScript" type="text/javascript" src="'+_rsND+'v5.js"><\/scr'+'ipt>';
		_rsCL='<script type="text/javascript" src="'+_rsND+'v52.js"></script>';
  	}
  	else
  	{
    	//_rsCL='<img src="'+_rsND+'cgi-bin/m?ci='+_rsCI+'&cg='+_rsCG+'&si='+_rsSI+'&rp='+_rsRP+'">';
		_rsCL='<img src="'+_rsND+'cgi-bin/m?ci='+_rsCI+'&amp;cg='+_rsCG+'" alt=""/>';
  	}
  
  document.write(_rsCL);
}

function cambiaImg(obj, sImg)
{
    document.images[obj].src = sImg;
}



// -------------- Cookies -------------

function setCookie2(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function SetCookie (name, value, expires, path, domain, secure) {
     var argv = SetCookie.arguments;

     var argc = SetCookie.arguments.length;

     var expires = (argc > 2) ? argv[2] : null;
     var path = (argc > 3) ? argv[3] : null;
     var domain = (argc > 4) ? argv[4] : null;
     var secure = (argc > 5) ? argv[5] : false;
     document.cookie = name + "=" + escape (value) +
       ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
       ((path == null) ? "" : ("; path=" + path)) +
       ((domain == null) ? "" : ("; domain=" + domain)) +
       ((secure == true) ? "; secure" : "");
   }
   
function DeleteCookie (name) {
     var exp = new Date();
     exp.setTime (exp.getTime() - 1);  // This cookie is history
     var cval = GetCookie (name);
     document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
   }

 function getCookieVal (offset) {
     var endstr = document.cookie.indexOf (";", offset);
     if (endstr == -1)
       endstr = document.cookie.length;
     return unescape(document.cookie.substring(offset, endstr));
   }
   function GetCookie (name) {
     var arg = name + "=";
     var alen = arg.length;
     var clen = document.cookie.length;
     var i = 0;
     while (i < clen) {
       var j = i + alen;
       if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
       i = document.cookie.indexOf(" ", i) + 1;
       if (i == 0) break; 
     }
     return null;
   }

   
    function saveCookie(name, data, expires) {
        var expDate = expires
        if (expDate != "") {
            expDate = "; expires=" + expDate.toGMTString() 
        }
        //alert ("The cookie: " + name + "=" + escape(data) + expDate )
        document.cookie = name + "=" + escape(data) + expDate
    }
      

// ------------ Fin cookies -----------

function ver_opcion_menu(el)
{
	if (el.parentNode.getElementsByTagName('ul')[0])
	{
		if (el.parentNode.getElementsByTagName('ul')[0].className == 'oculto')
		{
			el.parentNode.className=el.parentNode.className + ' desplegado';
			el.parentNode.getElementsByTagName('ul')[0].className = ''
		}
		else
		{
			el.parentNode.className=el.parentNode.className.replace('desplegado','');			
			el.parentNode.getElementsByTagName('ul')[0].className = 'oculto';
		}
	}
			
}