<%@ page language="C#" autoeventwireup="true" inherits="V5Shop.Admin.weblogin_Product_Operate_Ajax, V5Shop.Shop.Category" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>
<%if (act == "getSpecList"){ %>
<% = specList %>
<script type="text/javascript">
$$("#spec_select input[name^=spec_select]").each(function(v,i){
    var info = $("dialog-info-"+v.value).value;
    //bind events
    v.addEvent("click",function(){
        $("sel-spec-value-area").set("html",info);
        bindEvent();
    })
});

var win = $("mainFrame").contentWindow || window.frames["mainFrame"];
$E(".btn").addEvent("click", function(e){
    if(!confirm('您确定吗，选定规格后将不能增加新的规格'))
        return;
    e.stop();
    var arr = new Array();
    $$("input:checked").each(function(v){
        arr.push($("dialog-menu-"+v.value).value);
        $(v).get("specid");
        $(v).get("title");
    });
    arr = arr.reverse();
    win.Product.addSpec(arr);
    //close this window
    $E(".dialog-btn-close",$E(".dialog")).fireEvent("click");
});

var bindEvent = function(){
    $$(".specLink").removeEvents().addEvent("click", function(e){
        e.stop();
        win.location.href=this.href;
        $E(".dialog-btn-close",$E(".dialog")).fireEvent("click");
    });
}

bindEvent();
</script>
<%}else if(act=="getPicList"){%>
<% =picList%>
<script type="text/javascript">
$E(".btn").addEvent("click", function(e){
    e.stop();
    var dialog=this.getParent('.dialog');
    var callback=dialog.retrieve('callback',$empty);
    var ids="",srcs="";
    $$("#sel-albums-images input:checked").each(function(v){
        ids+=v.value+",";
        srcs+=$(v).get("src")+",";
    });
    //引用存储在本窗口中的function对象
    callback(ids,srcs);
    //close this window
    $E(".dialog-btn-close",$E(".dialog")).fireEvent("click");
})  

$E(".btnUpload").addEvent("click", function(e){
    e.stop();
    var win = $("mainFrame").contentWindow || window.frames["mainFrame"];
    //调用JS
    win.change_option(11,4);
    //close this window
    $E(".dialog-btn-close",$E(".dialog")).fireEvent("click");
})  
</script>
<%}else if(act=="getPriceList"){ %>
<% =priceList%>
<script type="text/javascript">
$E(".btn").addEvent("click", function(e){
    e.stop();
    var dialog=this.getParent('.dialog');
    var callback=dialog.retrieve('callback',$empty);
    var values="";
    $$("#levelPriceEditor input").each(function(v){
        var val = v.value;
        if(val.length){
            if(isNaN(val)){
                MessageBox.error("请输入有效数字"); return;
            }
            
            values += v.name+":"+val+";";
        }        
    });
    callback(values);
    //close this window
    $E(".dialog-btn-close",$E(".dialog")).fireEvent("click");
});
</script>
<%} %>