﻿// 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;
var is_IE=(navigator.appName=="Microsoft Internet Explorer");//判读是否为ie浏览器
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>');

function isSearch_hots(cons)
{    
    if(cons != null && cons != "")
    {
        var strUrl = root + "Search.aspx?cons=" + escape(cons);
        this.location.href=strUrl;
    }
}
function isSearch_lists()
{    
    var txtS = document.getElementById('txtSou'); 
    if(txtS != null)
    {
        if(txtS.value == "")
        {
            alert("请输入要搜索的关键词！");
            txtS.focus();
        }
        else
        {
            var strUrl = root + "Search.aspx?cons=" + escape(txtS.value);
            this.location.href=strUrl;
        }
    }
}
function overClass(obj,classname)
{
    if(typeof(obj) != "object"){obj=document.getElementById(obj);}
    window.clearTimeout(obj.tmExpand);
    if(obj.className != classname)
    {obj.className = classname;}
}
function outClass(obj,classname)
{
    if(typeof(obj) != "object"){obj=document.getElementById(obj);}
    obj.tmExpand = window.setTimeout( "document.getElementById('" + obj.id + "').className = '" + classname + "';", 100);
}
function overMenu(obj)
{
    var index = obj.getAttribute("mIndex") - 0;
    var menu = document.getElementById('iMenu_' + index);
    if(menu != null)
    {
        if(menu.className.indexOf("O") > 0)
            return;
        menu.className += "O";
        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);
                openMenu(divMenu);
            }
//            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 tempClass = menu.className.replace("O","");
        if(menu.className != tempClass)
            menu.className = tempClass;
        if(index > 0)
        {
            var divMenu = document.getElementById('divMenu_' + index);
            if(divMenu != null)
                divMenu.tmExpand = window.setTimeout("closeMenu(document.getElementById('divMenu_" + index + "'));",100);//document.getElementById('divMenu_" + index + "').style.display = 'none';", 100);
        }
    }
}
function openMenu(obj)
{
	if(obj.tmExpand) 
	    window.clearTimeout(obj.tmExpand); // 如果有定时器，则清除先
	obj.style.display = "";
	return;
    //fadeIn(divMenu.id,2,0);
	obj.resize = 0;    // 扩展
	if(is_IE)
	{
	    ExpansionHeightIE(obj);
	    //ExpansionWidthIE(obj);
	}
	else
	{
	    ExpansionHeightFireFox(obj);
	    //ExpansionWidthFireFox(obj);
	}
}
function closeMenu(obj)
{
	if(obj.tmExpand) 
	    window.clearTimeout(obj.tmExpand); // 如果有定时器，则清除先
	obj.style.display = "none";
	return;
	obj.resize = -1;	//收缩
	if(is_IE)
	{
	    ExpansionHeightIE(obj);
	    //ExpansionWidthIE(obj);
	}
	else
	{
	    ExpansionHeightFireFox(obj);
	    //ExpansionWidthFireFox(obj);
	}
	obj.setAttribute("callback","document.getElementById('"+obj.id+"').style.display = 'none';");
}
function initMenu()
{
    if(nowPageIndex > -1 && nowPageIndex < 5)//nowPageIndex此变量是在MasterPage母版页中设定
    {
        var menu = document.getElementById('iMenu_' + nowPageIndex);
        if(menu != null)
            menu.className = menu.className + "O";
    }
    for(var i = 0;i < 5 ;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 display_div(item,v,count,class1,class2)
{
	for(var i = 1; i <= count ; i++)
	{
		show_div(item,v,i,class1,class2);
	}
}
function show_div(item,v,index,class1,class2)
{
	var div = document.getElementById('div' + item + '_' + index);
	var span = document.getElementById('i' + item + '_' + index);
	var divm = document.getElementById('divm' + item + '_' + index);
	if(div != null)
	    div.style.display='none';
	span.className =class2;
	if(divm != null)
		divm.style.display='none';
	if(v == index)
	{
	    if(div != null)
		    div.style.display='block';
		span.className =class1;
		if(divm != null)
			divm.style.display='block';
	}
}


//点击在线客服事件
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('<script language="javascript" src="'+root+'js/swfobject.js"></script>');
