var fHDes = new function (){
	this.rHotelDes = function (){
		var myurl = "Func/HotelDescription/HotelDescription.php", http = new getXMLHTTPRequest();
		http.onreadystatechange = function() {if (http.readyState != 4) { return; }
			if($("TpDetail")){
				$("TpDetail").innerHTML=http.responseText;
				fHDes.rCancel();
			}
		};
		http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.send("Mode=1&"+rURL+"&"+new Date().getTime());
	};
	this.rHotelDesPromote = function (){
		var myurl = "Func/HotelDescription/HotelDescriptionPromote.php", http = new getXMLHTTPRequest();
		http.onreadystatechange = function() {if (http.readyState != 4) { return; }
			if($("TpDetail")){
				$("TpDetail").innerHTML=http.responseText;
			}
		};
		http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.send("Mode=1&"+rURL+"&"+new Date().getTime());
	};
	this.rCancel = function (){
		if($("Policy")){
			var myurl = "Func/Result/ViewCXLPolicy.php", http = new getXMLHTTPRequest();
			var PartPost = "CodeHotel="+CodeHotel+"&PaxPassport="+PaxPassport+"&InternalCode="+InternalCode+"&FromDt="+FromDt+"&ToDt="+ToDt+"&flagAvail="+flagAvail+"&Paxdetail=1&CancelPolicyID="+CancelPolicyID;
			http.onreadystatechange = function() {if (http.readyState != 4) { return; }			
				if($("Policy")){
					rp = http.responseText.replace(/HOTELNAME/,"");
					$("Policy").innerHTML = rp;
				}
			};
			http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
			http.send(PartPost+"&"+new Date().getTime());
		}
	};
	
	this.jumpToPaxdetail = function (){
		var strFile = "PaxDetail.php";
		strFile += "?Code=" + this.HotelCode;
//		strFile += "&FileRP=" + this.FileRP;
		strFile += "&Available=" + this.Available;
		strFile += "&" + new Date().getTime();
		window.open (strFile, "_self");
	}

	this.sendMail = function (obj){
		var dMail = $("txtEmail");
		var dDesc = $("txtDescription");
		if (!dMail) return;
		if (dMail.value=="")
		{
			alert("please type the e-mail.");
			dMail.focus();
			return;
		}
		var myurl = "Func/HotelDescription/mcHotelDescription.php", http = new getXMLHTTPRequest();
		var param = "Code="+CodeHotel+"&PaxPassport="+PaxPassport+"&InternalCode="+InternalCode+"&FromDt="+FromDt+"&ToDt="+ToDt+"&Available="+flagAvail+"&CancelPolicyID="+CancelPolicyID;
		param += "&txtEmail="+encodeURI(dMail.value);
		param += "&txtDescription="+encodeURI(dDesc.value);
		http.onreadystatechange = function() {if (http.readyState != 4) { return; }			
			var mytext = http.responseText;
			var pobj = obj.parentNode.parentNode.parentNode;
			//pobj.innerHTML = mytext; return;
			var pobj = dMail.parentNode;
			var strMail = dMail.value;
			pobj.removeChild(dMail);
			pobj.innerHTML = strMail;
			var pobj = dDesc.parentNode;
			var strDesc = dDesc.value;
			pobj.removeChild(dDesc);
			pobj.innerHTML = strDesc;
			var pobj = obj.parentNode;
			pobj.style.borderStyle = "none";
			pobj.innerHTML = "Send Completed";
		};
		http.open("POST", myurl, true); http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		http.send(param+"&"+new Date().getTime());
	}

}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
