// JavaScript Document
function banderas_on()
{
obj = document.getElementById('ban');
var top=obj.offsetTop 
var left=obj.offsetParent.offsetLeft 
tt=document.getElementById('ban').offsetTop
ll=document.getElementById('ban').offsetLeft
var navegador = navigator.appName 
if (navegador == "Microsoft Internet Explorer") 
	{
	document.getElementById('banderas').style.left=left+447+ll+'px'
	document.getElementById('banderas').style.top=tt+115+'px'
	}
else 
	{
	document.getElementById('banderas').style.left=left+ll+190+'px'
	document.getElementById('banderas').style.top=tt+5+'px'
	}
document.getElementById('banderas').style.display=""
}
function pop_on(marco)
{
	if (marco=='marco1'){men='m1';}
	if (marco=='marco2'){men='m2';}
	if (marco=='marco3'){men='m3';}
	if (marco=='marco4'){men='m4';}
	if (marco=='marco5'){men='m5';}
	if (marco=='marco6'){men='m7';}
obj = document.getElementById(men);
var top=obj.offsetTop 
var left=obj.offsetParent.offsetLeft 
tt=document.getElementById(men).offsetTop
ll=document.getElementById(men).offsetLeft
var navegador = navigator.appName 
var version = navigator.appVersion 
var xx=version.search(/MSIE 8/i);
//alert(xx);
if (navegador == "Microsoft Internet Explorer") 
{
	if(xx<0)
		{
		document.getElementById(marco).style.left=left+440+ll+'px'
		document.getElementById(marco).style.top=tt+115+'px'
		}
	else
		{
		document.getElementById(marco).style.left=left+190+ll+'px'
		document.getElementById(marco).style.top=tt+5+'px'
		}
}
else 
{
document.getElementById(marco).style.left=left+ll+190+'px';
document.getElementById(marco).style.top=tt+5+'px';
}
document.getElementById(marco).style.display="";
}
function pop_off2()
{

	document.getElementById('marco1').style.display="none";
	document.getElementById('marco2').style.display="none";
	document.getElementById('marco3').style.display="none";
	document.getElementById('marco4').style.display="none";
	document.getElementById('marco5').style.display="none";
	document.getElementById('marco6').style.display="none";
}
function pop_off(a,b,c,d,e)
{
	document.getElementById(a).style.display="none";
	document.getElementById(b).style.display="none";
	document.getElementById(c).style.display="none";
	document.getElementById(d).style.display="none";
	document.getElementById(e).style.display="none";
}
function pop_offg()
{
	document.getElementById('marco1').style.display="none";
	document.getElementById('marco2').style.display="none";
	document.getElementById('marco3').style.display="none";
	document.getElementById('marco4').style.display="none";
	document.getElementById('marco5').style.display="none";
	document.getElementById('marco6').style.display="none";
}
function valida_contacto()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_ciudad.value=="")|(document.form1.txt_email.value=="")|(document.form1.lst_compania.value==0))
	{
		alert("Todos los datos (*) son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.submit();
		}
	}
}
function valida_contacto22()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_email.value=="")|(document.form1.txt_telefono.value=="")|(document.form1.txt_fecha.value=="")|(document.form1.txt_fecha2.value=="")|(document.form1.txt_plazas.value==""))
	{
		alert("Todos los datos (*) son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.submit();
		}
	}
}


function valida_objetoperdido()
{
if ((document.form1.txt_nombre.value=="")||(document.form1.txt_email.value=="")||(document.form1.lst_linea.value==0))
	{
		alert("Todos los datos (*) son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.action="cercanias_operdidos_cmd.php";
			document.form1.submit();
		}
	}
}


