
//muestra los detalles del hotel
  function gti_p(searchid, wsid, hotelid, roomid, optionid, accomid, userid, div_id, Quote, d_from, bBwGen, strDestination, strPassengers, sCheck_in, sCheck_out, sMorsData, iAgency_id)
 	 {

	     var params = "iSearchId=" + searchid
					        	   + "&wsid=" + wsid
							       + "&hotelid=" + hotelid
								   + "&roomid=" + roomid
								   + "&optionid=" + optionid
								   + "&accomId=" + accomid
								   + "&userid=" + userid
								   + "&quote=" + Quote
								   + "&from=" + d_from
								   + "&strDestination=" + strDestination
			 					   + "&strPassengers=" + strPassengers
								   + "&Check_in=" + sCheck_in
								   + "&Check_out=" + sCheck_out
								   + "&MorsData=" + sMorsData
								   + "&Agencyid=" + iAgency_id;

		//para el webservice 9 bw necesita generar las tarifas.
		//if (document.getElementById("generated_"+ wsid + hotelid).value == 0 && wsid == 9 && bBwGen == 0){
		if (wsid == 9 && bBwGen == 0)
		{	var wait = '<br/><table align="center"><tr><td><img src="images/loading_wait.gif"></td></tr></table>';
			AJ_S("#allroom_" + wsid+hotelid+ "hidden", "ajax_bw_llena_xmlRoom.asp", params, wait);
			document.getElementById("allroom_"+ wsid + hotelid).style.display = 'none';
		}
		else
		 	{AJ_S("#HtlRoomID_" + div_id, "ajax_detalle_hotel.asp", params, "");}
	}

//botones booknow (setean los valores)
function HotelSelection(H_ID, R_ID, O_ID, A_ID, M_ISQUOT)

{

	document.WS_SearchHotel.idhotel.value=H_ID;
	document.WS_SearchHotel.idroom.value=R_ID;
	document.WS_SearchHotel.OptionID.value=O_ID;
	document.WS_SearchHotel.cboAccom.value=A_ID;
	document.WS_SearchHotel.quote.value=M_ISQUOT;
	
	document.WS_SearchHotel.submit();	
	return false;
}

//botones booknow (setean los valores)
function JumboHotelSelection(H_ID, R_ID, AC_ID, ST_ID)
{
	if  (!(typeof document.WS_SearchHotel.FileID == "undefined")){
		if (document.WS_SearchHotel.FileID.value != '')
			{document.WS_SearchHotel.action="mors/webserv_prebooking.asp";}
			
		else if (document.WS_SearchHotel.user_id.value == 0) 
			{document.WS_SearchHotel.action="mors_login_alt.asp";}
			
		else
			{document.WS_SearchHotel.action="mors/res_chkavail_newfile_pax.asp";}
	}
	else if (document.WS_SearchHotel.user_id.value == 0)
		{document.WS_SearchHotel.action="mors_login_alt.asp";}
	else
		{document.WS_SearchHotel.action="mors/res_chkavail_newfile_pax.asp";}

	document.WS_SearchHotel.redir_ok_aux.value='webserv_prebooking.asp';
	document.WS_SearchHotel.idhotel.value=H_ID;
	document.WS_SearchHotel.idroom.value=R_ID;
	document.WS_SearchHotel.cboAccom.value=AC_ID ;
	document.WS_SearchHotel.WS_ID.value = 1;
	document.WS_SearchHotel.submit();	
	return false;
}	

//botones booknow (setean los valores)
function WSHotelSelection(H_ID, O_ID, ST_ID, WS_ID, M_ISQUOT)
{
	if (typeof document.WS_SearchHotel.FileID != "undefined"){ //si existe el hidden
		if (document.WS_SearchHotel.FileID.value != '')
			{document.WS_SearchHotel.action="mors/webserv_prebooking.asp";}
		else if (document.WS_SearchHotel.user_id.value == 0) 
			{document.WS_SearchHotel.action="mors_login_alt.asp";}
	} //sino existe el hidden
	else if (document.WS_SearchHotel.user_id.value == 0)
		{document.WS_SearchHotel.action="mors_login_alt.asp";}
	else	
	
		{document.WS_SearchHotel.action="mors/res_chkavail_newfile_pax.asp";}
		
	document.WS_SearchHotel.redir_ok_aux.value='webserv_prebooking.asp';
	document.WS_SearchHotel.idhotel.value=H_ID;
	document.WS_SearchHotel.OptionID.value=O_ID;
	document.WS_SearchHotel.statusid_search.value = ST_ID;
	document.WS_SearchHotel.WS_ID.value = WS_ID;
	document.WS_SearchHotel.quote.value=M_ISQUOT;
	document.WS_SearchHotel.submit();	
	
	return false;
}


function ClearAny()
{
document.frmSearch.cboCatAny.checked = false;
}

function ClearChkNbr()
{
for (i=0; i<document.frmSearch.cboCat.length; i++)
   {document.frmSearch.cboCat[i].checked=false;}
}



function doSubmit()
{	
	//Limpio el id de busqueda.
	document.frmSearch.iSearchId.value="";
	document.frmSearch.submit();
	return true;	

}


function ValidateFields()
{

	var sinput = document.frmSearch.text.value + document.frmSearch.cityid.value + document.frmSearch.zoneid.value + document.frmSearch.txtcityzone.value;

	if (sinput == '')
	{ 
	   alert("Please suply at least a 'city' or 'text to search' to narrow the result set.")
	   document.frmSearch.txtcityzone.focus();
	   return false;
	}

	if (isNaN(document.frmSearch.pfrom.value)) {
	    alert("Please suply only numeric values for Price.")
	    document.frmSearch.pfrom.focus();	
	    return false;
	}

	if (isNaN(document.frmSearch.pto.value)) {
	    alert("Please suply only numeric values for Price.")
	    document.frmSearch.pto.focus();
   	    return false;
	}

	return true;
}

		 
function HotelSearchSumbit()
{

	if (ValidateFields())
		{return doSubmit();}
	else 
		{return false;}
}


function HotelSearchQuotSumbit(iChd, iJr, iInf, chdage, jrage, infage)
{
	
	if (ValidateFields())
		{ 
			if (QuotCheckMinor(iChd, iJr, iInf, chdage, jrage, infage))
				{return doSubmit();}
			else
				{return false;}
				
		} 
	else
		{return false;}
}


function ChkChangeSearch()
{
	if (document.TrSearchMod.style.display=='none'){
		document.TrSearchMod.style.display="block";
	}else{
		document.TrSearchMod.style.display="none";
	}
}


