
document.write("<script type='text/javascript' src='/js/ajax_v2.js'></script"+">");
document.write("<script type='text/javascript' src='/js/prototype.js'></script"+">");
document.write("<script type='text/javascript' src='/js/xml2json.js'></script"+">");	
document.write("<script type='text/javascript' src='/js/BarraPepe.js'></script"+">");
document.write("<link rel='stylesheet' type='text/css' href='/css/barra-pepe.css'/"+">");
  
  function menuSupEstatico(){	  
	  info_sesion = new PeticionBD ('xsesion.info_sesion.xml', 'null', cargaInfo,errorInfo);
	  info_sesion.Iniciar("");
	}
    
    function cargaInfo(datos){
      var ul = getRefToDiv('loginCliente');

	/** Barra Pepe **/
	// David (20/08/2008)
	//
	// No mostrar en pagina principal (excepto agencias) - Cuando haya banners:
/*	if (window.location.href != window.location.protocol + '//www.pepephone.com/html/es/index.html' && datos.sesion.codcan != 'AGE') {
		barra_pepe();
	}*/
	// Mostrar siempre (excepto agencias) - Cuando NO haya banners:
	/*
	alert(datos);
	if (datos.sesion!==undefined){
		alert(datos.sesion.codage);
		}else{
		
	}
	*/
		
	if (datos.sesion.codcan != 'AGE') {
		barra_pepe();
	} 
	//-- ^ --

      if((datos.sesion.idecli!="")&&(datos.sesion.codage=="")){
        info_cliente(ul,datos.sesion);
		barra_pepe();
      } 
      if(datos.sesion.codage!=""){
        info_agencia(ul,datos.sesion);
      }
      if((datos.sesion.idecli=="")&&(datos.sesion.codage=="")){
        sin_sesion(ul);   
//		barra_pepe();
      }
	  // Isabel Gamero(17/05/2010)
      g_ideses = datos.sesion.ses;
      if(window.origen!=undefined){
        if (window.origen==''){
  	     controlSesion();
        }
      }else{
        controlSesion();
      }
    }
    
    function errorInfo(){
        alert(texto_js.error_sesion);
    }
    
    function info_cliente(ul,sesion){
      var spanhola = document.createElement('span');
      var textospan = document.createTextNode (texto_js.hola);
      spanhola.appendChild(textospan);
      var liprim = document.createElement('li');
      liprim.className="first_li";
      liprim.appendChild (spanhola);
            
      
      var strong = document.createElement('strong');
      strong.id="nomcli";
      strong.appendChild(document.createTextNode(sesion.cliente.nomcli)); 
      liprim.appendChild (strong);
      
      var atencli   = document.createElement('a');
      atencli.target= "atciente"
      atencli.href  = '/html/'+idi+'/atencioncliente.html';
      var texto = document.createTextNode (texto_js.atencion_cliente);
      atencli.appendChild (texto);
      var liseg = document.createElement('li');
      liseg.className="first_li";
      liseg.appendChild (atencli);
      
      var acerrar   = document.createElement('a');
      acerrar.href  = '/ppm_web/ppm_web/1/mipepephone/xweb_cliente.logout.html';
      var texto = document.createTextNode (texto_js.cerrar_sesion);
      acerrar.appendChild (texto);      
      var litre = document.createElement('li');
      //litre.className="first_li";
      litre.appendChild (acerrar);
      
      ul.appendChild(liprim);
      ul.appendChild(liseg);
      ul.appendChild(litre);
    
      
		  if (document.getElementById('nomcli2')){
			  document.getElementById('nomcli2').innerHTML = sesion.cliente.nomcli;
      }
    }
    
    function info_agencia(ul,sesion){
      var spanhola = document.createElement('span');
      var textospan = document.createTextNode ('Canal ');
      spanhola.appendChild(textospan);
      var strong = document.createElement('strong');
      strong.id="nomcli";
      strong.appendChild(document.createTextNode('['+sesion.codage+']'+sesion.coduas));
      var liprim = document.createElement('li');
      liprim.appendChild (spanhola);
      liprim.appendChild (strong);
      liprim.className="first_li";
      ul.appendChild(liprim);
      
      var atencli   = document.createElement('a');
      atencli.target= "atciente"
      atencli.href  = '/html/'+idi+'/atencioncliente.html';
      var texto = document.createTextNode (texto_js.atencion_cliente);
      atencli.appendChild (texto);
      var liseg = document.createElement('li');
      liseg.className="first_li";
      liseg.appendChild (atencli);
      
      var acerrar   = document.createElement('a');
      acerrar.href  = '/ppm_web/ppm_web/1/mipepephone/xweb_cliente.logout.html';
      var texto = document.createTextNode (texto_js.cerrar_sesion);
      acerrar.appendChild (texto);
      var litre = document.createElement('li');
     // liseg.className="first_li";
      litre.appendChild (acerrar);
      
      
      
      ul.appendChild(liseg);
      ul.appendChild(litre);
      
      if (document.getElementById('nomcli2')){
			  document.getElementById('nomcli2').innerHTML = sesion.codage;
      } 
    } 
    
    function sin_sesion(ul,sesion){
      var atencli   = document.createElement('a');
      atencli.target= "atciente"      
      atencli.href  = '/html/'+idi+'/atencioncliente.html';
      var texto = document.createTextNode (texto_js.atencion_cliente);
      atencli.appendChild (texto);
      var liprim = document.createElement('li');
      liprim.className="first_li";
      liprim.appendChild (atencli);
      
      var accppp   = document.createElement('a');
      var texto = document.createTextNode (texto_js.acceder_mi_ppm);
      accppp.appendChild (texto);
      accppp.href='https://www.pepephone.com/ppm_web/ppm_web/1/mipepephone/xweb_cliente.info_sesion.html';
      var liseg = document.createElement('li');
      liseg.appendChild (accppp);
  //    liseg.className="first_li";
      ul.appendChild(liprim);
      ul.appendChild(liseg);
    } 
    

	function get_value(parametro)
	{
		var aData=new Array();
		var sLocation=document.URL;
		sLocation= unescape(sLocation); // quita los %20 u otros caracteres escapados.
		var indice=sLocation.indexOf(parametro);
		if(indice < 1) return '';
		var sData=sLocation.substring(indice+1,sLocation.length);
		aData =sData.split("&");
		var valor=aData[0].substring(aData[0].indexOf("=")+1,aData[0].length);
		return valor;
	}


	function getRefToDiv(divID)
	{
		if( document.layers )                                       //Netscape layers
			return document.layers[divID];
		if( document.getElementById )                               //DOM; IE5, NS6, Mozilla, Opera
			return document.getElementById(divID);
		if( document.all )                                          //Proprietary DOM; IE4
			return document.all[divID];
		if( document[divID] )                                       //Netscape alternative
			return document[divID];
		return false;
	}
	
    function mostrar(Seccion){ 
      Seccion.style.display="" 
    }
    
    function ocultar(Seccion){ 
      Seccion.style.display="none" 
    }	

    function ocultartexto(Seccion){
      document.getElementById(Seccion).value="";  
    }
    
    function cambiartipo(Seccion){
     alert(Seccion.type);alert(Seccion.type);
    }    	

	function barra_pepe()
	{   return;
		document.body.style.background = "url(/img/body.gif) repeat-y #cc0000";
//		document.body.style.width = "900px";

		barra = document.createElement('div');
		barra.id = "barra-pepe";
		document.body.appendChild(barra);

		configuration = {
				   'url'      : 'https://www.pepetravel.com',
				   'sitio'    : 'pepephone'
		};
		barraPepe.crearMenu();
	}