function valida_bolsa(x)
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_telefono.value=="")|(document.form1.txt_email.value==""))
	{
		alert("Debe especificar su nombre, teléfono y e-mail.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.action="bolsa_cmd.php?id="+x;
			document.form1.submit();
		}
	}
}
function valida_presu1(x)
{
/*if ((document.form1.txt_nombre.value=="")|(document.form1.txt_telefono.value=="")|(document.form1.txt_email.value==""))
	{
		alert("Todos los datos son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{*/
			document.form1.action="presu2.php?tipo="+x
			document.form1.submit();
		//}
	//}
}
function valida_presu()
{
if ((document.form1.txt_nombre.value=="")|(document.form1.txt_telefono.value=="")|(document.form1.txt_email.value==""))
	{
		alert("Todos los datos son obligatorios.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.action="presu_envio.php"
			document.form1.submit();
		}
	}
}
function valida_presu2(x)
{
opt='precio';
	var i;
	var valor=''; 
	if (document.form1[opt])
	{
	for (i=0;i<document.form1[opt].length;i++)
		{ 
	   		if (document.form1[opt][i].checked)
	   		{
			valor=document.form1[opt][i].value;
			break;
			}
    	} 
	}
if ((x==0)|(valor==''))
	{
		alert("Debe indicar la tarifa deseada.")
	}
else
	{	
	
	document.form1.action="presu3.php";
	document.form1.submit();
	}
}
function mensajes()
{
var query = window.location.search.substring(1);
if (query=="id=1001"){alert("El mensaje fué enviado con éxito,"+'\n'+"en breve nos comunicaremos contigo."+'\n'+"Muchas Gracias!.")}
if (query=="bolsaok"){alert("Sus datos fueron enviados con éxito."+"\n"+"En breve nos comunicaremos con usted."+"\n"+"Gracias!!!")}
if (query=="alquiler"){alert("Sus datos fueron enviados con éxito."+"\n"+"En breve nos comunicaremos con usted."+"\n"+"Gracias!!!")}
}
function buscaprovincia() {
	var valor = document.getElementById("lst_pais").value;
    if (!enProceso && http) {
       var url = "includes/duplicado.php?pais="+valor+"&modulo=buscaprovincia";
	   var mm=1;
	   http.open("GET", url, true);
	   http.onreadystatechange = handleHttpResponse_provincia;
       enProceso = true;
       http.send(null);	  
    }
}
function handleHttpResponse_provincia() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
		    var qbusco = http.responseText.split("?");
			var busca='lst_provincia'
			var objeto=eval(document.getElementById("lst_provincia"));
			while (objeto.length=0)
			{
			 for (var g=0; g < objeto.length;g++) {
			 document.getElementById("lst_provincia").options[g] = null;}
			 }
			var new_optionl = new Option('Seleccione...', 0, false, false);
			document.getElementById("lst_provincia").options[0] = new_optionl;
			var final;
			var resulta = http.responseText.split("#"); 
			      for (var i=0; i < resulta.length; i++) {
				   	if (final==null) { 
				    final = (resulta[i] + "<p>");
							}
					else
					{final = final + (resulta[i] + "<p>");}
					//busco separador
					var m;
					var patron=/,/i;
					var lugar
					var codigo
					m=resulta[i];
					lugar=m.search(patron);
					codigo=m.substr(lugar+1,10);
					var new_option = new Option(resulta[i].substr(0,lugar), codigo, false, false);
					//alert (codigo);
					if (lugar>0){		  	        
					document.getElementById(busca).options[i+1] = new_option;
					}
					}
					//divLista.innerHTML = final;
			 enProceso = false;
				
          }
       }
    }
}
function buscaprovincia1() {
	var valor = document.getElementById("lst_pais1").value;
    if (!enProceso && http) {
       var url = "includes/duplicado.php?pais="+valor+"&modulo=buscaprovincia";
	   var mm=1;
	   http.open("GET", url, true);
	   http.onreadystatechange = handleHttpResponse_provincia1;
       enProceso = true;
       http.send(null);	  
    }
}
function handleHttpResponse_provincia1() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
		    var qbusco = http.responseText.split("?");
			var busca='lst_provincia1'
			var objeto=eval(document.getElementById("lst_provincia1"));
			while (objeto.length=0)
			{
			 for (var g=0; g < objeto.length;g++) {
			 document.getElementById("lst_provincia1").options[g] = null;}
			 }
			var new_optionl = new Option('Seleccione...', 0, false, false);
			document.getElementById("lst_provincia1").options[0] = new_optionl;
			var final;
			var resulta = http.responseText.split("#"); 
			      for (var i=0; i < resulta.length; i++) {
				   	if (final==null) { 
				    final = (resulta[i] + "<p>");
							}
					else
					{final = final + (resulta[i] + "<p>");}
					//busco separador
					var m;
					var patron=/,/i;
					var lugar
					var codigo
					m=resulta[i];
					lugar=m.search(patron);
					codigo=m.substr(lugar+1,10);
					var new_option = new Option(resulta[i].substr(0,lugar), codigo, false, false);
					//alert (codigo);
					if (lugar>0){		  	        
					document.getElementById(busca).options[i+1] = new_option;
					}
					}
					//divLista.innerHTML = final;
			 enProceso = false;
				
          }
       }
    }
}
function buscapoblacion() {
	var valor = document.getElementById("lst_provincia").value;
    if (!enProceso && http) {
       var url = "includes/duplicado.php?provincia="+valor+"&modulo=buscapoblacion";
	   var mm=1;
	   http.open("GET", url, true);
	   http.onreadystatechange = handleHttpResponse_poblacion;
       enProceso = true;
       http.send(null);	  
    }
}
function handleHttpResponse_poblacion() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
		    var qbusco = http.responseText.split("?");
			var busca='lst_localidad'
			var objeto=eval(document.getElementById("lst_localidad"));
			while (objeto.length=0)
			{
			 for (var g=0; g < objeto.length;g++) {
			 document.getElementById("lst_poblacion").options[g] = null;}
			 }
			var new_optionl = new Option('Seleccione...', 0, false, false);
			document.getElementById("lst_localidad").options[0] = new_optionl;
			var final;
			var resulta = http.responseText.split("#"); 
			      for (var i=0; i < resulta.length; i++) {
				   	if (final==null) { 
				    final = (resulta[i] + "<p>");
							}
					else
					{final = final + (resulta[i] + "<p>");}
					//busco separador
					var m;
					var patron=/,/i;
					var lugar
					var codigo
					m=resulta[i];
					lugar=m.search(patron);
					codigo=m.substr(lugar+1,10);
					var new_option = new Option(resulta[i].substr(0,lugar), codigo, false, false);
					//alert (codigo);
					if (lugar>0){		  	        
					document.getElementById(busca).options[i+1] = new_option;
					}
					}
					//divLista.innerHTML = final;
			 enProceso = false;
				
          }
       }
    }
}
function buscapoblacion1() {
	var valor = document.getElementById("lst_provincia1").value;
    if (!enProceso && http) {
       var url = "includes/duplicado.php?provincia="+valor+"&modulo=buscapoblacion";
	   var mm=1;
	   http.open("GET", url, true);
	   http.onreadystatechange = handleHttpResponse_poblacion1;
       enProceso = true;
       http.send(null);	  
    }
}
function handleHttpResponse_poblacion1() { 
    if (http.readyState == 4) { 
       if (http.status == 200) { 
          if (http.responseText.indexOf('invalid') == -1) {
		    var qbusco = http.responseText.split("?");
			var busca='lst_localidad1'
			var objeto=eval(document.getElementById("lst_localidad1"));
			while (objeto.length=0)
			{
			 for (var g=0; g < objeto.length;g++) {
			 document.getElementById("lst_localidad1").options[g] = null;}
			 }
			var new_optionl = new Option('Seleccione...', 0, false, false);
			document.getElementById("lst_localidad1").options[0] = new_optionl;
			var final;
			var resulta = http.responseText.split("#"); 
			      for (var i=0; i < resulta.length; i++) {
				   	if (final==null) { 
				    final = (resulta[i] + "<p>");
							}
					else
					{final = final + (resulta[i] + "<p>");}
					//busco separador
					var m;
					var patron=/,/i;
					var lugar
					var codigo
					m=resulta[i];
					lugar=m.search(patron);
					codigo=m.substr(lugar+1,10);
					var new_option = new Option(resulta[i].substr(0,lugar), codigo, false, false);
					//alert (codigo);
					if (lugar>0){		  	        
					document.getElementById(busca).options[i+1] = new_option;
					}
					}
					//divLista.innerHTML = final;
			 enProceso = false;
				
          }
       }
    }
}
/***ajax*///
function getHTTPObject()
{
 var xmlhttp = null;
 //Internet Explorer
 try
 {
  xmlhttp = new ActiveXObject("MSXML2.XMLHTTP");
 }
 catch (e)
 {
  try
  {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  }
  catch (e)
  {
   xmlhttp = null;
  }
 }

 //Mozilla y Safari

 if ((xmlhttp == null) && (typeof XMLHttpRequest != 'undefined'))
 {
  try
  {
   xmlhttp = new XMLHttpRequest();
  }
  catch (e)
  {
   xmlhttp = null;
  }
 }
 return xmlhttp;
}
var enProceso = false; // lo usamos para ver si hay un proceso activo
var http =  getHTTPObject(); // Creamos el objeto XMLHttpRequest
function valida_busqueda()
{
	//if ((document.form1.loc_id1.value=='')|(document.form1.loc_id2.value==''))
	if ((document.form1.loc_id1.value=='')|(document.form1.lst_destino.value<1))
	{
		alert("Debes indicar la Población de origen y destino.")
	}
else
	{	
		document.form1.submit();
	}
}
function itinerarioo(id,ide,horario,desde,hasta)
{
window.open('admin/view_itinerario.php?id='+id+'&print=1&horario='+horario+'&desde='+desde+'&hasta='+hasta,'window','width=540,height=600,scrollbars=yes,top=10,left=340')
}
function itinerariooo(desde,hasta)
{
window.open('includes/search.php?print=1&desde='+desde+'&hasta='+hasta,'window','width=540,height=600,scrollbars=yes,top=10,left=340')
}
function internacionales(id)
{
window.open('print_internacionales.php?id='+id,'window','width=600,height=400,scrollbars=yes,top=10,left=340')
}
function itinerario_imagen(fot)
{
window.open('imagen.php?print=1&fot='+fot,'window','width=540,height=600,scrollbars=yes,top=10,left=340')
}


