function GetValueReadio_CheckBox(GetName,InputType)
{  
  var GetValue; GetValue = "";
  var InputName = document.getElementsByName(GetName);
    var LenInput = InputName.length;
  if (LenInput<=0){   
    return GetValue;
  }
  else
  {
    for(var i=0;i<LenInput;i++){
      if(InputName[i].checked){
        if(InputType.toLowerCase() == "radio"){
          GetValue = InputName[i].value;
          break;
        }
        else
          if(InputType.toLowerCase() == "checkbox"){
          
            GetValue = GetValue + ', ' + InputName[i].value;
          }
          else{
            GetValue = "";
          }

      } 
    } 
  
    if(GetValue.indexOf(", ")!= -1){

      GetValue = GetValue.substring(2,GetValue.length);
    }
  }

  alert("ssssssssss" + GetValue);
  return GetValue;
}



function ShowMenu(ID){
  for(var i=0;i<3;i++){
    if (i==ID)
      document.getElementById("Item_"+i).className="normal";
    else
      document.getElementById("Item_"+i).className="acitve";
  }

  var SearchType;
  switch (ID)
  {
    case 0:
      {
        SearchType = "Product";
        document.getElementById("ItemSearchText").innerHTML = "请输入产品信息：";
        break;
      }
    case 1:
      {
        SearchType = "Article";
        document.getElementById("ItemSearchText").innerHTML = "请输入文章标题：";
        break;
      }
    case 2:
      {
        SearchType = "Agent";
        document.getElementById("ItemSearchText").innerHTML = "请输入公司名称：";
        break;
      }
    default:
      {
        SearchType = "Product";
        document.getElementById("ItemSearchText").innerHTML = "请输入产品型号：";
        break;
      }
  }
  document.ItemSearch.SearchType.value = SearchType;
}

function ShowContent(ID){
  GetPageContent(URLS[ID],"ItemContent","middling_5.gif","AfterShowContent()");
}
function AfterShowContent(){
  ResetLeftMenuHeight();
  var DivID = document.getElementById("SwitchImg");
  if(DivID.src.indexOf("/WebPurchase/images/pic24.gif") != -1){
    document.getElementById("ProductContent").style.width = 776; //582+184+10
  }
  else{
    document.getElementById("ProductContent").style.width = 582;
  }

}
function ShowPHContent(ID){
  if(ID == "PH_Price"){
    document.getElementById("PH_Price").className="PH_Normal";
    document.getElementById("PH_Sale").className="PH_Acitve";
    document.getElementById("PH_Content_Price").className="Show";
    document.getElementById("PH_Content_Sale").className="Hide";
  }
  else if(ID == "PH_Sale"){
    document.getElementById("PH_Sale").className="PH_Normal";
    document.getElementById("PH_Price").className="PH_Acitve";
    document.getElementById("PH_Content_Price").className="Hide";
    document.getElementById("PH_Content_Sale").className="Show";
  }
}
function ShowMore_Article(ID){
  document.getElementById("Hidemore_" + ID).className="Show";
  document.getElementById("HitMore_" + ID).innerHTML = "<a href=# onclick=\"HideMore_Article("+ ID +");\">精简..</a>";
}
function HideMore_Article(ID){
  document.getElementById("Hidemore_" + ID).className="Hide";
  document.getElementById("HitMore_" + ID).innerHTML = "<a href=# onclick=\"ShowMore_Article("+ ID +");\">更多..</a>";
}


