

function gi(val){return document.getElementById(val);}

function change(id, newClass) {identity=document.getElementById(id); identity.className=newClass;};

function show(idLayer) { document.getElementById(idLayer).style.display='block'; };
function showInline(idLayer) { document.getElementById(idLayer).style.display='inline'; };
function hide(idLayer) { document.getElementById(idLayer).style.display='none'; };
function rs_clear(idLayer){ document.getElementById(idLayer).innerHTML='';};


function tog_box(type){
	if (document.getElementById(type).style.display=='none'){show(type);}else{hide(type);}
}



function GetXmlHttpObject(){
	var xmlHttp=null;
	try{xmlHttp=new XMLHttpRequest();}
	catch (e){
		try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	}
	return xmlHttp;
};






var xmlHttp;
function rs_Cal(type, val, chkd, rule, aux, cust){
	if(rule=="first"){
		document.getElementById("rs_cal_"+type).innerHTML='<iframe frameborder="0" scrolling="no" src="/hbc_lib/inc/blank.php" id="rs_cal_iframe" style="height:191px"></iframe><div id="rs_cal" style="height:184px"><p style="padding:80px 0 0 0; margin:0; text-align:center; float:none;">loading calendar, please wait...</p></div>';
	}
	xmlHttp=GetXmlHttpObject();
var arr_type = new Array();
arr_type = type.split('_');
var type_aux = "";
	if (arr_type[0]=="in"){ if (arr_type[1]==null) type_aux="out"; else type_aux="out_"+arr_type[1];}
	if (arr_type[0]=="out"){ if (arr_type[1]==null) type_aux="in"; else type_aux="in_"+arr_type[1];}
	document.getElementById('rs_cal_'+type_aux).innerHTML='';
	var url="/hbc_lib/rscal/rscal.php";
	url=url+"?type="+type+"&val="+val+"&chkd="+chkd+"&aux="+aux+"&cust="+cust;
	url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=stateChanged_cal;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	function stateChanged_cal() {
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
			document.getElementById("rs_cal_"+type).innerHTML=xmlHttp.responseText;
		};
	};

};





function rs_Chk_srch(page, rs_action, mod)
{
	var blnPass = true;
	
	if (mod) mod=mod; else mod="";
	
	if (document.rs_sbh_form.rs_city){
		var city=document.rs_sbh_form.rs_city.value;
		city =  city.replace(/[^a-zA-Z0-9]+/g,'');
		if(city==""){
			alert('Please enter a city.');
			document.rs_sbh_form.rs_city.focus();
			blnPass = false;
		}
	}
	
	if (blnPass){
		var txt_apend="_txt";
		if(!gi("rs_chk_in"+mod+txt_apend) || !gi("rs_chk_out"+mod+txt_apend)){
			txt_apend="";
		}
		
		if(gi("rs_chk_in"+mod+txt_apend).value=="" || gi("rs_chk_in"+mod+txt_apend).value=="mm/dd/yyyy"){
			alert('Please enter a check-in date.');
			gi("rs_chk_in"+mod+txt_apend).focus();
			blnPass = false;
		}else if(gi("rs_chk_out"+mod+txt_apend).value=="" || gi("rs_chk_out"+mod+txt_apend).value=="mm/dd/yyyy"){
			alert('Please enter a check-out date.');
			gi("rs_chk_out"+mod+txt_apend).focus();
			blnPass = false;
		}
	}
	
	if (page=="city" && gi('rs_city_backup')){
		if (gi('rs_city_backup').value!=gi('rs_city').value){
				gi('rs_cid_span').innerHTML="";
				gi('rs_sbh_form').action=rs_action;
		}
	}

	if ((page=="city" || page=="home") && blnPass){
		if(document.rs_sbh_form.rs_rooms.value==5 || document.rs_sbh_form.rs_rooms.value==6 || document.rs_sbh_form.rs_rooms.value==7 || document.rs_sbh_form.rs_rooms.value==8){
			blnPass = false;
			window.location="http://hotelsbycity.hotelplanner.com/Search/Index.cfm?City="+document.rs_sbh_form.rs_city.value+"&InDate="+document.rs_sbh_form.rs_chk_in.value+"&OutDate="+document.rs_sbh_form.rs_chk_out.value+"&NumRooms="+document.rs_sbh_form.rs_rooms.value+"&sc=HBC"+document.rs_sbh_form.refid.value;
		}else if(document.rs_sbh_form.rs_rooms.value==9){
			blnPass = false;
			window.location="http://hotelsbycity.hotelplanner.com/GroupForm.cfm?City="+document.rs_sbh_form.rs_city.value+"&CheckInDate1="+document.rs_sbh_form.rs_chk_in.value+"&OutDate="+document.rs_sbh_form.rs_chk_out.value+"&sc=HBC"+document.rs_sbh_form.refid.value;
		}
	}
	return blnPass;
}




















