/*<span id="tcm:17-85159_tcm:17-289459-32">
*/

function goHome(strSection) {
	var strRepsolYPFMedia;
	strRepsolYPFMedia = getSiteActual("repsolypfmedia/").toLowerCase();

	if (strSection == null) {
		strRepsolYPFMedia = getSiteActual("");
	}
	else {

		// se le añade la barra al final para mantener la funcionalidad en caso que la función sea llamada desde la URL relativa
		// publicacion/repsolypfmedia/, porque en ese caso strSection = "/es_es/repsolypfmedia" y no contiene  la cadena buscada
		strSection = strSection + "/";

		if (strSection.toLowerCase().indexOf(strRepsolYPFMedia) < 0) {
			strRepsolYPFMedia = getSiteActual("");
		}

	}
            
	window.open (fncURLHome(0, strRepsolYPFMedia), "_top");    
}

function goHome2() {
    window.location = fncURLHome(0, getSiteActual(""));
}

function fncURLHome(intProtocolo, strRuta) {
    var strProtocolo;

    if (intProtocolo == 1) {
        strProtocolo = "https://";
    }
    else {
        strProtocolo = "http://";
    }

    if (strRuta == "") {
        strRuta = "/";
    }

    return (strProtocolo + window.location.hostname + strRuta);
}

function favoritos() {
	title = document.title; 
	url = location.href;

	if (window.sidebar) 
	{ 
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} 
	else if (window.external) 
	{ 
		// IE Favorite
		window.external.AddFavorite( url, title); 
	}
}
function alertas() {
	window.open ( getSiteActual("todo_sobre_repsol_ypf/informacion_para_accionistas_e_inversores/alertas_de_informacion_corporativa/"), "_top" );
}
function ayuda() {
	window.open ( getSiteActual("todo_sobre_repsol_ypf/otros/ayuda/"), "_top" );
}
function evaluacion() {
	window.open ( getSiteActual("todo_sobre_repsol_ypf/conocer_repsol_ypf/evaluacion.aspx?pag=" + location.href + ""), "_top" );
}
function imprimir() {
	var printSelectionDIV = document.getElementById('printSelection');

	if (printSelectionDIV != null) {
		printContent('printSelection');
	} else {
		window.print();
	}
}

function imprimirClickin(strURLNedstatPrint, idImg)
        {
            var printSelectionDIV = document.getElementById('printSelection');

            if (printSelectionDIV != null) {
                printContent('printSelection');
            }else {
                window.print();
            }
            document.getElementById(idImg).src = strURLNedstatPrint;
        }

function favoritosClickin(strURLNedstatPrint, idImg)
{
	title = document.title; 
	url = location.href;

	if (window.sidebar) 
	{ 
		// Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} 
	else if (window.external) 
	{ 
		// IE Favorite
		window.external.AddFavorite( url, title); 
	}
	document.getElementById(idImg).src = strURLNedstatPrint;
}

function guiaCampsa() {
    //Modificado por Evarona 23/07/2007 Peticion 98408.
    //Se modifica la funcion de llamada a la guiaCampsa
    window.open (fncURLHome(0, "/sa/herramientas/abreguia/abreguia.aspx?url="+window.location.href), "_top" );
}

function goURL(intTipo, strRutaRelativa, inTarget) {
    if (intTipo == 4) {
        strRutaTotal = getServerURL (strRutaRelativa, 2, 0) + 'el_tiempo/';
    } else {
        if (intTipo == 1) {
            strRutaTotal =  fncURLHome(0, strRutaRelativa);
        } else {
            strRutaTotal = getServerURL (strRutaRelativa, intTipo, 0);
        }
    }
    if (inTarget == 0) {
        window.open ( strRutaTotal, "_top" );
    } else {
        window.open ( strRutaTotal, "_new" );
    }
}

function pintaFlashRefino(sRefineria) {
	sRutaFlash = '/imagenes/'
	sRutaFlash += getSiteActual('/caja_refineria__169367_tcm7-228374.swf')
	sRutaFlash += '?nomrefineria=' + sRefineria;
	sRutaGcampsa = getServerURL (ruta,2,0);
	sRutaEltiempo = getSiteActual('el_tiempo/');
	document.write('<object id="three_tier" codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=3,0,0,0" height="135" width="400" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">');
	document.write('<param name="_cx" value="10583">');
	document.write('<param name="_cy" value="3572">');
	document.write('<param name="FlashVars" value="">');
	document.write('<param name="Movie" value="' + sRutaFlash + '">');
	document.write('<param name="Src" value="' + sRutaFlash + '">');
	document.write('<param name="WMode" value="Transparent">');
	document.write('<param name="Play" value="0">');
	document.write('<param name="Loop" value="-1">');
	document.write('<param name="Quality" value="High">');
	document.write('<param name="SAlign" value="">');
	document.write('<param name="Menu" value="0">');
	document.write('<param name="Base" value="">');
	document.write('<param name="AllowScriptAccess" value="">');
	document.write('<param name="Scale" value="ShowAll">');
	document.write('<param name="DeviceFont" value="0">');
	document.write('<param name="EmbedMovie" value="0">');
	document.write('<param name="BGColor" value="FFFFFF">');
	document.write('<param name="SWRemote" value="">');
	document.write('<param name="MovieData" value="">');
	document.write('<param name="SeamlessTabbing" value="1">');
	document.write('<param name="Profile" value="0">');
	document.write('<param name="ProfileAddress" value="">');
	document.write('<param name="ProfilePort" value="0">');
	document.write('<embed src="' + sRutaFlash + '" swliveconnect="FALSE" width="400" height="135" quality="autohigh" wmode="transparent" bgcolor="#ffffff" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
	document.write('</embed>');
	document.write('</object>');
}

function enviarCV(paisOferta, referenciaOferta) {
	if (referenciaOferta != null){
		if (paisOferta == "espana") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/espana/titulados_superiores/curriculum.aspx?procedencia=12&numOferta=" +  referenciaOferta + ""), "_top" );
		} 
		if (paisOferta == "argentina") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/argentina/nuevos_profesionales/curriculum.aspx?procedencia=23&numOferta=" + referenciaOferta + ""), "_top" );
		}
		if (paisOferta == "ecuador") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/ecuador/titulados_superiores/curriculum.aspx?procedencia=68&numOferta=" + referenciaOferta + ""), "_top" );
		}
		if (paisOferta == "peru") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/peru/nuevos_profesionales/curriculum.aspx?procedencia=62&numOferta=" + referenciaOferta + ""), "_top" );
		}
		if (paisOferta == "bolivia") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/bolivia/nuevos_profesionales/curriculum.aspx?procedencia=65&numOferta=" + referenciaOferta + ""), "_top" );
		}
		if (paisOferta == "venezuela") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/venezuela/curriculum.aspx?procedencia=71&numOferta=" + referenciaOferta + ""), "_top" );
		}
	}else{
		if (paisOferta == "espana") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/espana/titulados_superiores/curriculum.aspx?procedencia=12"), "_top" );
		} 
		if (paisOferta == "argentina") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/argentina/nuevos_profesionales/curriculum.aspx?procedencia=23"), "_top" );
		}
		if (paisOferta == "ecuador") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/ecuador/titulados_superiores/curriculum.aspx?procedencia=68"), "_top" );
		}
		if (paisOferta == "peru") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/peru/nuevos_profesionales/curriculum.aspx?procedencia=62"), "_top" );
		}
		if (paisOferta == "bolivia") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/bolivia/nuevos_profesionales/curriculum.aspx?procedencia=65"), "_top" );
		}
		if (paisOferta == "venezuela") {
			window.open ( getSiteActual("todo_sobre_repsol_ypf/trabaja_con_nosotros/venezuela/curriculum.aspx?procedencia=71"), "_top" );
		}
	}
}
function autoclub() {
	window.open ( getSiteActual('autoclub/autoclub/portada/'), "_top" );
}
function motor() {
	window.open ( getSiteActual('motor/'), "_top" );
}
function competicion() {
	window.open ( getSiteActual('competicion/'), "_top" );
}
function guia_repsol() {
	window.open ( getSiteActual('guia_repsol/'), "_top" );
}

