
function buscar()
{
			
		
	
	if(document.myform.TxtBuscar.value=="" )
		alert("Para buscar debe rellenar la caja de texto");
	else	
	{ 
		chekear(document.myform.TxtBuscar.value.toUpperCase());
	}
}


function chekear(texto)
{ 
	var numeros = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	for(var i=0;i<texto.length;i++)
	{
		var chr=texto.charAt(i);
		var encontrar =false;
		for(var j=0;j<numeros.length;j++)
		{
			if(chr==numeros.charAt(j))
			{ 
			encontrar=true; 
			break; 
			} 
		} 
	}
	 
	if(!encontrar)
	{ 
		alert("Debe rellenar el campo con caracteres validos") 
	} 
	else 
	{ 
		document.myform.action="http://www.banesto.es/servlet/ContentServer?pagename=Banesto/Portales/Banesto/NoCache&c=Page&cid=996138929323";
		document.myform.submit() 
	}
}


function CambioDoc(indice){
//document.Entrada.tipocod.selectedIndex=indice;
}


//Variables para comprobar los distintos navegadores
var isNS4 = (document.layers && !document.getElementById) ? true : false
var isIE4 = (document.all && !document.getElementById)? true:false
var isIE5 = (document.all && document.getElementById)? (navigator.appName!="Netscape"? true:false):false;
var isNM = (document.all && document.getElementById)? (navigator.appName=="Netscape"? true:false):false;
var isNS6 = (!document.all && document.getElementById) ? true : false


document.onkeydown = keyDown
if (isNS4) 
	document.captureEvents(Event.KEYDOWN)

function keyDown(e) 
{
	if (isNS4 || isNS6 || isNM)
	{
		var enterKey=e.which;
	}
	else
	{
		var enterKey=event.keyCode;
	}
	if(enterKey==13)//el enter
	{
		Vacio();
		return false;
	}
}

function Chequeo(){
	var Buscar = document.Entrada.elige;
	for (i=0;i<Buscar.length;i++) {
		if (Buscar[i].checked){
			document.Entrada.cod_entrada.value= (Buscar[i].value);
			return i;
		}
	}
	return -1;

}

function Vacio()
{
	var direc="";
	switch(Chequeo())
	{

	case 0 :
		direc = "https://extranet.banesto.es/npage/loginParticulares.htm";
		//direc = "/npage/loginParticulares.htm";
		Extranetventana=window.open(direc,"Extranetventana","status,scrollbars=no,resizable=yes,directories=no, menubar=no, toolbar=no, location=yes,width=700,height=630,screenX=0,screenY=0,left=100,top=100");				
		break;
	case 1 :
		direc="https://banesnet.banesto.es/npage/loginEmpresas.htm";
		//direc = "/npage/loginEmpresas.htm";
		Extranetventana=window.open(direc,"VentanaBanesnet","status,scrollbars=no,resizable=yes,directories=no, menubar=no, toolbar=no, location=yes,width=700,height=650,screenX=0,screenY=0,left=100,top=100");		
		break;
	default :
		alert("Debe seleccionar un servicio");
		return false;
	}

return true;
}

function recuperarClaveParticulares()
{
	var indclie="";
	var entra_por="";
	var direc="";
	direc= "https://extranet.banesto.es/Extranet/RecupClaves/GestionClavesAcceso/OPRecuperarOnLine/s.bto";
	indclie="P";
	entra_por="";
	Extranetventana=window.open("","Extranetventana","status,scrollbars,resizable=yes,width=790,height=525, screenX=0, screenY=0");
	document.RecuperarClaves.action=direc;
	document.RecuperarClaves.elements["DatosCliente.INDCLIE_E"].value=indclie;
	document.RecuperarClaves.elements["DatosCliente.ENTRADA_POR"].value=entra_por;
	document.RecuperarClaves.submit();
}



function recuperarClaves(recuperarParticulares,recuperarEmpresas)
{
	
	var indclie="";
	var entra_por="";
	var direc="";


	switch(Chequeo())
	{
		case 0 :
			direc= "https://extranet.banesto.es/Extranet/RecupClaves/GestionClavesAcceso/OPRecuperarOnLine/s.bto";
			indclie="P";
			entra_por="";
			Extranetventana=window.open("","Extranetventana","status,scrollbars,resizable=yes,width=790,height=525, screenX=0, screenY=0");
			break;
		case 1 :
			direc="https://extranet.banesto.es/Extranet/RecupClaves/GestionClavesAcceso/OPRecuperarOnLine/s.bto";
			indclie="E";
			entra_por="";
			Extranetventana=window.open("","Extranetventana","status,resizable=yes,width=790,height=525, screenX=0, screenY=0");
			break;
		default:
			alert("Debe seleccionar un servicio");
			return;
	}
		
		document.RecuperarClaves.action=direc;
		document.RecuperarClaves.elements["DatosCliente.INDCLIE_E"].value=indclie;
		document.RecuperarClaves.elements["DatosCliente.ENTRADA_POR"].value=entra_por;
		document.RecuperarClaves.submit();
}

function dameFecha(){
	fechaHoy=new Date();
	var anyo=fechaHoy.getYear();
	var mes=fechaHoy.getMonth();
	var dia=fechaHoy.getDate();
	var meses=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
	return dia+" "+meses[mes]+" "+anyo;
}

	
var ns4 = (document.layers); 
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
var ns6 = (!document.all && document.getElementById);