//更改产品的排序方式
function ShowOrder(OrderBy,FDItemCode,FDBidChildCode,FDTrademark,FDSysCode){
  if(FDItemCode == ""){
    location.href = "/WebPurchase/productlist.asp?FDBidChildCode=" + FDBidChildCode + "&FDTrademark=" + FDTrademark + "&FDSysCode=" + FDSysCode + "&OrderBy=" + OrderBy;
  }
  else{
    document.Search.OrderBy.value = OrderBy;
    Search_onsubmit();
  }

}
//首页查询表单提交
function ItemSearch_onsubmit()
{
  if(ISInputNull(document.ItemSearch.KeyWord.value)){
    document.ItemSearch.KeyWord.focus();
    alert('请输入关键字!');
    return false;
  }
  document.ItemSearch.submit();
}
//搜索产品表单提交
function Search_onsubmit(HideBidPrice)
{
  //    if(HideBidPrice=="False"){ //True 或 False 第一个字母要大写
  //        if(document.Search.price_range_start && isNaN(document.Search.price_range_start.value)){
  //            document.Search.price_range_start.focus();
  //            alert('您输入的价格范围有误，请重新输入!');
  //            return false;
  //        }
  //        if(document.price_range_end && isNaN(document.Search.price_range_end.value)){
  //            document.Search.price_range_end.focus();
  //            alert('您输入的价格范围有误，请重新输入!');
  //            return false;
  //        }
  //    }

  document.Search.submit();
}
//三级页面详细信息
function ClickMainMeun(ID,FDItemCode,FDProductID,HaveLogin,PriceVote){
  var baseURL = "/td_xxlcpxygh/"
    var AddURL = "?FDItemCode=" + FDItemCode + "&FDProductID=" + FDProductID;

  var WebLinks = new Array(9);
  WebLinks[0] = baseURL + "basic_param" + AddURL; //基本参数
  WebLinks[1] = baseURL + "gys_info" + AddURL;//供应商信息
  WebLinks[2] = baseURL + "price_trend" + AddURL;//价格走势
  WebLinks[3] = baseURL + "product_compare_chooser" + AddURL;//产品比较
  WebLinks[4] = baseURL + "xygh_configuration" + AddURL;//选配件信息
  WebLinks[5] = baseURL + "service" + AddURL;//售后服务
  WebLinks[6] = baseURL + "user_comment" + AddURL;//用户评论
  WebLinks[7] = baseURL + "reference_price" + AddURL;//提供参考价格
  WebLinks[8] = baseURL + "manyi" + AddURL + "&PriceVote=" + PriceVote;//产品价格投票--是否满意


  for(var i=0;i<=7;i++){
    if (i==ID)
      document.getElementById("MainMeun_"+i).className="Normal";
    else
      document.getElementById("MainMeun_"+i).className="Active";
  }
  if (HaveLogin.toUpperCase() == "TRUE" && ID == 2) //查看隐藏类的价格曲线也必须要登录。
  {
    //window.open ('/WebPurchase/PriceLogin.asp','LoginWindow','height=500,width=780,top=20,left=120,toolbar=yes,menubar=yes,scrollbars=no, resizable=yes,location=no, status=yes');
    document.getElementById("AjaxInfo").innerHTML = "<br> &nbsp;<a href=\"/WebPurchase/PriceLogin.asp\" target=\"_blank\">请您先登录</a>..";
  }
  else{
    //GetPageContent(WebLinks[ID],"AjaxInfo","middling_5.gif");
    //jQuery.ajax({async:true, success:function(request){jQuery('#AjaxInfo').html(request);}, url:WebLinks[ID]});
   //  document.getElementById("AjaxInfo").innerHTML = "<img src='/IncludeFile/images/middling_5.gif'/>"
     document.getElementById("AjaxInfo").innerHTML = "<img src='/IncludeFile/images/middling_5.gif'/>"
      new Ajax.Updater('AjaxInfo', WebLinks[ID], {asynchronous:true, evalScripts:true,method:"get"}); 
  }
}

//办公用品三级页面详细信息
function bgypClickMainMeun(ID,FDItemCode,FDProductID,HaveLogin,PriceVote){
    var AddURL = "?FDItemCode=" + FDItemCode + "&FDProductID=" + FDProductID;

    var WebLinks = new Array(9);
    WebLinks[0] = "/td_bgypxygh/basic_param" + AddURL; //基本参数
    WebLinks[1] = "/td_bgypxygh/gys_info" + AddURL;//供应商信息
    WebLinks[2] ="/td_bgypxygh/price_trend" + AddURL;//价格走势
    WebLinks[3] = "/td_bgypxygh/product_compare_chooser" + AddURL;//产品比较
    WebLinks[4] = "/td_bgypxygh/xygh_configuration" + AddURL;//选配件信息
    WebLinks[5] = "/td_bgypxygh/service" + AddURL;//售后服务
    WebLinks[6] = "/td_bgypxygh/user_comment" + AddURL;//用户评论
    WebLinks[7] = "/td_bgypxygh/reference_price" + AddURL;//提供参考价格
    WebLinks[8] = "/td_bgypxygh/manyi" + AddURL + "&PriceVote=" + PriceVote;//产品价格投票--是否满意


    for(var i=0;i<=7;i++){
        if (i==ID)
            document.getElementById("MainMeun_"+i).className="Normal";
        else
            document.getElementById("MainMeun_"+i).className="Active";
    }
    if (HaveLogin.toUpperCase() == "TRUE" && ID == 2) //查看隐藏类的价格曲线也必须要登录。
    {
        //window.open ('/WebPurchase/PriceLogin.asp','LoginWindow','height=500,width=780,top=20,left=120,toolbar=yes,menubar=yes,scrollbars=no, resizable=yes,location=no, status=yes');
        document.getElementById("AjaxInfo").innerHTML = "<br> &nbsp;<a href=\"/WebPurchase/PriceLogin.asp\" target=\"_blank\">请您先登录</a>..";
    }
    else{
        //GetPageContent(WebLinks[ID],"AjaxInfo","middling_5.gif");
        //jQuery.ajax({async:true, success:function(request){jQuery('#AjaxInfo').html(request);}, url:WebLinks[ID]});
        document.getElementById("AjaxInfo").innerHTML = "<img src='/IncludeFile/images/middling_5.gif'/>"
        new Ajax.Updater('AjaxInfo', WebLinks[ID], {asynchronous:true, evalScripts:true});
    }
}

