﻿if(/IE 6/.test(navigator.userAgent)){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}
function $(s){return document.getElementById(s)}
function ajax(fun,url,str,xml){
  var o=function(){try{o=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{o=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){try{o=new XMLHttpRequest()}catch(e){}}}return o}();
  if(!o)return;url+="&"+Math.random();o.open(str?"POST":"GET",url,true);if(str)o.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
  o.onreadystatechange=function(){if(o.readyState==4)if(o.status==200)fun(xml?o.responseXML:o.responseText)};o.send(str);
}
function getform(f){
  if(!f)f=document.forms[0];var e,o,r,s='';for(var i=0;i<f.length;i++){o=f[i];
  if(e=o.getAttribute('nullAlert')){if(o.value.replace(/\s/g,'')==''){alert(e);o.focus();return}}
  if(o.value&&(e=o.getAttribute('pattern'))){
    switch(e){
      case'name':r=/^[\u4e00-\u9fa5]{2,4}$/;break;
      default:if(/^\/.*\/$/.test(e))r=eval(e);
    }
    if(!r){alert('err: '+r);return}
    if(!r.test(o.value)){alert(o.getAttribute('patternAlert'));o.focus();return}
  }
  if(o.id&&o.type!='submit'&&o.type!='reset')s+='&'+o.id+'='+encodeURIComponent(o.value)}return s
}

