<%@ Page Language="C#" AutoEventWireup="true" Inherits="System_Info_UploadImg, QianboCMS" EnableEventValidation="false" %>
<!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 runat="server">
<title>上传图片</title>
<link href="../Css/layout.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var api = frameElement.api, W = api.opener, D = W.document;
</script>
</head>

<body scroll="no" style="margin: 0;">
<form id="form1" runat="server">
  <table cellpadding="0" cellspacing="1" class="border" align="center" id="uploadTable" runat="server">
    <tr class="tdbg">
      <td><input id="File1" runat="server" type="file" class="btn" />
        <input id="File2" runat="server" type="file" class="btn" /></td>
      <td><strong>设置属性：</strong></td>
    </tr>
    <tr class="tdbg">
      <td><input id="File3" runat="server" type="file" class="btn" />
        <input id="File4" runat="server" type="file" class="btn" /></td>
      <td><asp:CheckBox ID="IsWatermark" runat="server" Text="开启水印" Checked="True" /></td>
    </tr>
    <tr class="tdbg">
      <td><input id="File5" runat="server" type="file" class="btn" />
        <input id="File6" runat="server" type="file" class="btn" /></td>
      <td><asp:CheckBox ID="IsNewSize" runat="server" Text="自定义大小" />
        宽：<asp:TextBox ID="txtMaxWidth" runat="server" Width="28px">0</asp:TextBox>px
        高：<asp:TextBox ID="txtMaxHeight" runat="server" Width="28px">0</asp:TextBox>px</td>
    </tr>
    <tr class="tdbg">
      <td><input id="File7" runat="server" type="file" class="btn" />
        <input id="File8" runat="server" type="file" class="btn" /></td>
      <td><asp:CheckBox ID="IsBiLi" runat="server" Text="按比例缩放" />
        比例值：<asp:TextBox ID="txtBili" runat="server" Width="28px">0</asp:TextBox></td>
    </tr>
    <tr class="tdbg">
      <td><input id="File9" runat="server" type="file" class="btn" />
        <input id="File10" runat="server" type="file" class="btn" /></td>
      <td><asp:TextBox ID="imgNames" runat="server" Height="0" Width="0"></asp:TextBox></td>
    </tr>
    <tr class="tdbg">
      <td><input id="File11" runat="server" type="file" class="btn" />
        <input id="File12" runat="server" type="file" class="btn" /></td>
      <td></td>
    </tr>
    <tr class="tdbg">
      <td colspan="2" align="center"><asp:Button ID="btnUpload" runat="server" Text="开始上传" CssClass="btn" OnClick="btnUpload_Click" OnClientClick="this.value='上传中，请稍候…'" />
        <asp:Button ID="btnReturnValue" CssClass="btn" runat="server" Text="完成并返回参数" OnClientClick="setParent();" Visible="false" />
        <input id="returnImgType" type="hidden" runat="server" /></td>
    </tr>
  </table>
  <table id="imgTable" runat="server" visible="false" align="center">
    <tr class="tdbg">
      <td><asp:Image ID="ViewImg" runat="server" /></td>
    </tr>
  </table>
</form>
<asp:Literal ID="LitMsg" runat="server"></asp:Literal>
<br />
</body>
</html>
<script type="text/javascript">
function setParent()
{
    var imgNames=document.getElementById("imgNames").value;
    var obj=imgNames.split(',');
    try
    {
        var openerObj=D.form1.imgs;
        var I=openerObj.length;
        for(var i=0;i<obj.length;i++)
        {
            if(obj[i] != "")
            {
                openerObj.length++;
                openerObj.options[I].text=obj[i];
                openerObj.options[I].value=obj[i];
                I++;
            }
        }
        //window.opener.document.getElementById("countImg").innerText=I;
        D.getElementById('countImg').innerText=I;
    }
    catch(e)
    {
        var openerObj=opener.document.getElementById('imgs');
        for(var i=0;i<obj.length;i++)
        {
            if(obj[i]!="")
            {
                openerObj.options.add(new Option(obj[i],obj[i]));
            }
        }
        //window.opener.document.getElementById("countImg").innerHTML=openerObj.length;
        D.getElementById('countImg').innerHTML=openerObj.length;
    }
    //window.opener.document.getElementById('btnShowWindow').value='继续上传';
    //window.close();
    D.getElementById('btnShowWindow').value='继续上传';
    api.close();
}
</script>