﻿function SetProductType(product_setter)
{
    document.getElementById("QuickSearchProduct").innerHTML = product_setter.innerHTML;
    document.getElementById("QuickSearchProductList").style.display = "none";
}
function DoSearch()
{
    if (document.getElementById("QuickSearchProduct").innerHTML != "选择类别" && document.getElementById("QuickSearchProductKeyword").value != "" && document.getElementById("QuickSearchProductKeyword").value != "输入产品型号")
    {
        window.location = "ProductSearch.aspx?Product=" + GetProductNum(document.getElementById("QuickSearchProduct").innerHTML) + "&Keyword=" + escape(document.getElementById("QuickSearchProductKeyword").value);
    }
    else
    {
        alert("请选择需要搜索的产品类型,并输入关键字!");
    }
}
function DoSearch_Index()
{
    if (document.getElementById("QuickSearchProduct").innerHTML != "--选择类别--" && document.getElementById("QuickSearchProductKeyword").value != "" && document.getElementById("QuickSearchProductKeyword").value != "输入产品型号")
    {
        window.location = "ProductSearch.aspx?Product=" + GetProductNum(document.getElementById("QuickSearchProduct").innerHTML) + "&Keyword=" + escape(document.getElementById("QuickSearchProductKeyword").value);
    }
    else if (document.getElementById("QuickSearchProduct").innerHTML != "--选择类别--")
    {
    
    if (parseInt(GetProductNum(document.getElementById("QuickSearchProduct").innerHTML))==11)
    {window.location = "MeetingIndex.aspx?ObjectID=155";}
    else{
        window.location = "ProductIndex.aspx?ObjectID=" + (parseInt(GetProductNum(document.getElementById("QuickSearchProduct").innerHTML)) + 11).toString();
   }
    }
    else
    {
        alert("请选择需要搜索的产品类型,并输入关键字!");
    }
}
function HotProductKeyword(keyword_box)
{
    if (keyword_box.value == "输入产品型号")
    {
        keyword_box.value = "";
    }
}
function CoolProductKeyword(keyword_box)
{
    if (keyword_box.value == "")
    {
        keyword_box.value = "输入产品型号";
    }
}
function ShowDrop(dropdown_id)
{
    document.getElementById(dropdown_id + "List").style.width = (parseInt(document.getElementById(dropdown_id).style.width) + 25).toString() + "px";
    document.getElementById(dropdown_id + "List").style.display = (document.getElementById(dropdown_id + "List").style.display=="none"?"":"none");
}
function LightenDropDownItem(dropdown_item)
{
    dropdown_item.style.backgroundColor = "#ebebeb";
    dropdown_item.style.color = "#767676";
}
function UnLightenDropDownItem(dropdown_item)
{
    dropdown_item.style.backgroundColor = "";
    dropdown_item.style.color = "";
}
function LightenDropDown(dropdown_item)
{
    dropdown_item.style.backgroundColor = "#ebebeb";
    dropdown_item.style.backgroundImage = "url(../Images/Common/DropDownBG_Hover.gif)";
    dropdown_item.style.backgroundPosition = "right center";
    dropdown_item.style.backgroundRepeat = "no-repeat";
}
function UnLightenDropDown(dropdown_item)
{
    dropdown_item.style.backgroundColor = "";
    dropdown_item.style.backgroundImage = "url(../Images/Common/DropDownBG.gif)";
    dropdown_item.style.backgroundPosition = "right center";
    dropdown_item.style.backgroundRepeat = "no-repeat";
}
function SetClick(dropdown_item,product_setter)
{

 document.getElementById(product_setter).innerHTML = dropdown_item.innerHTML;
 $("#"+product_setter).attr("val",$(dropdown_item).attr("val"));
 document.getElementById(product_setter+"List").style.display = "none";
 //alert( $("#"+product_setter).attr("val"));
}
function toLanguage(strValue)
{
document.getElementById("GlobalYamahaList").style.display = "none";
document.getElementById("aLink").href=strValue;
document.getElementById("aLink").click();
}

function SetProductSort(product_setter)
{
 document.getElementById("QuickSearchProduct").innerHTML = product_setter.innerHTML;
document.getElementById("QuickSearchProductList").style.display = "none";

var sortid= $(product_setter).attr("val");
$("#QuickSearchProduct").attr("val",sortid);
if (sortid!=19)
{

 $("#productsubList").html("<img src=\"images/load.gif\">");
 var send_data = "action=getProductSub&pid="+sortid;
          strUrl="ajaxForServices.aspx"  
            //alert(send_data);
			$.ajax({
			type:"post",
			url:strUrl,
			data:send_data,
			success: function(msg)
			{
		    if (msg) $("#productsubList").html(msg);
		
			}
			
			});
}


}
function doSearchProduct()
{
var sortid= $("#QuickSearchProduct").attr("val");
var subid=$("#productsub").attr("val");
var sKeyword=$("#keyword").val();
if (sortid==19)
{
window.location = "/avit/ProductSearch.aspx?Keyword=" +sKeyword;
}
else
{
window.location = "ProductSearchbysub.aspx?sortid="+sortid+"&subid="+subid+"&Keyword=" +sKeyword;
}
}