function capa(id)
{
 var obj
  if(ns4) obj = document.layers[id];
  else if(ie4) obj = document.all[id];
          else if(ie5 || ns6) obj = document.getElementById(id);

 return obj
}

function oculta(id)
{
 temp_Obj = capa(id);
 if(ns4) temp_Obj.visibility = "hide";
 else temp_Obj.style.visibility = "hidden";
}

function muestra(id)
{
 temp_Obj = capa(id);
 if(ns4) temp_Obj.visibility = "show";
 else temp_Obj.style.visibility = "visible";
}	



function generarUrl(id,tipo,tipoOp,portal,paramUrl,nuevaVentana,nombreVentana)
{
	//alert(paramUrl);
	var paramUrl  		= "";
	var direccion 		= "";
	var opcionesVentana 	= "";
	var tituloVentana 	= "";

	if(nombreVentana!="" && nombreVentana!=null)
	{
		tituloVentana = "Ventana";
		
		opcionesVentana = "top=0,scrollbars=yes,";
		
		if(nombreVentana=="VentanaPq")
		{
			opcionesVentana = opcionesVentana + "width=525,height=250,left=100";
		}
		else if (nombreVentana=="AnticiposNoClientes")
		{
			tituloVentana = nombreVentana;
			opcionesVentana = "status,scrollbars,width=700,height=532";
		}	
		else
		{
			opcionesVentana = opcionesVentana + "status=yes,left=0,height=525,";
			
			if(nombreVentana=="AbrirV")
			{
				opcionesVentana = opcionesVentana + "resizable=yes,width=780";
			}
			else if (nombreVentana=="AbrirBanespyme")
			{
				opcionesVentana = "left=0, top=0, height=670, width=980, resizable=yes, scrollbars=yes";
			}	
			else if (nombreVentana=="AbrirMaximo")
			{
				opcionesVentana = "left=0, top=0, height=670, width=1020, resizable=yes,scrollbars=yes,";
			}				
			else if (nombreVentana=="AbrirFao")
			{
				opcionesVentana = "left=100, top=80, height=560, width=700, resizable=yes, scrollbars=no" ;
			}				
			else if(nombreVentana=="NewVentanaSin")
			{
				opcionesVentana = opcionesVentana + "width=790";
			}			
		}
	}
	
	if(tipo!="" && tipo!=null){ //es una url de OpenMarket
	
		//alert(paramUrl);
	
		direccion = "http://www.banesto.es/servlet/ContentServer?pagename=Banesto/Portales/"+portal+"/"+tipo+"&c="+tipoOp+"&cid="+id+paramUrl;
		
					
		if(nuevaVentana=="si")
		{
			window.open(direccion,tituloVentana,opcionesVentana);	
		}
		else
		{	
			document.location=direccion;
		}
	}
	else
	{
		if(nuevaVentana=="si")
		{
			window.open(id,tituloVentana,opcionesVentana);
		}
		else
		{	
			document.location=id;
		}
	}
	
}  //fin de funcion

function generarUrlBanner(id,tipo,tipoOp,portal,paramUrl,nuevaVentana,nombreVentana)
{
	//alert(paramUrl);
	//var paramUrl  	= "";
	var direccion 		= "";
	var opcionesVentana 	= "";
	var tituloVentana 	= "";

	if(nombreVentana!="" && nombreVentana!=null)
	{
		tituloVentana = "Ventana";
		
		opcionesVentana = "top=0,scrollbars=yes,";
		
		if(nombreVentana=="VentanaPq")
		{
			opcionesVentana = opcionesVentana + "width=525,height=250,left=100";
		}
		else if (nombreVentana=="AnticiposNoClientes")
		{
			tituloVentana = nombreVentana;
			opcionesVentana = "status,scrollbars,width=700,height=532";
		}	
		else
		{
			opcionesVentana = opcionesVentana + "status=yes,left=0,height=525,";
			
			if(nombreVentana=="AbrirV")
			{
				opcionesVentana = opcionesVentana + "resizable=yes,width=780";
			}
			else if(nombreVentana=="NewVentanaSin")
			{
				opcionesVentana = opcionesVentana + "width=790";
			}			
		}
	}
	
	if(tipo!="" && tipo!=null){ //es una url de OpenMarket
	
		//alert(paramUrl);
	
		direccion = "http://www.banesto.es/servlet/ContentServer?pagename=Banesto/Portales/"+portal+"/"+tipo+"&c="+tipoOp+"&cid="+id+paramUrl;
		
					
		if(nuevaVentana=="si")
		{
			window.open(direccion,tituloVentana,opcionesVentana);	
		}
		else
		{	
			document.location=direccion;
		}
	}
	else
	{
		if(nuevaVentana=="si")
		{
			window.open(id,tituloVentana,opcionesVentana);
		}
		else
		{	
			document.location=id;
		}
	}
	
}  //fin de funcion


function abrirVentana(direccion,tituloVentana,opcionesVentana)
{
	window.open(direccion,tituloVentana,opcionesVentana);	
}

function lanzaVentana(url,winName,wid,heigh){
 var sw=(screen.width/2)-(wid/2);
 var sh=(screen.height/2)-(heigh/2);
 window.open(url,winName,"width="+wid+",height="+heigh + ",left="+sw+", top="+sh+", resizable=1");
 }


function pulsar()
{
	document.frmTeleFood.submit();
}	