﻿// JScript 文件

function aa0(co)
{
   if(document.getElementById("spa"+co.substring(2)+"").style.display=="block"){
      return;
   } else {
       document.getElementById("spa"+co.substring(2)+"").style.display="block";
       document.getElementById(co).className='sp righto';
   }
}
function bb0(co)
{   
    if(document.getElementById("spa"+co.substring(2)+"").style.display=="none"){
        return;
    }
    document.getElementById("spa"+co.substring(2)+"").style.display="none";
    document.getElementById(co).className=('sp');
}
/*选项卡*/
function setTab(name, cursel, n)
{
 for(i=1;i<=n;i++){
     var menu = document.getElementById(name + i);
  var con=document.getElementById("con_"+name+"_"+i);
  if(con==undefined) return;
  menu.className=i==cursel?"hover":"";
  con.style.display=i==cursel?"block":"none";
 }
 if(name=='onedong'){
     switch(cursel)
     {
        case 1:
         document.getElementById('ssdong_ct').href='ODynamic.aspx';
        break;
        case 2:
         document.getElementById('ssdong_ct').href='Dynamic_Ord.aspx';
        break;
        case 3:
         document.getElementById('ssdong_ct').href='Dynamic_Fw.aspx';
        break;
        default:
         document.getElementById('ssdong_ct').href='ODynamic.aspx';
        break;
     }
 }
}
//产品加入购物车
function InvBuy(vid){
    var cname=escape(document.getElementById('hdfclass_desc_'+vid).value);
    var vname=escape(document.getElementById('azinv_'+vid).innerHTML);
    var vprice = document.getElementById('itprice_' + vid).innerHTML;
    var vIntegralGet = 0;
    if (document.getElementById("itgral_" + vid) != undefined)
    {
        vIntegralGet = document.getElementById("itgral_" + vid).innerText;
    }
    $.ajax({
    url: "Handsers/HSMyCart.aspx?us=0&cid=" + cname + "&vid=" + vid + "&vname=" + vname + "&vprice=" + vprice  + "&vIntegralGet=" + vIntegralGet + "&vIntegralCost=0",
          type:"GET",cache: false,
          success: function(text){
            if(text=='1'){
                alert('添加成功');
            } else {
                alert('添加失败');
            }
          }
    }); 
}
//显示购物车的信息
function myCartShow(to){
	document.getElementById('cpCart').style.display="block";
	if(to==0){
        $.ajax({
          url: "Handsers/HCartShow.aspx",
          type:"GET",
          cache: false,
          success: function(html){
            document.getElementById('cpCart').innerHTML=html;
            document.getElementById('PTop1_productCt').innerHTML=document.getElementById('lblInvCount').innerHTML;
          }
        });
    }
}
//隐藏购物车的信息
function myCartHidden()
{
	document.getElementById('cpCart').style.display="none";
}
//删除购物车里的信息
function deleteCart(vid){
    $.ajax({
    url: "Handsers/HCartShow.aspx?pc=1&vid=" + vid + "&jz=0&cn=0" + "",
      type:"GET",
      cache: false,
      success: function(html){
        document.getElementById('cpCart').innerHTML=html;
      //  document.getElementById('PTop1_productCt').innerHTML=document.getElementById('lblInvCount').innerHTML;
      }
    });
}
//有问必答
function getQa(aid,tyid)
{
    for(var i=1;i<=4;i++){
        document.getElementById("qa_"+i).className='';
    }
    document.getElementById(aid).className='onmouseqa';
    $("#dl_qa").empty();
        $.ajax({
          url: "Handsers/HQA.ashx?tid="+tyid+"&sort=1&userid=-1&index=1&size=3",
          type:"GET",
          cache: false,
          success: function(html){
            $("#dl_qa").append(html);
          }
        });
}
//选购搜索
function invSearch(){
    var key=document.getElementById('TopInvKey').value;
    if(key.replace(' ','').length<20 && key.replace(' ','').length>0){
        window.location.href("../Pr_List.aspx?key="+escape(key)+"");
    }
    else{
        alert('不能小于0或超过20个字符.')
        return 0;
    }
}
//软件搜索
function softSearch() {
    var key = document.getElementById('TopInvKey').value;
    if (key.replace(' ', '').length < 20 && key.replace(' ', '').length > 0) {
        window.location.href("../Pr_List1.aspx?key=" + escape(key) + "");
    }
    else {
        alert('不能小于0或超过20个字符.')
        return 0;
    }
}
//维修搜索
function servicSearch() {
    var key = document.getElementById('TopInvKey').value;
    if (key.replace(' ', '').length < 20 && key.replace(' ', '').length > 0) {
        window.location.href("../Pr_List2.aspx?key=" + escape(key) + "");
    }
    else {
        alert('不能小于0或超过20个字符.')
        return 0;
    }
}

function topSearch(key, cid, typeid)
{
    if (typeid == 1) //产品
    {
        window.location.href("../Pr_List.aspx?cid=" + cid + "&key=" + escape(key) + "");
    }
    else if (typeid == 2)//软件
    {
        window.location.href("../Pr_List1.aspx?cid=" + cid + "&key=" + escape(key) + "");
    }
    else if (typeid == 3)//方案
    {
        window.location.href("../SchemeList.aspx?tid=" + cid + "");
    }
    else if (typeid == 4)//维修服务,配件
    {
     window.location.href("../Pr_List2.aspx?cid=" + cid + "&key=" + escape(key) + "");
    }
}

//转到推荐配置详细页面
function GoToCommentShow(ty){
    var cg=document.getElementById('hdfCogID_'+ty).value;
    window.location='DiyCmShow.aspx?gID='+cg;
}
//验证发表评论等
function TestTitleCt(){
    var title=document.getElementById('cmTitle').value;
    var ct=document.getElementById('cmContent').value;
    if(title.replace(' ','').length<=0 || title.length>20){
        alert('标题不能为空且不能大于20个字符'); return false;
    }
    if(ct.replace(' ','').length<=0 || ct.length>2000){
        alert('内容不能为空');return false;
    }
}
//转到方案配置详细页面
function GoToSchemeShow(cg) {
   // var cg = document.getElementById('hdfScheme_' + ty).value;
    window.location = 'SchemeInfo.aspx?gID=' + cg;
}
