﻿//CreateXmlhttp函数会根据不同的浏览器初始化个xmlhttp对象
    function CreateXmlhttp()
    {
        var A=null; 
        try 
        { 
            A=new ActiveXObject("Msxml2.XMLHTTP"); 
        } 
        catch(e)
        { 
            try 
            { 
                A=new ActiveXObject("Microsoft.XMLHTTP"); 
            }
            catch(oc)
            { 
                A=null 
            } 
        } 
        if ( !A && typeof XMLHttpRequest != "undefined" ) 
        { 
            A=new XMLHttpRequest() 
        } 
        return A 
    }
//checkSubmit()//判断提交数据是否合法
function checkSubmit(id)
{
   if(document.getElementById(id).value=="")
   {
	   alert("请输入搜索关键字!");
	   return false;
	}
}


//ajaxart
function ajaxart(url,div)
{//function 
  
  var xmlHttp = CreateXmlhttp();
  if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0) 
  {	
  
      var weburl = url;
      xmlHttp.open("get",weburl, true);   
	  
	  xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	  
	  xmlHttp.onreadystatechange = function () 
      { 
        if (xmlHttp.readyState == 4) 
        { 
          if (xmlHttp.status == 200) 
          { 
		    var result = xmlHttp.responseText;//得到服务器返回的数据
			
		    document.getElementById(div).innerHTML=result;
			
		  }//200
		  
	    }//4
	  }
  }//4||0
  xmlHttp.send(null); 
}//function



//keys 阅读
function keys(id)
{
	
   url="showArtKeys.aspx?id="+id+"&rand="+Math.random();
   ajaxart(url,"keys");
   
}

//abouts 相关新闻 相关推荐
function about(id,bigid,smallid,smalls,todo,div)
{
	
    url="showArtAbout.aspx?bigid="+bigid+"&smallid="+smallid+"&smalls="+smalls+"&todo="+todo+"&id="+id+"&rand="+Math.random();
    ajaxart(url,div);
}
//iframe 自动高度
//iframeName:框架ID
function SetIframeSize(iframeName) 
{
  var iframe = document.getElementById(iframeName);
  try 
  {
		var bHeight = iframe.contentWindow.document.body.scrollHeight;
		var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
		//据说这两个高度可能不一样
		var height = Math.max(bHeight, dHeight);
		iframe.height =height;
  }
  catch (ex)
  {
  }
} 