function casayhogar() {
	window.open ( getSiteActual('casa_y_hogar/'), "_top" );
}

function tienda() {
                window.open (getServerURL ("/", 3, 0), "_top" );
}

function eltiempo()
{
              window.open ( getSiteActual('el_tiempo/'), "_top" );
}


function ventajas() {
	window.open ( getSiteActual('ventajas_del_portal/'), "_top" );
}
function productosyservicios() {
	window.open ( getSiteActual('productos_y_servicios/'), "_top" );
}
function tsry() {
	window.open ( getSiteActual('todo_sobre_repsol_ypf/'), "_top" );
}


function alvolante() {
	window.open ( getSiteActual('al_volante/'), "_top" );
}
function selecnacional() {
	window.open ( getSiteActual('seleccion/seleccion_nacional/portada/'), "_top" );
}
function guiaypf() {
	window.open ( "http://www.guiacampsa.com/GUIAYPF/ar_es/home/home.aspx", "_top" );
}

function stockcar() {
	window.open ( getSiteActual('competicion/stock_car_v8/'), "_top" );
}

function nuestroselegidos() {
	window.open ( getSiteActual('nuestros_elegidos/carlo_de_gavardo/'), "_top" );
}

function velocidade() {
	window.open ( getSiteActual('competicion/rally/portada/'), "_top" );
}

//P.R. 9/2/2007 Peticion SIGMA Ref. 0002
function consultaextracto(){

         var strValOK = "0123456789";
         var sValor;
         var bOk = true;
         sValor = document.Consulta.Valor.value.replace(" ", "");
					
                if (sValor=="")
	{
		alert('Introduzca los primeros seis digitos\nde su Tarjeta Repsol');
		bOk = false;
	}
	if (sValor.length<6 && bOk)
	{
		alert('Introduzca 6 digitos');
		bOk = false;
	}
                 if (bOk)
	{
		for (i = 0; i < sValor.length; i++) {
		        ch = sValor.charAt(i);
		         for (j = 0; j < strValOK.length; j++) {
		                    if (ch == strValOK.charAt(j)) {
		                    break;
		                    }
		           }
		           if (j == strValOK.length) {
		                    bOk = false;
			    alert('Introduzca valores numericos');
		                    break;
		           }
                                }
                }

	if (bOk)
	{
		if (sValor==409015 || sValor== 409016 || sValor== 409017)
		{
			window.open ("http://www.bbvanet.com", "_new");
		}
		else
		{
			if(sValor==402040 || sValor==459996 || sValor==459997 || sValor==409013 || sValor==409014)
			{
				window.open ("https://lo.lacaixa.es", "_new");
			}
			else
			{
				if (sValor==402040  || sValor== 459996  || sValor== 459997 || sValor== 409013 || sValor== 409014)
				{
					window.open ( getSiteActual('productos_y_servicios/tarjetas/visa_repsol/consulta_de_extracto/Caixa.aspx'), "_top" );
				}
				else
				{
					alert('Los digitos introducidos no coinciden con los 6 primeros digitos de la tarjeta Visa Repsol');
				}
			}
		}
	}
}
//P.R. 9/2/2007 Peticion SIGMA Ref. 0002




function formula1() {
	window.open ( getSiteActual('competicion/formula_1/portada/'), "_top" );
}

function moto() {
	window.open ( getSiteActual('competicion/motociclismo/portada/'), "_top" );
}

function rally() {
	window.open ( getSiteActual('competicion/rally/portada/'), "_top" );

}
function repsolmove() {
	window.open ( getSiteActual('productos_y_servicios/tarjetas/solred_puntos/introduo/'), "_top" );
}

function serviclub() {
	window.open ( '/sa/serviclub/', "_top" );
}

function piibe() {
        window.open ( getSiteActual('piibe/pub/proyecto_piibe/'), "_top" );
}


function usuariosRegistrados(reqPath,tienda) {
	// Mirar si estoy en un iframe
        if (parent.length > 0 ) { 
        	// En el caso que se llame a esta función desde un iframe la url de vuelta la recibimos ya 
                // Si ésta es vacía le mandamos a la home del portal
                if (tienda != "")
                {
	window.open ( getServerURL('/Tienda/login.asp?url=' + reqPath, 3, 1) , "_top");
	return;
                }
                
                if ( reqPath == ""  || reqPath == undefined ) { 
                	reqPath = getServerURL('', 1, 0)
                }
        } else {    
		// En caso contrario, si es una cabecera normal se coge la url
		reqPath = location.href;      
	} 

              //Modificado por Emma (19/06/2008) Si estas navegando por repsolypf.com te redirige a repsol.com
	//reqPath = reqPath.replace('www.repsolypf.com' , 'www.repsol.com');

	// LA url destino tiene la pagina de logout y falta concatenarle la url de la pagina de vuelta. 
	reqPath = reqPath.replace('&' , '%26'); 
   

	window.open ( getServerURL(getSiteActual('herramientas/FormsLoginGenerico/default.aspx?URLPagina=' + reqPath), 1, 0), "_top");
} 

//Nuevo Registro Usuarios Registrados
function usuariosRegistradosNuevoRegistro(reqPath,tienda) {
	reqPath = location.href;      
	
	// LA url destino tiene la pagina de logout y falta concatenarle la url de la pagina de vuelta. 
	reqPath = reqPath.replace('&' , '%26'); 

	//DGLB - Modificar por ruta pag redirect
	window.open ( getServerURL('/sa/herramientas/NuevoRegistroParticulares/login.aspx?URLPagina=' + reqPath, 1, 0), "_top");
}

function registrate() {
        window.open ( getSiteActual('herramientas/Registro/HomeRegistro.aspx'), "_top" );
}

function recordarPass() {


	window.open ("/SA/herramientas/NuevoRegistroParticulares/Pages/Particulares/RecordarClave.aspx", "_top" );

}

function modificarUsu() { 


 	window.open ("/SA/herramientas/Registro/particulares/login.aspx?entry=/sa/herramientas/NuevoRegistroParticulares/pages/particulares/alta.aspx&noentry=../home/registro.aspx&tiporegistro=P", "_top");

}


function getSiteActual(ruta) {
	return "/ec_es/" + ruta;
}

function AbrirVentanaNueva(URL) {
    window.open (URL,"_new");
    }

function AbrirEnMismaVentana(URL)
{
window.open (URL,"_self");
}

function AbrirPopUp(URL,ancho,alto,izq,sup) {
	var Sx=((screen.availWidth - ancho)/2)-5;
	var Sy=((screen.availHeight - alto)/2)-15;
	window.open (URL,'new','width=' + ancho + 'px,height=' + alto + 'px,top=' + Sy + 'px,left=' + Sx + 'px,directories=0,scrollbars=1,status=0,location=0');
	}

function AbrirVentana(URL) {
	if (URL=="ar_es") {
		window.open("http://www.ypf.com/", "_top");
	}
	else if (URL=="br_pt") {
		window.open("http://www.repsolsinopec.com.br", "_top");
	}
	else if (URL=="CHSEL") {
		window.open( "http://www.repsol.com"  + "/default.aspx?C=S", "_top");
	}
	else {
		creaCulturaActual(URL);
		window.open("http://www.repsol.com/" + URL + "/", "_top");
	}
}

