<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SeaExportInfoBillOfLadingAdding.aspx.cs" Inherits="DSWeb.Shipping.SeaExportInfoBillOfLadingAdding" %>

<!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 rel="STYLESHEET" type="text/css" href="../theme/page.css"/>
    <link href="../theme/tab.css" type="text/css" rel="stylesheet" />
    <!--自定义下拉框-->    
    <link href="../theme/style.css" type="text/css" rel="Stylesheet" media="screen"/>
    <link href="../theme/dhtmlxcombo.css" type="text/css" rel="Stylesheet" media="screen"/>
    <script type="text/javascript" src="../js/dhtmlxcommon.js"></script>
    <script type="text/javascript" src="../js/dhtmlxcombo.js"></script>
    <script type="text/javascript" src="../js/dhtmlxcombo_whp.js"></script>
    <script type="text/javascript">
       window.dhx_globalImgPath="../images/";
    </script>    
    <script language="javascript" type="text/javascript">
        var comboAdd;//添加提单
        function $(id)
        {
            return document.getElementById(id);
        }             
          
        function initComboAdd()//添加提单
        {       
            comboAdd = dhtmlXComboFromSelect("ddlAdd");            
            comboAdd.loadXML("../FeeCodes/TCodeTemplateAdapter.aspx?mask=0&pos=0");
            //
            var comIndex = comboAdd.getIndexByValue($("hd_comboAdd").value);
            comboAdd.selectOption(comIndex,true,true);  
        }
        function initComboAdd2()//添加提单
        {       
            comboAdd.attachEvent("onChange", function()
            {
                comboAdd.setComboText($("hd_comboAdd").value);
            }); 
            comboAdd.attachEvent("onBlur", function(){
                var s1 = comboAdd.getComboText();
                var s2 = s1.indexOf("|");
                if(s1=="")
                {
                    $("hd_comboAdd").value="";
                    comboAdd.setComboText($("hd_comboAdd").value);
                }
                else
                {
                    if(s2>0)
                    {
                        s2=s2+2;
                    }
                    var s3 = s1.substring(s2);
                    var s4 = s1.substring(0,s2-2);
                    if(s2>0)
                    {                    
                        comboAdd.setComboText(s3);
                        $("hd_comboAdd").value=s4;
                    }
                    else
                    {
                        comboAdd.setComboText($("hd_comboAdd").value);
                    }
                }
            }); 
            //comboAdd.setComboText($("hd_comboAdd").value);  
            //
            var comIndex = comboAdd.getIndexByValue($("hd_comboAdd").value);
            comboAdd.selectOption(comIndex,true,true);  
            //
            comboAdd.attachEvent("onKeyPressed", function(keyCode)
            {
                if(keyCode!="8")
                {          
                    var arrayArg = new Array();
                    setTimeout(function()
                    {
                       var filterCount = 0;
                       var is = -1;
                       var ishd = $("hd_comboAdd").value;
                       if("" != comboAdd.getComboText())
                       {
                           while("undefined" != typeof comboAdd.getOptionByIndex(filterCount))
                           {
                                var comboValue = comboAdd.getOptionByIndex(filterCount).text.toUpperCase();//.value;
                                var enterValue = comboAdd.getComboText().toUpperCase();
                                $("hd_comboAdd").value = comboAdd.getComboText().toUpperCase();
                                if(comboValue.indexOf(enterValue) == 0)
                                {
                                    comboAdd.selectOption(filterCount,true,true); 
                                    is=filterCount;
                                    break;
                                }
                                ++filterCount;
                           }
                            if(is==-1)
                            {
                                $("hd_comboAdd").value = ishd;
                                alert("无此内容,请重新选择!");
                            }
                       }
                     },10);
                 }
            });                        
            comboAdd.attachEvent("onSelectionChange", function()
            {
                $("hd_comboAdd").value = comboAdd.getComboText();
            }); 
        }      
    </script> 
    <!--确定-->
    <script language="javascript" type="text/javascript">     
        function QueryString()
        {            
           var name,value,i;//构造参数对象并初始化
           var str=location.href;//获得浏览器地址栏URL串
           var num=str.indexOf("?")
           str=str.substr(num+1);//截取“?”后面的参数串
           var arrtmp=str.split("&");//将各参数分离形成参数数组
           for(i=0;i < arrtmp.length;i++)
           {
                num=arrtmp[i].indexOf("=");
                if(num>0)
                {
                   name=arrtmp[i].substring(0,num);//取得参数名称
                   value=arrtmp[i].substr(num+1);//取得参数值
                   this[name]=value;//定义对象属性并初始化
                }
            }
        }
        function ShowDetail()
        {
            var rblBILLTYPE;
            var vRbtid=document.getElementById("RadioButtonList1");//得到radiobuttonlist            
            var vRbtidList= vRbtid.getElementsByTagName("INPUT");//得到所有radio
            for(var i = 0;i<vRbtidList.length;i++)
            {
                if(vRbtidList[i].checked)
                {
                    //var text =vRbtid.cells[i].innerText;
                    rblBILLTYPE=vRbtidList[i].value;
                }
            }
            //
            var ckvalue = $("Checkbox1").checked;
            var qs = new QueryString();//调用:
            var feature = "height=700, width=800,center:yes,help:no,resizable:yes,scroll:auto,toolbar=no,scrollbars=yes,toolbar=no,menubar=no,scrollbars=no,resizable=0,location=no,status=no"; 
            var URLs = "SeaExportInfoBillOfLadingAdd.aspx?BILLTYPE="+rblBILLTYPE+"&TEMPLATE="+$("hd_comboAdd").value+"&strIS="+ckvalue+"&handle="+qs.handle+"&asid="+qs.asid+"&id="+qs.id;
            
            /*
            ret = window.open(URLs,"_blank", feature);
            */            
            window.opener.window.ShowDetailAddInfo(URLs,feature);
            window.close();
            /*
            window.opener.location.reload();history.back();
            var parentObj = window.parent.opener.location;//alert(parentObj);
            window.opener.location.href=window.opener.location.href;
            window.opener.location='Login.aspx';window.opener = window.opener;
            window.opener='null';window.close();
            */
        }
    </script>
    <style type="text/css">
        .btncss 
        {
        	height:20px;
	        width:60px;
            BORDER-RIGHT: #2C59AA 1px solid; 
            PADDING-RIGHT: 2px; BORDER-TOP: #2C59AA 1px solid; 
            PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#C3DAF5); 
            BORDER-LEFT: #2C59AA 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; 
            BORDER-BOTTOM: #2C59AA 1px solid;
        }
    </style>
