// JavaScript Document


var dom = document.getElementById ? true:false;
var nn4 = document.layers ? true:false;
var ie4 = document.all ? true:false;
var nn = document.layers ? true:false;
var ie = document.all ? true:false;

var rutaweb;

var carp=''

function countLetter (string, letter) {
  var n = 0;
  var p = 0;
  while ((p = string.indexOf(letter, p) + 1) != 0)
    n++;
  return n;
}



function MostrarFecha()
   {
   var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado")
   var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")
   var fecha_actual = new Date()
   dia_mes = fecha_actual.getDate() 
   dia_semana = fecha_actual.getDay() 
   mes = fecha_actual.getMonth() + 1
   anio = fecha_actual.getFullYear()
	 lafecha='<span class="azulfecha">'+nombres_dias[dia_semana]+'</span><span class="textomenunivel3">|</span><span class="azulfecha"><strong>'+dia_mes+'</strong></span><span class="textomenunivel3">|</span><span class="azulfecha">'+nombres_meses[mes - 1]+'</span> '
   

     document.write(lafecha)
   }
function MostrarHora() {
   var fecha_actual = new Date()
   hora = fecha_actual.getHours()
  
   minuto = fecha_actual.getMinutes()
    if (minuto<10)  minuto='0'+minuto
     document.write(hora+':'+minuto)
   }



if (location.href.indexOf('_www')>-1) {
	posref=location.href.indexOf("_www")
	posref=eval(posref+5);
	
	rutaweb=location.href.substring(0,posref)

	carpeta=location.href.substring(posref,location.href.length)
	nivel=0
	
	
} else {


	
	nivel=0
	rutaweb="http://www.atencionenlinea.movistar.es/";


						
}


for (var j = 0; j < nivel; ++j) {
		carp+='../'
}
	

								

var storedValue ;
var menumm='';
var menummon='';
var primernivelactivo=-1;
var segundonivelactivo=-1;
var auxnivel;

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}


function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}


function item(nombre, parent, text, depth,clink) {
        this.nombre = nombre // is this item a parent?
	   this.parent = parent // is this item a parent?
        this.text = text // text for link (may include HTML)
        this.depth = depth // nested depth
		this.clink = clink // nested depth
}

////FUNCIONES GABI/////


function imprime(){
  cadena=document.location.href;
  nombre=('imp-'+cadena.slice(cadena.lastIndexOf('/')+1));
  imp=window.open(nombre,'imprimir','resizable=no,scrollbars=yes,toolbar=no,location=no,menu=no,Width=580,Height=350,');
 // imp.print();
}


function mifuncion() {
	self.print();
	setTimeout ('cerrado ()', 5000); 
}

function cerrado() {
	self.close();
}




function setStates() {
        // assign current cookie to local variable
        var storedValue = menumm

        // if desired cookie not found (null)
        
        if (!storedValue) {
                // set states to default if no cookie found
                for (var i = 0; i < arbol.length; ++i) {
                        // only topmost level is visible by default
                        if (arbol[i].depth == 0)
                                arbol[i].state = true
                        else
                                arbol[i].state = false
                }
        } else {
                // extract current states from cookie (0 => false, 1 => true)
                for (var i = 0; i < arbol.length; ++i) {
                
                
                        if (storedValue.charAt(i) == '1') {
	                      
                                arbol[i].state = true
                        } else {
                                arbol[i].state = false
                        }
                }
        }
}

function setImages() {

        for (var i = 0; i < arbol.length; ++i) {
                if (arbol[i].state)
                        if (arbol[i].parent) { // arbol[i] is a parent
                                if (arbol[i + 1].state) // arbol[i] is exploded
                                        arbol[i].pic = '&nbsp;<A HREF="javascript:toggle(' + i + ')"><IMG SRC="'+rutaweb+carp+'imgs/item-menos.gif" BORDER=0></A>'
                                else // arbol[i] is collapsed
                                        arbol[i].pic = '&nbsp;<A HREF="javascript:toggle(' + i + ')"><IMG SRC="'+rutaweb+carp+'imgs/item-mas.gif" BORDER=0></A>'
                        } else {
                                
                                if (arbol[i].depth==1) arbol[i].pic = '&nbsp;<IMG SRC="'+rutaweb+carp+'imgs/ico-menu-item.gif" BORDER=0>'
                                if (arbol[i].depth==2) arbol[i].pic = '&nbsp;<IMG SRC="'+rutaweb+carp+'imgs/ico-menu-secc4.gif" BORDER=0>'
                        }
        }
}