function AbrirVentanaEx(Protocol, URL, Ancho, Alto, ToolBar, MenuBar, LocationBar, StatusBar, ScrollBars, Resizable)
{
	var Page = "/comunes/b2b/Redirectb2b.asp";

    var Sw = Ancho;
    var Sh = Alto;
    var Sl = ((screen.availWidth - Ancho) / 2) - 5;
    var St = ((screen.availHeight - Alto) / 2) - 15;

    if (ScrollBars == 1)
    {
        Sw = Sw + 17;
        Sh = Sh + 17;
    }

    window.open (Page + "?Protocol=" + Protocol + "&URL=" + escape(URL), 'repsolypf', 'width=' + Sw + 'px,height=' + Sh + 'px,top=' + St + 'px,left=' + Sl + 'px,toolbar=' + ToolBar + ',menubar=' + MenuBar + ',location=' + LocationBar + ',status=' + StatusBar + ',scrollbars=' + ScrollBars + ',resizable=' + Resizable);
}

function eventoClick (eClick) {
    if (!eClick) var eClick = window.event;
    var oTarget = eClick.target || eClick.srcElement;

    if (oTarget.nodeType == 3) oTarget = oTarget.parentNode;

    if (oTarget.nodeName.toUpperCase() == "A") {
        var sUrlLink = oTarget.href.toLowerCase();
        var sUrlInter = "includes/_tcmInterIdioma.aspx".toLowerCase();
        var sTagJS = "javascript:".toLowerCase();
        if ((sUrlLink.indexOf(sUrlInter) >= 0) && (sUrlLink.indexOf(sTagJS) < 0)) {
            popupInteridioma (oTarget);
            return false;
        }
        else {
            return true;
        }
    }
    else {
        return true;
    }
}

function popupInteridioma (strUrl) {
    var intMaxAncho = 575;
    var intMaxAlto = 230;
    var intAncho = (screen.availWidth * 0.95);
    var intAlto = (screen.availHeight * 0.95);
    if (intAncho > intMaxAncho) intAncho = intMaxAncho;
    if (intAlto > intMaxAlto) intAlto = intMaxAlto;
    var intTop = (screen.availHeight / 2) - (intAlto / 2);
    var intLeft = (screen.availWidth / 2 ) - (intAncho / 2);

    var strParametros;
    strParametros = "top=" + intTop;
    strParametros += ",left=" + intLeft;
    strParametros += ",width=" + intAncho;
    strParametros += ",height=" + intAlto;
    strParametros += ",toolbar=no";
    strParametros += ",location=no";
    strParametros += ",directories=no";
    strParametros += ",status=no";
    strParametros += ",menubar=no";
    strParametros += ",scrollbars=no";
    strParametros += ",resizable=no";
    strParametros += ",copyhistory=yes";
    window.open (strUrl, "", strParametros);
}

/*function creaCulturaDefecto(cultura)
{

 var d = new Date("January 31, 2050");
 SetCookie("DefaultCulture",cultura,d,"/",document.domain);
 if (getCookie("CurrentCulture")!=cultura) SetCookie("CurrentCulture",cultura,d,"/",document.domain);
}*/
//Petición 132386 -- Roberto de Torres
function creaCulturaDefecto(cultura)
{
 var d = new Date("January 31, 2050");
 var domino = document.domain.replace(/www/,"");
 
 SetCookie("DefaultCulture",cultura,d,"/",document.domain);
 SetCookie("CurrentCulture",cultura,d,"/",document.domain);

 if (document.domain.indexOf("dportal")!=-1 || document.domain.indexOf("pportal")!=-1)
 {
	SetCookie("CurrentCulture",cultura,d,"/",".repsolypf.com");
 }
 else if (getCookie("CurrentCulture")!=cultura)
 {
	SetCookie("CurrentCulture",cultura,d,"/",domino);
 }
 else
 {
	SetCookie("CurrentCulture",cultura,d,"/",domino);
 }
}

/*function creaCulturaActual(cultura)
{
        SetCookie("CurrentCulture",cultura,"","/",document.domain);
}*/
//Petición 132386 -- Roberto de Torres
function creaCulturaActual(cultura)
{
 var d = new Date("January 31, 2050");
 var domino = document.domain.replace(/www/,"");

 SetCookie("CurrentCulture",cultura,d,"/",document.domain);

 if (document.domain.indexOf("dportal")!=-1|| document.domain.indexOf("pportal")!=-1)
 {
	SetCookie("CurrentCulture",cultura,d,"/",".repsolypf.com");
 }
 else
 {
	SetCookie("CurrentCulture",cultura,d,"/",domino);
 }
}

function obtenerCulturaDefecto()
{
        return getCookie("DefaultCulture");
}

function obtenerCulturaActual()
{
        return getCookie("CurrentCulture");
}
function getCookie(name)
{
        var strCookies = document.cookie;
        var index = strCookies.indexOf(name + "=");

        if (index == -1)
        {
                return '';
        }
        else
        {
                var startstr = strCookies.indexOf("=", index) + 1;
                var endstr = strCookies.indexOf(";", index);

                if (endstr == -1)
                {
                        endstr = strCookies.length;
                }

                return unescape(strCookies.substring(startstr , endstr));
        }
  }

function SetCookie (nombre,valor,expiracion,path,dominio,segura) {
        var c = nombre + "=" + escape (valor) +
            ((expiracion) ? "; expires=" + expiracion.toGMTString() : "") +
            ((path) ? "; path=" + path : "") +
            ((dominio) ? "; domain=" + dominio : "") +
            ((segura) ? "; secure" : "");
        document.cookie = c;
}

function DeleteCookie(nombre,path,dominio) {
  if (getCookie(nombre)) {
        var d = new Date("January 01, 70");
        SetCookie(nombre,"",d,path,dominio);

  }
}

function GetObjectByName(n, d) {
	var p,i,x;
	if(!d)
		d=document;
	if((p=n.indexOf("?")) > 0 && parent.frames.length)
	{
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n]) && d.all)
		x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=findObj(n,d.layers[i].document);
	return x;
}

function Home_Galeria_Mostrar()
{
	var i,p,v,obj,args=Home_Galeria_Mostrar.arguments;

	for (i=0; i<(args.length-2); i+=3)
	{
		if ((obj=GetObjectByName(args[i])) != null)
		{
			v=args[i+2];
			if (obj.style)
			{
				obj=obj.style;
			}
			obj.display=v;
		}
	}
}


function Home_Galeria_Ocultar()
{
	var i,args=Home_Galeria_Ocultar.arguments;
	for (i=0; i<args.length; i++)
	{
		Home_Galeria_Mostrar(args[i],'','none');
	}
}

function cv2(URL) {
	window.opener.location = URL;
	window.opener.focus();
	}

function mandarInterIdioma(formulario) {
	eval("document." + formulario + ".submit()");
}

function tcmBuscarGeneral(texto) {
        document.tcmBuscar.target = "_top";
//INI DGLB PI 236346
//      document.tcmBuscar.action = "http://www.repsol.com" + getSiteActual('herramientas/buscadorweb/default.aspx');
        document.tcmBuscar.action = "http://www.repsol.com" + "/SA/Herramientas/BuscadorGSA/search.aspx";
//      document.tcmBuscar.texto.value=texto;
        document.tcmBuscar.q.value=texto;
//FIN DGLB PI 236346
        document.tcmBuscar.submit();
}

