function addRow(){//属性+
	var html = '<div class="clearfix attribute mb10"><div class="f_l"><div class="Validform_checktip f_l">下单满:</div><input type="text" name="config[discount_limit][]" class="form-control f_l w80" /><div class="Validform_checktip f_l">元</div><div class="Validform_checktip f_l">立减:</div><input type="text" name="config[discount_amount][]" class="form-control f_l w80" /><div class="Validform_checktip f_l">元</div><a onclick="delRow(this)" href="javascript:void(0)">[-]</a></div></div>';
    $('#promote_html').append(html);
}
function delRow(obj){//属性-
	$(obj).parent().parent().remove();
}

$(function(){
  var is_shopid = $("input[name='is_shopid']").val();
  if(is_shopid != 0)is_shopid = 1;
  ff_show(is_shopid);
});
function ff_show(key){
  if(key == 1){
    $(".xs_xz").css('display','table-row'); 
  }else{
    $(".xs_xz").css('display','none'); 
  }
}
function addShop(val){
    var rang = $("#"+val).val();
    var lists  = document.getElementById("shop_range_ext");
    var rang_val = document.forms['myform'].elements[val];
    if (rang > 0){
        rangId = rang;
        rangName = rang_val.options[rang_val.selectedIndex].text;
    }else{
        return;
    }
    // 检查该仓库是否已经存在
    exists = false;
    for (i = 0; i < document.forms['myform'].elements.length; i++){
      if (document.forms['myform'].elements[i].type=="checkbox"){
        if (document.forms['myform'].elements[i].value == rangId){
          exists = true;
          $.showConfirm('选定的选项已经存在','','hc')
        }
      }
    }
    // 创建checkbox
    if (!exists){
      lists.innerHTML += "<label class='checkbox-inline'><input type='checkbox' name='shop_ids[]' value='" + rangId + "' checked='true' /> "+ rangName +"</label>&nbsp;&nbsp;";
    }
}