function toggle(num) {
	
  if (isNaN(num)) {
  
  	for (var i = 0; i < arbol.length; ++i) {
  		if (arbol[i].nombre==num) {
  			num=i;
  			break;
  		}
 		
  	
  	}
  }
  	

	if ((arbol[num].depth==0) && (primernivelactivo!=num)){


		for (var i = 0; i < arbol.length; ++i) {
			// only topmost level is visible by default
			if (arbol[i].depth == 0)
				arbol[i].state = true
			else
				arbol[i].state = false
		}

	}
	
	if ((arbol[num].depth==2) && (segundonivelactivo!=num)){

	
		for (var i = 0; i < arbol.length; ++i) {
			// only topmost level is visible by default
			if (arbol[i].depth == 2)
				arbol[i].state = true
			else
				arbol[i].state = false
		}

	}
	

		
	

        for (var i = num + 1; i < arbol.length && arbol[i].depth >= arbol[num].depth + 1; ++i) {
	        
                // if current item (arbol[i]) is a direct child of arbol[num]
                if (arbol[i].depth == arbol[num].depth + 1) {
                	 
			arbol[i].state = !arbol[i].state // toggle state
		} else {
			arbol[i].depth=false;
		}
				
	}
	
	if (arbol[num].depth==0) primernivelactivo=num
	if (arbol[num].depth==1) segundonivelactivo=num
	


        setStorage(num)
        creararbol();
        pintamenu()

}


