//---Es el cambio que se cuando se cambia la fecha de ida. 
 	function ActualizaRegreso()
	{	
		var fechaR = new Date();
		var mesIda = document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaIM.selectedIndex;
		var diaIda = document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaID.selectedIndex;
		var mesRegreso;
		if (document.forma1.BEFormaCentroNuevoF1_rbIdayRegreso.checked)
		{
		document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaRD.selectedIndex = fechaR.getDate();
		document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaRM.selectedIndex = fechaR.getMonth() + 1;
		} 
	}  
 //----es para asignar los eventos al rblTipoVuelo
 	var oDivRadios = null;
	function deshabilitar_fecharegreso(objeto)
	{
		if(objeto.checked)
		{	
			try
			{
				document.getElementById('div_fecharegreso').style.visibility = 'hidden';
				document.getElementById('DomValidationSummary1').style.visibility='hidden';;
			}
			catch(e){var c = 0;}
		}
	}
	
	function habilitar_fecharegreso(objeto)
	{
		if(objeto.checked)
		{	
		  	try
			{
				document.getElementById('div_fecharegreso').style.visibility = 'visible';
				document.getElementById('DomValidationSummary1').style.visibility='hidden';
			}
			catch(e){var c = 0;}
		}
	}
	function document_onload()
	{
 		//asigna el evento click a cada uno de los radiobutton. 
 		var oDivRadios;
 		if(document.getElementById)
			oDivRadios = document.getElementById('divRadios');
		else if(document.all)
			oDivRadios = document.all('divRadios');
		if(oDivRadios)
			oDivRadios.onclick = divRadios_onclick;
		// Esto es para dejar por defecto la ultima opcion que selecciono el usuario ;)
		var BEFormaCentroNuevoF1_rbIdayRegreso = document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso');
		if (BEFormaCentroNuevoF1_rbIdayRegreso && BEFormaCentroNuevoF1_rbIdayRegreso.checked)
 		{
 		  muestramultidestino('multi','no-multi');	
		  habilitar_fecharegreso(BEFormaCentroNuevoF1_rbIdayRegreso);
 		}
 		
 		var BEFormaCentroNuevoF1_rbSoloIda = document.getElementById('BEFormaCentroNuevoF1_rbSoloIda');
 		if (BEFormaCentroNuevoF1_rbSoloIda && BEFormaCentroNuevoF1_rbSoloIda.checked)
 		{
  			muestramultidestino('multi','no-multi');	
			deshabilitar_fecharegreso(BEFormaCentroNuevoF1_rbSoloIda);
  		}
  		
  		var BEFormaCentroNuevoF1_rbMultidestino = document.getElementById('BEFormaCentroNuevoF1_rbMultidestino');
 		if (BEFormaCentroNuevoF1_rbMultidestino && BEFormaCentroNuevoF1_rbMultidestino.checked)
 		{
  		   muestramultidestino('no-multi','multi');
  		}
	}

	function divRadios_onclick(evt)
	{
 		var oSrc = null;

		if(!evt)
			evt = window.event;

		if(evt)
		{
			oSrc = evt.srcElement;
			if(!oSrc)
				oSrc = evt.target;
		}

		if(oSrc && oSrc.tagName)
		{
			if(oSrc.tagName.toLowerCase() == 'input'  &&  oSrc.type == 'radio')
				AsingFunction(oSrc);
		}
	}
    //funcion que habilita o deshabilita los div dependiendo del bloque que se pase
    function muestramultidestino(blo,blo2)
    {
      var objBlo = document.getElementById(blo);
      var objBlo2 = document.getElementById(blo2);
      objBlo.style.visibility='hidden';
      objBlo.style.display='none';
      objBlo2.style.visibility='visible';
      objBlo2.style.display='';
      
      try
		{
			document.getElementById('DomValidationSummary1').style.visibility='hidden';
		}
	  catch(e){var c = 0;}

	  var objElement = document.getElementById("ofertas");

      if (objElement!=null)
      {
		if (blo=='no-multi')
			objElement.style.visibility='hidden';
		else
			objElement.style.visibility='visible';
      }
    }        
	function AsingFunction(oSrc)
	{
		if (oSrc.value == "0")
		{
		    muestramultidestino('multi','no-multi');	
			habilitar_fecharegreso(oSrc);
		}
		if (oSrc.value == "1")
		{
		    muestramultidestino('multi','no-multi');	
			deshabilitar_fecharegreso(oSrc);
		}
		if (oSrc.value == "2")
		{
		    muestramultidestino('no-multi','multi');
   			//habilitar_fecharegreso(oSrc);
		}
	}
	//--Valida que el usuario seleccione ambas fechas. 
 	function ValidarFechaIda() 
	{
		 if (document.getElementById('BEFormaCentroNuevoF1_rbSoloIda').checked || document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
         {
		  if (document.getElementById(fechaIda).value=="")
		  {
			return false;
		  }
		 }
		return true;
	}
	//Verifica que el usuario no deje espacions en balnco en la ciudad origen. 
   function CiudadOrigenObligatoria()
   {
     	 if (document.getElementById('BEFormaCentroNuevoF1_rbSoloIda').checked || document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById(ciudadOrigen).value=="")
		   {
	 		 return false;
		   }
		  }
		 return true;
   }
   //Verifica que el usuario no deje espacios en blanco en la ciudad destino. 
   function CiudadDestinoObligatoria()
   {
     	 if (document.getElementById('BEFormaCentroNuevoF1_rbSoloIda').checked || document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById(ciudadDestino).value=="")
		   {
	 		 return false;
		   }
		  }
		 return true;
   }
 	//******Cambiado por el customo validator cvFechaROT****** O.K
	function ValidarFechaRegreso()
	{
		if (document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
		{
		  if (document.getElementById(fechaRegreso).value=="")
		  {
			return false;
		  }
		}
		return true;
	}
//--valida que la fecha de regreso sea mayor a la fecha de ida. 	
	function ValidarFechaMayor()
	{
	  if (document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
	  {
 	  	 strFechaRegreso=document.getElementById(fechaRegreso).value;
 	     strFechaIda=document.getElementById(fechaIda).value;
          if (strFechaIda != "" && strFechaRegreso !="")
          {
           if (strFechaIda > strFechaRegreso)
		   {
	  	     return false;
           }
          }
          return true;
	  } 
	  return true;
	}
	function CrearObjeto ()
	{
		var progIDs = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
		var x = null;
	 for (var i = 0; i < progIDs.length; ++i) {
		 var progID = progIDs[i];
		 try {
			x = new ActiveXObject(progID);
			return x;
		 } 
		 catch(e)    
		 {
		 }
	 }
	 if (x==null)
	 {
		x=new XMLHttpRequest();
		
	 }
	return x;
    }
	//Funcion Nueva que verifica si se selecciona una fecha menor a hoy 
	function ValidaFechaMenorIda() //TOD:PosibleCambioFuncionAJAX.
	{
		var datPosterior = new Date();	
		var datSelecc = new Date();
		var dia = document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaID.options[document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaID.selectedIndex].value;
		var mes = document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaIM.options[document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaIM.selectedIndex].value;
		datSelecc.setDate(1);
		datSelecc.setMonth(mes-1);
		datSelecc.setDate(dia);
		if (datSelecc < datPosterior)
		{
		  datSelecc.setFullYear(parseInt(datSelecc.getFullYear())+1);
		  milisegundos=parseInt(355*24*60*60*1000);
		  var tiempo=datPosterior.getTime();
		  total=datPosterior.setTime(parseInt(tiempo+milisegundos));
		  if (datSelecc > datPosterior)
		  {
		    alert('No se permiten reservas de mas de 355 dias');
		    return false;
		  }
		}
	  return true;
	}
	function ValidaFechaMenorRegreso() //TOD:PosibleCambioFuncionAJAX.
	{
		var datPosterior = new Date();	
		var datSelecc = new Date();
		var dia = document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaRD.options[document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaRD.selectedIndex].value;
		var mes = document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaRM.options[document.forma1.BEFormaCentroNuevoF1_BEUnsolodestino1_BEFechaRM.selectedIndex].value;
		datSelecc.setDate(1);
		datSelecc.setMonth(mes-1);
		datSelecc.setDate(dia);
		if (datSelecc < datPosterior)
		{
		  datSelecc.setFullYear(parseInt(datSelecc.getFullYear())+1);
		  milisegundos=parseInt(355*24*60*60*1000);
		  var tiempo=datPosterior.getTime();
		  total=datPosterior.setTime(parseInt(tiempo+milisegundos));
		  if (datSelecc > datPosterior)
		  {
		    alert('No se permiten reservas de mas de 355 dias');
		    return false;
		  }
		}
	  return true;
	}
	// Funcion que valida que la cantidad de adultos sea igual o mayor la cantidad de infantes
	function EvaluarInfantesporAdulto()
	{
		if(document.getElementById('BEFormaCentroNuevoF1_ddlInfantes').selectedIndex > document.getElementById('BEFormaCentroNuevoF1_ddlNumAdultos').selectedIndex)
		{
			return false;
		}
		return true;
	}
	
	function ValidarNinos()
	{
		if(document.getElementById('BEFormaCentroNuevoF1_ddlNumAdultos').selectedIndex == 0)
		{
			return false;
		}
		return true;
	}
	
	function ValidarNAdultos()
	{

		if(document.getElementById('BEFormaCentroNuevoF1_ddlNumAdultos').selectedIndex == 0)
		{
			return false;
		}
		return true;
	}
	//----
	// REMPLAZADO POR cvCiudadesIgualesOT. O.K 
	function ValidarCiudadesIguales()
	{
		  if (document.getElementById('BEFormaCentroNuevoF1_rbSoloIda').checked || document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById(ciudadOrigen).value==document.getElementById(ciudadDestino).value)
		   {
	 		 return false;
		   }
		  }
		 return true;
	}
	
	//--funcion para contar el numero de pasajeros. 
   function SumaPasajeros()
   {
	var Childs=parseInt(document.getElementById('BEFormaCentroNuevoF1_ddlNumNinos').value);
	var Parent=parseInt(document.getElementById('BEFormaCentroNuevoF1_ddlNumAdultos').value); 
	var Infants=0;/*parseInt(document.getElementById('BEFormaCentroNuevoF1_ddlInfantes').value);*/
	var Result = Childs+Parent+Infants;
	
	if (Result > MaxPasajeros)
		return false;
	else
	    return true;
   }
   /*
   Agregado al custom Validator cvSumaCantidadPasajeros O.K 
   */
   function ValidarCondiciones()
   {
     var enviar=true;
     if (!SumaPasajeros())
      {
        enviar=false;
      }
     return enviar;
   }
 //--Validaciones Multidestino. 
    /*
     Funcion que valida que dos ciudades no sean iguales en el multidestino
    */
    function ValidarCiudadesIgualesMultidestino(source)
    {
			var i ;
			var enviar=true;
			//posicion es el numero total de registros mostrados. 
			if (document.getElementById('BEFormaCentroNuevoF1_rbMultidestino').checked)
			{
			 var totalregmostrados=intnumeroiterinariosMostrados+contador
			 for ( i = 1; i <= totalregmostrados; i++ )
			 {
		      if( document.getElementById(arrCiudadOrigen[i]).value==document.getElementById(arrCiudadDestino[i]).value)
 		      {
	 		    enviar=false;
 		  	    break;
	 	      }
    	     }
    	    }
	     source.ErrorMessage="Hola mundo";
   	     return enviar;
  	  }
    /*
     Funcion que valida que se ingrese una fecha en los multidestinos. 
    */
   function ValidarFechaIdaMultidestino()
	{
		var i;
		var enviar=true;
		//posicion es el numero total de registros mostrados. 
		var totalregmostrados=intnumeroiterinariosMostrados+contador
		if (document.getElementById('BEFormaCentroNuevoF1_rbMultidestino').checked)
		{
 		 for ( i = 1; i <= totalregmostrados; i++ )
		 {
		   if (document.getElementById(arrFecha[i]).value=="")
		   {
 	 	     enviar=false;
 		  	 break;
		   }
		 } 
	    }
	    return enviar;
	}
    /*
     Funcion que valida que se ingrese la ciudad origen en el multidestino. 
    */
   function CiudadOrigenObligatoriaMulti()
	{
		var i;
		var enviar=true;
		//posicion es el numero total de registros mostrados. 
		var totalregmostrados=intnumeroiterinariosMostrados+contador
		if (document.getElementById('BEFormaCentroNuevoF1_rbMultidestino').checked)
		{
 		 for ( i = 1; i <= totalregmostrados; i++ )
		 {
		   if (document.getElementById(arrCiudadOrigen[i]).value=="")
		   {
 	 	     enviar=false;
 		  	 break;
		   }
		 } 
	    }
	    return enviar;
	}
    /*
     Funcion que valida que se ingrese la ciudad origen en el multidestino. 
    */
   function CiudadDestinoObligatoriaMulti()
	{
		var i;
		var enviar=true;
		//posicion es el numero total de registros mostrados. 
		var totalregmostrados=intnumeroiterinariosMostrados+contador
		if (document.getElementById('BEFormaCentroNuevoF1_rbMultidestino').checked)
		{
 		 for ( i = 1; i <= totalregmostrados; i++ )
		 {
		   if (document.getElementById(arrCiudadDestino[i]).value=="")
		   {
 	 	     enviar=false;
 		  	 break;
		   }
		 } 
	    }
	    return enviar;
	}
   //Funcion que me valida que las fechas sean cronologicas en el multidestino. 
   function fechasCronologicas(source)
   {
   		var i;
		var enviar=true;
		var totalregmostrados=intnumeroiterinariosMostrados+contador
		if (document.getElementById('BEFormaCentroNuevoF1_rbMultidestino').checked)
		{
 		 for ( i = 2; i <= totalregmostrados; i++ )
		 {
		   if (document.getElementById(arrFecha[i-1]).value > document.getElementById(arrFecha[i]).value)
		   {
 	 	     enviar=false;
 		  	 break;
		   }
		 } 
	    }
	    return enviar;
   }
   ///Funcion que sirve para mostrar el numero de filas por defecto. O.K.
   function mostrar(numeroFilas) 
   {
    for (var i=1;i<=intnumeroiterinarios;i++)
    {
        fila = document.getElementById(arrFilas[i]);
        if (i <= numeroFilas)
        {
			fila.style.visibility ="visible"; //mostrar la fila
			fila.style.display = "inline";
        }
        else
        {
			fila.style.visibility = "hidden"; //ocultar la fila
			fila.style.display = "none";
        } 
    }
  }
    //Funcion para agregar un nuevo iterinario en el destino. 
  function AgregarNuevoDestino(numeroFilasM)
  {
   contador++;
   posicion=numeroFilasM+contador;
   if (posicion <=intnumeroiterinarios)
    {
     fila = document.getElementById(arrFilas[posicion]);
     fila.style.visibility ="visible"; //mostrar la fila
	 fila.style.display = "inline";
     estado=document.getElementById(Estado[posicion]);//muestra la fila.
     estado.value="S"; //cambia el estado. 
    }
    else
    {
      contador--;
      /*alert('No se pueden incluir mas destinos');*/
      alert(alertaMultidestinos);
    }
  }
   //Funcion para agregar un nuevo iterinario en el destino. 
  function EliminarDestino(numeroFilasM)
  {
/*   contador--;*/
   posicion=numeroFilasM+contador;
   if (posicion > numeroFilasM)
    {
     fila = document.getElementById(arrFilas[posicion]);
     fila.style.visibility ="hidden"; //mostrar la fila
	 fila.style.display = "none";
     estado=document.getElementById(Estado[posicion]);//muestra la fila.
     estado.value="N"; //cambia el estado. 
     contador--;
    }
    else
    {
      /*contador--;*/
      /*alert('No se pueden incluir mas destinos');*/
      alert(alertaMultidestinosMin);
    }
  }
// Validación para que solo se puedan ingresar números en las cajas de texto
function Numericos(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode;
 if (charCode > 31 && (charCode < 48 || charCode > 57))
 {
  return false;
 }
  return true;
}
// Validación para la longitud del codigo de reserva.
function longitudcodigo()
{
  var str=document.getElementById('EstadodeReserva1_tbxRecordNumber').value;
  
   if (str.length !=6)
   {
    return false;
   }
   return true;
}
/*
lo que hace esta funcion es que carga todas las ciudades cuando uno da click sobre el 
combo de ciudades. Revisar Propiedad OnClickFocus del combo. 
*/
function entercombo(source,args)
{
 source.SetText("");
 source.ClearItems();
}

// Se encarga de que cuando se haga click sobre el icono del dropdownlist, este cargue la lista de valores
function OnClientDropDownOpening(item)
{
	item.RequestItems("",false);
	//alert('OnClientDropDownOpening');
}

//Esto lo que hace es el cambio de Fecha. 
 function cambioFecha()
 {
  var datIda=BEFormaCentroNuevoF1_BEUnsolodestino1_dtOrigen;
  var datRegreso=BEFormaCentroNuevoF1_BEUnsolodestino1_dtDestino;
  var fechaInicial= new Date;
  var fechaFinal= new Date;
  fechaInicial=datIda.GetDate();
  fechaFinal=datRegreso.GetDate();
  if (document.getElementById('BEFormaCentroNuevoF1_rbIdayRegreso').checked)
   {
    if (fechaFinal < fechaInicial)
    {
     datRegreso.SetDate(fechaInicial);
    }
   } 
 }
 
 /*time table*/
 //Esto lo que hace es el cambio de Fecha. 
 function cambioFechaTT()
 {
  var datIda=WUC_TimeTable1_BEUnsolodestino1_dtOrigen;
  var datRegreso=WUC_TimeTable1_BEUnsolodestino1_dtDestino;
  var fechaInicial= new Date;
  var fechaFinal= new Date;
  fechaInicial=datIda.GetDate();
  fechaFinal=datRegreso.GetDate();
  if (document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
   {
    if (fechaFinal < fechaInicial)
    {
     datRegreso.SetDate(fechaInicial);
    }
   } 
 }
 
//Método para funcionamiento de rangos de fechas genérico
function cambioFechaGenerico(controlFecha1, controlFecha2)
{
	var datIda= controlFecha1;
	var datRegreso= controlFecha2;
	var fechaInicial= new Date;
	var fechaFinal= new Date;
	fechaInicial=datIda.GetDate();
	fechaFinal=datRegreso.GetDate();
	if (fechaFinal < fechaInicial)
	{
		datRegreso.SetDate(fechaInicial);
		datRegreso.SetMinDate(fechaInicial);
	}

}
 
 	//Verifica que el usuario no deje espacions en balnco en la ciudad origen. 
   function CiudadOrigenObligatoriaTT()
   {
     	 if (document.getElementById('WUC_TimeTable1_rbSoloIda').checked || document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById('WUC_TimeTable1_BEUnsolodestino1_ddlCiudadOrigen_Input').value=="")
		   //if(document.getElementById(ciudadOrigen).value=="")
		   {
	 		 return false;
		   }
		  }
		 return true;
   }
   //Verifica que el usuario no deje espacios en blanco en la ciudad destino. 
   function CiudadDestinoObligatoriaTT()
   {
     	 if (document.getElementById('WUC_TimeTable1_rbSoloIda').checked || document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById('WUC_TimeTable1_BEUnsolodestino1_ddlCiudadDestino_Input').value=="")
		   {
	 		 return false;
		   }
		  }
		 return true;
   }
   // REMPLAZADO POR cvCiudadesIgualesOT. O.K 
	function ValidarCiudadesIgualesTT()
	{
		  if (document.getElementById('WUC_TimeTable1_rbSoloIda').checked || document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById('WUC_TimeTable1_BEUnsolodestino1_ddlCiudadOrigen_Input').value==document.getElementById('WUC_TimeTable1_BEUnsolodestino1_ddlCiudadDestino_Input').value)
		   {
	 		 return false;
		   }
		  }
		 return true;
	}
	//--Valida que el usuario seleccione ambas fechas. 
 	function ValidarFechaIdaTT() 
	{
		 if (document.getElementById('WUC_TimeTable1_rbSoloIda').checked || document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
         {
		  if (document.getElementById('WUC_TimeTable1_BEUnsolodestino1_dtOrigen_dateInput_text').value=="")
		  {
			return false;
		  }
		 }
		return true;
	}
		//******Cambiado por el customo validator cvFechaROT****** O.K
	function ValidarFechaRegresoTT()
	{
		if (document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
		{
		  if (document.getElementById('WUC_TimeTable1_BEUnsolodestino1_dtDestino_dateInput_text').value=="")
		  {
			return false;
		  }
		}
		return true;
	}
//--valida que la fecha de regreso sea mayor a la fecha de ida. 	
	function ValidarFechaMayorTT()
	{
	  if (document.getElementById('WUC_TimeTable1_rbIdayRegreso').checked)
	  {
 	  	 //strFechaRegreso=document.getElementById('WUC_TimeTable1_BEUnsolodestino1_dtDestino_dateInput_text').value;
 	     //strFechaIda=document.getElementById('WUC_TimeTable1_BEUnsolodestino1_dtOrigen_dateInput_text').value;
 		return valFechas(); 
 	  }
	}
 
 
 /*region para validar las fechas en timetable*/
   function esDigito(sChr){ 
    var sCod = sChr.charCodeAt(0); 
    return ((sCod > 47) && (sCod < 58)); 
   } 

   function valSep(oTxt){ 
    var bOk = false; 
    bOk = bOk || ((oTxt.charAt(2) == "-") && (oTxt.charAt(5) == "-")); 
    bOk = bOk || ((oTxt.charAt(2) == "/") && (oTxt.charAt(5) == "/")); 
    return bOk; 
   } 

   function finMes(oTxt){ 
    var nMes = parseInt(oTxt.substr(3, 2), 10); 
    var nAno = parseInt(oTxt.substr(6), 10); 
    var nRes = 0; 
    switch (nMes){ 
     case 1: nRes = 31; break; 
     case 2: nRes = 28; break; 
     case 3: nRes = 31; break; 
     case 4: nRes = 30; break; 
     case 5: nRes = 31; break; 
     case 6: nRes = 30; break; 
     case 7: nRes = 31; break; 
     case 8: nRes = 31; break; 
     case 9: nRes = 30; break; 
     case 10: nRes = 31; break; 
     case 11: nRes = 30; break; 
     case 12: nRes = 31; break; 
    } 
    return nRes + (((nMes == 2) && (nAno % 4) == 0)? 1: 0); 
   } 

   function valDia(oTxt){ 
    var bOk = false; 
    var nDia = parseInt(oTxt.substr(0, 2), 10); 
    bOk = bOk || ((nDia >= 1) && (nDia <= finMes(oTxt))); 
    return bOk; 
   } 

   function valMes(oTxt){ 
    var bOk = false; 
    var nMes = parseInt(oTxt.substr(3, 2), 10); 
    bOk = bOk || ((nMes >= 1) && (nMes <= 12)); 
    return bOk; 
   } 

   function valAno(oTxt){ 
    var bOk = true; 
    var nAno = oTxt.substr(6); 
    bOk = bOk && ((nAno.length == 2) || (nAno.length == 4)); 
    if (bOk){ 
     for (var i = 0; i < nAno.length; i++){ 
      bOk = bOk && esDigito(nAno.charAt(i)); 
     } 
    } 
    return bOk; 
   } 

   function valFecha(oTxt){ 
    var bOk = true; 
    if (oTxt.value != ""){ 
     bOk = bOk && (valAno(oTxt)); 
     bOk = bOk && (valMes(oTxt)); 
     bOk = bOk && (valDia(oTxt)); 
     bOk = bOk && (valSep(oTxt)); 
     return bOk; 
    } 
   } 

   function fechaMayorOIgualQue(fec0, fec1){ 
    var bRes = false; 
    var sDia0 = fec0.substr(0, 2); 
    var sMes0 = fec0.substr(3, 2); 
    var sAno0 = fec0.substr(6, 4); 
    var sDia1 = fec1.substr(0, 2); 
    var sMes1 = fec1.substr(3, 2); 
    var sAno1 = fec1.substr(6, 4); 
    
    if (sAno0 > sAno1) bRes = true; 
    else { 
     if (sAno0 == sAno1){ 
      if (sMes0 > sMes1) bRes = true; 
      else { 
       if (sMes0 == sMes1) 
        if (sDia0 >= sDia1) bRes = true; 
      } 
     } 
    } 
    return bRes; 
   } 

   function valFechas()
   { 
		var strFechaRegreso=document.getElementById('WUC_TimeTable1_BEUnsolodestino1_dtDestino_dateInput_text').value;
   		var strFechaIda=document.getElementById('WUC_TimeTable1_BEUnsolodestino1_dtOrigen_dateInput_text').value;
 	   	var fec0 = strFechaIda;
   		var fec1 = strFechaRegreso;
		var bOk = false; 
		if (valFecha(fec0))
		{ 
			if (valFecha(fec1))
			{ 
				if (fechaMayorOIgualQue(fec1, fec0))
				{ 
					bOk = true; 
					//alert("Ok"); 
				}
				else 
				{ 
					bOk = false; 
					//alert("Rango inválido"); 
				} 
			} 
			else 
			{ 
				bOk = false; 
				//alert("Fecha inválida1"); 
			} 
		} 
		else 
		{ 
			bOk = false; 
			//alert("Fecha inválida2"); 
		} 
		return bOk;
   } 
 
 
 
 
/*home corporativo*/
 
 function cambioFechaCorp()
 {
             InicioCorporativos1_BEUnSoloDestinoCorporativo1_ddlCiudadOrigen
  var datIda=InicioCorporativos1_BEUnSoloDestinoCorporativo1_dtOrigen;
  var datRegreso=InicioCorporativos1_BEUnSoloDestinoCorporativo1_dtDestino;
  var fechaInicial= new Date;
  var fechaFinal= new Date;
  fechaInicial=datIda.GetDate();
  fechaFinal=datRegreso.GetDate();
  if (document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
   {
    if (fechaFinal < fechaInicial)
    {
     datRegreso.SetDate(fechaInicial);
    }
   } 
 }
 
 
function document_onloadCorp()
	{
 		//asigna el evento click a cada uno de los radiobutton. 
 		var oDivRadios;
 		if(document.getElementById)
			oDivRadios = document.getElementById('divRadios');
		else if(document.all)
			oDivRadios = document.all('divRadios');
		if(oDivRadios)
			oDivRadios.onclick = divRadios_onclick;
		// Esto es para dejar por defecto la ultima opcion que selecciono el usuario ;)
		var InicioCorporativos1_rbIdayRegreso = document.getElementById('InicioCorporativos1_rbIdayRegreso');
		if (InicioCorporativos1_rbIdayRegreso && InicioCorporativos1_rbIdayRegreso.checked)
 		{
 		  muestramultidestino('multi','no-multi');	
		  habilitar_fecharegreso(InicioCorporativos1_rbIdayRegreso);
 		}
 		
 		var InicioCorporativos1_rbSoloIda = document.getElementById('InicioCorporativos1_rbSoloIda');
 		if (InicioCorporativos1_rbSoloIda && InicioCorporativos1_rbSoloIda.checked)
 		{
  			muestramultidestino('multi','no-multi');	
			deshabilitar_fecharegreso(InicioCorporativos1_rbSoloIda);
  		}
  		
  		var InicioCorporativos1_rbMultidestino = document.getElementById('InicioCorporativos1_rbMultidestino');
 		if (InicioCorporativos1_rbMultidestino && InicioCorporativos1_rbMultidestino.checked)
 		{
  		   muestramultidestino('no-multi','multi');
  		}
	}
	
//--Valida que el usuario seleccione ambas fechas. 
 	function ValidarFechaIdaCorp() 
	{
		 if (document.getElementById('InicioCorporativos1_rbSoloIda').checked || document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
         {
		  if (document.getElementById(fechaIda).value=="")
		  {
			return false;
		  }
		 }
		return true;
	}
	//Verifica que el usuario no deje espacions en balnco en la ciudad origen. 
   function CiudadOrigenObligatoriaCorp()
   {
     	 if (document.getElementById('InicioCorporativos1_rbSoloIda').checked || document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById(ciudadOrigen).value=="")
		   {
	 		 return false;
		   }
		  }
		 return true;
   }
   //Verifica que el usuario no deje espacios en blanco en la ciudad destino. 
   function CiudadDestinoObligatoriaCorp()
   {
     	 if (document.getElementById('InicioCorporativos1_rbSoloIda').checked || document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById(ciudadDestino).value=="")
		   {
	 		 return false;
		   }
		  }
		 return true;
   }
 	//******Cambiado por el customo validator cvFechaROT****** O.K
	function ValidarFechaRegresoCorp()
	{
		if (document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
		{
		  if (document.getElementById(fechaRegreso).value=="")
		  {
			return false;
		  }
		}
		return true;
	}
//--valida que la fecha de regreso sea mayor a la fecha de ida. 	
	function ValidarFechaMayorCorp()
	{
	  if (document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
	  {
 	  	 strFechaRegreso=document.getElementById(fechaRegreso).value;
 	     strFechaIda=document.getElementById(fechaIda).value;
          if (strFechaIda != "" && strFechaRegreso !="")
          {
           if (strFechaIda > strFechaRegreso)
		   {
	  	     return false;
           }
          }
          return true;
	  } 
	  return true;
	}
	
	function ValidarNAdultosCorp()
	{

		if(document.getElementById('InicioCorporativos1_ddlNumAdultos').selectedIndex == 0)
		{
			return false;
		}
		return true;
	}
	//----
	// REMPLAZADO POR cvCiudadesIgualesOT. O.K 
	function ValidarCiudadesIgualesCorp()
	{
		  if (document.getElementById('InicioCorporativos1_rbSoloIda').checked || document.getElementById('InicioCorporativos1_rbIdayRegreso').checked)
		  {
		   if(document.getElementById(ciudadOrigen).value==document.getElementById(ciudadDestino).value)
		   {
	 		 return false;
		   }
		  }
		 return true;
	}
	//Esto lo que hace es el cambio de Fecha xa multidestinos
function cambioFechaMD()
{
	/*fechas 1-2*/
	var datIda=BEMultiDestinoNew1_rptIterinarios__ctl1_datFechaIda;
	var datRegreso=BEMultiDestinoNew1_rptIterinarios__ctl2_datFechaIda;
	var fechaInicial= new Date;
	var fechaFinal= new Date;
	fechaInicial=datIda.GetDate();
	fechaFinal=datRegreso.GetDate();
	if (fechaFinal < fechaInicial)
	{
	    datRegreso.SetDate(fechaInicial);
	}
	
	/*fechas 2-3*/
	datIda=BEMultiDestinoNew1_rptIterinarios__ctl2_datFechaIda;
	datRegreso=BEMultiDestinoNew1_rptIterinarios__ctl3_datFechaIda;
	fechaInicial= new Date;
	fechaFinal= new Date;
	fechaInicial=datIda.GetDate();
	fechaFinal=datRegreso.GetDate();
	if (fechaFinal < fechaInicial)
	{
	    datRegreso.SetDate(fechaInicial);
	}
	
	/*fechas 3-4*/
	datIda=BEMultiDestinoNew1_rptIterinarios__ctl3_datFechaIda;
	datRegreso=BEMultiDestinoNew1_rptIterinarios__ctl4_datFechaIda;
	fechaInicial= new Date;
	fechaFinal= new Date;
	fechaInicial=datIda.GetDate();
	fechaFinal=datRegreso.GetDate();
	if (fechaFinal < fechaInicial)
	{
	    datRegreso.SetDate(fechaInicial);
	}
	
	/*fechas 4-5*/
	datIda=BEMultiDestinoNew1_rptIterinarios__ctl4_datFechaIda;
	datRegreso=BEMultiDestinoNew1_rptIterinarios__ctl5_datFechaIda;
	fechaInicial= new Date;
	fechaFinal= new Date;
	fechaInicial=datIda.GetDate();
	fechaFinal=datRegreso.GetDate();
	if (fechaFinal < fechaInicial)
	{
	    datRegreso.SetDate(fechaInicial);
	}
}
	