﻿_spBodyOnLoadFunctionNames.push("LoadViajesExito");
//Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginReq); 
//Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endReq);    

var waitDialog;

function beginReq(sender, args){ 
	waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Cargando...', 'Cargando...');
} 

function endReq(sender, args) { 
	if(waitDialog != null && typeof waitDialog != 'undefined'){
	    waitDialog.close();
	}
} 

function LoadViajesExito(){
	if (__cultureInfo){
	   Sys.CultureInfo.CurrentCulture = Sys.CultureInfo._parse(__cultureInfo);
	   delete __cultureInfo;
	}
	CambiarTextoBuscandoPorClases(".breadcrumbRootNode", "Inicio")
}

function ValidaFecha(source, arguments) {
    var fecha = Date.parseLocale(arguments.Value);
    arguments.IsValid = fecha != null;
    return;
}

function CambiarTextoBuscandoPorClases(clase, texto)
{
	var CampoTexto = $(clase);
	if(CampoTexto != null && typeof CampoTexto != 'undefined')
	{
		if (CampoTexto.text() != "")
		{
			CampoTexto.text(texto);	
		}
	}
}

function ValidaFecha(source, arguments) {
    var fecha = Date.parseLocale(arguments.Value);
    arguments.IsValid = fecha != null;
    return;
}

function CambiarTextoBuscandoPorClases(clase, texto)
{
	var CampoTexto = $(clase);
	if(CampoTexto != null && typeof CampoTexto != 'undefined')
	{
		if (CampoTexto.text() != "")
		{
			CampoTexto.text(texto);	
		}
	}
}

function OnCitySelectedIndexChanged(dropDownListCiudad, ciudadDeCompra)
{
	if (dropDownListCiudad.value.split('|')[0] == ciudadDeCompra)
	{
		$("span[id$='lbCabina']").css("display", "none");
		$("select[id$='ddlCabina']").css("display", "none");
	}
	else
	{
		$("span[id$='lbCabina']").css("display", "");
		$("select[id$='ddlCabina']").css("display", "");	
	}
}

function FechaIdaSelectionChanged(sender, args)
{     
	var selectedDate = sender.get_selectedDate();
	var calendarFechaRegreso = $find("CalFechaRegreso");
	calendarFechaRegreso.set_selectedDate(selectedDate);
}

