var please_wait = null;
var ajccache = new Object();
var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument != 'undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox") != -1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
function open_url(url, target) {
	var contentele = document.getElementById(target);
	if(ajccache[url] == null){
		var xhttp = createXMLHttp();
			if (xhttp.readyState < 4) {
		contentele.innerHTML = "<img src='./images/loading.gif' alt='loading...'><span style='padding-left:6px; font-size: 14px; color:#FF9900';>载入中，请稍后...</span>";
	}
		xhttp.onreadystatechange = function(){
			if(xhttp.readyState == 4 && (xhttp.status == 200 || window.location.href.indexOf("http") == -1)){
				if (Browser.isMozilla){
					contentele.innerHTML = xhttp.responseText;
				}else{
					contentele.innerHTML = xhttp.responseText;
				}
				ajccache[url] = contentele.innerHTML;
			}
		}
		xhttp.open("GET",url,true);
		xhttp.send(null);
	}else{
		contentele.innerHTML = ajccache[url];
	}
}

function response(link, url, target) {
	//alert(link.readyState + ' -- ' + target);
	//alert(link.readyState);
	if (link.readyState < 4) {
		document.getElementById(target).innerHTML = "<img src='./images/loading.gif' alt='loading...'><span style='padding-left:6px; font-size: 14px; color:#FF9900';>载入中，请稍后...</span>";
	} else {
		document.getElementById(target).innerHTML = (link.status == 200) ? link.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the fallowing errorcode: " + link.status;
	}
}

function set_loading_message(msg) {
 	please_wait = msg;
}