function tcmBuscarGeneralSeccion(texto,index) {
        document.tcmBuscarSeccion.target = "_top";
        document.tcmBuscarSeccion.action = getSiteActual('herramientas/buscadorweb/default.aspx');
        document.tcmBuscarSeccion.texto.value=texto;
        document.tcmBuscarSeccion.Seccion.value=index;
        document.tcmBuscarSeccion.submit();
}

function abreess(){
	location.href="/se/gerenteseess/acceso.asp"
}

function enviar(path,titulo) {
	var strHref = window.location.href;
	var arrURL = strHref.split("/");
	// Ejemplo: http://www.repsolypf.com/es_es
	//arrURL[0] = http: | arrURL[1] = | arrURL[2] = www.repsolypf.com | arrURL[3] = es_es

	if (path.indexOf("http") == -1 )
	{
		path = "http:/" + arrURL[1] + "/" + arrURL[2] + path;
	}

	var propiedades = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=450,height=450,top=50,left=200";

	window.open ( "/ec_es/herramientas/EnviarAmigo/Default.aspx?titulo=" + titulo + "&link=" + path, "Amigo" , propiedades );
}


/* SteveW */
function printContent(nombre) {
	var _tcmContent = document.getElementById(nombre);
	var printWindow = window.open(' ', 'popimpr', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=520,height=450,top=0,left=0');

	printWindow.document.write( "<html><head><title>" + document.title + "</title>");
	printWindow.document.write( "<link rel=\"stylesheet\" type=\"text/css\" id=\"tcmPrintWindow\" media=\"all\" href=\"" + document.styleSheets[0].href + "\" />");
	printWindow.document.write( "</head><body>" );
	printWindow.document.write( _tcmContent.innerHTML );
	printWindow.document.write( "</body></html>" );

	printWindow.document.close();
	printWindow.print( );
	printWindow.close();
}



function getServerURL(ruta, tipo, protocol) {
	var sReturn = "";

	if (protocol == 1) {
		sReturn = "https://";
	} else {
		sReturn = "http://";
	}

	if (tipo == 0) {
		sReturn = sReturn + "servicios.repsolypf.com";
	} else if (tipo == 1) {
		//Modificado por Emma (19/06/2008)
                               //incidencia 5844 y 5837
                                if (ruta.toLowerCase().indexOf("ar_es")>0) 
                               {
                                         ruta = ruta.replace('www.repsolypf.com' , 'www.ypf.com'); 
                                         ruta = ruta.replace('www.repsol.com', 'www.ypf.com'); 
                                         sReturn = sReturn + "www.ypf.com";
                                } 
                                else
		{
                                        ruta = ruta.replace('www.repsolypf.com' , "www.repsol.com");   
                                        sReturn = sReturn + "www.repsol.com";
                                }
	} else if (tipo == 2) {
		sReturn = sReturn + "www.guiacampsa.com";
	} else if (tipo == 3) {
		sReturn = sReturn + "tienda.repsolypf.com";
	}


	return sReturn + ruta;
}
function LogOut(urlDestino, urlOrigen)
{
           // Mirar si estoy en un iframe
                if (parent.length > 0 )
                {
                        // En el caso que se llame a esta función desde un iframe la url de vuelta la recibimos ya
                        // Si ésta es vacía le mandamos a la home del portal
                if (urlOrigen == "")
                {
                                urlOrigen = getServerURL('', 1, 0)
                }
                }
                else
                {
                // En caso contrario, si es una cabecera normal se coge la url
                        urlOrigen = location.href;
                }
        // LA url destino tiene la pagina de logout y falta concatenarle la url de la pagina de vuelta.
        urlDestino = urlDestino + urlOrigen.replace('&' , '%26');

        window.open ( urlDestino , "_top");
}



function VerificarCookie(){
	var _url = document.location.pathname;
	var _caa = getSiteActual("").split("/");
	var _ca = _caa[1];
	if (obtenerCulturaActual()=="") {
		if(obtenerCulturaDefecto()==_ca) {
			creaCulturaActual(obtenerCulturaDefecto());
		} else {
			creaCulturaActual(_ca);
		}
	}
}

function generarNumAleatorios(intDesde, intHasta) {
var aleatorio = Math.round(Math.random()*(intHasta-intDesde)+intDesde);
//var aleatorio = Math.round(Math.random()*intRango);
generarNumAleatorios= aleatorio;
}


function mostrarCSS()
{
	var strLocation;
	strLocation = unescape(location.href.substr(0,location.href.indexOf("?")));
	var strLocationPYS;
	strLocationPYS = unescape(location.href);
	if (((strLocation.toLowerCase().indexOf("corporacion") == -1) || (location.href.toLowerCase().indexOf("sa/corporacion") != -1)) && 
	    (location.href.toLowerCase().indexOf("sa/herramientas/nuevoregistroparticulares") == -1) && 
	    ((strLocationPYS.toLowerCase().indexOf("productos-servicios") == -1) && 
	     (location.href.toLowerCase().indexOf("sa/productosyservicios/buscadorpys") == -1)) &&
	    (location.href.toLowerCase().indexOf("sa/productosyservicios/nrp_promocion") == -1))
	{
		document.write("<link rel='stylesheet' type='text/css' id='tcm395762' media='all' href='/es_es/includes/css/cabeceras.css' />");
	}

	if ((location.pathname.toLowerCase().indexOf("/so/") != -1) && (location.pathname.toLowerCase().indexOf("/so/solargas/") == -1))
	{
		document.write("<link rel='stylesheet' type='text/css' id='tcm395762' media='all' href='/es_es/includes/css/so.css' />");
		document.write("<style>#mContenido #opcion li ul.subopcion,#opcion ul.sub_stc li{z-index:1;}</style>");
	}
}




    function getElementsByClassInter(searchClass, node, tag) {
        var classElements = new Array();
        if (node == null)
            node = document;
        if (tag == null)
            tag = '*';
        var els = node.getElementsByTagName(tag);
        var elsLen = els.length;
        var pattern = new RegExp('(^\\s)' + searchClass + '(\\s$)');
        for (i = 0, j = 0; i < elsLen; i++) {
            if (searchClass == els[i].className) {
                classElements[j] = els[i];
                j++;
            }
        }
        return classElements;
    }












function medicionNedstatVideo(nombreVideo)
{

    var divMedicionSWF = document.getElementById("medicionSWF");
    //INI DGLB 03032010
    //divMedicionSWF.innerHTML = divMedicionSWF.innerHTML + "<img src='http://es.sitestat.com/repsolypf/guiacampsa/s?clicking.video.gr." + strTag + "." + nombreVideo + "' width='1' height='1' alt=''/>";
    
    while (divMedicionSWF.firstChild) divMedicionSWF.removeChild(divMedicionSWF.firstChild);
    imagen = document.createElement("img");
    
    imagen.setAttribute("src", "http://es.sitestat.com/repsolypf/guiacampsa/s?clicking.video.gr." + strTag + "." + nombreVideo + "&ns__t=" + new Date().getTime().toString());
    imagen.setAttribute("width", "1");
    imagen.setAttribute("height", "1");
    divMedicionSWF.appendChild(imagen);
    //FIN DGLB

}


/* Carga script swfobject.js para la representacion de flash*/
function getScriptSWFObject()
{
	document.write("<script type=\"text/javascript\" src=\"/scripts/swfobject.js\"></script>");
}


/* Carga script sifr.js y sifr-addons.js para el reemplazo de titulares por flash*/
//function getScriptSIFR()
//{
//	document.write("<script type=\"text/javascript\" src=\"/scripts/sifr.js\"></script>");
//	document.write("<script type=\"text/javascript\" src=\"/scripts/sifr-addons.js\"></script>");
//}

mostrarCSS();
getScriptSWFObject();
//getScriptSIFR();

VerificarCookie();

function Check_unCheck(checkSel,checkboxform)
{ 
var form=document.getElementById(checkboxform);
var check=document.getElementById(checkSel);

   for (var i=0;i<form.length;i++) 
   {
      if(check.checked == 1)
	  {
		form.elements[i].checked=1;
	  }
	  else form.elements[i].checked=0;	  
	}
}

function GenerarZip(checkboxform, strURL)
{
 var form=document.getElementById(checkboxform);
 var sValor;
 for (var i=0;i<form.length;i++) 
   {   
      if(form.elements[i].type == "checkbox" && form.elements[i].checked == 1)
		{				
		sValor = form.elements[i].value;				
		strURL += sValor;				
		strURL += ",";						
		}		
	}	
	if (sValor != null)
	{	
		window.open(strURL,"_new");	
	}
	else
	{
		alert('Debe seleccionar al menos un archivo');
	}
}

function AnyadirMisDescargas(checkboxform)
{ 
var form=document.getElementById(checkboxform);
var sValor;
var iCount=0;
   for (var i=0;i<form.length;i++) 
   {
		if(form.elements[i].type == "checkbox" && form.elements[i].checked == 1)
		{
			if (sValor == null)
			{
			sValor = form.elements[i].value;			
			}
		iCount++;
		}
		if (iCount > 1)
		{
		           alert('Tiene seleccionados varios archivos. S\u00f3lo se a\u00f1adir\u00e1 el primero de la lista');			
                                           break;
		}		
	}
	if (iCount == 0)
	{
	        alert('Debe seleccionar al menos un archivo');
    }  	
	/* Codigo facilitado por el proveedor externo*/
	/* sValor contiene la URL del componente que se debe añadir a mis descargas */
}

function ReplaceTextToImage()
{
	var elementosh1 = this.document.getElementsByTagName("h1");
	var elementosh2 = this.document.getElementsByTagName("h2");
	var elementosh3 = this.document.getElementsByTagName("h3");
	
	var imagen, enlace;
	var i=0;
	
	for(i=0; i<elementosh1.length; i++)
	{
		imagen = document.createElement("img");
		if(elementosh1[i].childNodes[0].innerHTML != null)
		{
			enlace = document.createElement("a");
			enlace.href=elementosh1[i].childNodes[0].getAttribute("href");
			enlace.target=elementosh1[i].childNodes[0].getAttribute("target");
			imagen.title=elementosh1[i].childNodes[0].innerHTML;
			imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh1[i].childNodes[0].innerHTML + "&s=23&w=600&e=&tag=h1';");
			imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh1[i].childNodes[0].innerHTML + "&s=23&w=600&e=over&tag=h1';");
			imagen.src="/scripts/ImageGen.aspx?t=" + elementosh1[i].childNodes[0].innerHTML + "&s=23&w=600&e=&tag=h1";
			imagen.alt=elementosh1[i].childNodes[0].innerHTML;
			imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh1[i].childNodes[0].innerHTML);
			enlace.appendChild(imagen);
			elementosh1[i].replaceChild(enlace,elementosh1[i].childNodes[0]);
		}
		else
		{
			imagen.title=elementosh1[i].firstChild.nodeValue;
			imagen.src="/scripts/ImageGen.aspx?t=" + elementosh1[i].firstChild.nodeValue + "&s=23&w=600&e=&tag=h1";
			imagen.alt=elementosh1[i].firstChild.nodeValue;
			imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh1[i].firstChild.nodeValue);
			elementosh1[i].replaceChild(imagen,elementosh1[i].firstChild);
		}
		imagen.removeAttribute("height");
		imagen.removeAttribute("width");
	}
	
	for(i=0; i<elementosh2.length; i++)
	{
		if (window.navigator.userAgent.indexOf("MSIE") != -1) //Explorer
		{
			imagen = document.createElement("img");
			if (elementosh2[i].parentNode.className == "tripleColumnaA"){
				imagen.src="/scripts/ImageGen.aspx?t=" + document.getElementById("lblCalendario").innerHTML + "&s=23&w=185&e=&tag=h2";
				imagen.alt=document.getElementById("lblCalendario").innerHTML;
				imagen.setAttribute("longdesc",obtenerLongDescCultura() + document.getElementById("lblCalendario").innerHTML);
				elementosh2[i].replaceChild(imagen,document.getElementById("lblCalendario"));
			}else if (elementosh2[i].childNodes.length > 0){
				if (elementosh2[i].childNodes[0].nodeName == "A"){
					enlace = document.createElement("a");
					enlace.href=elementosh2[i].childNodes[0].getAttribute("href");
					enlace.target=elementosh2[i].childNodes[0].getAttribute("target");
					imagen.title=elementosh2[i].childNodes[0].innerHTML;
					if (elementosh2[i].className == "entradilla"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=20&w=225&e=&tag=h2";
						imagen.onmouseover = new Function("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=20&w=225&e=over-under&tag=h2';");
						imagen.onmouseout = new Function ("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=20&w=225&e=&tag=h2';");
					}else if(elementosh2[i].parentNode.className == "contenidoCajaDestacada"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=495&e=&tag=h2";
						imagen.onmouseover = new Function("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=495&e=over-under&tag=h2';");
						imagen.onmouseout = new Function ("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=495&e=&tag=h2';");
					}else if ((elementosh2[i].parentNode.className == "tripleColumnaAB") 
						|| (elementosh2[i].parentNode.className == "tripleColumnaBC")){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=395&e=&tag=h2";
						imagen.onmouseover = new Function("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=395&e=over-under&tag=h2';");
						imagen.onmouseout = new Function ("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=395&e=&tag=h2';");
					}else if (elementosh2[i].parentNode.parentNode.parentNode.className == "col_der_subhomeDoble"){
						imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=500&e=&tag=h2';");
						imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=500&e=over-under&tag=h2';");
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=500&e=&tag=h2";												
					}else{
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=605&e=&tag=h2";
						imagen.onmouseover = new Function("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=605&e=over-under&tag=h2';");
						imagen.onmouseout = new Function ("this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=605&e=&tag=h2';");
					}
					imagen.alt=elementosh2[i].childNodes[0].innerHTML;
					imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].childNodes[0].innerHTML);
					enlace.appendChild(imagen);
					elementosh2[i].replaceChild(enlace,elementosh2[i].childNodes[0]);
				}else if (elementosh2[i].childNodes[0].nodeName == "SPAN"){
					if ((elementosh2[i].parentNode.className == "tripleColumnaAB") 
						|| (elementosh2[i].parentNode.className == "tripleColumnaBC")){
						imagen.title=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML + "&s=23&w=395&e=&tag=h2";
					}else if (elementosh2[i].parentNode.className == "cajaArchivo alma"){
						imagen.title=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML + "&s=23&w=225&e=&tag=h2";
					}else{
						imagen.title=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML + "&s=23&w=605&e=&tag=h2";
					}
					imagen.alt=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
					imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML);
					elementosh2[i].replaceChild(imagen,elementosh2[i].firstChild);
				}else{
					imagen.title=elementosh2[i].firstChild.nodeValue;
					if (elementosh2[i].className == "entradilla"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=20&w=225&e=&tag=h2";
					}else if (elementosh2[i].parentNode.className == "cajaArchivo"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=170&e=&tag=h2";
					}else if (elementosh2[i].parentNode.className == "contenidoCajaDestacada"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=495&e=&tag=h2";
					}else if ((elementosh2[i].parentNode.className == "tripleColumnaAB") || (elementosh2[i].parentNode.className == "tripleColumnaBC")){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=395&e=&tag=h2";
					}else if (elementosh2[i].parentNode.parentNode.parentNode.className == "col_der_subhomeDoble"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=500&e=&tag=h2";
					}else{
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=605&e=&tag=h2";
					}
					imagen.alt=elementosh2[i].firstChild.nodeValue;
					imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].firstChild.nodeValue);
					elementosh2[i].replaceChild(imagen,elementosh2[i].firstChild);
				}
			}
			imagen.removeAttribute("height");
			imagen.removeAttribute("width");
		}
		else //Firefox-Opera
		{
		
			imagen = document.createElement("img");
			if (elementosh2[i].parentNode.className == "tripleColumnaA"){
				imagen.src="/scripts/ImageGen.aspx?t=" + document.getElementById("lblCalendario").innerHTML + "&s=23&w=185&e=&tag=h2";
				imagen.alt=document.getElementById("lblCalendario").innerHTML;
				imagen.setAttribute("longdesc",obtenerLongDescCultura() + document.getElementById("lblCalendario").innerHTML);
				elementosh2[i].replaceChild(imagen,document.getElementById("lblCalendario"));
			}//else if (elementosh2[i].children.length > 0){
			else if (elementosh2[i].childNodes.length > 0){
				if (elementosh2[i].childNodes[0].nodeName == "A"){
					enlace = document.createElement("a");
					enlace.href=elementosh2[i].childNodes[0].getAttribute("href");
					enlace.target=elementosh2[i].childNodes[0].getAttribute("target");
					imagen.title=elementosh2[i].childNodes[0].innerHTML;
					if (elementosh2[i].className == "entradilla"){
						imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=20&w=225&e=&tag=h2';");
						imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=20&w=225&e=over-under&tag=h2';");
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=20&w=225&e=&tag=h2";											
					}else if (elementosh2[i].parentNode.className == "contenidoCajaDestacada"){
						imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=495&e=&tag=h2';");
						imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=495&e=over-under&tag=h2';");
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=495&e=&tag=h2";
					}else if ((elementosh2[i].parentNode.className == "tripleColumnaAB") 
						|| (elementosh2[i].parentNode.className == "tripleColumnaBC")){
						imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=395&e=&tag=h2';");
						imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=395&e=over-under&tag=h2';");
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=395&e=&tag=h2";
					}else if (elementosh2[i].parentNode.parentNode.parentNode.className == "col_der_subhomeDoble"){
						imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=500&e=&tag=h2';");
						imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=500&e=over-under&tag=h2';");
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=500&e=&tag=h2";
					}else{
						imagen.setAttribute("onmouseout", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=605&e=&tag=h2';");
						imagen.setAttribute("onmouseover", "this.src='/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=605&e=over-under&tag=h2';");
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].childNodes[0].innerHTML + "&s=23&w=605&e=&tag=h2";
					}
					imagen.alt=elementosh2[i].childNodes[0].innerHTML;
					imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].childNodes[0].innerHTML);
					enlace.appendChild(imagen);
					elementosh2[i].replaceChild(enlace,elementosh2[i].childNodes[0]);
				}else if (elementosh2[i].childNodes[0].nodeName == "SPAN"){
				 //else if (elementosh2[i].children[0].nodeName == "SPAN"){
					if ((elementosh2[i].parentNode.className == "tripleColumnaAB") 
						|| (elementosh2[i].parentNode.className == "tripleColumnaBC")){
						imagen.title=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML + "&s=23&w=395&e=&tag=h2";
					}else if (elementosh2[i].parentNode.className == "cajaArchivo alma"){
						imagen.title=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML + "&s=23&w=225&e=&tag=h2";
					}else{
						imagen.title=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML + "&s=23&w=605&e=&tag=h2";
					}
					imagen.alt=elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML;
					imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].getElementsByTagName("SPAN")[0].innerHTML);
					//elementosh2[i].replaceChild(imagen,elementosh2[i].children[0]);
					elementosh2[i].replaceChild(imagen,elementosh2[i].childNodes[0]);
				}else{
					imagen.title=elementosh2[i].firstChild.nodeValue;
					if (elementosh2[i].className == "entradilla"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=20&w=225&e=&tag=h2";					
					}else if (elementosh2[i].parentNode.className == "cajaArchivo"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=170&e=&tag=h2";
					}else if (elementosh2[i].parentNode.className == "contenidoCajaDestacada"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=495&e=&tag=h2";
					}else if ((elementosh2[i].parentNode.className == "tripleColumnaAB") 
						|| (elementosh2[i].parentNode.className == "tripleColumnaBC")){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=395&e=&tag=h2";
					}else if (elementosh2[i].parentNode.parentNode.parentNode.className == "col_der_subhomeDoble"){
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=500&e=&tag=h2";
					}else{
						imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=605&e=&tag=h2";
					}
					imagen.alt=elementosh2[i].firstChild.nodeValue;
					imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].firstChild.nodeValue);
					elementosh2[i].replaceChild(imagen,elementosh2[i].firstChild);
				}
			}else{
				imagen.title=elementosh2[i].firstChild.nodeValue;
				if (elementosh2[i].className == "entradilla"){
					imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=20&w=225&e=&tag=h2";					
				}else if (elementosh2[i].parentNode.className == "cajaArchivo"){
					imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=170&e=&tag=h2";
				}else if (elementosh2[i].parentNode.className == "contenidoCajaDestacada"){
					imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=495&e=&tag=h2";
				}else if ((elementosh2[i].parentNode.className == "tripleColumnaAB") 
					|| (elementosh2[i].parentNode.className == "tripleColumnaBC")){
					imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=395&e=&tag=h2";
				}else if (elementosh2[i].parentNode.parentNode.parentNode.className == "col_der_subhomeDoble"){
					imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=500&e=&tag=h2";
				}else{
					imagen.src="/scripts/ImageGen.aspx?t=" + elementosh2[i].firstChild.nodeValue + "&s=23&w=605&e=&tag=h2";
				}
				imagen.alt=elementosh2[i].firstChild.nodeValue;
				imagen.setAttribute("longdesc",obtenerLongDescCultura() + elementosh2[i].firstChild.nodeValue);
				elementosh2[i].replaceChild(imagen,elementosh2[i].firstChild);
			}
		}
	}
}
function obtenerLongDescCultura(){
	var attLongDesc = "";
	attLongDesc = "Esto es una imagen que representa el titulo:";
	return attLongDesc;
}