function valida_olvide()
{
if ((document.form1.txt_email.value==""))
	{
		alert("Debe especificar su cuenta de email.")
	}
else
	{	
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
		{
			alert ("La dirección de e-mail es incorrecta.")
			document.form1.txt_email.focus();
		}
		else
		{
			document.form1.action="olvide_cmd.php";
			document.form1.submit();
		}
	}
}


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_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_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 chgHeader(){
	for(var i=1;i<2;i++){
			
		var myH = document.getElementsByTagName('h'+i);
		var imgSrc = myH[0].attributes.item('title').value;
		var txt = myH[0].innerHTML;
		var objCabecera = document.getElementById('head').childNodes[0];
		if(imgSrc!=''){
			objCabecera.removeChild(myH[0]);
			var objNext = objCabecera.firstChild;
			var newAnchor=document.createElement('a');
			newAnchor.setAttribute('href','index.php');
			var newImage = document.createElement('img');
			newImage.setAttribute('src','img/' + imgSrc);
			newImage.setAttribute('alt',txt);
			newImage.setAttribute('title',txt);
			newImage.setAttribute('border','0');
			newAnchor.appendChild(newImage);
			objCabecera.insertBefore(newAnchor,objNext);
		}		
	}
}


	function mensaj(x) {
		if (x==1){alert("Su mensaje fue enviado con éxito."+"\n"+"En breve nos comunicaremos con usted."+"\n"+"Gracias!!!");}		
		if (x==2){alert("La cuenta de email inidicada no figura en nuestros registros.");}
		if (x==3){alert("Los datos han sido enviados con éxito."+"\n"+"Gracias!!!");}
	}
		
	function valida_olvide_prov()	{
		
	if (document.form1.txt_email.value=="")
		{
		alert("Debe indicar su email.")
		}
	else
		{
		q=document.form1.txt_email.value;
		var b=/^[^@\s]+@[^@\.\s]+(\.[^@\.\s]+)+$/ 
		if(b.test(q)==false)
			{
			alert ("La dirección de email es incorrecta")
			}
		else
			{
				document.form1.action="olvide_prov_cmd.php"
				document.form1.submit();
			}
		}
	}


