// JavaScript Document
//hotel pic
function popPhoto(id){
	window.open("/popup_photo.php?id="+id,"","resizable=1,height=200,width=200");
}
function popGallery(pic_type,hid){
	window.open("/popup_gallery.php?type="+pic_type+"&hid="+hid+"","","resizable=1,height=200,width=200");
}

//period
function periodBox(){	
	var periodBox = document.getElementById('periodBox');	
	var requestBox = document.getElementById('rate_req_result');	
	periodBox.style.display ='none';		
	requestBox.style.display ='block';		
}

function periodBoxCheck(theForm){
	if(theForm.cid.value>=theForm.cod.value){
		alert("Invalid Check-In or Check-Out day.");
		return false;
	}else{
		return true;
	}
}

function periodBoxChangeCid(theForm){
	if(theForm.cid.value>=theForm.cod.value){
		theForm.cod.selectedIndex = theForm.cid.selectedIndex;
	}
}

function periodBoxChangeCod(theForm){
	if(theForm.cod.value<=theForm.cid.value){
		theForm.cid.selectedIndex = theForm.cod.selectedIndex;
	}
}

function checkrate(){
	var validity = false;
	var cid = document.cperiod.cid.value;
	var cod = document.cperiod.cod.value;
	
	if(cid>=cod){
		validity = false;
	}else{
		validity = true;
	}

	if (validity) {
			var hid = document.cperiod.hid.value;
			var url_path = "pg_checkrate.php?hid="+ hid + "&cid=" + cid + "&cod=" + cod + "&r=" + new Date().getTime();
//			alert(url_path);
			loading('rate_req_result',url_path);

	} else alert("Invalid Check-In or Check-Out day.");

}

var win=null;
function NewWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}