﻿// Ajax共用文件

var xmlHttp;
var methord;
function createXMLHttpRequest(url)
{
    if(window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        methord="post";
    }
    else if(window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
        methord="get";
    }
    xmlHttp.onreadystatechange=XmlOnReadyStateChange;
    xmlHttp.open(methord,url,false);
    xmlHttp.send(null);
    return XmlOnReadyStateChange();
}
function createTextHttpRequest(url)
{
    if(window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        methord="post";
    }
    else if(window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();
        methord="get";
    }
    xmlHttp.onreadystatechange=TextOnReadyStateChange;
    xmlHttp.open(methord,url,false);
    xmlHttp.send(null);
    return TextOnReadyStateChange();
}
//返回为text
function TextOnReadyStateChange()
{
    var code;
    if(xmlHttp.readyState ==4)
    {
        if(xmlHttp.status==200)
        {
            code = xmlHttp.responseText;
        }
    }
    return code;
}
//返回xml数据
function XmlOnReadyStateChange()
{
    var code;
    if(xmlHttp.readyState ==4)
    {
        if(xmlHttp.status==200)
        {
            code = xmlHttp.responseXml;
        }
    }
    return code;
}

/**展示头部行业菜单**/
function ShowAllChannel(_this,id,bgleft,bgtop1,bgtop2){
	document.getElementById(id).style.display="block";
	var bgpos1 = bgleft + " " + bgtop1;
	var bgpos2 = bgleft + " " + bgtop2;
	document.getElementById(id).onmouseover=function(){this.style.display="block";_this.style.backgroundPosition=bgpos1;}
	document.getElementById(id).onmouseout=function(){this.style.display="none";_this.style.backgroundPosition=bgpos2;}
	_this.style.backgroundPosition=bgpos1;
	_this.onmouseout=function(){document.getElementById(id).style.display="none";_this.style.backgroundPosition=bgpos2;}
	_this.onmouseout=function(){document.getElementById("font1").style.display="block";
	                            document.getElementById("font2").style.display="none";}
}
function ShowimagesChanne1(){
	document.getElementById("font2").style.display="block";
	document.getElementById("font1").style.display="none";
}
function ShowimagesChanne2(){
	document.getElementById("font1").style.display="block";
	document.getElementById("font2").style.display="none";
}