function SelWholesale()
{
    var TypeCount=document.getElementsByName("TxtWholesale");
    for(var i=1;i<TypeCount.length;i++)
    {
        if(TypeCount[i].checked)
        {
            if(TypeCount[i].value=="1")
            {
                DivWholesale.style.display="";
            }
            else
            {
                 DivWholesale.style.display="none";
            }
        }
    }
}
function SelRetailPrice()
{
    if(document.getElementsByName("RetailPriceSet")[2].checked)
    {
        DivRetailPrice.style.display="";
    }
    else
    {
        DivRetailPrice.style.display="none";
    }
}
function SelColor(input_val,img_val)
{
    WinOpenDialog("../../Common/SelColor.aspx?input_val="+input_val+"&img_val="+img_val+"","360","330");
}
function SetShopParam()
{
    var data = XmlHttpPostMethodText("../Info/GetColumn.aspx","ColId="+$('ddlColId').value);
    if(data== "")
    {
        return;
    }
    else
    {
        var param = data.split('$');
        if(param.length==7)
        {
            $('txtPageType_'+(param[0]-1)).checked=true;
            $('txtTemplatePath').value = param[1];
            if(param[6]=="True")
            {
                $('chkBoxIsAllowComment').checked=true;
            }
       }
    }
}
function SetTitleType(obj){
    var temp=obj;
    if(temp==1){
        $('rbComm').checked=true;
        ShowImgUrl.style.display="none";
    }
    else if(temp==2){
        $('rbImg').checked=true;
        ShowImgUrl.style.display="";
    }
}
function CheckTitle(TableName)
{
    var title = $("txtTitle").value.trim();
    if(title.length==0)
    {
        alert('请输入检测标题！');
        $("txtTitle").focus();
        return;
    }
    var flag = CheckHas("../Common/CheckHas.aspx",title,"Title",TableName)
    if(!flag)
    {
        alert("标题不存在！");
        $("txtTitle").focus();
    }
    else
    {
        alert("标题已存在！");
        $("txtTitle").focus();
    }
}
function CheckProductNum(TableName)
{
    var ProductNum = $("txtProductNum").value.trim();
    if(ProductNum.length==0)
    {
        alert('请填写检测商品编号！');
        $("txtProductNum").focus();
        return;
    }
    var flag = CheckHas("../Common/CheckHas.aspx",ProductNum,"ProductNum",TableName)
    if(!flag)
    {
        alert("商品编号不存在！");
        $("txtProductNum").focus();
    }
    else
    {
        alert("商品编号已存在！");
        $("txtProductNum").focus();
    }
}
function GetShopModelHtml(ChId,Id)
{
    system_shop_SetShop.GetModelHtmlValue(ChId,Id,CallBack)
}
function GetShopModelHtmlUser(ChId,Id)
{
    user_info_SetShop.GetModelHtmlValue(ChId,Id,CallBack)
}
function BuyCart(RootPath,ChId,Id)
{
    var data = XmlHttpPostMethodText(""+RootPath+"/User/Shop/BuyCart.aspx","ChId="+ChId+"&Id="+Id);
    if(data== "")
    {
        return;
    }
    else
    {
        switch(data)
        {
            case "1":
                document.location.href=""+RootPath+"/User/Shop/ShoppingCart.aspx";
                return;
                break;
            case "NoSale":
                alert("该商品目前暂不支持销售操作！");
                return;
                break;
            case "2":
                alert("成功加入购物车！");
                return;
                break;
            case "NotLogin":
                alert("请先登录！");
                return;
                break;
            case "NoStorageNum":
                alert("错误，该商品库存数量不足！");
                return;
                break;
            case "NoUserShop":
                alert("请取消购物车中相关商品后继续购买！")
                return;
                break;
            default:
                document.location.href=data;
                return;
                break;
        }
    }
}
function PaymentUserLogin()
{
    if($("UserLogin1").checked)
    {
        $("Div_UserLogin2").style.display="none";
        $("Div_UserLogin1").style.display="";
    }
    else
    {
        $("Div_UserLogin2").style.display="";
        $("Div_UserLogin1").style.display="none";
    }
}