//24/02/2010
//Autor: Adrian Garitta
//Inicio PI:193955- Funcion de nexo para anadirDescarga. Enviara la url de nedstat y el checkbox seleccionado

function enviarAnadirMisDescargas(checkboxform, urlNedstat, lblMensajeAlerta)
{
	var form = document.getElementById(checkboxform);
	var strValor;
	var countSelect = 0;
	var fileName;
	var fileType;
	var arrValor;
	var strUrlFile;
	var urlServidor = "http://" + document.location.host;
	var auxNedstat;
	var strNstype;
	var intTamanio;

	for (var i=0;i<form.length;i++)
	{
		if(form.elements[i].type == "checkbox" && form.elements[i].checked == 1)
		{
			countSelect ++;
			strUrlFile = form.elements[i].value;
			arrValor = strUrlFile.split('/');
			strValor = arrValor[arrValor.length-1];
			fileName = strValor.substring(0,strValor.indexOf("_tcm"));
			intTamanio = strValor.length;
			fileType = strValor.substring(strValor.lastIndexOf('.') + 1, intTamanio);
			
			if(fileType.toUpperCase() == "PDF")
				strNstype = "pdf";
			else
				strNstype = "clickin";
			
			auxNedstat = urlNedstat;
			auxNedstat += fileName;
			auxNedstat += "&ns_type=" + strNstype + "&ns_url=" + urlServidor + strUrlFile;
			anadirDescarga(auxNedstat);
			
			strUrlFile = "";
			arrValor = "";
			strValor = "";
			type = "";
			fileName = "";
			auxNedstat = "";
		}
	}

	if(countSelect == 0)
		alert(lblMensajeAlerta);
}