function busca_provincia(event) {
var texto=document.getElementById("txt_localidad1").value
var cant=texto.length
var Key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
if (texto=="")
{
document.getElementById("loc_id1").value=""
}
if (Key==27){
	document.getElementById('tr_busca').style.display="none"	
}
else
{
	if (cant > 0){
		if (Key==40){
		
		document.getElementById("lst_busca").focus()
		}
		else
		{
		if (!enProceso && http) {
    	   var url = "includes/duplicado.php?busca_provincia="+texto;
		   var mm=1;
		   http.open("GET", url, true);
		   http.onreadystatechange = cmdbusca_provincia;
		   enProceso = true;
		   document.getElementById('origenes').style.display="block";
		   document.getElementById('lst_destino').style.display="none";
			 document.getElementById('dest').style.display="none";	
		   http.send(null);	  
	    }
		}
	}
	else
	{
		document.getElementById('tr_busca').style.display="none"
	}
}
}
function cmdbusca_provincia() {
    if (http.readyState == 4) { 
			document.getElementById('origenes').style.display="none";
       if (http.status == 200) {
		    if (http.responseText.indexOf('invalid') == -1) {
			var qbusco = http.responseText.split("?");
			if (http.responseText==""){
			document.getElementById("loc_id1").value=""
			}
			var busca='lst_busca'
			var objeto=eval(document.getElementById("lst_busca"));
			while (objeto.length=0)
			{
			for (var g=0; g < objeto.length;g++) {
			document.getElementById("lst_busca").options[g] = null;}
			}
			var new_optionl = new Option('Seleccione...', 10000, false, false);
			document.getElementById("lst_busca").options[0] = new_optionl;
			//alert(objeto.length)
			//tr_busca.style.display="none"
			var final;
			//alert(http.responseText); 
			var resulta = http.responseText.split("#"); 
			if (resulta.length>10)
				{
				var alto=10
				}
			else
				{
				var alto=resulta.length
				}
			document.getElementById("lst_busca").size=alto
			if (resulta.length>1)
				{document.getElementById('tr_busca').style.display=""}
			else
				{document.getElementById('tr_busca').style.display="none"}
			      for (var i=0; i < resulta.length; i++) {
				   	if (final==null) { 
				    final = (resulta[i] + "<p>");
							}
					else
					{final = final + (resulta[i] + "<p>");}
					//busco separador

					var m;
					var patron=/,/i;
					var lugar
					var codigo
					m=resulta[i];
					lugar=m.search(patron);
					codigo=m.substr(lugar+1,60);
					var new_option = new Option(codigo,resulta[i].substr(0,lugar), false, false);
					if (lugar>0){		  	        
					document.getElementById(busca).options[i] = new_option;
					}
					}					
				//divLista.innerHTML = final;
			 enProceso = false;
          }
       }
    }
	else
	{
	  //document.getElementById('origenes').style.display="block";	
	}
}

