//获取商品分类搜索的价格区间
function ProCateURLList(str,id,UrlFile)
{
    var url=str+"="+id;
    var obj=window.location.search;
    if(obj.indexOf(str)!=-1)
    {
        obj=obj.substring(0,obj.indexOf(str))+url;
    }
    else
    {
        if(obj.indexOf("?")!=-1)
        {
            obj=obj+"&"+url;
            }
        else
        {
            obj=obj+"?"+url;
        }
    }
    window.location.href=UrlFile+obj;
}

function ProCateURL(str,UrlFile)
{
    var url=str;
    if(str=="_n")
        url="_n"+UrlFile;
    var obj=window.location.pathname;
    //alert(obj);
    if(obj.indexOf('_y')!=-1)
    {
        obj=obj.substring(0,obj.indexOf('_y'))+url;
    }
    if(obj.indexOf(str)!=-1)
    {
        obj=obj.substring(0,obj.indexOf(str))+url;
    }
    else
    {
        obj=obj.substring(0,obj.indexOf("."))+url;
    }
    window.location.href=obj+".html";
}

//代购单验证商品名称和联系方式必须填一个
function chkDaiGou(){ 
    if(ChkValite('ctl00_cph_txtQuantity',1,0)) return false;
    if(ChkValite('ctl00_cph_txtQuantity',2,0)) return false;
    if(ChkValite('ctl00_cph_txtPrice',2,0)) return false;
    if(document.getElementById("ctl00_cph_txtPCname").value=="")
    {
       document.getElementById("ctl00_cph_txtPCname").focus();
       alert("商品的中文名称必须填写！");
       return false;
    }
    if(document.getElementById("ctl00_cph_txtMobile").value=="" && document.getElementById("ctl00_cph_txtTel").value=="")
    {
       document.getElementById("ctl00_cph_txtMobile").focus();
       alert("手机或者固定电话字至少填写一个");
       return false;
    }
    return true;
    }
//清空代购单填写内容
    function ClearDaiGou(){
    var editor1 = document.getElementById('CE_ctl00_cph_ContentSpaw_ID'); 
    document.getElementById("ctl00_cph_txtPCname").value="";
    document.getElementById("ctl00_cph_txtPEname").value="";
    document.getElementById("ctl00_cph_txtUrl").value="";
    document.getElementById("ctl00_cph_txtQuantity").value="";
    document.getElementById("ctl00_cph_txtPrice").value="";
    document.getElementById("ctl00_cph_txtAddress").value="";
    document.getElementById("ctl00_cph_txtMobile").value="";
    document.getElementById("ctl00_cph_txtTel").value="";
    FCKeditorAPI.GetInstance("ctl00_cph_FCKeditor1").EditorDocument.body.innerHTML="";
    }

//首页BBS显示内容的切换
function showBBS(obj)
{    
    for(var i=0;i<9;i++)
    {
        var li=document.getElementById("li_"+i);
        var div=document.getElementById("div_"+i);
        if(i==obj)
        {
            li.className="flog";
            div.style.display="block";
        }
        else
        {
            li.className="nflog";
            div.style.display="none";
        }
    }
}

function showCategory(obj,div)
{
    var img=document.getElementById(obj);
    var ul=document.getElementById(div);
    
    if(ul.scrollHeight<133)
    {
        
        img.style.display="none";
        return;
    }
    if(img.alt=="显示所有")
    {
        ul.style.height=ul.scrollHeight;
        ul.style.overflow="";
        img.alt="默认显示";
        img.src="/Neweshop/images/main/cplb1_r11_c92.gif";
    }
    else
    {
        ul.style.height="135px";
        ul.style.overflow="hidden";
        img.alt="显示所有";
        ctl00_cph_divPic.style.display="";
        img.src="/Neweshop/images/main/cplb1_r11_c9.gif";
    }
}

function showGuoWai(obj,j)
{
    var div=document.getElementById(obj);
    var li=div.childNodes;
    //alert(div.childNodes.getElementsByTagName("li").length);
    for(var i=0;i<li.length;i++)
    {
        var id="li_"+i;
        var ul=document.getElementById(id);
        var img=document.getElementById("img_"+i);
        if(i==j)
        {
            if(ul.style.display=="block")
            {
            img.src='/Neweshop/images/main/daijia.gif';
            ul.style.display='none';
            }
            else
            {
            img.src='/Neweshop/images/main/daijian.gif';
            ul.style.display="block";
            }
        }
        else
        {
            img.src='/Neweshop/images/main/daijia.gif';
            ul.style.display='none';
        }
    }
    
}