function pintamenu(){
	
	actual= menummon
	
	gestion=0
	
		
	
	
	textohtml='<table width="204" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><tr><td height="5" colspan="3" class="textomenu"></td></tr>'
	textohtml+='<tr><td height="9"  colspan="3" class="textomenu"><a href="'+rutaweb+carp+'index.htm" title="Atención en Línea"><img src="'+rutaweb+carp+'imgs/titular-atencion.gif" width="204" height="30" border="0"></a></td></tr></table>'
	textohtml+='<table width="204" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><tr><td class="textomenu" width="5" bgcolor="#ECECEC"><img src="'+rutaweb+carp+'imgs/espacio3.gif" width="5" height="16"></td><td width="194">'
	textohtml+='<table width="194" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"><tr><td height="5" colspan="3" class="textomenu"></td></tr>'
	
	

	for (var i = 0; i < arbol.length; ++i) {

	  if (arbol[i].text=="MENUGESTION")  { gestion=1; textohtml+='<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>'}
	  
	  if (arbol[i].depth==0) textohtml+='<tr width="194" align="right" valign="top"><td width="194" colspan="3" bgcolor="#D4D5D7"><img src="'+rutaweb+carp+'imgs/icogris.gif" width="1" height="1"></td></tr>'

	if (gestion==0) {
	  
	  
	  	
		if (arbol[i].state) {
	
		
		
			if ((actual==i) && (primernivelactivo>-1) && (arbol[0].state==1)) {
				texxxto= '<b>'+arbol[i].text+'</b>'


				if (arbol[i].depth==0) { cestilo='textomenu'; textohtml+='<tr><td width="5" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="189" colspan="2" class="textomenu">'}
				if (arbol[i].depth==1) { cestilo='textomenunivel3'; textohtml+='<tr><td>&nbsp;</td><td>&nbsp;&nbsp;<img src="'+rutaweb+carp+'imgs/iconivel3.gif" vspace="2"></td><td height="2">'}
				if (arbol[i].depth==2) { cestilo='textomenunivel3'; textohtml+='<tr><td>&nbsp;</td><td>&nbsp;&nbsp;<img src="'+rutaweb+carp+'imgs/iconivel3.gif"  vspace="2"></td><td height="2"  class="'+cestilo+'">'}
				if (arbol[i].depth==3) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="'+cestilo+'">'}



			} else {


				if (arbol[i].depth==0) { cestilo='textomenu'; textohtml+='<tr><td width="5" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="189" colspan="2" class="textomenu">'}
				if (arbol[i].depth==1) { cestilo='textomenunivel2'; textohtml+='<tr><td width="12">&nbsp;</td><td width="16"><img src="'+rutaweb+carp+'imgs/iconivel2.gif" width="14" height="16"></td><td width="167" height="14" class="textomenunivel2">'}
				if (arbol[i].depth==2) { cestilo='textomenunivel3b'; textohtml+='<tr><td>&nbsp;</td><td>&nbsp;</td><td height="14"><a href="#" class="textomenunivel3b"><img src="'+rutaweb+carp+'imgs/iconivel3b.gif"  border="0" align="absmiddle" class="'+cestilo+'">'}
				if (arbol[i].depth==3) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="'+cestilo+'">'}

				texxxto= ''+arbol[i].text+''

			}
	
			
		
		
	 			if (arbol[i].clink!='') {
	 				textohtml+='<a href="'+rutaweb+carp+arbol[i].clink+'" '
					
					if (arbol[i].clink.indexOf("img")<0) textohtml+=' title="'+arbol[i].text+'" class="'+cestilo+'" '
					
					textohtml+=' >'+texxxto+'</a></td></tr>'
	 			} else {
				
	 				textohtml+='<a href="javascript:toggle(' + i + ')" '
					
					if (arbol[i].text.indexOf("img")<0) {
					
						textohtml+=' title="'+arbol[i].text+'"  class="'+cestilo+'"'
					} 
					
					textohtml+='>'+texxxto+'</a></td></tr>'		
	 			}
	 

		
	
		} else {
			
			var previous = i
			for (var k = i + 1; k < arbol.length && arbol[k].depth >= arbol[previous].depth; ++k) {
				++i
			}
		
		}
		
				

		
		
		
		
	} else {
	
		
		
		
	 /// AQUI PINTA EL MENU DE GESTION QUE ES DISTINTO
	 
	 if (arbol[i].text=="MENUGESTION")  { 
		 
		 	
			 textohtml+='<tr><td height="9" colspan="3" class="textomenu">&nbsp;</td></tr></table>'
			 textohtml+='<table width="204" border="1" cellspacing="0" cellpadding="0"><tr><td colspan="5"><img src="'+rutaweb+carp+'atencion/imgs/titular-atencion.gif" width="204" height="30"></td></tr>'
			 textohtml+='<tr><td width="3" bgcolor="#2284CF"><img src="'+rutaweb+carp+'imgs/espacio3.gif" width="3" height="16"></td><td width="195"><table width="198" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">'

	 }	 
	 
	 if (arbol[i].text!="MENUGESTION") {
	 
	 		if (arbol[i].state){
	 	
	 		
					if (arbol[i].depth==0)  textohtml+='<tr><td  colspan="3" align="right"><img src="'+rutaweb+carp+'imgs/icogris.gif" width="196" height="1"></td></tr>'
					
					if (arbol[i].depth==2)  textohtml+='<tr><td></td><td></td><td  align="right"><img src="'+rutaweb+carp+'imgs/icogris.gif" width="165" height="1"></td></tr>'
					
	 			if ((actual==i) && (primernivelactivo>-1) && (arbol[0].state==1)) {
					texxxto= '<b>'+arbol[i].text+'</b>'


					if (arbol[i].depth==0) { cestilo='textomenu'; textohtml+='<tr><td bgcolor="#D6D5DA"><img src="'+rutaweb+carp+'imgs/iconar1on.gif" width="12" height="16"></td><td colspan="2" bgcolor="#D6D5DA" class="textomenu">'}
					if (arbol[i].depth==1) { cestilo='textomenunivel2'; textohtml+='<tr><td width="12">&nbsp;</td><td width="16"><img src="'+rutaweb+carp+'imgs/iconivel2.gif" width="14" height="13"></td><td width="167" height="14" class="textomenunivel2">'}
					if (arbol[i].depth==2) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="'+cestilo+'">'}
					if (arbol[i].depth==3) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="'+cestilo+'">'}



				} else {


					if (arbol[i].depth==0) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="textomenu">'}
					if (arbol[i].depth==1) { cestilo='textomenunivel2'; textohtml+='<tr><td width="12">&nbsp;</td><td width="16"><img src="'+rutaweb+carp+'imgs/iconivel2.gif" width="14" height="13"></td><td width="167" height="14" class="textomenunivel2">'}
					if (arbol[i].depth==2) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="'+cestilo+'">'}
					if (arbol[i].depth==3) { cestilo='textomenu'; textohtml+='<tr><td width="12" height="16"><img src="'+rutaweb+carp+'imgs/iconar1.gif" width="12" height="16"></td><td height="16" width="150" colspan="2" class="'+cestilo+'">'}

							if ((i==segundonivelactivo) ) {
								texxxto= '<b>'+arbol[i].text+'</b>'
								
							} else {
								texxxto= ''+arbol[i].text+''
							}
			
			}
	 
	 			
	 		
	 		
	 			if (arbol[i].clink!='') {
	 				textohtml+='&nbsp;<a  href="'+rutaweb+carp+arbol[i].clink+'" tabindex='+eval(i+30)+''
					
					if (arbol[i].clink.indexOf("img")<0) textohtml+=' title="'+arbol[i].text+'" class="'+cestilo+'" '
					
					textohtml+=' >'+texxxto+'</a></td></tr>'
	 			} else {
			
	 				textohtml+='&nbsp;<a href="javascript:toggle(' + i + ')" tabindex='+eval(i+30)+' '
					
					if (arbol[i].clink.indexOf("img")<0) textohtml+=' title="'+arbol[i].text+'"  class="'+cestilo+'"'
					
					textohtml+='>'+texxxto+'</a></td></tr>'		
	 			}
	 		
	 		
	 		
	 		} else {
	 			
				
					
					var previous = i
					for (var k = i + 1; k < arbol.length && arbol[k].depth >= arbol[previous].depth; ++k) {
						++i
					}
				
	 		
			}
			
					
	
		}
		
		
		
	
	
	
	}
		
		
		
		
	}

	
	
	textohtml+='<tr align="right" valign="top"><td colspan="3"><img src="'+rutaweb+carp+'imgs/icogris.gif" width="194" height="1"></td></tr>'
	textohtml+='</table></td><td width="5" class="textomenu" bgcolor="#ECECEC"><img src="'+rutaweb+carp+'imgs/espacio3.gif" width="5" height="16"></td></tr><tr><td colspan="3"><img src="'+rutaweb+carp+'imgs/piegestion.gif" width="204" height="11"></td></tr></table><br>'
		
	

		
		
	MM_setTextOfLayer('arbol','',''+escape(textohtml))
	


}

// create items of arbol