//Fin PI:193955

//05/04/2010
//Autor: Adrian Garitta
//Inicio PI:197138

/****************************************************
Autor:			MBORDA - Borda de San Vicente Maximiliano.
Fecha:			03/06/2011.
Motivo:			255602 WWW-P-SM-P2 Archivo Histórico Corporación
Modificacion: 	Se modifico los parametros que recibe esta funcion, cambiando las cuatro variables idOcultar1,idOcultar2,idOcultar3,idOcultar4
				por una unica variable de tipo string, para lograr independencia de codigo.
*****************************************************/
function navegarTabs(idTabVisible, idsOcultar, checkboxform)
{
	var form = document.getElementById(checkboxform);
	//var ids = new Array(idTabVisible, idOcultar1, idOcultar2, idOcultar3, idOcultar4);
	
	//BEGIN - MBORDA 03/06/2011 Pet.255602
	var ids = new Array();
    var StrAnios = new String(idTabVisible + ',' + idsOcultar);   
    ids = StrAnios.split(",");	
	//END - MBORDA 03/06/2011 Pet.255602
	
	var strResult = "resultados";
	var classVisible = "resultados";
	var classOcultar = "resultados ocultarElemento";
	var classTabOver = "tabberactive";

	for(var i = 0; i < ids.length; i++)
	{
		if(i == 0)
		{
			document.getElementById(strResult + ids[i]).className = classVisible;
			document.getElementById(ids[i]).className = classTabOver;
		}
		else
		{
			if(ids[i] != "")
			{
				document.getElementById(strResult + ids[i]).className = classOcultar;
				document.getElementById(ids[i]).className = "";
			}
		}
	}
	
	for(var x = 0; x < form.length; x++)
	{
		if(form.elements[x].type == "checkbox" && form.elements[x].checked == 1)
			form.elements[x].checked = false;
	}
}

