var prepararSalidaTipoViaje = false;
var SalidaTiposViaje = {};

function getOferta( p_ofecod, tipofe, ideses, aptcod ){
		//alert("oriFirst: " + oriFirst);
		
		// link de las ofertas
		/*origenStr = String(vCodOrigenes[document.getElementById("s_o").selectedIndex]);
		codOri = origenStr.substring(0,origenStr.indexOf(","));
			
		if (codOri == "") codOri = oriFirst;
	
		if (numnoc.indexOf("-")==-1){	//caso numnoches sin rango
			noches=numnoc;
		} else {						//caso numnoches con rango cogemos el primer valor
			noches = numnoc.substring(0,numnoc.indexOf("-"));
		}*/
		/*var p_sprind = "";
		var fprapr = "";
		var aprcod = "";
		
		var origenStr = String(vCodOrigenes[document.getElementById("s_o").selectedIndex]);
		
		var codOri =origenStr.substring(0, origenStr.indexOf(","));
		var noches = "";
		var fecsal = "";
		
		var mensaje_ofertas = '';
		mensaje_ofertas += '<form name="form2" method="post" onSubmit=acceso_ofertas("form2") target=_top class="form2">';
		mensaje_ofertas += '<input type="hidden" value="'+p_ofecod+'" name="p_ofecod">';
		mensaje_ofertas += '<input type="hidden" value="'+p_sprind+'" name="p_sprind">';
		mensaje_ofertas += '<input type="hidden" value="' + (fprapr.length>0 && aprcod.length>0 ? fprapr + '_' + aprcod : '') + '" name="p_producto">';
		mensaje_ofertas += '<input type="hidden" value="'+codOri+'" name="p_aptcod">';
		mensaje_ofertas += '<input type="hidden" value="'+noches+'" name="p_numnoc">';
		mensaje_ofertas += '<input type="hidden" value="'+fecsal+'" name="p_fecsal">';
		mensaje_ofertas += '<input type="hidden" value="'+tipofe+'" name="p_tipofe">';
		mensaje_ofertas += '<input type="hidden" value="ofertas.seleccionHotel" name="p_action">';
		mensaje_ofertas += '<input type="hidden" value="S" name="p_header">';
		mensaje_ofertas += '<input type="hidden" value="S" name="p_menu">';
		mensaje_ofertas += '<table cellSpacing="0" width="100%" height="100%" border="0" borderColor="#cc0000" cellPadding="0" bgcolor=#ffffff>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class="mensaje_ofertas" align=center borderColor="#ffffff" height=80>';
		mensaje_ofertas += 'Más información y Reservas en su Agencia de Viajes';
		mensaje_ofertas += '<br><br> <a href=javascript:oculta_login()><img src="estatico/n_volver.gif" border=0></a><br>';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td borderColor="#ffffff" align=center valign=top class="mensaje_agencias">';
		mensaje_ofertas += '<table cellSpacing="0" width="80%" border="0" cellPadding="0" bgcolor="#f1f1f6" borderColor="#f1f1f6" class="agencia">';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class="ofertas_log_tit inicio" align=left colspan=2>';
		mensaje_ofertas += 'Agencias de Viajes';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left colspan=2>';
		mensaje_ofertas += 'Si es una Agencia de Viajes registrada puede continuar el proceso introduciendo sus datos de usuario:';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr><td class=espacio_sep colspan=2>&nbsp;</td></tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align="right" width=50%>';
		mensaje_ofertas += 'Usuario:';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left width=50%>';
		mensaje_ofertas += '<input type="text" name="p_usuario" class="h_clogin" size="12" maxlength="20" >';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align="right">';
		mensaje_ofertas += 'Contraseña:';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left>';
		mensaje_ofertas += '<input type="password" name="p_password" class="h_clogin" size="12" maxlength="20"  >';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left>';
		mensaje_ofertas += '&nbsp;';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '<td class="ofertas_log_txt final" align=left height=20>';
		mensaje_ofertas += '<input type="image" src="estatico/ofe_entrar.gif" border="0" alt="Login" >';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '</table>';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '</table>';
		mensaje_ofertas += '</form>';
		
		
		//self.scrollTo(10,10);
		document.getElementById("headerBox").scrollIntoView(true);
		var pantalla = document.body.clientWidth;
		var pos = ((pantalla/2+50)-325);
		document.getElementById("login_ofertas").style.left=(pos);
		document.getElementById("login_ofertas").style.visibility="visible";
		document.getElementById("login_ofertas").innerHTML=mensaje_ofertas;
		document.getElementById("s_m").style.visibility="hidden";
		document.getElementById("s_t_v").style.visibility="hidden";
		document.getElementById("s_o").style.visibility="hidden";*/
		
		
		document.location.href = getDominioB2b() + "/reserves/do/express.seleccionHoteles?" + 
		 "p_ofecod=" + p_ofecod +
		 "&p_aptcod=" + aptcod + 
		 "&p_ideses=" + ideses + 
		 "&p_tipofe=" + tipofe;
	
	}
	
	
	function getParques(p_ofecod, p_sprind, fprapr, aprcod, orden, aptcod, numnoc, fecsal, oriFirst, tipOfe){
		
		// link de las ofertas
		origenStr = String(vCodOrigenes[document.getElementById("s_o").selectedIndex]);
		codOri = origenStr.substring(0,origenStr.indexOf(","));
			
		if (codOri == "") codOri = oriFirst;
	
		if (numnoc.indexOf("-")==-1){	//caso numnoches sin rango
			noches=numnoc;
		} else {						//caso numnoches con rango cogemos el primer valor
			noches = numnoc.substring(0,numnoc.indexOf("-"));
		}
		
		var mensaje_ofertas = '';
		
		mensaje_ofertas += '<table cellSpacing="0" width="100%" height="100%" border="1" borderColor="#cc0000" cellPadding="0" bgcolor=#ffffff>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=mensaje_ofertas align=center borderColor="#ffffff" height=80>';
		mensaje_ofertas += 'Más información y Reservas en su Agencia de Viajes';
		mensaje_ofertas += '<br><br> <a href=javascript:oculta_login()><img src="estatico/n_volver.gif" border=0></a><br>';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td borderColor="#ffffff" align=center valign=top>';
		mensaje_ofertas += '<form name="form2" method="post" onSubmit=acceso_ofertas("form2") target=_top>';
		mensaje_ofertas += '<input type="hidden" value="'+p_ofecod+'" name="p_ofecod">';
		mensaje_ofertas += '<input type="hidden" value="'+p_sprind+'" name="p_sprind">';
		mensaje_ofertas += '<input type="hidden" value="'+fprapr+"_"+aprcod+'" name="p_producto">';
		mensaje_ofertas += '<input type="hidden" value="'+codOri+'" name="p_aptcod">';
		mensaje_ofertas += '<input type="hidden" value="'+noches+'" name="p_numnoc">';
		mensaje_ofertas += '<input type="hidden" value="'+fecsal+'" name="p_fecsal">';
		mensaje_ofertas += '<input type="hidden" value="parques.parques" name="p_action">';
		mensaje_ofertas += '<input type="hidden" value="S" name="p_header">';
		mensaje_ofertas += '<input type="hidden" value="S" name="p_menu">';
		mensaje_ofertas += '<table border="0" cellSpacing="0" width="80%" border="10" cellPadding="0" bgcolor="#f1f1f6" borderColor="#f1f1f6">';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_tit align=left colspan=2>';
		mensaje_ofertas += 'Agencias de Viajes';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left colspan=2>';
		mensaje_ofertas += 'Si es una Agencia de Viajes registrada puede continuar el proceso introduciendo sus datos de usuario:';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr><td class=espacio_sep colspan=2>&nbsp;</td></tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left width=50%>';
		mensaje_ofertas += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Usuario:';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left width=50%>';
		mensaje_ofertas += '<input type="text" name="p_usuario" class="h_clogin" size="12" maxlength="20" >';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left>';
		mensaje_ofertas += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Contraseña:';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left>';
		mensaje_ofertas += '<input type="password" name="p_password" class="h_clogin" size="12" maxlength="20"  >';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '<tr>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left>';
		mensaje_ofertas += '';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '<td class=ofertas_log_txt align=left height=20>';
		mensaje_ofertas += '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="image" src="estatico/ofe_entrar.gif" border="0" alt="Login" >';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '</table>';
		mensaje_ofertas += '</form>';
		mensaje_ofertas += '</td>';
		mensaje_ofertas += '</tr>';
		mensaje_ofertas += '</table>';
		
		
	//	self.scrollTo(10);
		document.getElementById("headerBox").scrollIntoView(true);
		var pantalla = document.body.clientWidth;
		var pos = ((pantalla/2+50)-325);
		document.getElementById("login_ofertas").style.left=(pos);
		document.getElementById("login_ofertas").style.visibility="visible";
		document.getElementById("login_ofertas").innerHTML=mensaje_ofertas;
	
	}


	function acceso_ofertas(form){
		pass=document.form2.p_password.value.toUpperCase();
		document.form2.p_password.value=pass;
		user=document.form2.p_usuario.value.toUpperCase();
		document.form2.p_usuario.value=user;
		document.form2.action="http://www.b2b.soltour.es/reserves/do/agencias.login";
		document.form2.submit();
	}
	
	function oculta_login() {
		document.getElementById("login_ofertas").style.visibility="hidden";
		document.getElementById("s_o").style.visibility="visible";
		document.getElementById("s_m").style.visibility="visible";
		document.getElementById("s_t_v").style.visibility="visible";
	}


