/**
 *添加扩展分类[+]
 */
function addMoreCat(conObj) {
    var sel = document.createElement("SELECT");
    var selCat = document.forms['myform'].elements['cat_id'];
    var browser = navigator.userAgent;
    for (i = 0; i < selCat.length; i++) {
        var opt = document.createElement("OPTION");
        opt.text = selCat.options[i].text;
        opt.value = selCat.options[i].value;
        if (browser.indexOf("MSIE") > 0) {
            sel.add(opt);
        } else {
            sel.appendChild(opt);
        }
    }
    conObj.appendChild(sel);
    sel.name = "more_cat[]";
    sel.style.display = "inline";
}
//商品导出
function do_export() {
    var keyword = $("[name='keyword']").val();
    var catid = $("[name='catid']").val();
    var brandid = $("[name='brandid']").val();
    var suppliersid = $("[name='suppliersid']").val();
    var url = APP + "Shop/Goods/export.html" + "&keyword=" + keyword + "&catid=" + catid + "&brandid=" + brandid + "&suppliersid=" + suppliersid;
    window.location.href = url;
}
//品牌搜索
function search_brand() {
    var keyword = $('#search_brand_keyword').val();
    var query = new Object();
    query.keyword = keyword;
    var url = APP + "Shop/Goods/search_brand.html"
    $.ajax({
        url: url,
        data: query,
        type: "post",
        dataType: "json",
        success: function (obj) {
            if (obj.status) {
                $('#brand_id').html(obj.options);
                return false;
            } else {
                return false;
            }
        }
    });
}
//商品的上下架
function status(id, type) {
	var url = APP + "Shop/Goods/status.html"
	$.get(url, {
		id: id,
		type: type
	}, function(jsondata) {
		var return_data = eval("(" + jsondata + ")");
		$("#" + type + "_" + id + " img").attr('src', THEME_PATH + 'common/images/status_' + return_data + '.gif');
	});
}