//Fin PI:197138


//31/05/2010
//Autor: MJesus Perez
//Inicio PI:207946
function switchCompartir() {
								if (document.all) { //internet explorer
									eval( "estado = document.all.ocultable.style.display");
								}
								if (document.getElementById &&!document.all) {//firefox
									estado = document.getElementById('ocultable').style.display;
								}
								if (document.layers) { //resto
									estado = document.layers['ocultable'].display;
								}
								
								if (estado == 'block') {
									estado = 'none';
									estado2 = 'block';
									visibleUp = 'none';
								} else {
									estado = 'block';
									estado2 = 'none';
									visibleUp = 'block';
								}
								
								if (document.all) { //internet explorer
									eval( "document.all.ocultable.style.display = estado");
									eval( "document.all.ocultable2.style.display = estado2");
									eval( "document.all.separadorUp.style.display = visibleUp");
								}
								if (document.getElementById &&!document.all) { //firefox
									document.getElementById('ocultable').style.display = estado;
									document.getElementById('ocultable2').style.display = estado2;
									document.getElementById('separadorUp').style.display = visibleUp;
								}
								if (document.layers) { //resto
									document.layers['ocultable'].display = estado;
									document.layers['ocultable2'].display = estado2;
									document.layers['separadorUp'].display = visibleUp;
									}

							}
//Fin PI:207946


//Peticion 216454
function countryRequestLayerNoUSA() {
	if (document.all) { //internet explorer
		eval("document.all.CountryRequestLayer1.style.display = 'none'");
		eval("document.all.CountryRequestLayer2.style.display = 'block'");
	}
	if (document.getElementById &&!document.all) { //firefox
		document.getElementById('CountryRequestLayer1').style.display = 'none';
		document.getElementById('CountryRequestLayer2').style.display = 'block';
	}
	if (document.layers) { //resto
		document.layers['CountryRequestLayer1'].display = 'none';
		document.layers['CountryRequestLayer2'].display = 'block';
	}
}
function countryRequestLayerAccess() {
	if (document.all) { //internet explorer
		eval("document.all.CountryRequestLayer2.style.display = 'none'");
		eval("document.all.CountryRequestLayer3.style.display = 'block'");
	}
	if (document.getElementById &&!document.all) { //firefox
		document.getElementById('CountryRequestLayer2').style.display = 'none';
		document.getElementById('CountryRequestLayer3').style.display = 'block';
	}
	if (document.layers) { //resto
		document.layers['CountryRequestLayer2'].display = 'none';
		document.layers['CountryRequestLayer3'].display = 'block';
	}
}
//Fin Peticion 216454

//04/01/2011
//Autor: Adrian Garitta
//Inicio PI:235858

function checkSizeLimit(checkboxForm, msj)
{
	var form = document.getElementById(checkboxForm);
	var strValor;
	var sizeCounter = 0;

	for (var i=0;i<form.length;i++)
	{
		if(form.elements[i].type == "checkbox" && form.elements[i].checked == 1)
			if(document.getElementById("td" + (i + 1).toString() + "-" + checkboxForm).innerHTML != null)
			{
				strValor = document.getElementById("td" + (i + 1).toString() + "-" + checkboxForm).innerHTML;
				strValor = strValor.substring(0, strValor.indexOf(" ",0));
				sizeCounter = sizeCounter + parseInt(strValor);
                        
				if(sizeCounter > 81920)
				{
					alert(msj);
					break;
				}
			}
	}
}

//Fin PI:235858
/********************************************************************************************/
//Autor: 			Borda Maximiliano.
//Motivo: 			Peticion 248032_Implementacion imprimir.
//Funcionalidad:	Esta funcion se utiliza para obtener el div contenedor.
/********************************************************************************************/
function getOuterHTML(object) {
    var element;
    if (!object) return null;
    element = document.createElement("div");
    element.appendChild(object.cloneNode(true));
    return element.innerHTML;
}
 