function setStorage(numero) {
        // initialize local variable to empty string
        var text = ""

        // loop through all properties of arbol "array"
        for (var i = 0; i < arbol.length; ++i) {
                // use "1" character to represent true state, and "0" for false state
                text += (arbol[i].state) ? "1" : "0"
        }



        menumm= text
	menummon=numero
		
}
 





/////////////////////////////////////////////
/// FUNCIONES DE CENTRADO DE LAS PAGINAS   //
/////////////////////////////////////////////


var nWidth=0;
var nHeight=0;
var nBodyW=0;
var nBodyH=0;



function centrarcapa(nombre,val1,val2){
		if (document.layers) {
			totalwidth=window.innerWidth;
			totalheight=window.innerHeight;
		} else {
			totalwidth=document.body.clientWidth;
			totalheight=document.body.clientHeight;

		}
		val1=eval(val1)
		val2=eval(val2)

		if (window.opera) {eval('document.getElementById("'+nombre+'").style.left='+val1);eval('document.getElementById("'+nombre+'").style.top='+val2)}
		if (document.all) {eval('document.all("'+nombre+'").style.left='+val1);eval('document.all("'+nombre+'").style.top='+val2)}
		if (document.layers) {eval('document.layers["'+nombre+'"].left='+val1);eval('document.layers["'+nombre+'"].top='+val2);}
		if (document.getElementById) { eval('document.getElementById("'+nombre+'").style.left="'+val1+'px"');	eval('document.getElementById("'+nombre+'").style.top="'+val2+'px"');		}

}


	
	var nTcontent = 65;
	var nLcontent = 305;
	
	
function centrar(){

	if ((ie) || (nn)) {

		if (ie && document.body.clientWidth){
		nWidth = document.body.clientWidth/2;
		nHeight = document.body.clientHeight/2;
		}else{
		nWidth = window.innerWidth/2;
		nHeight = window.innerHeight/2;
		}
		
		nBodyW = nWidth-405;
		nBodyH = nHeight;

		centrarcapa('pagina',nBodyW,nBodyH);
		centrarcapa('arbol',nBodyW+25,nBodyH+154); //+482
			
	}
	
	MM_showHideLayers('pagina','','show','arbol','','show');
	
}
function centrarsinarbol(){

	if ((ie) || (nn)) {

		if (ie && document.body.clientWidth){
		nWidth = document.body.clientWidth/2;
		nHeight = document.body.clientHeight/2;
		}else{
		nWidth = window.innerWidth/2;
		nHeight = window.innerHeight/2;
		}
		
		nBodyW = nWidth-405;
		nBodyH = nHeight;
		
		centrarcapa('pagina',nBodyW,nBodyH);
			
	}
	
	MM_showHideLayers('pagina','','show','arbol','','show');
	
}


function centrarhome(){

	if ((ie) || (nn)) {

		if (ie && document.body.clientWidth){
		nWidth = document.body.clientWidth/2;
		nHeight = document.body.clientHeight/2;
		}else{
		nWidth = window.innerWidth/2;
		nHeight = window.innerHeight/2;
		}
		
		nBodyW = nWidth-405;
		nBodyH = nHeight;
		centrarcapa('Layer1',nBodyW,nBodyH);
		centrarcapa('Layer2',nBodyW+30,nBodyH);
		centrarcapa('Layer3',nBodyW+236,nBodyH);
			
	}
	
	
}

function buscar(mifrm){  
  var texque=mifrm.txtbuscar.value	
  if (texque=="" || null){  
    alert("Introducir texto a buscar.")
    mifrm.txtbuscar.focus
  }else{  
    //var url="../"+carp+"buscador/index.htm?claves="+(texque)
	var url="http://www.movistar.es/buscador/index.htm?claves="+(texque)
 
    var idv=window.open (url, "buscador", "scrollbars=yes,status=yes,width=790,height=560,screenX=0,screenY=0")

    idv.focus()
  }  

}

var comilla;

function escribefechahora(){
	
	var fecha_actual = new Date(); hora = fecha_actual.getHours(); minuto = fecha_actual.getMinutes();  if (minuto<10)  minuto='0'+minuto; 
	htmlfecha='<span class="grisfecha">&nbsp;&nbsp;&nbsp;&nbsp;'+hora+':'+minuto+'&nbsp;</span>';
	var nombres_dias = new Array("Domingo", "Lunes", "Martes", "Mi&eacute;rcoles", "Jueves", "Viernes", "S&aacute;bado"); var nombres_meses = new Array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");var fecha_actual = new Date();dia_mes = fecha_actual.getDate();dia_semana = fecha_actual.getDay();mes = fecha_actual.getMonth() + 1;anio = fecha_actual.getFullYear();lafecha= nombres_dias[dia_semana] + ", " + dia_mes + " de " + nombres_meses[mes - 1]; 
	htmlfecha+='<span class="grisfecha">'+lafecha.toLowerCase()+'</span>'
	return htmlfecha
	
}



