﻿// JScript 文件
//导航栏样式加载

function menu_load()
{
    var str_url=window.location.href;  //获取url
    var str_class1=/class=hm/;           //获取参数
    str_class1.exec(str_url);
    var str_class=RegExp.rightContext;
    str_class=str_class.substring(0,1);
    if(parseInt(str_class)>= 0 && parseInt(str_class)<=9)
    {
        document.getElementById("td_menu"+str_class).style.background="url(/images/style/menu_over.gif) no-repeat center top";
        document.write("<style type='text/css'>#td_menu"+str_class+" a{color:#e67817; padding-top:13px; height:22px;}</style>");
    }
    else
    {
        document.getElementById("td_menu1").style.background="url(/images/style/menu_over.gif) no-repeat center top";
        document.write("<style type='text/css'>#td_menu1 a{color:#e67817; padding-top:13px; height:22px;}</style>");
    }
}

//导航栏链接生成
function menu_link(str_menu_id)
{
    var str_menu_index;
    str_menu_index=str_menu_id.substring(7,8);
    if(str_menu_index == "1")
    {
        location.href = "/";
    }
    else
    {
        location.href = "/?class=hl_mn" + str_menu_index;
    }
}

//
function pic_link(str_id)
{
    document.getElementById(str_id).className="img_hm_btn2";
    switch (str_id)
    {
        case "img_pic_lnk1":
            window.location.href = "/index/hm4.aspx";
            break;
        case "img_pic_lnk2":
            window.location.href = "/index/hm5/hl1.aspx";
            break;
        case "img_pic_lnk3":
            window.location.href = "/index/hm5/hl2.aspx";
            break;
        default:
            window.location.href = "/index/hm7.aspx";
            break;
    }
}

//
function change_display(str_list_id)
{
    if(document.getElementById(str_list_id).style.display == "")
    {
        document.getElementById(str_list_id).style.display = "none";
    }
    else
    {
        document.getElementById(str_list_id).style.display = "";
    }
}

//产品显示页面鼠标经过小图片时改变样式且改变大图src
function image_change(str_di_id)
{
  try
  {
  document.getElementById("div_pd_1").className="div_pd_img1";
  }
  catch(err){}
  try
  {
document.getElementById("div_pd_2").className="div_pd_img1";
  }
  catch(err){}
  try
  {
document.getElementById("div_pd_3").className="div_pd_img1";
  }
  catch(err){}
document.getElementById(str_di_id).className="div_pd_img2";
var str_im_id;
str_im_id=str_di_id.replace("div","img");
document.getElementById("img_pd_b").src = document.getElementById(str_im_id).src;
}

function show_big_pdimg()
{
document.getElementById("div_pd_bb").style.display="";
document.getElementById("img_pd_bb").src = document.getElementById("img_pd_b").src;
}

function menu_list_display() 
{ //v9.0
    var i,p,v,obj,args=menu_list_display.arguments;
    for (i=0; i<(args.length-2); i+=3) 
    with (document)
    if (getElementById && ((obj=getElementById(args[i]))!=null))
    {
    v=args[i+2];
    if (obj.style)
    { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v;
    }
}

function div_locat()
{
    for(var ii = 2; ii <= 9; ii++ )
    {
        try
        {
            var obj_ls = document.getElementById("div_td_menu" + ii);
            var iwidth = parseInt(obj_ls.style.width.replace("px",""));
            var ileft = obj_ls.offsetLeft;
            var str_page_trim = (document.body.clientWidth - 968) / 2;
            if((iwidth + ileft) > (str_page_trim + 968))
            {
                obj_ls.style.right = str_page_trim + 1 + "px";
            }
        }
        catch(err){}
    }
}

//
function tag_onfocus(str_id)
{
    document.getElementById("td_tag_1").className="td_tag";
    document.getElementById("td_tag_2").className="td_tag";
    document.getElementById("td_tag_3").className="td_tag";
    document.getElementById(str_id).className="td_tag2";
    try
    {
        document.getElementById("div_td_tag_1").style.display = "none";
        document.getElementById("div_td_tag_2").style.display = "none";
        document.getElementById("div_td_tag_3").style.display = "none";
    }
    catch(err)
    {}
    document.getElementById("div_" + str_id).style.display = "";
}

//
function td_n_menu_style()
{
    var str_url=window.location.href;  //获取url
    var str_class1=/class=hm/;           //获取参数
    str_class1.exec(str_url);
    var str_class=RegExp.rightContext;
    str_class=str_class.substring(0,1);
    if(str_class == "1" || str_class == "" || str_class == null)
    {
        document.getElementById("td_left_1").style.width="150px";
        document.getElementById("td_left_2").style.width="818px";
    }
    else
    {
        document.getElementById("td_left_1").style.width="270px";
        document.getElementById("td_left_2").style.width="698px";
        document.getElementById("td_leftmenu_" + str_class).style.background = "url(/images/style/left_menu_over.gif)";
        document.getElementById("div_td_leftmenu_" + str_class).style.visibility="visible";
    }
}

//
function leftmenu_list_show(str_id)
{
    
    for(var i=0;i<=9;i++)
    {
        try
        {
            document.getElementById("div_td_leftmenu_" + i).style.visibility="hidden";
            document.getElementById("td_leftmenu_" + i).style.background="url(/images/style/left_menu_out.gif)";
        }
        catch(err)
        {}
    }
    document.getElementById("div_" + str_id).style.visibility="visible";
    document.getElementById(str_id).style.background = "url(/images/style/left_menu_over.gif)";
}

//
function qiehuan(num){
	for(var id = 0;id<=9;id++)
	{
		if(id==num)
		{
			document.getElementById("qh_con"+id).style.display="block";
			document.getElementById("mynav"+id).className="nav_on";
		}
		else
		{
    		try
    		{
			    document.getElementById("qh_con"+id).style.display="none";
			    document.getElementById("mynav"+id).className="";
		    }
		    catch(err){}
		}
	}
}

//search text box on click to clear text
function srh_text_click(str_id)
{
    try
    {
        var obj = document.getElementById(str_id);
        if(obj.value == "站内搜索")
        {
            obj.value = "";
            obj.style.color = "#444444";
        }
        else if(obj.value == "")
        {
            obj.value = "站内搜索";
            obj.style.color = "#aaaaaa";
        }
    }
    catch(Error){}
}

