// JavaScript Document
var msg_err="您请求的页面出现异常错误";
//function killErr(){return true;
//} 
//window.onerror=killErr;
function Trim(){
	return this.replace(/\s+$|^\s+/g,"");
}
String.prototype.Trim=Trim;
function getObjValues(id){
    if(getObjects(id).value!=undefined)
    return getObjects(id).value.Trim();
    else
    return "";
}
function getObjects(id) { 	
    if (document.getElementById) { 
       return document.getElementById(id); 
    } else if (document.all) { 
       return document.all[id]; 
    } else if (document.layers) { 
       return document.layers[id]; 
    } 
}
function createXMLHttps(){
       var ret = null;
       try {
           ret = new ActiveXObject('Msxml2.XMLHTTP');
       } catch (e) {
           try {
               ret = new ActiveXObject('Microsoft.XMLHTTP');
           }
           catch (ee) {
               ret = null;
           }
       }
       if (!ret && typeof XMLHttpRequest != 'undefined')
           ret = new XMLHttpRequest();
       return ret;
}

function createXMLHttpRequest(){
       if (window.XMLHttpRequest) {
           XMLHttpReq=new XMLHttpRequest();
       }else if (window.ActiveXObject) {
           try {
	         XMLHttpReq=new ActiveXObject("Msxml2.XMLHTTP");
	       } catch (e) {
                 try{
	             XMLHttpReq=new ActiveXObject("Micrsost.XMLHTTP");
	       } catch(e){
           }
       }
       }
}
var cache = new Array();
function getHttpObject(){
       var objType = false;
       try {
           objType = new ActiveXObject('Msxml2.XMLHTTP');
       } catch(e) {
           try {
               objType = new ActiveXObject('Microsoft.XMLHTTP');
           } catch(e) {
               objType = new XMLHttpRequest();
           }
       }
       return objType;
}

function GETAjax(URL,DIVID,TIDTXT){
       var DIVID=document.getElementById(DIVID);
       if(DIVID){
           DIVID.innerHTML = "<img border=0 src=" + jsdir + "images/loading.gif>"
	   var xmlhttp = createXMLHttps();
	   xmlhttp.open("GET",URL,true);
	   xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
		    DIVID.innerHTML = unescape(xmlhttp.responseText);
                    if (TIDTXT != null) {document.getElementById("tidtxt").innerHTML=TIDTXT;}
		}
	   }
	xmlhttp.send(null);
       }
}

function POSTAjax(URL,data,DIVID){
       var DIVID=document.getElementById(DIVID);
       if(DIVID){
           DIVID.innerHTML = "<img border=0 src=" + jsdir + "images/loading.gif>"
	   var xmlhttp = createXMLHttps();
	   xmlhttp.open("POST",URL,true);
           xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	   xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
		    DIVID.innerHTML = unescape(xmlhttp.responseText);
		}
	   }
	xmlhttp.send(data);
       }
}
function getpagevalue(URL,DIVID,LoadTip,Dispalyid){
       var DIVID=document.getElementById(DIVID);
	   var Dispalyid2=document.getElementById(Dispalyid);
	   DIVID.innerHTML = null;
       if(DIVID){
		   //if (LoadTip ==0){
			   //DIVID.innerHTML = null;
		   //}
		   if (LoadTip ==1){
			   DIVID.innerHTML = "<img border=0 src=" + jsdir + "images/loading.gif>";
			   
		   }
		   else
		   {
			   DIVID.innerHTML = LoadTip;
		   }
	   var xmlhttp = createXMLHttps();
	   xmlhttp.open("GET",URL,true);
	   xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
		    DIVID.innerHTML = unescape(xmlhttp.responseText); 
			if ((unescape(xmlhttp.responseText)).indexOf(Dispalyid) >-1) {
				Dispalyid2.style.display='none';
			}  
		}
	   }
	xmlhttp.send(null);
       }
}
function CheckMemberDo(Url,postBody,messageID){
    document.getElementById(messageID).innerHTML = "<img border=0 src=" + jsdir + "images/loading.gif>";
    var theHttpRequest = getHttpObject();
    theHttpRequest.onreadystatechange = function() {
        processAJAX(messageID);
    };
    theHttpRequest.open("POST", Url, true);
    theHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    theHttpRequest.send(postBody);
    function processAJAX(messageID){
        if (theHttpRequest.readyState == 4) {
            if (theHttpRequest.status == 200) {
                document.getElementById(messageID).innerHTML = unescape(theHttpRequest.responseText);
             } else {
                document.getElementById(messageID).innerHTML="<p>错误信息:&nbsp;" + unescape(theHttpRequest.statusText) +"<\/p>";
             }
         }
    }
}
function checkreg(inputValue, fieldID, messageID){
    var memberurl=jsdir+ "common/checkreg.asp"
    if (fieldID){
        // inputValue = encodeURIComponent(inputValue);
        inputValue =escape(inputValue);
        fieldID = escape(fieldID);
        cache.push("inputValue=" + inputValue + "&fieldID=" + fieldID);
    }
    if (cache.length > 0){
        var cacheEntry = cache.shift();
        CheckMemberDo(memberurl,cacheEntry,messageID);
    }
}

function checkurldo(Url,postBody,messageID){
	document.getElementById(messageID).innerHTML = "<img border=0 src=" + jsdir + "images/loading.gif>";
    var theHttpRequest = getHttpObject();
    theHttpRequest.onreadystatechange = function() {
        processAJAX(messageID);
    };
    theHttpRequest.open("POST", Url, true);
    theHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    theHttpRequest.send(postBody);
    function processAJAX(messageID){
        if (theHttpRequest.readyState == 4) {
            if (theHttpRequest.status == 200) {
                var arr=theHttpRequest.responseText;
				//document.myform.UrlNew.value= unescape(theHttpRequest.responseText);
				var ss=arr.split('@@@');
                document.myform.UrlNew.value= unescape(ss[0]);
				document.myform.UrlCharset.value= unescape(ss[1]);
				document.myform.UrlTitle.value= unescape(ss[2]);
				document.myform.UrlKeyword.value= unescape(ss[3]);
				document.myform.UrlDescription.value= unescape(ss[4]);
				document.getElementById(messageID).innerHTML = unescape(ss[5]);
             } else {
                document.getElementById(messageID).innerHTML="<p>错误信息:&nbsp;" + unescape(theHttpRequest.statusText) +"<\/p>";
             }
         }
    }
}