var xmlhttp = null;

function loadAjaxDataAsynchronousV(url,gofun){
   xmlhttp = CreateRequestObj();
   if(xmlhttp == null){
   	   alert("加载ActiveXObject失败1");
   }else{
       xmlhttp.open("get",url,true);
       xmlhttp.onreadystatechange = function(){ 
          var html="";
          try{
             if(xmlhttp.readyState==4){
	            if(xmlhttp.status==200){
	               html = xmlhttp.responseText;
	               xmlhttp = null;
	               eval(gofun+"(html);");
                }else if(xmlhttp.status==500){
	     	       xmlhttp = null;
	     	       alert("数据加载失败");
                }
             }
          }catch(e){
   	         alert("加载ActiveXObject失败2");
          }
       }
       xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
       xmlhttp.send(null);
   }
}

function loadAjaxDataAsynchronous(url){
   xmlhttp = CreateRequestObj();
   if(xmlhttp == null){
   	   alert("加载ActiveXObject失败1");
   }else{
       xmlhttp.open("get",url,true);
       xmlhttp.onreadystatechange = Myreadystatechange;
       xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
       xmlhttp.send(null);
   }
} 

function Myreadystatechange(){
   var html="";
   var isay = 0;
   try{
      if(xmlhttp.readyState==4){
	     if(xmlhttp.status==200){
	        html = xmlhttp.responseText;
	        xmlhttp = null;
	        GetIkbaoXmlDate(html);
	     }else if(xmlhttp.status==500){
	     	xmlhttp = null;
	     	alert("加载ActiveXObject失败1");
	     }else{
	     	xmlhttp = null;
	     	alert("加载ActiveXObject失败11");
	     }
      }
   }catch(e){
   	  //alert("加载ActiveXObject失败2");
   }
}

function loadAjaxDataSynchronization(url){
   var html = "";
   var request = CreateRequestObj();
   if(request == null){
   	   return "加载AXO失败";
   }else{
       request.onreadystatechange = function(){
          if(request.readyState==4){
	         if(request.status==200){
	            html = request.responseText;
	         }else if(request.status==500){
	            html = "数据加载失败";
	         }
          }
       };
       request.open("get",url,false);
       request.send(null);
       request = null;
       return html;
   }
} 

function CreateRequestObj(){
   var objXMLHttp = null;
   if (window.XMLHttpRequest){
      objXMLHttp = new XMLHttpRequest();
   }else{
      var MSXML = ['MSXML2.XMLHTTP.5.0', 'MSXML2.XMLHTTP.4.0', 'MSXML2.XMLHTTP.3.0', 'MSXML2.XMLHTTP', 'Microsoft.XMLHTTP'];
      for(var n=0; n<MSXML.length; n++){
         try{
            objXMLHttp = new ActiveXObject(MSXML[n]);
            break;
         }catch(e){}
      }
   }
   return objXMLHttp;
}

function GetRands(){
   var now= new Date(); 
   var year=now.getYear(); 
   var month=now.getMonth()+1; 
   var day=now.getDate(); 
   var hour=now.getHours(); 
   var minute=now.getMinutes(); 
   var second=now.getSeconds(); 
   return year+""+month+""+day+""+hour+""+minute+""+second;
}

function iframeAuto(){
  try{
     if(window!=parent){//定位需要调整的frame框架（在父级窗口中查找）
       var a = parent.document.getElementsByTagName("IFRAME");
       for(var i=0; i<a.length; i++){
          if(a[i].contentWindow==window){
             var h1=0, h2=0;
             a[i].parentNode.style.height = a[i].offsetHeight +"px";
             a[i].style.height = "10px";              //首先设置高度为10px,后面会修改
             if(document.documentElement&&document.documentElement.scrollHeight){
                h1=document.documentElement.scrollHeight;
             }
             if(document.body) h2=document.body.scrollHeight;
             var h=Math.max(h1, h2);               //取两者中的较大值
             if(document.all) {h += 4;}
             if(window.opera) {h += 1;}//调整框架的大小
             h+=100;
             a[i].style.height = a[i].parentNode.style.height = h +"px";
          } 
       } 
     }
  }catch (ex){}
}

function IframeAutoHeight(){
  //事件绑定的方法，支持IE5以上版本
  if(window.attachEvent){
    window.attachEvent("onload", iframeAuto);
  }else if(window.addEventListener){
    window.addEventListener('load', iframeAuto, false);
  }
}