function LoadStatus(result,errorcode) {
// var params="status=1"+"&result="+encodeURIComponent(result)+"&errorcode="+encodeURIComponent(errorcode);
 var params="status=1"+"&result="+result+"&errorcode="+errorcode;
 var xld=new XML_Load("/cms/status.htm","GET",params,null,null);
 if(xld.IsReady()) {
  xld.OnReady=function(status,list,ldata) {
   var container=document.getElementById("Status");
   while(container.hasChildNodes()) container.removeChild(container.lastChild);
   container.innerHTML=ldata;
   var arr=ldata.match(/<script language=JavaScript>((.|\n)*?)<\/script>/ig);
   if(arr) {
    for(var a=0;a<arr.length;a++) {
     arr[a].match(/<script language=JavaScript>((.|\n)*?)<\/script>/ig);
     var script=RegExp.$1;
     window.eval(script);
     }
    }
   }
  xld.Load();
  }
 }

function NumberToNumber(num) {
 var ns=""+num,nns,s,first;
 var i,len;
 if (ns=="") return false;
 first=true;

 len=ns.length;
 for (i=len-1;i>=0 && ns.charAt(i)==" ";i--) len--;

 i=0;
 for (i=0;i<ns.length && ns.charAt(i)==" ";i++) {} //Skip spaces before

 if (ns.charAt(i)=="-") {
     i++;
     for (i;i<ns.length && ns.charAt(i)==" ";i++) {} //Skip spaces after
     nns="-";
 } else nns="";

 for (i;i<len;i++) {
      s=ns.charAt(i);
      if ((s>='0' && s<='9') || s=='.') {
          if (first && s=='0') continue;
          nns+=s;
          first=false;
      } else return false;
 }
 return eval(nns);
}



function FCrEl(parent,tagName,param,style,text) {
 //parent - parent of element, can be NULL
 //param  - "border=1; cellspacing=3; class=my"
 //style  - "border: solid 1px #000000; backgroundColor: #FF0000;"
 tagName=tagName.toLowerCase();
 var el;
 if (tagName=="text") el=document.createTextNode(param);
     else {
           el=document.createElement(tagName);
           var result;
           //Add Attributes
           FCrEl.rep.lastIndex=0;
           while ((result=FCrEl.rep.exec(param))!=null) {
                  var attr=document.createAttribute(result[1]);
                  attr.value=result[2];
                  el.setAttributeNode(attr);
           }

           //Add Style
           FCrEl.res.lastIndex=0;
           while ((result=FCrEl.res.exec(style))!=null) el.style[result[1]]=result[2];
          }

 if (text) el.appendChild(document.createTextNode(text));
 if (parent!=null) parent.appendChild(el);
 return el;
}

FCrEl.rep=new RegExp();
FCrEl.rep.compile(" *(.*?) *= *(.*?) *(;|$)","g");

FCrEl.res=new RegExp();
FCrEl.res.compile(" *(.*?) *: *(.*?) *(;|$)","g");



function CrEl(parent,tagName,param,style) {
 //parent - parent of element, can be NULL
 //param  - "border=1; cellspacing=3; class=my"
 //style  - "border: solid 1px #000000; backgroundColor: #FF0000;"
 tagName=tagName.toLowerCase();
 var el;
 if (tagName=="text") el=document.createTextNode(param);
     else {
           el=document.createElement(tagName);
           var i,j,attr,l;

           //Add Attributes
           if (param && param!="") {
               i=0;j=0;l=param.length;
               while (i<l) {              
                      j=param.indexOf("=",i);
                      key=param.substring(i,j).toLowerCase();
                      i=j+1;
                      j=param.indexOf(";",i);
                      val=param.substring(i,j);
                      i=j+1;
                      i++; //skip next space              

                      attr=document.createAttribute(key);
                      attr.value=val;
                      el.setAttributeNode(attr);
               }
           }

           //Add Style
           if (style && style!="") {
               i=0;j=0;l=style.length;
               while (i<l) {              
                      j=style.indexOf(":",i);
                      key=style.substring(i,j).toLowerCase();
                      i=j+1;
                      j=style.indexOf(";",i);
                      val=style.substring(i,j);
                      i=j+1;
                      i++; //skip next space       
                      eval("el.style."+key+"="+val);
               }
           }

          }
 if (parent!=null) parent.appendChild(el);
 return el;
}



function ContainObject(where,what) {
 var child;

 if (where==what) return true;

 for (child=where.firstChild; child != null; child=child.nextSibling) {
      if (ContainObject(child,what)) return true;
 }

 return false;
}



function ObjectProp(o) {                         
var txt;
txt="";
for (i in o) {
 if (i!="innerHTML" && i!="outerHTML" && i!="innerText" && i!="outerText") txt+=i+"="+o[i]+"    "; 
}
alert(txt);
}

   function InsertChild(before,Child,newChild) {
    if (before) Child.parentNode.insertBefore(newChild,Child);
        else Child.parentNode.insertBefore(newChild,Child.nextSibling);
   }

   function XML_FindSubRootSection(XML_RootO,sec_TagName) {
    if (!XML_RootO) return null;
    var xml_co=XML_RootO.firstChild;
    while (xml_co) {
     if (xml_co.tagName==sec_TagName) return xml_co;
     xml_co=xml_co.nextSibling;
    }
    return null;
   }


//Delete all out this function
function urlencode(v) {
 return v;
}