function errorIcono(imagen){
	imagen.src="/www/img/airlines/cia_blanco.gif";
}

/*
function showPosterList(id){

	document.getElementById("posterOn").value = 1;
	
	postersLib.showPosterListJskk(id);
	
	document.getElementById("posterLisBox").innerHTML = result;
	document.getElementById("posterLisBox").style.display = "block";

}

function hidePosterList(id){
	document.getElementById("posterList_" + id).style.display = "none";
}
*/



/***************************/


function strReplace(str,strSearch){
	output = "";
	for (i=0;i<str.length;i++){
		aux = str.substring(i,(i+1));
		if (aux == strSearch) output += " ";
		else output += aux;
	}
	return output;
}

function showDestinosMes(codMes){
	BuscadorOfertas.showDestinosMes(codMes, callbackDestinosMes);
}

function showResultados(){

	var codDes = document.getElementById("p_destino").value;
	var txtDes = document.getElementById("nom_destino").value;
	if( codDes=="" ){
		alert("Debe elegir un destino");
		return;
	}
	//var codDes = document.getElementById("destino").value
	//var txtDes = document.getElementById("destino").options[document.getElementById("destino").selectedIndex].text;
	
	document.getElementById("resultBox").style.display = "none";
	document.getElementById("boxPosters").style.display = "none";
	document.getElementById("cargandoBox").style.display = "block";
	
	if (txtDes.indexOf("+")) txtDes = strReplace(txtDes,"+");

	//codMesSelect = document.getElementById("s_m");
	//codOriSelect = document.getElementById("s_o");

	codMes = Number(document.getElementById("s_m").value);
	if($("#divOrigen").css("display")=='none'){
		codOri = "";
		desOri = "";
	}else{
		codOri = document.getElementById("s_o").value;
		
		desOri = String(vCodOrigenes[document.getElementById("s_o").value]);

		origenStr = String(vCodOrigenes[document.getElementById("s_o").selectedIndex]);
		codOri = origenStr.substring(0,origenStr.indexOf(","));
		desOri = origenStr.substring(origenStr.indexOf(",")+1);
	}
	desMes=document.getElementById("s_m").options[document.getElementById("s_m").selectedIndex].text;
	


	maxPrice = "";//document.getElementById("s_p").value;
	
	codTipoViaje = document.getElementById("s_t_v").value;
	desTipoViaje=document.getElementById("s_t_v").options[document.getElementById("s_t_v").selectedIndex].text;
	
	BuscadorOfertas.showResultados(null, codOri, codMes, codDes, desOri, txtDes, maxPrice, false, codTipoViaje, desTipoViaje, callbackShowResultados);

}