//空调三级页面详细信息
function ktClickMainMeun(ID,FDItemCode,FDProductID,HaveLogin,PriceVote){
  var AddURL = "?FDItemCode=" + FDItemCode + "&FDProductID=" + FDProductID;
  var wsyjURL = "?product_id=" + FDProductID + "&category_id=" + FDItemCode + "&type=chanpin";
  var WebLinks = new Array(9);
  WebLinks[0] = "/td_ktxygh/basic_param" + AddURL; //基本参数
  WebLinks[1] = "/td_ktxygh/gys_info" + AddURL;//供应商信息
  WebLinks[2] ="/td_ktxygh/price_trend" + AddURL;//价格走势
  WebLinks[3] = "/td_ktxygh/product_compare_chooser" + AddURL;//产品比较
  WebLinks[4] = "/td_ktxygh/xygh_configuration" + AddURL;//选配件信息
  WebLinks[5] = "/td_ktxygh/service" + AddURL;//售后服务
  WebLinks[6] = "/td_ktxygh/user_comment" + AddURL;//用户评论
  WebLinks[7] = "/td_ktxygh/reference_price" + AddURL;//提供参考价格
  WebLinks[8] = "/wsdg/show_area" + wsyjURL;//网上订购
  for(var i=0;i<=7;i++){
    if (i==ID)
      document.getElementById("MainMeun_"+i).className="Normal";
    else
      document.getElementById("MainMeun_"+i).className="Active";
  }
  if (HaveLogin.toUpperCase() == "TRUE" && ID == 2) //查看隐藏类的价格曲线也必须要登录。
  {
    document.getElementById("AjaxInfo").innerHTML = "<br> &nbsp;<a href=\"/WebPurchase/PriceLogin.asp\" target=\"_blank\">请您先登录</a>..";
  }
  else{
    document.getElementById("AjaxInfo").innerHTML = "<img src='/IncludeFile/images/middling_5.gif'/>"
      new Ajax.Updater('AjaxInfo', WebLinks[ID], {asynchronous:true, evalScripts:true});
  }
}



//三级页面选择比较产品
function  CheckCompareFormSubmit(FDProductID,FDItemCode){

  var tempID,ProductArray;
  tempID = "";
  document.CompareForm.product_id.value = "";
  tempID = GetValueReadio_CheckBox("cid","checkbox");
  if(ISInputNull(tempID)){
    alert("请选择要比较的产品");
    return;
  }
  else{
    tempID = ", " + FDProductID + "$" + FDItemCode + ", " + tempID;
    ProductArray = tempID.split(", ");        
    if(ProductArray.length > 5){
      alert("比较产品的数量不能多于4个");
      return;
    }
    else{
      document.CompareForm.product_id.value = tempID;
      document.CompareForm.submit();
    }
  }
}
//产品比较页面淘汰比较产品
function washoutCompareProduct(ProductID){    
  var tempID,ProductArray;    
  tempID = ", " + document.CompareForm.product_id.value;    
  ProductArray = tempID.split(", ");    
  if(ProductArray.length <= 2){
    alert("不能淘汰所有产品");
    return;
  }
  else{
    tempID = tempID.replace(", " + ProductID,"");
    document.CompareForm.product_id.value = tempID;
    document.CompareForm.submit();
  }
}

