<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Admin_GameLstHot.aspx.cs" Inherits="TW.UI.Admin.Admin_GameLstHot" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link href="css/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="../js/public.js"></script>
<script type="text/javascript" src="../js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="../js/artDialog/artDialog.js?skin=default"></script>
<script type="text/javascript" src="../js/artDialog/plugins/iframeTools.js"></script>
<script type="text/javascript" src="../js/kindeditor/kindeditor-min.js"></script>
<script type="text/javascript" src="/js/FancyZoom/FancyZoom.js"></script>
<script type="text/javascript" src="/js/FancyZoom/FancyZoomHTML.js"></script>
<script type="text/javascript">
    function addhotid(obj) {
        var sphtml = $(obj).prev().html();
        if (sphtml != "") {
            alert("一次只能添加一个商品");
            return false;
        }
        KyoWin('添加商品', '/admin/Admin_ProductList.aspx?act=addpro&inhtml=<%=gmlsthorpro %>');
    }
    function addhotproinfo() {
        var thoypronum = $("input[type='hidden'][name='<%=gmlsthorpro %>_id']").length;
        if (thoypronum >= 8) {
            alert("最多添加8个热门商品");
            return false;
        }
        if ($("input[type='hidden'][name='<%=gmlsthorpro %>']").length <= 0) {
            alert("请添加商品");
            return false;
        }
        var proid = $("input[type='hidden'][name='<%=gmlsthorpro %>']").val();
        var protit = $("input[type='hidden'][name='<%=gmlsthorpro %>']").prev().html();
        var thumb = $("#hidThumb").val();
        if (thumb == "") {
            alert("请上传代表图");
            return false;
        }
        if ($("input[type='hidden'][name='<%=gmlsthorpro %>_id'][value='" + proid + "']").length > 0) {
            alert("该商品已添加");
            return false;
        }
        $("#hotprotab").append('<tr><td>' + (thoypronum + 1) + '</td><td>' + protit + '<input type="hidden" name="<%=gmlsthorpro %>_id" value="' + proid + '"/></td><td><a class="anocss" onclick="KyoWin(\'修改代表图\',\'/admin/Admin_GmLstHotThumb.aspx?id=' + proid + '\');" id="thumb' + proid + '"><img src="/uploads/?' + thumb + '_240x140.jpg"/><input type="hidden" name="<%=gmlsthorpro %>_thumb" value="' + thumb + '"/></a></td><td><a class="probtn" onclick="delthot(this);">删除</a></td></tr>');
        $("#hidThumb").val(""); 
        $("#<%=gmlsthorpro %>").html("");
        $("#hidThumb_Preview").html("");
    }
    function delthot(obj) {
        $(obj).parent().parent().remove();
        var i=1;
        $("input[type='hidden'][name='<%=gmlsthorpro %>_id']").each(function () { 
            $(this).parent().prev().html(i);
            i++;
        });
    }
</script>
</head>
<body onload="setupZoom();">
<form id="form1" runat="server">
<div class="nav"><h1>游戏列表热门</h1></div>

<div class="cont">

<div class="opera">
    <table class="seletable">
        
        <tr>
            <td>
            </td>
            <td><font color=red>注：该功能用于首页游戏列表中热门信息管理：示例图：<a href="/silitu/yxlbrm.png"><img src="images/tu1.gif" /></a>,最多添加<strong>8</strong>个热门商品</font>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                <input id="Button3" type="button" value="查看前台页面" onclick="window.open('/');" class="btn1 btn111" />
                <asp:Button ID="btnSave" runat="server" Text="批量保存" CssClass="btn1 btn111" onclick="btnSave_Click" />
            </td>
        </tr>
    </table>
</div>
<div id="ss"></div>
<table class="table2">
    <tr>
        <th>商品：</th>
        <td>
            <div id="<%=gmlsthorpro %>"></div>
            <input type="button" onclick="addhotid(this);" value="添加商品" class="btn1 btn111" />
        </td>
    </tr>
    <tr>
        <th>
            代表图：
        </th>
        <td>
            建议尺寸：像素-240x140
            <br />
	        <asp:HiddenField ID="hidThumb" runat="server" />
	        <iframe src="/inc/upload.aspx?dir=image&input=hidThumb" id="Iframe1" width="96%" height="25" scrolling="no" frameborder="0" allowtransparency="true"></iframe>
	        <span id="hidThumb_Preview"></span>
        </td>
    </tr>
    <tr>
        <th></th>
        <td class="abtn"><input type="button" value="添加" onclick="addhotproinfo();" /></td>
    </tr>
</table>

<table class="table1" id="hotprotab">
<tr>
    <td>序号</td>
    <td>商品名称</td>
    <td>代表图片</td>
    <td>操作</td>
</tr>
    <asp:Literal ID="litHotProList" runat="server"></asp:Literal>
</table>
</div>

</form>

<script type="text/javascript">
    var oTab = $('.table1')[0];
    var oldBgColor = '';
    var i = 0;
    for (i = 0; i < oTab.tBodies[0].rows.length; i++) {
        oTab.tBodies[0].rows[i].style.background = i % 2 ? '#ffffff' : 'url(images/line2.png) repeat-x';
        oTab.tBodies[0].rows[i].onmouseover = function () {
            oldBgColor = this.style.background;
            this.style.background = '#ffffd4 url(images/line.png) repeat-x';
        };
        oTab.tBodies[0].rows[i].onmouseout = function () {
            this.style.background = oldBgColor;
        };
    }
</script>
</body>
</html>
