﻿
var xmlHttp;


//根据ID获取指定对象
function $(e) 
{
   return document.getElementById ? document.getElementById(e) : null;
}

//加载帮助列表
function HelpCenterInit(pageNum)
{
    $("helpCt").style.display="none";
    var selStr=escape($("searchzi").value);
    var url="Help_process.aspx?action=HelpCenterInit&page="+pageNum+"&search="+selStr;
    CreateXmlHttp();
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = function()
        {
            if (xmlHttp.readyState == 4)
            {
                if(xmlHttp.status==200)
                {
                    $("InfoHelp").style.display="block";//显示帮助
                    var args=xmlHttp.responseText.split('<#5izd#>');
                    $("helpList").innerHTML=args[0];
                    $("helpPage").innerHTML=args[1]; 
                    document.title ="帮助中心 - 医药终端网";//创建当前title                   
                }
            } 
        }    
        xmlHttp.send(null);    
}
//显示特定的帮助信息
//参数:
    //type,now,prePage,nextPage
    //类型,当前页,前一页,后一页
function HelpInfo(type,np,prep,nextp)
{
    if(type=="content")
    {
       $("helpCt").style.display="block";
       var url="Help_process.aspx?action=HelpContent&Npage="+np+"&Ppage="+prep+"&Nxpage="+nextp;
       CreateXmlHttp();
       xmlHttp.open("GET",url,true);
       xmlHttp.onreadystatechange = function()
        {
            if (xmlHttp.readyState == 4)
            {
                if(xmlHttp.status==200)
                {
                    var args=xmlHttp.responseText.split('<#5izd#>');
                    if(args.length>2)
                    {
                        $("helpList").innerHTML=args[0];//当前标题
                        $("helpCt").innerHTML=args[1];//当前内容
                        $("helpPage").innerHTML=args[2];//前后页
                    }else
                    {
                        $("helpList").innerHTML=xmlHttp.responseText;
                    }
                }
            } 
        }    
        xmlHttp.send(null);    
    }
}
//清理查询问题
function ClearSearch()
{
    $("searchzi").value="";
    HelpCenterInit(1);
}
//创建xmlHttp对象
function CreateXmlHttp()
{
	try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
	catch (e) { try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
	catch (e) { try { xmlHttp = new XMLHttpRequest(); }
	catch (e) { xmlHttp = false; }}}
}
