﻿document.write("<script src='/aspx/iplimit.aspx?s=" + Math.random() + "'><\/script>"); 
function $(TID)
{
    return document.getElementById(TID);
}

function ShowSubMenu(show_id,hide_ids)
{
    if(hide_ids != "")
    {
        for(var i=0;i<hide_ids.split(",").length;i++)
        {
            try
            {
                $(hide_ids.split(",")[i]).style.display='none';
            }catch(e){}
        }
    }
    
    try
    {
        $(show_id).style.display='block';
    }
    catch(e){}
}


function Search_Click()
{
    var str=$("SearchStr").value;
    if(str == "")
    {return;}
    location.href ="/aspx/Search.aspx?Key="+str;
}


function showBgImage(index)
{
try
{
    $("mainNav").getElementsByTagName("li")[index].id="current";
}
catch(e){}
}

// JScript 文件
function getCookie (sCookieName)
{
    var sName=sCookieName+"=", ichSt, ichEnd;
    var sCookie=document.cookie;

    if ( sCookie.length && ( -1 != (ichSt = sCookie.indexOf(sName)) ) )
    {
        if (-1 == ( ichEnd = sCookie.indexOf(";",ichSt+sName.length) ) )
            ichEnd = sCookie.length;
        return unescape(sCookie.substring(ichSt+sName.length,ichEnd));
    }
    
    return null;
}
   
function setCookie (sName, vValue)
{
    var argv = setCookie.arguments, argc = setCookie.arguments.length;
    var sExpDate = (argc > 2) ? "; expires="+argv[2].toGMTString() : "";
    var sPath = "; path=/";// (argc > 3) ? "; path="+argv[3] : "";
    var sDomain = (argc > 4) ? "; domain="+argv[4] : "";
    var sSecure = (argc > 5) && argv[5] ? "; secure" : "";
    document.cookie = sName + "=" + escape(vValue,0) + sExpDate + sPath + sDomain + sSecure + ";";
}
    
function deleteCookie (sName)
{
    document.cookie = sName + "=" + getCookie(sName) + "; expires=" + (new Date()).toGMTString() + ";";
}

//------------------------------------

//function setProductInqurie(pid,ask)
//{
//    var oldCookie = getCookie("InquireList")==null?"":getCookie("InquireList");
//    if(pid.replace(" ","") != "" && oldCookie.indexOf(pid+",")<0)
//    {
//        setCookie("InquireList",oldCookie+pid+",");
//    }
//    if(ask==true)
//    {
//        if(window.confirm("Inquiry for the product was submitted successfully. Shift to the page of products inquired ?"))
//        {
//            location.href="/aspx/InquiryBasket.aspx";
//        }
//    }
//}
function setProductInqurie(pid,ask)
{
if(ask == true){
    setCookie("InquireList",pid+",");
    location.href="/aspx/Products_Feedback.aspx";
}else{
    var oldCookie = getCookie("InquireList")==null?"":getCookie("InquireList");
    if(pid.replace(" ","") != "" && oldCookie.indexOf(pid+",")<0)
    {
        setCookie("InquireList",oldCookie+pid+",");
    }
}
}
function selectAll()
{
    var cbs = document.getElementsByName("CheckBox_Prod");

    var check_ids = "";
    for(var i=0;i<cbs.length;i++)
    {
        if(cbs[i].checked == true)
        {
            check_ids += cbs[i].value+",";
            setProductInqurie(cbs[i].value,false);
        }
    }
    //alert(getCookie("InquireList"));
    if(check_ids != "")
    {
        if(window.confirm("Inquiry for the product was submitted successfully. Shift to the page of products inquired ?"))
        {
            location.href="/aspx/InquiryBasket.aspx";
        }
    }
    else
    {
        alert("Pls select products");
    }
    //
    //event.returnValue = false;
    return false;
}

function pcSearch()
{
    var maxtype=$("ProdClassSearch1_drtype");
    var _id = maxtype.options[maxtype.selectedIndex].value;
    var id = _id.replace("max_","").replace("min_","");
    //
    var key = document.getElementById("ProdClassSearch1_KeyText1").value;
    if(_id.indexOf("min")>=0)
    {
        location.href = "/aspx/Search.aspx?cid="+id+"&key="+key;
    }
    else if(_id.indexOf("max")>=0)
    {
        location.href = "/aspx/Search.aspx?maxid="+id+"&key="+key;
    }
    else
    {
        if(key=="")
        {return;}
         location.href = "/aspx/Search.aspx?key="+key;
    }
}
function clickThisImg(Name)
{
    
    $("Img").src="/UserFiles/Image/"+Name;
}

function chgH3_Style(id)
{
    try
    {  
    $( id ).className="sub";
    }catch(e){}
}

function chgH4_Style(id)
{
    try
    {  
    $( id ).className="sub";
    }catch(e){}
}

function showContent(obj,a_id)
{
    var ps = "p_Description,p_Specification,p_Picture,p_Case";
    for(var i=0;i<ps.split(",").length;i++)
    {
        try
        {
            $(ps.split(",")[i]).style.display = "none";
        }
        catch(e){}
    }
    obj.style.display = "block";
    
    //
    var as="a_show_Description,a_show_Specification,a_show_Picture,a_show_Case,";//background:#EBF1F8; color:#2E3192;
    for(var i=0;i<as.split(",").length;i++)
    {
        try
        {
            $(as.split(",")[i]).style.background = "#7298CB";
            $(as.split(",")[i]).style.color = "#FFFFFF";
        }
        catch(e){}
    }
    $(a_id).style.backgroundColor = "#EBF1F8";
    $(a_id).style.color = "#2E3192";
    try{
    window.event.returnValue =false;
    }catch(e){}
    return false;
}

function suckerfish(type, tag, parentId) {
	if (window.attachEvent) {
		window.attachEvent("onload", function() {
			var sfEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
			type(sfEls);
		});
	}
}

hover = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" hover";	
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" hover\\b"), "");
		}
	}
}