/********************************************************************************************/
//Autor: 			Borda Maximiliano.
//Motivo: 			Peticion 248032_Implementacion imprimir.
//Funcionalidad:	Esta funcion se utiliza para la previsualizacion del contenido a imprimir
//					buscando la contenido para su posterior visualizacion.
/********************************************************************************************/
    function ImprimirPrevisualizacion() {

        var StrDisp_setting = "";
        var divs = document.getElementsByTagName('div');
        var itemCol_centro;
        var StrHtmlBody = '600px';
        var StrWidthDisplay;
        var StrstylemediaText;
        var StrServidor = 'www.repsol.com'; 
        var StrCultura = 'ec_es';
        
        var StrProtocolo = new String(document.URL); //esta variable contendra el protocolo del servidro Http:// o Https:// o Ftp://
        StrProtocolo = StrProtocolo.substring(0, StrProtocolo.indexOf("/")) + '//';
        
        
        //Se recorren todas las etiquetas Div 
        //para posteriormente evaluar y utilizar la que corresponda
        for (i = 0; i < divs.length; i++) {

            // se asigna el primer div por si no encuentra ninguna 
            //var itemCol_centro = divs.item(0);

            switch (divs.item(i).className) {
                case 'col_cent1004':
                    itemCol_centro = divs.item(i);
                    StrWidthDisplay = '800px'; 
                    i = divs.length;
                    break;
                case 'col_izq_cent1004':
                    itemCol_centro = divs.item(i);
                    StrWidthDisplay = '760px';
                    i = divs.length;
                    break;
                case 'col_cent-der1004':
                    itemCol_centro = divs.item(i);
                    StrWidthDisplay = '842px';
                    i = divs.length;
                    break;
                case 'col_centCE':
                    itemCol_centro = divs.item(i);
                    StrWidthDisplay = '600px';
                    i = divs.length;
                    break;
                case 'col_cent':
                    itemCol_centro = divs.item(i);
                    StrWidthDisplay = '480px';
                    i = divs.length;
                    break;
                case 'col_centhome':
                    itemCol_centro = divs.item(i);
                    StrWidthDisplay = '633px';
                    i = divs.length;
                    break;

            }
        }

        //si no encuentra ninguno de los contenedores imprimibles, 
        //es porque se encuentra en productos y servicios nuevo, 
        //por ende en lugar de buscar por las clases, se debe de buscar por el ID 'contenido'
        if (itemCol_centro == null) {
            StrHtmlBody =  getOuterHTML(document.getElementById('contenido'));
            StrWidthDisplay = '800px';
        }
        else {
            //Se obtiene el cuerpo a imprimir asignandolo en variable StrHtmlBody
            //var StrHtmlBody = getOuterHTML(itemCol_centro);
            StrHtmlBody = itemCol_centro.innerHTML;
        }

        //si se quiere mostrar la ventana en una nueva pagina hay que habilitar esta linea
        StrDisp_setting = 'toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,resizable=yes,width=' + StrWidthDisplay + ',Height=600px';

        var printWindow = window.open("", "", StrDisp_setting);
        //se posiciona la ventana.
        printWindow.moveTo(250, 100);
        //printWindow.document.open();

        printWindow.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
        printWindow.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
        printWindow.document.write('<head>');
        printWindow.document.write('<meta name="tipo_contenido" http-equiv="Content-Type" content="text/html; charset=utf-8">');	
        printWindow.document.write('<title>' + document.title + '</title>');

        //se recorren las styles sheets de la pagina para que la nueva pagina las herede.   
        for (i = 0; i < document.styleSheets.length; i++) {
            if ((document.styleSheets[i].href != null) || (document.styleSheets[i].href != "")) {
                //condicion ternaria, el problema es que ".media.mediaText" no funciona en ie 6, retorna null
                StrstylemediaText = (document.styleSheets[i].media.mediaText == null) ? 'all' : document.styleSheets[i].media.mediaText;               
                printWindow.document.write('<link rel="stylesheet" type="' + document.styleSheets[i].type + '" media="' + StrstylemediaText + '" href="' + document.styleSheets[i].href + '" />');

            }
        }
        printWindow.document.write('<link rel="stylesheet" type="text/css" media="print" href="' + StrProtocolo + StrServidor + '/' + StrCultura + '/includes/css/imprimir.css" />');
        printWindow.document.write('<link rel="stylesheet" type="text/css" media="all" href="' + StrProtocolo + StrServidor + '/' + StrCultura + '/includes/css/Previsualizacion.css" />');
        printWindow.document.write('</head><body>');
        printWindow.document.write('<div class="verImprimir"><div class="cabeceraImprimir"><div class="logoImprimir">');
        printWindow.document.write('<img src="' + StrProtocolo + StrServidor + '/imagenes/imgplantilla/LogoImprimir.jpg" width="191" height="124" /></div>');
        printWindow.document.write('<div class="barraIconos"><a href="Javascript:window.print();" class="icono_imprimir"> Imprimir </a>');
        printWindow.document.write('<a href="Javascript:window.close();" class="icono_cerrar"> Cerrar Ventana </a></div>');
        printWindow.document.write('<p class="notaImpresion"> Recuerda que esta impresiÃ³n tiene un coste ambiental. </p></div>');
        printWindow.document.write('<div class="contenidoImprimir">');
        printWindow.document.write(StrHtmlBody.replace('//secure-uk.imrworldwide.com', ''));
        printWindow.document.write('</DIV></body></html>');

        printWindow.document.close();
        printWindow.focus();
    }  

/********************************************************************************************/
//Autor: 			Borda Maximiliano.
//Motivo: 			Peticion 248032_Implementacion imprimir.
//Funcionalidad:	Esta funcion se utiliza para la previsualizacion del contenido a imprimir
//					buscando la contenido para su posterior visualizacion utilizando la funcionalidad de Sitestat o contador de visitas.
/********************************************************************************************/
function ImprimirPrevisualizacionClickin(strURLNedstatPrint, idImg){
	
	document.getElementById(idImg).src = strURLNedstatPrint;
	 ImprimirPrevisualizacion();

} 

/********************************************************************************************/
//Autor: 			MJP.
//Motivo: 			Mostrar publicidad Antevenio.
//Funcionalidad:		Esta funcion se utiliza mostrar/oculatra la publicidad Antevenio
/********************************************************************************************/
function switchPublicidad()
{
	var myBanners = new Array(new Array ("Mega","img3626416"), new Array("Middle","img3626420"),new Array("x02","img3633905"),new Array("Position1","img3635771"));
	for(i=0;i<myBanners.length;i++)
	{
		if (tienePublicidad(myBanners[i][1])){
			try{document.getElementById(myBanners[i][0]).style.display = "block";}catch(err){}
			try{eval("document.all." + myBanners[i][0] + ".display = 'block'");}catch(err){}
			try{document.layers[myBanners[i][0]].display = "block";}catch(err){}
		} else {
			try{document.getElementById(myBanners[i][0]).style.display = "none";}catch(err){}
			try{eval("document.all." + myBanners[i][0] + ".display = 'none'");}catch(err){}
			try{document.layers[myBanners[i][0]].display = "none";}catch(err){}
		}
	}
	//Este es el banner superior derecho, que necesita forzar la visibilidad del izquierdo para que se vea correctamente...
	if (tienePublicidad("img3635092")){
		try{document.getElementById("x06").style.display = "block";}catch(err){}
	} else {
		try{
			try{document.getElementById("x06").style.display = "none";}catch(err){}
			document.getElementById("Top").style.width = 750;
			
			if(tienePublicidad(myBanners[0][1])){
			}else {
				//ocultar top...
				try{document.getElementById("Top").style.display = "none";}catch(err){}
				try{eval("document.all.Top.display = 'none'");}catch(err){}
				try{document.layers["Top"].display = "none";}catch(err){}
			}
		}catch(err){}
	}
}


/********************************************************************************************/
//Autor: 			MJP.
//Motivo: 			Mostrar publicidad Antevenio.
//Funcionalidad:		Esta funcion se utiliza mostrar/oculatra la publicidad Antevenio
/********************************************************************************************/
function tienePublicidad(imagen)
{
	anchoPub = -1;
	if (document.all) 
	{
		try{eval("anchoPub = document.all." + imagen + ".width");}catch(err){}
	}
	
	if (document.getElementById && !document.all) //Firefox
	{
		try{anchoPub = document.getElementById(imagen).width;}catch(err){}
	}
	
	if (document.layers) 
	{
		try{anchoPub = document.layers[imagen].width;}catch(err){}
	}
	
	if (anchoPub == 1 || anchoPub == 0) 
	{
		return false; //existe la imagen con width = 1, así que no hay publicidad
	}
	else 
	{
		return true;
	}
}

/********************************************************************************************/
//Autor: 			AO.
//Motivo: 			Rollover de los tr en tablas de corporacion. PI 260491
//Funcionalidad:		Hace el rollvoer de las filas de las tablas en corporacion
/********************************************************************************************/
function trRollover()
{
	$("tr").hover(
	  function () {
		$(this).addClass("filaHoverXSL");
	  },
	  function () {
		$(this).removeClass("filaHoverXSL");
	  }
	);
}
/*
</span>*/

