if(!$CommonFile){
var $CommonFile;

/**
*
*xmlHttp Object
*/
try{
	var xmlHttp = null;
	if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	} else if(window.ActiveXObject){
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
}catch(e){alert('ÄúµÄä¯ÀÀÆ÷²»Ö§³ÖXMLHttp')}

// JavaScript Document

var REQUEST = new Object();

function _REQUEST(strName,win)
{
	if(!win) win = window;
	var strHref = win.location.search;
	var intPos = strHref.indexOf("?");
	if(intPos==-1)return REQUEST;
	var strRight = strHref.substr(intPos + 1);

	var arrTmp = strRight.split("&");
	
	for(var i = 0; i < arrTmp.length; i++)
	{
		var arrTemp = arrTmp[i].split("=");
		REQUEST[arrTemp[0]] = arrTemp[1]
	}
	if(strName)
		return REQUEST[strName];
	else
		return REQUEST;
}
_REQUEST();

function parseURL(add,remove,page){
	if(!remove)remove = new Object()
	var _GET = _REQUEST();
	if(add){
		for(key in add){
			
			_GET[key] = add[key]
		}
	}
	var new_query = ""
	if(_GET){
		for(key in _GET){
			
			if(!remove[key]){
				if(new_query == "")
				new_query += "?" + key + "=" + _GET[key]
				else
				new_query += "&" + key + "=" + _GET[key]
			}
		}
	}

	if(!page)
	page = window.location.pathname;

	return page + new_query;
}

function Redirect(url){
	window.location = url
}

function htmlspecialchars(text) {
	text=text.replace(/&/g,'&amp;');
	text=text.replace(/</g,'&lt;');
	text=text.replace(/>/g,'&gt;');
	text=text.replace(/"/g,'&quot;');
	text=text.replace(/'/g,"&#039;");

	return text;
}

function unhtmlspecialchars(text) {
	text=text.replace(/&lt;/g,'<');
	text=text.replace(/&gt;/g,'>');
	text=text.replace(/&quot;/g,'"');
	text=text.replace(/&#039;/g,"'");
	text=text.replace(/&amp;/g,'&');
	return text;
}

function WindowOnload(funcs){
	if(typeof(window.onload) == 'function') var oldOnload = window.onload;
	window.onload = function(){
		if(oldOnload)oldOnload();
		funcs();
	}
}

//document.write(htmlspecialchars(document.body.innerHTML))
function _doCommand(args){
	try{
		var args = args.split("$");
		
		
		if(args[2]&&parseInt(args[2])>0){
			if(!formhandle(args[1]))return false;
		}
	
		var form = document.getElementById(args[1])
		
		var _target = form.target
		var _action = form.action

		var _div = document.getElementById("_CommandDiv");
		if(!_div){
			var _div = document.createElement("div");
			_div.id = "_CommandDiv"
			_div.innerHTML = '<IFRAME id="_CommandIframe" name="_CommandIframe" width="100%" height="0"></IFRAME>'
			document.body.appendChild(_div);
		}
		var _input = document.createElement("input");
		_input.id 		= "_CommandName"
		_input.name 	= "_CommandName";
		_input.type 	= "hidden";
		_input.value	= args[0];
		form.appendChild(_input);

		form.target = "_CommandIframe"
		form.action = "command.php"

		form.submit();
		form.target = _target
		form.action = _action

		var _input = document.getElementById("_CommandName");
		_input.parentNode.removeChild(_input);

		//var _div = document.getElementById("_CommandDiv");
		//_div.parentNode.removeChild(_div);
	}catch(e){alert(e.message)}
}

function HotelOrder(args){
	try{
		var _div = document.createElement("div");
		_div.id = "_HotelOrder_FormDiv"
		_div.innerHTML = '<form id="HotelOrder_Form" name="HotelOrder_Form" method="post" action="hotel_book.php">'
						+ '  <input name="HotelOrder_Content" type="hidden" id="HotelOrder_Content" value="'+args+'" />'
						+ '  <input name="HotelOrder_Set" type="hidden" id="HotelOrder_Set" value="1" />'
						+ '</form>'
		document.body.appendChild(_div);
		
		var theForm = document.getElementById('HotelOrder_Form')
		theForm.submit()
	}catch(e){alert(e.message)}
}

function HotelDetail(args){
	try{
		_doPostBack('refresh','hotel_detail.php?'+args,'_blank');
		return;
	}catch(e){alert(e.message)}
}


function _doPostBack(){
	
	var postAction = parseURL();
	var postTarget = '_self';
	var postContent = 'refresh';
	var postWindow;

	switch(arguments.length){
		case 1:
			postContent = arguments[0];
			break;
		case 2:
			postContent = arguments[0];
			postAction = arguments[1];
			break;
		case 3:
			postAction = arguments[1];
			postTarget = (arguments[2].length)?arguments[2]:postTarget;
			postContent = arguments[0];
			break;
		case 4:
			postContent = arguments[0];
			postAction = arguments[1];
			postTarget = (arguments[2].length)?arguments[2]:postTarget;
			postWindow = arguments[3];
			break;
	}
	try{
		
		
		var _document = (postWindow)?postWindow.document:document;
		var _div = document.getElementById("PostBack_FormDiv");
		if(!_div){
			_div = _document.createElement("div");
			_div.id = "PostBack_FormDiv"
			_div.innerHTML = '<form action="'+postAction+'" target="'+postTarget+'" id="PostBack_Form" name="PostBack_Form" method="post">'
							+ '  <input value="'+postContent+'" name="content" type="hidden" id="content" />'
							+ '  <input name="method" type="hidden" id="method" value="postBack" />'
							+ '</form>'
			_document.body?_document.body.appendChild(_div):_document.appendChild(_div);
		}
		var theForm = _document.getElementById('PostBack_Form')
		theForm.action = postAction;
		theForm.target = postTarget;
		theForm.content.value = postContent;

		theForm.submit();
	}catch(e){alert(e.message)}
}

}