function escribecabecera(){
comilla="'";

var htmltop="";
var htmltop2="";
var sHTML="";
var nivel=new Array();
var swdefecto=0;
urlpos=document.location.href.indexOf('_www');
if(document.location.href.indexOf('/'))
nivel=document.location.href.substr(urlpos+4).split("/")
else
nivel=document.location.href.substr(urlpos+4).split("\\")



htmltop+='<table width="761" height="134" border="0" cellpadding="0" cellspacing="0">';
htmltop+='<tr><td width="168" height="63" rowspan="2" valign="bottom"><a href="http://www.movistar.es" tabindex="1"><img src="'+rutaweb+carp+'imgs/canales/logo-movistar.gif" alt="Movistar" width="168" height="63" hspace="0" vspace="0" border="0" /></a></td>';
htmltop+='<td height="27" colspan="2" valign="top"><table width="402" height="27" border="0" align="right" cellpadding="0" cellspacing="0">';
htmltop+='<tr><td width="56" align="center" valign="middle"><a href="http://www.movistar.es/media/contacta/contacta-particulares.htm" class="topmenu" title="Contacta" tabindex="2">Contacta</a></td>';
htmltop+='<td align="center"><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop+='<td width="101" align="center" valign="middle"><a href="http://www.atencionenlinea.movistar.es/particulares/tarifas.htm" class="topmenumarcado" title="Atenci&oacute;n en L&iacute;nea" tabindex="3">Atenci&oacute;n en L&iacute;nea</a></td>';
htmltop+='<td align="center"><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop+='<td width="59" align="center" valign="middle"><a href="http://www.movistar.es/accesible/"  class="topmenu" target="_blank" title="Accesible" tabindex="4">Accesible</a></td>';
htmltop+='<td align="center"><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop+='<td width="41" align="center" valign="middle"><a href="http://www.movistar.es/media/mapa/mapa.htm" class="topmenu" title="Mapa" tabindex="5">Mapa</a></td>';
htmltop+='<td><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop+='<td width="141" valign="middle">&nbsp;<a href="#" style="color:#1E84CF;font-family:Arial, Helvetica, sans-serif;font-size:10px;';
htmltop+='text-decoration:none;" title="Buscador" tabindex="6">Buscador</a></span>';
htmltop+='<input type="text" name="txtbuscar" accesskey="b" tabindex="6" class="inputbuscador">';
htmltop+='<a href="javascript:buscar(document.frmbuscar)" tabindex="6"><img src="'+rutaweb+carp+'imgs/canales/flecha-buscador.gif" alt="Buscar" width="13" height="18" border="0" align="absmiddle" /></a></td>';
htmltop+='</tr></table></td></tr><tr>';
htmltop+='<td width="528" height="36" valign="bottom" background="'+rutaweb+carp+'imgs/canales/fondo-cabecera.gif"><img src="'+rutaweb+carp+'imgs/canales/pixel.gif" alt="blanco" width="200" height="36" border="0" /></td>';
htmltop+='<td height="36" align="right" valign="bottom"><a href="http://www.telefonica.es" target="_blank" tabindex="7"><img src="'+rutaweb+carp+'imgs/canales/logo-telefonica.gif" alt="Telef&oacute;nica" width="85" height="36" border="0" /></a></td>';
htmltop+='</tr><tr><td height="20" colspan="3" background="'+rutaweb+carp+'imgs/canales/fondo-vertical.gif" valign="top"><table width="759" height="20" border="0" align="right" cellpadding="0" cellspacing="0">';
htmltop+='<tr><td width="339"><script>document.write(escribefechahora());</script></td>';
htmltop+='<td width="104"><a href="http://www.movistar.es" alt="Particulares" title="Particulares" tabindex="8" ><img src="'+rutaweb+carp+'imgs/canales/solapaparticulares-on.gif" alt="Particulares"  name="solaparticulares" width="104" height="20" border="0" id="solaparticulares" /></a></td>';
htmltop+='<td width="175"><a href="http://www.movistar.es/empresas/" alt="Empresas y Profesionales" title="Empresas y Profesionales" onmouseover="MM_swapImage(\'solapaempresas\',\'\',\''+rutaweb+carp+'imgs/canales/solapaempresas-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="9"><img src="'+rutaweb+carp+'imgs/canales/solapaempresas.gif" alt="Empresas y Profesionales"  name="solapaempresas" width="175" height="20" border="0" id="solapaempresas" /></a></td>';
htmltop+='<td width="140"><a href="http://www.empresa.movistar.es/" onmouseover="MM_swapImage(\'solapaconoce\',\'\',\''+rutaweb+carp+'imgs/canales/solapaconoce-on.gif\',1)" onmouseout="MM_swapImgRestore()" alt="Conoce la Empresa" title="Conoce la Empresa" tabindex="10"><img src="'+rutaweb+carp+'imgs/canales/solapaconoce.gif" alt="Conoce la Empresa"  name="solapaconoce" width="140" height="20" border="0" id="solapaconoce" /></a></td>';
htmltop+='</tr></table></td></tr><tr>';
htmltop+='<td height="51" colspan="3"><table width="761" border="0" align="right" cellpadding="0" cellspacing="0">';
htmltop+='<tr><td width="95"><a href="http://www.movistar.es/particulares/tarifasycontratos/index.htm" onmouseover="MM_swapImage(\'tarifas\',\'\',\''+rutaweb+carp+'imgs/canales/tarifas-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="11"><img src="'+rutaweb+carp+'imgs/canales/tarifas.gif" alt="Tarifas y Contratos" name="tarifas" width="97" height="51" border="0" id="tarifas" /></a></td>';
htmltop+='<td width="95"><a href="http://www.canalcliente.movistar.es/?menup" onmouseover="MM_swapImage(\'ccliente\',\'\',\''+rutaweb+carp+'imgs/canales/ccliente-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="12"><img src="'+rutaweb+carp+'imgs/canales/ccliente.gif" alt="Canal Cliente" name="ccliente" width="95" height="51" border="0" id="ccliente" /></a></td>';
htmltop+='<td width="95"><a href="http://www.movistar.es/particulares/tarifasycontratos/recarga/recarga.htm" onmouseover="MM_swapImage(\'recarga\',\'\',\''+rutaweb+carp+'imgs/canales/recarga-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="13"><img src="'+rutaweb+carp+'imgs/canales/recarga.gif" alt="Recarga tu Tarjeta" name="recarga" width="95" height="51" border="0" id="recarga" /></a></td>';
htmltop+='<td width="95"><a href="http://www.movistar.es/particulares/servicios/index.htm" onmouseover="MM_swapImage(\'tusservicios\',\'\',\''+rutaweb+carp+'imgs/canales/tusservicios-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="14"><img src="'+rutaweb+carp+'imgs/canales/tusservicios.gif" alt="Tus Servicios" name="tusservicios" width="95" height="51" border="0" id="tusservicios" /></a></td>';
htmltop+='<td width="95"><a href="http://www.movistar.es/particulares/internacionalyroaming/" onmouseover="MM_swapImage(\'internac\',\'\',\''+rutaweb+carp+'imgs/canales/internac-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="15"><img src="'+rutaweb+carp+'imgs/canales/internac.gif" alt="Internacional y Roaming" name="internac" width="95" height="51" border="0" id="internac" /></a></td>';
htmltop+='<td width="95"><a href="http://www.movistar.es/particulares/renueva/index.htm" onmouseover="MM_swapImage(\'renueva\',\'\',\''+rutaweb+carp+'imgs/canales/renueva-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="16"><img src="'+rutaweb+carp+'imgs/canales/renueva.gif" alt="Renueva tu m&oacute;vil" name="renueva" width="95" height="51" border="0" id="renueva" /></a></td>';
htmltop+='<td width="95"><a href="http://www.movistar.es/portabilidad/index.htm" onmouseover="MM_swapImage(\'venams\',\'\',\''+rutaweb+carp+'imgs/canales/venams-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="17"><img src="'+rutaweb+carp+'imgs/canales/venams.gif" alt="Ven a movistar" name="venams" width="95" height="51" border="0" id="venams" /></a></td>';
htmltop+='<td width="102"><a href="https://www.tu-tienda.movistar.es/index.html?origen=P" onmouseover="MM_swapImage(\'tutienda\',\'\',\''+rutaweb+carp+'imgs/canales/tutienda-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="18"><img src="'+rutaweb+carp+'imgs/canales/tutienda.gif" alt="Tu Tienda" name="tutienda" width="93" height="51" border="0" id="tutienda" /></a></td>';
htmltop+='</tr></table></td></tr></table>';

htmltop2+='<table width="761" height="134" border="0" cellpadding="0" cellspacing="0">';
htmltop2+='<tr><td width="168" height="63" rowspan="2" valign="bottom"><a href="http://www.movistar.es" tabindex="1"><img src="'+rutaweb+carp+'imgs/canales/logo-movistar.gif" alt="www.movistar.es" width="168" height="63" hspace="0" vspace="0" border="0" /></a></td>';
htmltop2+='<td height="27" colspan="2" valign="top"><table width="402" height="27" border="0" align="right" cellpadding="0" cellspacing="0">';
htmltop2+='<tr><td width="56" align="center" valign="middle"><a href="http://www.movistar.es/media/contacta/contacta-empresas.htm" class="topmenu" title="Contacta" tabindex="2">Contacta</a></td>';
htmltop2+='<td align="center"><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop2+='<td width="101" align="center" valign="middle"><a href="http://www.atencionenlinea.movistar.es/empresas/tarifas.htm" class="topmenumarcado" title="Atención en L&iacute;nea" tabindex="3">Atenci&oacute;n en L&iacute;nea</a></td>';
htmltop2+='<td align="center"><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop2+='<td width="59" align="center" valign="middle"><a href="http://www.movistar.es/accesible/"  class="topmenu" tabindex="4" target="_blank" title="Accesible">Accesible</a></td>';
htmltop2+='<td align="center"><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop2+='<td width="41" align="center" valign="middle"><a href="http://www.movistar.es/media/mapa/mapa.htm" class="topmenu" tabindex="5" title="Mapa">Mapa</a></td>';
htmltop2+='<td><img src="'+rutaweb+carp+'imgs/canales/divis-sup.gif" alt="division" width="1" height="27" /></td>';
htmltop2+='<td width="141" valign="middle">&nbsp;<a href="#" style="color:#1E84CF;font-family:Arial, Helvetica, sans-serif;font-size:10px;';
htmltop2+='text-decoration:none;" title="Buscador" tabindex="6">Buscador</a></span> ';
htmltop2+='<input type="text" name="txtbuscar" accesskey="b" tabindex="6"  class="inputbuscador"/>';
htmltop2+='<a href="javascript:buscar(document.frmbuscar)" tabindex="6"><img src="'+rutaweb+carp+'imgs/canales/flecha-buscador.gif" alt="Buscar" width="13" height="18" border="0" align="absmiddle" /></a></td>';
htmltop2+='</tr></table></td></tr><tr><td width="528" height="36" valign="bottom" background="'+rutaweb+carp+'imgs/canales/fondo-cabecera.gif"><img src="'+rutaweb+carp+'imgs/canales/pixel.gif" alt="blanco" width="200" height="36" border="0" /></td>';
htmltop2+='<td height="36" align="right" valign="bottom"><a href="http://www.telefonica.es" target="_blank" tabindex="6"><img src="'+rutaweb+carp+'imgs/canales/logo-telefonica.gif" alt="Telef&oacute;nica" width="85" height="36" border="0" /></a></td>';
htmltop2+='</tr><tr><td height="20" colspan="3" background="'+rutaweb+carp+'imgs/canales/fondo-vertical.gif" valign="top"><table width="759" height="20" border="0" align="right" cellpadding="0" cellspacing="0">';
htmltop2+='<tr><td width="339"><script>document.write(escribefechahora());</script></td>';
htmltop2+='<td width="104"><a href="http://www.movistar.es" alt="Particulares" title="Particulares" tabindex="7"><img src="'+rutaweb+carp+'imgs/canales/particulares.gif" alt="Particulares"  name="solaparticulares" width="104" height="20" border="0" id="solaparticulares" onmouseover="MM_swapImage(\'solaparticulares\',\'\',\''+rutaweb+carp+'imgs/canales/particulares-on.gif\',1)" onmouseout="MM_swapImgRestore()" /></a></td>';
htmltop2+='<td width="175"><a href="http://www.movistar.es/empresas/" alt="Empresas y Profesionales" title="Empresas y Profesionales" tabindex="8"><img src="'+rutaweb+carp+'imgs/canales/empresas-on.gif" alt="Empresas y Profesionales"  name="solapaempresas" width="175" height="20" border="0" id="solapaempresas" /></a></td>';
htmltop2+='<td width="140"><a href="http://www.empresa.movistar.es/" onmouseover="MM_swapImage(\'solapaconoce\',\'\',\''+rutaweb+carp+'imgs/canales/solapaconoce-on.gif\',1)" onmouseout="MM_swapImgRestore()" alt="Conoce la Empresa" title="Conoce la Empresa" tabindex="9"><img src="'+rutaweb+carp+'imgs/canales/solapaconoce.gif" alt="Conoce la Empresa"  name="solapaconoce" width="140" height="20" border="0" id="solapaconoce" /></a></td>';
htmltop2+='</tr></table></td></tr><tr>';
htmltop2+='<td height="51" colspan="3"><table width="761" border="0" align="right" cellpadding="0" cellspacing="0">';
htmltop2+='<tr><td width="95"><a href="http://www.movistar.es/empresas/tarifasycontratos/index.htm" onmouseover="MM_swapImage(\'tarifas\',\'\',\''+rutaweb+carp+'imgs/canales/tarifas-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="10"><img src="'+rutaweb+carp+'imgs/canales/tarifas.gif" alt="Tarifas y Contratos" name="tarifas" width="97" height="51" border="0" id="tarifas" /></a></td>';
htmltop2+='<td width="95"><a href="https://www.canalcliente.movistar.es/empresas?menue" onmouseover="MM_swapImage(\'ccliente\',\'\',\''+rutaweb+carp+'imgs/canales/ccliente-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="11"><img src="'+rutaweb+carp+'imgs/canales/ccliente.gif" alt="Canal Cliente" name="ccliente" width="95" height="51" border="0" id="ccliente" /></a></td>';
htmltop2+='<td width="95"><a href="http://www.movistar.es/empresas/servicios/index.htm" onmouseover="MM_swapImage(\'servisoluc\',\'\',\''+rutaweb+carp+'imgs/canales/servicios-sol-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="12"><img src="'+rutaweb+carp+'imgs/canales/servicios-sol.gif" alt="Recarga tu Tarjeta" name="servisoluc" width="95" height="51" border="0" id="servisoluc" /></a></td>';
htmltop2+='<td width="95"><a href="http://www.movistar.es/empresas/internacionalyroaming/" onmouseover="MM_swapImage(\'internac1\',\'\',\''+rutaweb+carp+'imgs/canales/internac2-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="13"><img src="'+rutaweb+carp+'imgs/canales/internac2.gif" alt="Tus Servicios" name="internac1" width="95" height="51" border="0" id="internac1"  /></a></td>';
htmltop2+='<td width="95"><a href="http://www.movistar.es/empresas/dispositivosymoviles/" onmouseover="MM_swapImage(\'dispos\',\'\',\''+rutaweb+carp+'imgs/canales/dispositi-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="14"><img src="'+rutaweb+carp+'imgs/canales/dispositi.gif" alt="Internacional y Roaming" name="dispos" width="95" height="51" border="0" id="dispos" /></a></td>';
htmltop2+='<td width="95"><a href="http://www.movistar.es/empresas/renueva/index.htm" onmouseover="MM_swapImage(\'renueva\',\'\',\''+rutaweb+carp+'imgs/canales/renueva2-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="15"><img src="'+rutaweb+carp+'imgs/canales/renueva2.gif" alt="Renueva tu m&oacute;vil" name="renueva" width="95" height="51" border="0" id="renueva" /></a></td>';
htmltop2+='<td width="95"><a href="http://www.movistar.es/portabilidad/index2.htm" onmouseover="MM_swapImage(\'venams\',\'\',\''+rutaweb+carp+'imgs/canales/venams2-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="16"><img src="'+rutaweb+carp+'imgs/canales/venams2.gif" alt="Ven a movistar" name="venams" width="95" height="51" border="0" id="venams" /></a></td>';
htmltop2+='<td width="102"><a href="http://www.tu-tienda.movistar.es/" onmouseover="MM_swapImage(\'tutienda\',\'\',\''+rutaweb+carp+'imgs/canales/tutienda-on.gif\',1)" onmouseout="MM_swapImgRestore()" tabindex="17"><img src="'+rutaweb+carp+'imgs/canales/tutienda.gif" alt="Tu Tienda" name="tutienda" width="93" height="51" border="0" id="tutienda" /></a></td>';
htmltop2+='</tr></table></td></tr></table>';

switch(nivel[1])
{
case "empresas":
htmltop=htmltop2;
break;
//Preparado para nuevos casos

default:
htmltop=htmltop;
break;

}
return htmltop;	
}

