function LoadLang(url,handleResponse,param){
    var isXML=false;
    var isCache=false;
    var method="GET";
    var attach="";
    if(param){
       re = / /g;
       param=param.replace(re, "");
       var tmp=param.split(",");
       for(var i=0;i<tmp.length;i++){
              var pa=tmp[i].substr(0,3);
              var ct=tmp[i].split("=")[1];
              switch (pa){
                  case "isX":
                  if(ct=="true"){
                      isXML= true;
                  }else{
                      isXML= false;
                  }
                  break;
                  case "isC":
                  if(ct=="true"){
                      isCache= true;
                  }else{
                      isCache= false;
                  }
                  break;
                  case "met":
                  method=ct;
                  break;
                  case "att":
                  attach=ct;
                  break;
              }
       }
    }
    if(!isCache){
        var t=new Date().getTime();
        if(url.indexOf("?")>0){
            url+="&t="+t;
        }else{
            url+="?t="+t;
        }
    }
    var postdata=null;
    if(method=="POST"){
        purl=url.split("?");
        url=purl[0];
        postdata=purl[1];
    }
    RequestHTTP(url,handleResponse,method,isXML,postdata,attach);
}
function translate(doc){
  if(doc){
    var pagecontent=eval(doc);
    var lang=pagecontent[0];
    var aInputs = document.getElementsByTagName("input") ;
    for (var i = 0; i < aInputs.length ; i++ ){
        if ( aInputs[i].lang )
            aInputs[i].value = lang[ aInputs[i].lang ] ;
    }
    var aSpans = document.getElementsByTagName("span") ;
    for (var i = 0 ; i < aSpans.length ; i++ ){
        if ( aSpans[i].lang )
            aSpans[i].innerHTML = lang[ aSpans[i].lang ] ;
    }
    var aLabels = document.getElementsByTagName("label") ;
    for (var i = 0 ; i < aLabels.length ; i++ ){
        if ( aLabels[i].lang )
            aLabels[i].innerHTML = lang[ aLabels[i].lang ] ;
    }
    var aH1s = document.getElementsByTagName("h1") ;
    for (var i = 0 ; i < aH1s.length ; i++ ){
        if ( aH1s[i].lang )
            aH1s[i].innerHTML = lang[ aH1s[i].lang ] ;
    }
    var aH3s = document.getElementsByTagName("h3") ;
    for (var i = 0 ; i < aH3s.length ; i++ ){
        if ( aH3s[i].lang )
            aH3s[i].innerHTML = lang[ aH3s[i].lang ] ;
    }
    var aOptions = document.getElementsByTagName("option") ;
    for (var i = 0 ; i < aOptions.length ; i++ ){
        if ( aOptions[i].lang )
            aOptions[i].innerHTML = lang[ aOptions[i].lang ] ;
    }
    var aas = document.getElementsByTagName("a") ;
    for (var i = 0 ; i < aas.length ; i++ ){
        if ( aas[i].lang )
            aas[i].innerHTML = lang[ aas[i].lang ] ;
    }
    var  alis= document.getElementsByTagName("li") ;
    for (var i = 0 ; i < alis.length ; i++ ){
        if ( alis[i].lang )
            alis[i].innerHTML = lang[ alis[i].lang ] ;
    }
    var  aps= document.getElementsByTagName("p") ;
    for (var i = 0 ; i < aps.length ; i++ ){
        if ( aps[i].lang )
            aps[i].innerHTML = lang[ aps[i].lang ] ;
    }
    }else{
      alert("error");
    }
}
function AJAXFORM(formID,handleResponse,param){
var isXML=false;
var attach="";
if(param){
       re = / /g;
       param=param.replace(re, "");
       var tmp=param.split(",");
       for(var i=0;i<tmp.length;i++){
              var pa=tmp[i].substr(0,3);
              var ct=tmp[i].split("=")[1];
              switch (pa){
                  case "isX":
                  if(ct=="true"){
                      isXML= true;
                  }else{
                      isXML= false;
                  }
                  case "att":
                  attach=ct;
                  break;
              }
          }}
var url=$(formID).action;
var data=getForm(formID);
RequestHTTP(url,handleResponse,"POST",isXML,data,attach);
}
function getForm(theFormName){
   var form = document.forms[theFormName];
   if(typeof form.name == "undefined" || form.name=="")
       form = $(theFormName);
   var formData = "";
   var element;
   for (var i = 0; i < form.elements.length; i++) {
      element = form.elements[i];
      var type=element.type.toLowerCase();
      if (type == "hidden" ||type == "text" || type == "password" || type == "textarea"){
       formData += element.name + "=" + $E(element.value) + "&";
      }else if (element.type.indexOf("select") != -1) {
         for (var j = 0; j < element.options.length; j++) {
            if (element.options[j].selected == true) formData +=  element.name + "=" + $E(element.options[element.selectedIndex].value) + "&";
         }
      }
      else if (element.type == "checkbox") {
         if (element.checked) formData += element.name + "=" + $E(element.value) + "&";
      }
      else if (element.type == "radio") {
          if (element.checked == true) formData += element.name + "=" + $E(element.value) + "&";
      }
   }
   return formData.substring(0, formData.length - 1);
}
function RequestHTTP(burl,rdRandleResponse,bmethod,bXML,Formdata,attach){
var http_request = false;
function doHttpRequest()
{
       if (window.XMLHttpRequest) {
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        } else if (window.ActiveXObject) {
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }
        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
    http_request.onreadystatechange=handleStateChange;
    http_request.open(bmethod,burl,true);
    if(Formdata){
    http_request.setRequestHeader("Content-Length",Formdata.length);
    http_request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
    http_request.send(Formdata);
    }else{
        if(bXML){
            http_request.setRequestHeader("Content-Type","text/xml");
        }else{
            http_request.setRequestHeader("Content-Type","text/html");
        }
    http_request.send(null);
    }
}
function handleStateChange()
{
    if(http_request.readyState==4 && http_request.status==200){
        var response_content;
        if(bXML){
        response_content=http_request.responseXML;
        }else{
        response_content=http_request.responseText;
        }
        eval(rdRandleResponse+"(response_content,attach)");
    }
}
doHttpRequest();
}
function getTagValue(doc, tag){
     var elems = doc.getElementsByTagName(tag)[0].firstChild.nodeValue;
     return elems;
}
function $(obj){
  return document.getElementById(obj);
}
function $F(obj){
  return document.getElementById(obj).value;
}
function $U(str){
  return encodeURIComponent(escape(str));
}
function $E(str){
  return encodeURIComponent(str);
}
function getElementsByClass(searchClass,node,tag) {
    var classElements = new Array();
    if ( node == null )
        node = document;
    if ( tag == null )
        tag = '*';
    var els = node.getElementsByTagName(tag);
    var elsLen = els.length;
    var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)");
    for (i = 0, j = 0; i < elsLen; i++) {
        if ( pattern.test(els[i].className) ) {
            classElements[j] = els[i];
            j++;
        }
    }
    return classElements;
}
function fCheck(){
    if( loginform.username.value =="") {
    alert("请填写管理员用户名！");
    loginform.username.focus();
    return false;
    }
    if( loginform.password.value =="") {
    alert("请填写密码！");
    loginform.password.focus();
    return false;
    }
    if( loginform.checkcode.value =="") {
    alert("请填写验证码！");
    loginform.checkcode.focus();
    return false;
    }
return true;
}
function LoadScript(url)
{
    document.write( '<script type="text/javascript" src="' + url + '" onerror="alert(\'Error loading \' + this.src);"><\/script>' ) ;
}
function LoadCss(url)
{
    document.write( '<link href="' + url + '" type="text/css" rel="stylesheet" onerror="alert(\'Error loading \' + this.src);" />' ) ;
}
function LoadPage(url)
{
    document.write( '<link href="' + url + '" type="text/css" rel="stylesheet" onerror="alert(\'Error loading \' + this.src);" />' ) ;
}