<%@ page language="C#" autoeventwireup="true" inherits="V5Shop.Admin.Template_Lable_Activity_Link_Dialog, V5Shop.Shop.Template" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title><%=TitleName %></title>
    <link href="css/css.css" rel="stylesheet" type="text/css">
    <link href="css/css_list.css" rel="stylesheet" type="text/css">
    <link href="css/control.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" language="javascript" src="js/Common.js"></script>
    <style>
        .OperateTable tr td div{padding-left:10px;}
        .hback td {height:16px;}
        .hback td div{height:16px; padding:2px 0 0 0;}
    </style>
    <base Target="_self" /> 
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table width="100%" style="border:solid 1px;" height="40" border="0" align=center cellpadding="0" cellspacing="0" class="table" valign=absmiddle>
            <tr> 
                <td colspan="2"  align="Left" height="30">
            
                <div class="OperateTitle">
                <div id="tab1" style="float:left; padding-left:20px; cursor:pointer" ><strong style="font-size:14px; color:#000">【活动详细页面标签创建】</strong></div>

                <p style="float:right; padding-right:10px;" align="right"> 
                    <a href="http://www.021web.com.cn/" target="_blank">查看视频帮助</a>
                    <input name="button4" type="button" onClick="window.returnValue='';window.close();" value="关闭窗口" class="button">
                </p></div></td>
            </tr>
        </table>
        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="table">
		<tr class="hback">
			<td width="24%"><div style="background:#666666;" align="center"><a href="javascript:showtab(1);"><font color="#FFFFFF">活动详细</font></a></div></td>
		</tr>
	</table>
	
	<input type="hidden" id="LableTag" value="1" />
	<input type="hidden" id="TagName" value="readmalls" />

    <div>
        <table id="Area_1" class="OperateTable" width="100%" height="100" border="0" align=center cellpadding="0" cellspacing="0" valign=absmiddle>
            
            <tr id="out_type">
                <td align="center" class="hback" ><div align="left"><b>标签的输出格式：</b></div></td>
                <td class="hback" >
                    <input type="radio" class="radio" name="c_type_3" value="out_Table" id="type_7" onclick="out_Table_Click()" checked="checked" /><label for="type_7">Table格式</label>
                    <input type="radio" class="radio" name="c_type_3" value="out_Div" id="type_8" onclick="out_Div_Click()" /><label for="type_8">Div格式</label>
                    <input type="radio" class="radio" name="c_type_3" value="out_Ul" id="type_9" onclick="out_Ul_Click()" /><label for="type_9">UL+LI格式</label>
                    <input type="radio" class="radio" name="c_type_3" value="out_None" id="type_10" onclick="out_None_Click()" /><label for="type_10">无格式</label>
                </td>
            </tr>
            <tr id="s_type_7">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    TABLE的宽度为
                    <input type="text" id="tablewidth" size="1" value="100" onchange="return checkNum('tablewidth', 1)" />
                    <select id="widthtype">
                        <option value="%">百分比</option>
                        <option value="px">象素</option>
                    </select>
                    &nbsp;&nbsp;
                    您每行想显示
                    <input type="text" id="tablecount" size="2" value="2" onchange="return checkNum('tablecount', 1)" />
                    个活动
                </td>
            </tr>
            <tr id="s_type_8" style="display:none;">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    每个DIV上的样式为
                    <input type="text" id="divclassname" size="8" value="classname" />
                </td>
            </tr>
            <tr id="s_type_9" style="display:none;">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    您每行想显示
                    <input type="text" id="ulcount" size="2" value="2" onchange="return checkNum('ulcount', 1)" />
                    个活动
                    &nbsp;&nbsp;
                    每个UL上的样式为
                    <input type="text" id="ulclass" size="8" value="classname" />
                </td>
            </tr>
            
            <tr id="Need_1">
                <td width="26%" align="center" class="hback" ><div align="left"><b>调用样式：</b></div></td>
                <td width="74%" class="hback" >
                    <select id="styleid"  name="MallsStyle" style="width:200px;">
                        <asp:Repeater ID="MallsTyleOptions" runat="server">
                            <ItemTemplate>
                                <option value="<%#Eval("Name") %>"><%#Eval("Name") %></option>
                            </ItemTemplate>
                        </asp:Repeater>
                    </select> 
                    <input type="button" value="查看选中样式" class="button" onclick="GetSelectedLabelView('styleid', 'hs')"/>
                </td>
            </tr>
            
            <tr id="Need_2" style="display:none">
                <td width="26%" align="center" class="hback" ><div align="left"><b>数据调用样式：</b></div></td>
                <td width="74%" class="hback" >
                    <select id="Select1"  name="MallsStyle" style="width:200px;">
                        <asp:Repeater ID="MallsDataOptions" runat="server">
                            <ItemTemplate>
                                <option value="<%#Eval("Name") %>"><%#Eval("Name") %></option>
                            </ItemTemplate>
                        </asp:Repeater>
                    </select> 
                    <input type="button" value="查看选中样式" class="button" />
                </td>
            </tr>
            
            <tr id="Tr1">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    标题长度限制在
                    <input type="text" id="titlecount" size="1" value="30" onchange="return checkNum('titlecount', 1)" />
                    个字以内
                </td>
            </tr>
            <tr id="Tr2" style="display:none;">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    简介长度限制在
                    <input type="text" id="markcount" size="1" value="200" onchange="return checkNum('markcount', 1)" />
                    个字以内
                </td>
            </tr>
            <tr id="Tr4" style="display:none;">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    日期格式为
                    <input type="text" id="datetype" size="26" value="YY02-MM-DD" />
                </td>
            </tr>
            <tr id="Tr5">
                <td align="center" class="hback" ><div align="left"></div></td>
                <td class="hback" >
                    图片宽为
                    <input type="text" id="imgwidth" size="1" value="90" onchange="return checkNum('imgwidth', 1)" />
                    高为
                    <input type="text" id="imgheight" size="1" value="90" onchange="return checkNum('imgheight', 1)" />
                </td>
            </tr>
            <tr id="OpenModel">
                <td align="center" class="hback" ><div align="left"><b>显示内容限制：</b></div></td>
                <td class="hback" >
                    <input type="checkbox" class="checkbox" name="c_type_6" value="3" id="Checkbox2" checked="checked" /><label for="Checkbox2">新窗口打开</label>
                </td>
            </tr>
                        
            <tr id="Submit_Area"> 
              <td colspan="3" align="center" height="30"> 
                <input name="button" type="button" onClick="InitValue(this.form)" value="<%=ButtonValue %>" class="button"> 
                <input name="button" type="button" onClick="window.returnValue='';window.close();" value=" 取 消 " class="button">     
              </td>
            </tr>
        </table>
    </div>
        
        <script language="javascript" type="text/javascript">
            var height = 513;
            
            function GetObj(id){
                return document.getElementById(id);
            }
            
            function showtab(count){
                var list = "1,1,1,1";
                switch(count){
                    case 1:
                        listhidden = "out_type,s_type_7,OpenModel,Tr1,Tr2";
                        listshow="Need_1,Tr4,Tr5"
                        GetObj("TagName").value = "readactivity";
                        break;
                }
               
                //根据字符串判断是否显示
                HiddenOrShow(listhidden,listshow);
                //赋值
                GetObj("LableTag").value = count;
            }
            
            function HiddenOrShow(strlisthidden,strlistshow){
                var ary = strlisthidden.split(",");
                var ary2 = strlistshow.split(",");
               for(var i=0;i<ary.length;i++)
               {
                    if(ary[i]!="")
                        GetObj(ary[i]).style.display = "none";
               }
               for(var i=0;i<ary2.length;i++)
               {
                    if(ary2[i]!="")
                        GetObj(ary2[i]).style.display = "";
               }
                
                InitNewTrClass();
            }
            
            function InitNewTrClass(){
                InitTrClassById("Area_1");
            }
            
            function InitValue(){
                var typeid = GetObj("LableTag").value;
                var tagname = GetObj("TagName").value;
                var tempstr = "{web:hs=" + tagname;
                
                //输出格式判断
                var outtype = GetObjValueByName("c_type_3");
                if(GetObj("out_type").style.display != "none")
                {
                    switch(outtype){
                        case "out_Table":
                            tempstr += "┆输出格式$out_Table┆排列列数$" + GetObj("tablecount").value + "┆标签宽度$" + GetObj("tablewidth").value + GetObj("widthtype").value;
                            break;
                        case "out_Div":
                            tempstr += "┆输出格式$out_Div┆标签样式$" + GetObj("divclassname").value;
                            break;
                        case "out_Ul":
                            tempstr += "┆输出格式$out_Ul┆排列列数$" + GetObj("ulcount").value + "┆标签样式$" + GetObj("ulclass").value;
                            break;
                        case "out_None":
                            tempstr += "┆输出格式$out_None";
                            break;
                    }
                }
                
                tempstr += "┆引用样式$" + GetObj("styleid").value;
                //标题长度
                if(GetObj("Tr1").style.display !="none")
                    tempstr += "┆标题数$" + GetObj("titlecount").value;
                //简介长度
                if(GetObj("Tr2").style.display !="none")
                    tempstr += "┆简介长度$" + GetObj("markcount").value;
                //日期格式
                if(GetObj("Tr4").style.display !="none")
                    tempstr += "┆日期格式$" + GetObj("datetype").value;
                //图片尺寸
                if(GetObj("Tr5").style.display !="none")
                    tempstr += "┆缩略图宽高$" + GetObj("imgwidth").value + "*" + GetObj("imgheight").value;
                //是否新窗口打开
                if(GetObj("Checkbox2").checked == true && GetObj("OpenModel").style.display !="none")
                    tempstr += "┆打开窗口$1";
                    
                tempstr += "}";
                
                //返回
                if (navigator.appVersion.indexOf("MSIE") == -1){
                    window.opener.returnAction(tempstr);
                    window.close();
                }else{
                    window.returnValue = tempstr;
                    window.close();
                }
            }
            
            //初始化
            InitNewTrClass();
            showtab(1);
            
            function checkNum(id, count){
                var obj = document.getElementById(id);
                if(obj.value < count || isNaN(obj.value) || obj.value.indexOf('.') != -1){
                    alert("请输入一个大于等于" + count + "的整数");
                    return false;
                }
                return true;
            }
        
            function GetObjValueByName(s){
                var obj = document.getElementsByName(s);
                for(var i=0;i<obj.length;i++){
                    if(obj[i].checked == true)
                        return obj[i].value;
                }
                return "";
            }
            
            function out_Table_Click(){
                if(document.getElementById('s_type_7').style.display == 'none' && document.getElementById('s_type_8').style.display == 'none' && document.getElementById('s_type_9').style.display == 'none')
                    height += 41;
                HiddenField_3();
                document.getElementById('s_type_7').style.display='';
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
            
            function out_Div_Click(){
                if(document.getElementById('s_type_7').style.display == 'none' && document.getElementById('s_type_8').style.display == 'none' && document.getElementById('s_type_9').style.display == 'none')
                    height += 41;
                HiddenField_3();
                document.getElementById('s_type_8').style.display='';
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
            
            function out_Ul_Click(){
                if(document.getElementById('s_type_7').style.display == 'none' && document.getElementById('s_type_8').style.display == 'none' && document.getElementById('s_type_9').style.display == 'none')
                    height += 41;
                HiddenField_3();
                document.getElementById('s_type_9').style.display='';
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
            
            function out_None_Click(){
                if(document.getElementById('s_type_7').style.display == '' || document.getElementById('s_type_8').style.display == '' || document.getElementById('s_type_9').style.display == '')
                    height -= 41;
                HiddenField_3();
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
    
            function HiddenField_3(){
                document.getElementById('s_type_7').style.display='none';
                document.getElementById('s_type_8').style.display='none';
                document.getElementById('s_type_9').style.display='none';
            }
            
            function showArea_15(){
                document.getElementById('Tr1').style.display = document.getElementById('Tr1').style.display == '' ? 'none' : '';
                if(document.getElementById('Tr1').style.display == '')
                    height += 41;
                else
                    height -= 41;
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
            function showArea_16(){
                document.getElementById('Tr2').style.display = document.getElementById('Tr2').style.display == '' ? 'none' : '';
                if(document.getElementById('Tr2').style.display == '')
                    height += 41;
                else
                    height -= 41;
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
            function showArea_18(){
                document.getElementById('Tr4').style.display = document.getElementById('Tr4').style.display == '' ? 'none' : '';
                if(document.getElementById('Tr4').style.display == '')
                    height += 41;
                else
                    height -= 41;
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
            function showArea_19(){
                document.getElementById('Tr5').style.display = document.getElementById('Tr5').style.display == '' ? 'none' : '';
                if(document.getElementById('Tr5').style.display == '')
                    height += 41;
                else
                    height -= 41;
                InitNewTrClass();
                window.dialogHeight = height + "px";
            }
        </script>
    <script language="javascript" type="text/javascript">
    InitData();
    
    function InitData(){
        <%=LabelType %>
        //输出格式
        var outstyle = "<%=OutStyle %>";
        var tablewidth = "<%=TableWidth %>";
        var tablewidthtype = "%";
        BindObjByName("c_type_3", "<%=OutStyle %>");
        switch(outstyle){
            case "out_Table":
                if(tablewidth.indexOf("%") == -1){
                    tablewidthtype = "px";
                }
                GetObj("tablewidth").value = tablewidth.replace("%","").replace("px","");
                BindSelect("widthtype", tablewidthtype);
                GetObj("tablecount").value = "<%=TableCount %>";
                break;
            case "out_Div":
                GetObj("divclassname").value = "<%=LabelCss %>";
                break;
            case "out_Ul":
                GetObj("ulclass").value = "<%=LabelCss %>";
                GetObj("ulcount").value = "<%=TableCount %>";
                break;
            case "out_None":
                
                break;
        }
        //调用样式
        BindSelect("styleid", "<%=StyleName %>");
//        //排序字段和方向
//        BindSelect("orderfield", "<%=OrderField %>");
//        BindSelect("orderdirection", "<%=OrderDirection %>");
        //图片尺寸
        var imglength = "<%=ImgLength %>";
        if("<%=ImgLength %>" != ""){
            BindWidth(imglength);
        }else{
            showArea_19();
        }
//        //标题长度
//        var titlecount = "<%=TitleLength %>";
//        if(titlecount != ""){
//            GetObj("titlecount").value = titlecount;
//        }else{
//            showArea_15();
//        }
//        //简介长度
//        var shortcontent = "<%=ShortContentLength %>";
//        if(shortcontent != ""){
//            GetObj("markcount").value = shortcontent;
//            
//        }else{
//            showArea_16();
//        }
        //日期格式
        var dateformat = "<%=DateFormat %>";
        if(dateformat != ""){
            GetObj("datetype").value = dateformat;
            
        }else{
            showArea_18();
        }
//        //JS特效
//        var jsviewtype = "<%=JsViewType %>";
//        BindObjByName("c_type_7", jsviewtype);
//        switch(jsviewtype){
//            case "默认滚动":
//                GetObj("speed").value = "<%=MarqueeSpeed %>";
//                BindSelect("marquee", "<%=Marquee %>");
//                GetObj("marqueeheight").value = "<%=MarqueeHeight %>";
//                break;
//            case "定时滚动":
//                GetObj("waitnum").value = "<%=WaitNum %>";
//                GetObj("heightnum").value = "<%=HeightNum %>";
//                break;
//            case "手动滚动":
//                GetObj("widthnum").value = "<%=WidthNum %>";
//                break;
//            default:
//                break;
//        }
//        //活动数量
//        var count = "<%=StartNum %>";
//        //分页样式
//        var pagestyle = "<%=PageSyle %>";
//        switch(count){
//            case "":
//                if(pagestyle != ""){
//                    GetObj("Radio5").checked = true;
//                    showArea_44();
//                    GetObj("pagecount").value = "<%=Count %>";
//                    BindSelect("pagestyle", pagestyle);
//                }else{
//                    GetObj("countnum").value = "<%=Count %>";
//                }
//                break;
//            default:
//                GetObj("type_5").checked = true;
//                showArea_4();
//                GetObj("start_count").value = count;
//                GetObj("end_count").value = "<%=Count %>";
//                break;
//        }
        //新窗口打开
        var isnewwindow = "<%=IsNewWindow %>";
        if(isnewwindow == "")
            GetObj("Checkbox2").checked = false;
    }
    
    function BindSelect(id, value){
        var obj = document.getElementById(id);
        for(var i=0;i<obj.length;i++){
            if(obj[i].value == value){
                obj[i].selected = true;
            }
        }
    }
    
    function BindObjByName(s, value){
        var obj = document.getElementsByName(s);
        for(var i=0;i<obj.length;i++){
            if(obj[i].value == value){
                obj[i].checked = true;
                eval(value + "_Click()");
            }
        }
    }
    
    function BindWidth(length){
        var Array = length.split("*");
        GetObj("imgwidth").value = Array[0];
        GetObj("imgheight").value = Array[1];
    }
</script>
    </div>
    </form>
</body>
</html>