function escribepie(){

htmlpie='<table width="728" border="0" cellpadding="0" cellspacing="0"><tr>\n'
htmlpie+='<td colspan="2"><img src="'+rutaweb+carp+'imgs/espacio.gif" alt="" width="500" height="9" title=""></td>\n'
htmlpie+='</tr><tr><td width="14" rowspan="2"><img src="'+rutaweb+carp+'imgs/espacio.gif" alt="" width="15" height="15" title=""></td>\n'
htmlpie+='<td width="653" valign="top"><img src="'+rutaweb+carp+'imgs/cabecera/icoazul.gif" alt="" width="759" height="6" border="0" title=""></td>\n'
htmlpie+='</tr><tr><td height="27" align="center" valign="bottom" class="palopie"><a href="http://www.telefonicamoviles.com/esp/index.html" target="_blank" title="Telefónica Móviles"><img src="'+rutaweb+carp+'imgs/logo-telefonica-moviles.gif" width="47" height="18" hspace="5" border="0" align="top" border="0" alt="Telefónica Móviles" valign="middle"/></a> <a href="javascript:;" class="pie" title="Aviso Legal" onClick="MM_openBrWindow('+comilla+'http://www.movistar.es/media/legal/texto.htm'+comilla+','+comilla+'legal'+comilla+','+comilla+'scrollbars=yes,resizable=yes'+comilla+','+comilla+'560'+comilla+','+comilla+'329'+comilla+','+comilla+'true'+comilla+')">Aviso Legal</a> | <a href="javascript:;" class="pie" title="Web Protecci&oacute;n de Datos" onClick="MM_openBrWindow('+comilla+'http://www.movistar.es/telegal/flotante/prodatos.htm'+comilla+','+comilla+'protecciondatos'+comilla+','+comilla+'scrollbars=yes,resizable=yes'+comilla+','+comilla+'560'+comilla+','+comilla+'329'+comilla+','+comilla+'true'+comilla+')">Web Protecci&oacute;n de Datos</a> | <a href="javascript:;" class="pie" title="Telef&oacute;nica M&oacute;viles Espa&ntilde;a, S.A.U." onClick="MM_openBrWindow('+comilla+'http://www.movistar.es/media/legal/legal.htm'+comilla+','+comilla+'legal'+comilla+','+comilla+'scrollbars=yes,resizable=yes'+comilla+','+comilla+'560'+comilla+','+comilla+'329'+comilla+','+comilla+'true'+comilla+')">Telef&oacute;nica M&oacute;viles Espa&ntilde;a, S.A.U.</a> | <a href="javascript:;" class="pie" title="Optimizado para..." onClick="MM_openBrWindow('+comilla+'http://www.movistar.es/media/legal/optimizado.htm'+comilla+','+comilla+'legal'+comilla+','+comilla+'scrollbars=yes,resizable=yes'+comilla+','+comilla+'560'+comilla+','+comilla+'329'+comilla+','+comilla+'true'+comilla+')">Optimizado Para...</a> </td>\n'
htmlpie+='</tr><tr><td>&nbsp;</td><td valign="top" class="palopie">&nbsp;</td></tr></table>\n'

	
	return htmlpie

}