function muestraZonasDes(cod_des, cod_agz, desc_agz){

	destinoNew = cod_des;
	dia_seleccionado = "";
	dia_seleccionado = document.getElementById('fecini').value;
	
	document.paramForm.zonaTur_cod.value = cod_des;
	
	if (dia_seleccionado.length == 8) {
		dia = dia_seleccionado.substring(0,2);
		mes = parseInt(dia_seleccionado.substr(2,2),10) + 1;
		any = dia_seleccionado.substring(4);
	
		if (mes < 10) mes = "0" + mes;
		else mes = mes + "";
	
		dia_seleccionado = dia + mes + any;
		var resultado = InfoDestinosXML.recuperaZonasHTML(cod_des, cod_agz, desc_agz, dia_seleccionado, callbackMuestraZonasDes);
	} else {
		alert("Seleccione el día de entrada");
	}
	document.getElementById("calZona").style.display = 'none';
	document.getElementById("residentTxt").innerHTML = '';

}

function trOver(elem){
	aux = elem.className;
	
	if (aux.indexOf("last") == -1) elem.className = "trIn";
	else elem.className = "trIn last";
}

function trOut(elem){
	aux = elem.className;
	
	if (aux.indexOf("last") == -1) elem.className = "trOut";
	else elem.className = "trOut last";
}