function guarda(xs,control,event){
	var Key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if (event.keyCode==27){
		document.getElementById(control).value=xs
	}
}

function agrf(dbl,event) {
	var Key = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
	if(Key==13 | dbl==1){
		var m=document.getElementById('lst_busca').value
		var indice1 = document.getElementById('lst_busca').selectedIndex; 
		var texto1=document.getElementById('lst_busca')[indice1].text;
		if (m>0)
			{
			document.getElementById('tr_busca').style.display="none"
			document.getElementById('txt_localidad1').focus()
			document.getElementById('txt_localidad1').value=texto1
			document.getElementById('loc_id1').value=m
			busca_destinos(m,texto1);
			}
	}
	
	if (Key==27){
		document.getElementById('tr_busca').style.display="none"
		document.form1.txt_localidad1.value=""
		document.getElementById('loc_id1').value=""
		document.form1.txt_localidad1.focus()
	}

	
}

function busca_destinos(x,loc) 
{
if (!enProceso && http)
	{
  	var url = "includes/duplicado.php?busca_destinos="+x+"&loc="+loc;
		var mm=1;
		http.open("GET", url, true);
		http.onreadystatechange = cmdbusca_destinos;
		enProceso = true;
		document.getElementById('lst_destino').style.display="none";
		document.getElementById('dest').style.display="block";	
	 	http.send(null);	  
	}	
}
function cmdbusca_destinos() {
    if (http.readyState == 4) { 
		document.getElementById('lst_destino').style.display="block";
		document.getElementById('dest').style.display="none";	
		if (http.status == 200) { 
		    if (http.responseText.indexOf('invalid') == -1) {
			var qbusco = http.responseText.split("?");
			var busca='lst_destino'
			var objeto=eval(document.getElementById("lst_destino"));
			while (objeto.length=0)
			{
			for (var g=0; g < objeto.length;g++) {
			document.getElementById("lst_destino").options[g] = null;}
			}
			var new_optionl = new Option('Seleccione...', 10000, false, false);
			document.getElementById("lst_destino").options[0] = new_optionl;
			//alert(objeto.length)
			//tr_busca.style.display="none"
			var final;
			//alert(http.responseText); 
			var resulta = http.responseText.split("#"); 
			if (resulta.length>10)
				{
				var alto=10
				}
			else
				{
				var alto=resulta.length
				}
			document.getElementById("lst_destino").size=alto
			     for (var i=0; i < resulta.length; i++) {
				   	if (final==null) { 
				    final = (resulta[i] + "<p>");
							}
					else
					{final = final + (resulta[i] + "<p>");}
					//busco separador

					var m;
					var patron=/,/i;
					var lugar
					var codigo
					m=resulta[i];
					lugar=m.search(patron);
					codigo=m.substr(lugar+1,60);
					var new_option = new Option(codigo,resulta[i].substr(0,lugar), false, false);
					if (lugar>0){		  	        
					document.getElementById(busca).options[i] = new_option;
					}
					}					
				//divLista.innerHTML = final;
			 enProceso = false;
          }
       }
    }
	else
	{
		//document.getElementById('lst_destino').style.display="none";
		//document.getElementById('dest').style.display="block";		
	}
}