</head>
<body onload="initComboAdd2();" style="border:0; background-color: #ECF2FF;font-size:12px;">
    <form id="form1" runat="server">
        <table>
            <tr>
                <td width=120px>
                    <asp:RadioButtonList ID="RadioButtonList1" runat="server" CssClass="txtTab"
                        RepeatDirection="Horizontal" Height="26px" Width="110px">
                        <asp:ListItem Selected="True" Value="0">主单</asp:ListItem>
                        <asp:ListItem Value="1">分单</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
                <td width=100px align=right>
                    <asp:Label ID="Label1" runat="server" Text="提单名称:" Width=100px CssClass="cssfont"></asp:Label>
                </td>
                <td width=220px>
                    <select id="ddlAdd" runat=server style="width:200px" class="txtTab"></select>
                </td>
            </tr>
            <tr>
                <td colspan=3 class="cssfont">
                    <input id="Checkbox1" type="checkbox" checked=checked/>是否调入委托信息的发货人、收货人、通知人
                </td>
            </tr>
            <tr>
                <td colspan=3 align=center class="cssfont">
                    <input type="hidden" id="hd_comboAdd" runat="server"/>    
                </td>
            </tr>
            <tr>
                <td colspan=3 align=center class="cssfont">
                    <asp:Button ID="btnEnter" runat="server" Text="确  定" OnClientClick="ShowDetail();" CssClass="btncss"/>
                </td>
            </tr>
        </table> 
    </form>
</body>
</html>