//mostrar_poster_pdf
function showPoster(codofe) {
	
	directorio = "/estatico/";
	dominio = "http://www.soltour.es";
	
	codofe = dominio + "/ofertas/" + codofe;
	
	windowVar=window.open(codofe+".pdf","poster", "toolbar=yes,scrollbars=yes,resizable=yes");
	
	//document.getElementById("posterOn").value = 1;
}

function callBackGetFechaActualizacion(data){

	if (okFunction(data)) document.getElementById("actualizado").innerHTML = data;
	else showError(data);
	
}

function callBackGetComboMeses(data){
	if (okFunction(data)){
		document.getElementById("s_mes").innerHTML = '<select id="s_m" style="width:160px;">'+ data +'</select>';
		$("#s_m").change(function(){
			$("#resultBox").html("");
		});
	}else{
		showError(data);
	}

}

function callBackGetComboOrigenes(data){
	if (okFunction(data)){
		document.getElementById("s_origen").innerHTML = '<select id="s_o" style="width:160px;">'+ data +'</select>';
		$("#s_o").change(function(){
			$("#resultBox").html("");
		});
	}else{
		showError(data);
	}

}



function callBackGetOrigenesMesVec(data){
	if (okFunction(data)){
		eval(data);
	}else{
		showError(data);
	}
	
}

function callbackShowResultados(data){

	if (okFunction(data)){
	
		document.getElementById("resultBox").innerHTML = data;
		document.getElementById("cargandoBox").style.display = "none";
		document.getElementById("resultBox").style.display = "block";
		
	} else showError(data);

}

function callbackDestinosMes(data){

	if (okFunction(data)){
	
		document.getElementById("nom_destino").value="Seleccione un destino";
		document.getElementById("p_destino").value="";
		
		//destinos = data.substring(0,data.indexOf("*"));
		//vDestinoJs = data.substring(data.indexOf("*")+1);
		document.getElementById("listaDestinos").innerHTML = data;
		//document.getElementById("s_destino").innerHTML = '<select id="destino" style="width:160px;">'+ data +'</select>';
		$('#listaDestinos dl dt img').click(function(){

			$(this).parent().toggleClass('select');
			if($(this).parent().hasClass('select')){

				$(this).attr('src','/www/img/less-icon.gif');

			}else{

				$(this).attr('src','/www/img/iconoSeleccionDest.gif');

			}
			
			$(this).parent().nextAll().each(function(){if($(this).is('dd')){$(this).slideToggle(200);}else{return false;}});

			return false;

		});
		$('#listaDestinos dl dt a').click(function(){

			$(this).parent().toggleClass('select');
			if($(this).parent().hasClass('select')){

				$($(this).parent().find("img")[0]).attr('src','/www/img/less-icon.gif');

			}else{

				$($(this).parent().find("img")[0]).attr('src','/www/img/iconoSeleccionDest.gif');

			}
			$(this).parent().nextAll().each(function(){if($(this).is('dd')){$(this).slideToggle(200);}else{return false;}});

			return false;

		});
		
	} else showError(data);

}

function okFunction(info){

	if (info.indexOf("ERROR") < 0) return true;
	else return false;

}

function showError(info){

	//document.getElementById("boxParametros").style.display = "none";
	document.getElementById("boxError").style.display = "block";
	document.getElementById("boxError").innerHTML = info;
	
}

/*****Objeto posterCollection*****/
function posterCollection(){
	//atributos
	this.vecGlobal=new Array();
	
	//métodos
	this.addPosterList=addPosterList;		//añade una lista de posters a la coleccion
	this.showPosterListJskk=showPosterListJskk;		//muestra una lista de posters
}

//Añade una Lista de Posters a la Coleccion
function addPosterList(posterList){
	this.vecGlobal[this.vecGlobal.length]=posterList;
}

//Dado un Código de lista
//Muestra la tabla que se corresponde con la lista
function showPosterListJskk(codLista){
	
	aux = "";
	aux += "<table class='posterList' cellpadding='0' cellspacing='0'>";
	aux += "<caption>Posters</caption>";
	aux += "<thead>";
	aux += "	<th class='col1'></th>";
	aux += "	<th class='col2'></th>";
	aux += "</thead>";

	for (kk=0, exit=false; ((kk < this.vecGlobal.length) && (!exit)) ;kk++){
		codActual = this.vecGlobal[kk].getCodPosterList();
		if (codActual == codLista){
			aux += this.vecGlobal[kk].showList();
			exit = true;
		}
	}
	
	aux += "</table>";
	
	return aux;
	
}