/*
function busca_paradas(elem){
	
	document.getElementById("lst_parada").options.length = 0;
	
	if(elem.options[elem.selectedIndex].value!="0"){
	
		var x=elem.options[elem.selectedIndex].value.split('|');
		var dataString = "modulo=busca_paradas&id="+x[0];
				
		$.ajax({
			type: "GET",
			dataType:"html",
			async:false,
			cache:false,
			url: "includes/duplicado.php",
			data: dataString,
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				if ( XMLHttpRequest.status > 0 ) {
					alert("Error en la consulta ajax: ".errorThrown);
				}
			},		
			success: function(datos) {			
				var a=datos.split("#");
				var cant=a.length;
				for (var g=0; g < cant-1;g++) {
					var new_option = new Option(a[g], a[g], false, false);
					document.getElementById("lst_parada").options[g] = new_option;	
				}			
			}
		});
		
	}
	
	
}
*/

function validaprov() {
	var browserName=navigator.appName;
if ((document.form_prov.txtUsuario.value=="" )|(document.form_prov.txtUsuario.value==""))
	{
	alert("Debes ingresar el E-mail y la Contraseña.");
	document.form_prov.txtUsuario.focus();
	}
else
	{

	document.form_prov.submit();
	
	}		
}

function intro_prov(event){
	var x=event.keyCode
	if (x==13)  
	{
	validaprov();
	return true;
	}
}

function validausu()
{
	var browserName=navigator.appName;
if ((document.form_usuario.usuario.value=="" )|(document.form_usuario.clave.value==""))
	{
	alert("Debes ingresar el Usuario y la Contraseña.");
	document.form_usuario.usuario.focus();
	}
else
	{	
	document.form_usuario.submit();
	}

}

function intro(event){
	var x=event.keyCode;
	if (x==13)  
	{
	validausu();
	return true;
	}
}

function mensajes2(x){
	if(x==1){alert("Su oferta fue almacenada con éxito.");}
	if(x==2){alert("Su oferta fue eliminada con éxito.");}
}
