﻿// JScript 文件
var root = "/";
var nowPage = "";//当前页面名称！
if(nowPageIndex == undefined)//此变量定义的是当前页面编号，是在MasterPage母版页中设定,此处判断是否设定了此变量，如果没有则初始化，1000为其它页面
    var nowPageIndex = 1000;
function isAgent(s)   
{   
	if(navigator.userAgent.indexOf(s) == -1)
		return false;
	else
		return true;
}
var isIE6 = false;
var isFirefox = false;
if(isAgent("MSIE 6.0"))
{
    document.write('<script language="javascript" src="'+root+'js/png.js"></script>');
    //document.write('<script language="javascript" src="'+root+'js/no-jquery.js"></script>');
    isIE6 = true;
}
else if(isAgent("MSIE 7.0"))
{
}
else if(isAgent("MSIE 8.0"))
{
}
else if(isAgent("Firefox"))
{
    isFirefox = true;
}
else
{}

document.write('<script language="javascript" src="'+root+'js/g.js"></script>');


var searchIndex = 1;
function isSearchs()
{    
    var txtS = document.getElementById('divSearch_' + searchIndex); 
    if(txtS != null)
    {
        if(txtS.value == "" || txtS.value == "输入要搜索的会展关键词" || txtS.value == "输入要搜索的展品关键词" || txtS.value == "输入要搜索的展商关键词" || txtS.value == "输入要搜索的资讯关键词")
        {
            var searchTS = "输入要搜索的关键词";
            if(txtS.value != "")
                searchTS = txtS.value;
            alert(searchTS);
            txtS.focus();
        }
        else
        {
            var strUrl = root;
            if(searchIndex==1)
                 strUrl += "ExpoLists.aspx?cons=";
            else if(searchIndex==2)
                strUrl += "ProductsLists.aspx?cons=";
            else if(searchIndex==3)
                strUrl += "StoreLists.aspx?cons=";
            else if(searchIndex==4)
                strUrl += "Lists.aspx?cons=";

            this.location.href = strUrl + escape(txtS.value);
        }
    }
}
function overClass(obj,classname)
{
    window.clearTimeout(obj.tmExpand);
    obj.className = classname;
}
function outClass(obj,classname)
{
    obj.tmExpand = window.setTimeout( "document.getElementById('" + obj.id + "').className = '" + classname + "';", 10);
}
function overMenu(obj)
{
    var index = obj.getAttribute("mIndex") - 0;
    var menu = document.getElementById('iMenu_' + index);
    if(menu != null)
    {
        if(menu.src.indexOf("_1.gif") > 0)
            return;
        var tempSrc = menu.src.replace(".gif","_1.gif");
        if(menu.src != tempSrc)
            menu.src = tempSrc;
        if(index > 0)
        {
            var divMenu = document.getElementById('divMenu_' + index);
            if(divMenu != null)
            {
                if(divMenu.getAttribute("mIndex") == null || divMenu.getAttribute("mIndex") == undefined)
                {
                    divMenu.setAttribute("mIndex",index);
                    divMenu.onmouseover = function(){overMenu(this);};
                    divMenu.onmouseout = function(){outMenu(this);};
                }
                window.clearTimeout(divMenu.tmExpand);
                //fadeIn(divMenu.id,2,0);
                divMenu.style.display = "";
            }
//            for(var i = 1;i <=9; i++)//隐藏除当前菜单外的其它菜单列表
//            {
//                if(index != i)
//                {
//                    divMenu = document.getElementById('divMenu_' + i);
//                    if(divMenu != null)
//                        divMenu.style.display = 'none';
//                }
//            }
        }
    }
}
function outMenu(obj)
{
    var index = obj.getAttribute("mIndex") - 0;
    var menu = document.getElementById('iMenu_' + index);
    if(menu != null)
    {
        var tempSrc = menu.src.replace("_1.gif",".gif");
        if(menu.src != tempSrc)
            menu.src = tempSrc;
        if(index > 0)
        {
            var divMenu = document.getElementById('divMenu_' + index);
            if(divMenu != null)
                divMenu.tmExpand = window.setTimeout("document.getElementById('divMenu_" + index + "').style.display = 'none';", 100);
        }
    }
}
function initMenu()
{
    if(nowPageIndex > -3 && nowPageIndex < 10)//nowPageIndex此变量是在MasterPage母版页中设定
    {
        var menu = document.getElementById('iMenu_' + nowPageIndex);
        if(menu != null)
            menu.src = menu.src.replace(".gif","_1.gif");
    }
    for(var i = -2;i < 10 ;i++)
    {
        if(nowPageIndex != i)
        {
            var menu = document.getElementById('iMenu_' + i);
            if(menu != null)
            {
                menu.setAttribute("mIndex",i);
                menu.onmouseover = function(){overMenu(this);};
                menu.onmouseout = function(){outMenu(this);};
            }
        }
    }
}

function showObj(id)
{
    var obj = document.getElementById(id);
    if(obj)
    {
        window.clearTimeout(obj.tmExpand);
        obj.style.display = "";
    }
}
function hideObj(id)
{
    var obj = document.getElementById(id);
    if(obj)
        obj.tmExpand = window.setTimeout( "document.getElementById('" + id + "').style.display = 'none';", 100);
}

//点击在线客服事件
function clickCallWo()
{
    var aCallWo = document.getElementById('divCallWo').getElementsByTagName('a');
    if(aCallWo.length > 0)
    {
        if(document.all)  
            aCallWo[0].click();
        else  
        {  
            var evt = document.createEvent("MouseEvents");  
            evt.initEvent("click",   true,   true);  
            aCallWo[0].dispatchEvent(evt);  
        }
    }  
}


//if(nowPageIndex != 0)
//    document.write('<link href="'+root+'css/style1.css" rel="stylesheet" type="text/css" />');
document.write('<link href="'+root+'css/my.css" rel="stylesheet" type="text/css" />');
//document.write('<link href="http://www.suqian.cm/css/newyear2011.css" rel="stylesheet" type="text/css" />');