/*****Objeto posterList*****/
function posterList(codPosterList){
	//atributos
	this.codPosterList=codPosterList
	this.vec=new Array();
	
	//métodos
	this.getCodPosterList=getCodPosterList;	//devuelve el código de la lista
	this.addPosterDef=addPosterDef;			//añade a la lista un poster pasando la definicion como parámetro
	this.addPoster=addPoster;				//añade un poster a la lista
	this.showList=showList;					//muestra una lista de posters
}

//Devuelve el código de la Lista de Posters
function getCodPosterList(){
	return this.codPosterList;
}

//Dados un:
//	*Código de poster
//	*Código de destino
//	*Descripción de destino
//Añade un nuevo poster a la Lista de posters
function addPosterDef(codPoster,codDestino,desDestino){
	newPoster = new poster(codPoster,codDestino,desDestino);
	this.vec[this.vec.length] = newPoster;
}

//Dado un poster
//Lo añade a la lista de Posters
function addPoster(poster){
	this.vec[this.vec.length]=poster;
}

//Muestra la lista de posters
function showList(){
	aux = "";
	
	for (i=0;i<this.vec.length;i++){
		aux += "<tr onclick=\"alert(\'" + this.vec[i].getCodPoster() + "\')\">";
		aux += "<td>" + this.vec[i].getDesDestino() + "</td><td>ico</td></tr>";
		aux += "</tr>";
	}
	
	return aux;

}

/*****Objeto poster*****/
function poster(codPoster,codDestino,desDestino){
	//atributos
	this.codPoster=codPoster;
	this.codDestino=codDestino;
	this.desDestino=desDestino;
	
	//métodos
	this.getPoster=getPoster;		//Devuelve la informacion del poster
	this.getCodDestino=getCodDestino;		//Devuelve el Destino del Poster
	this.getDesDestino=getDesDestino;		//Devuelve el Destino del Poster
	this.getCodPoster=getCodPoster;	//Devuelve el Código del Poster
}

//Devuelve el codigo
function getCodPoster(){
	return this.codPoster;
}

//Devuelve el Código Destino
function getCodDestino(){
	return this.codDestino;
}

//Devuelve la Descripción Destino
function getDesDestino(){
	return this.desDestino;
}

//Devuelve la informacion del poster
function getPoster(){
	aux = "";
	aux += "Codposter: " + this.codPoster + " // "; 
	aux += "CodDestino: " + this.codDestino + " // "; 
	aux += "DesDestino: " + this.desDestino;
	
	return aux;
}

function showListaPosters(elem){
	document.getElementById("posterOn").value = 1;
	
	var pantalla = document.body.clientWidth;
	var pos = (pantalla/2+50)-15;
	capaPosters = document.getElementById("boxPosters");
	capaPosters.style.left=(pos);
	capaPosters.style.top = 383 + (26 * (elem-1));
	capaPosters.style.display = "block";
	capaPosters.innerHTML = document.getElementById("postersTable_" + elem).innerHTML;	

}

function closePosterList(){
	document.getElementById("boxPosters").style.display = "none";
}

function overClose(elem){
	elem.className = "col2Over";
}

function outClose(elem){
	elem.className = "col2";
}

function callBackGetTiposViajes(data){
	if (okFunction(data)){
		document.getElementById("s_tipo_viaje").innerHTML = '<select id="s_t_v" style="width:160px;">'+ data +'</select>';
		$("#s_t_v").change(function(){
			$("#resultBox").html("");
		});
		if(prepararSalidaTipoViaje){
			preparaTratamientoTipoViaje();
		}else{
			prepararSalidaTipoViaje =true;
		}
	}else{
		showError(data);
	}
}

function callBackgetSalidaTiposViaje(data){
	if (okFunction(data)){
		eval(data);
		if(prepararSalidaTipoViaje){
			preparaTratamientoTipoViaje();
		}else{
			prepararSalidaTipoViaje =true;
		}
	}else{
		showError(data);
	}
}

function selecDestino(cod, nom){
	document.getElementById("nom_destino").value=nom;
	document.getElementById("p_destino").value=cod;
	$("#resultBox").html("");
	tb_remove();
}

function preparaTratamientoTipoViaje(){
	
	$("#s_t_v").change(mostrarSalida);
	$("#s_t_v").change();
	
}

function mostrarSalida(){
	if( SalidaTiposViaje[$("#s_t_v").val()]!= null && SalidaTiposViaje[$("#s_t_v").val()]=="N"){
		$("#divOrigen").hide();
		$("#s_o").val("");
	}else{
		$("#divOrigen").show();
	}
	
}
