﻿
function GetProduct(PCID)
{
    $.getJSON('/Ajax/Price/GetProduct/', { PCID: PCID }, function (json)
    {
        if (json)
        {
            ClearSelect("Product");
            AddSelect('Product', 0, '-请选择产品-');
            for (i = 0; i < json.length; i++)
            {
                var item = json[i];
                AddSelect('Product', item.PCID, item.Name);
            }
        }
    });
}
function GetProductType(MarketID)
{
    $.getJSON('/Ajax/Price/GetProductType/', { MarketID: MarketID }, function (json)
    {
        if (json)
        {
            ClearSelect("ProductType");
            AddSelect('ProductType', 0, '-请选择产品类型-');
            for (i = json.length - 1; i >= 0; i--)
            {
                var item = json[i];
                AddSelect('ProductType', item.PCID, item.Name);
            }
        }
    });
}
function GetMarket(PCID)
{
    $.getJSON('/Ajax/Price/GetMarket/', { PCID: PCID }, function (json)
    {
        if (json)
        {
            ClearSelect("Market");
            AddSelect('Market', 0, '-请选择市场-');
            for (i = 0; i < json.length; i++)
            {
                var item = json[i];
                AddSelect('Market', item.MarketID, item.Name);
            }
        }
    });
}

function GetCompareMarket(PCID)
{
    $.getJSON('/Ajax/Price/GetCompareMarket/', { PCID: PCID }, function (json)
    {
        if (json)
        {
            ClearSelect("MarketCompare");
            AddSelect('MarketCompare', 0, '-请选择对比市场-');
            for (i = 0; i < json.length; i++)
            {
                var item = json[i];
                AddSelect('MarketCompare', item.MarketID, item.Name);
            }
        }
    });
}



var isCreateCheckImage = false;

function CreateCheckImage(txtCheckImage, width, height)
{
    if (!isCreateCheckImage)
    {
        var strImg = '<img id="imgCheckCode" alt="验证码" class="code" onclick="JavaScript:this.src=\'/CheckCode?w=85&h=28&l=6&\'+Math.random();" style="cursor: pointer; vertical-align: middle; margin-top: 0px; *margin-top: 2px;!important; *margin-top: 2px;" /><span><a href="#" onclick="$(\'#imgCheckCode\').attr(\'src\',\'/CheckCode?w=85&h=28&l=6&\'+Math.random())">换一个</a></span>';
        $(strImg).insertAfter("#" + txtCheckImage);
        $("#imgCheckCode").attr("src", "/CheckCode?w=85&h=28&l=6&" + Math.random());
        isCreateCheckImage = true
    }
}
