<%@ page language="C#" autoeventwireup="true" validaterequest="false" masterpagefile="~/MasterFile/TimeCheck.master" inherits="Masters_TA_UI_Master_LevelChildAdd, App_Web_cgb2gaqc" %>

<%@ Register Src="../UserControls/TA_uc_Levels.ascx" TagName="TA_uc_Levels" TagPrefix="uc1" %>
<asp:Content ContentPlaceHolderID="BodyContentPH" ID="Content1" runat="server">
    <script type="text/javascript" language="javascript">
        var Entervalid = "Enter valid";
        var AlertNumber = "number";
        var Phonenumber = "Phone number must be minimum 6 characters";
        var Entervalidphonenumber = "Enter valid phone number";
        var EntervalidFaxnumber = "Enter valid Fax number";
        var EntervalidMobilenumber = "Enter valid Mobile number";
        var ConfirmSave = "Are you sure, to Save?";
        var MaxLength = "Maximum length is ";
        function MaxLengthh(maxLength) {
            MaxLength = maxLength;
        }
        function SetAlertMessages(entervalid, alertNumber, phonenumber, entervalidphonenumber, entervalidFaxnumber, entervalidMobilenumber, confirmSave) {
            Entervalid = entervalid;
            AlertNumber = alertNumber;
            Phonenumber = phonenumber;
            Entervalidphonenumber = entervalidphonenumber;
            EntervalidFaxnumber = entervalidFaxnumber;
            EntervalidMobilenumber = entervalidMobilenumber;
            ConfirmSave = confirmSave;
        }
        var ph;
        function assignValue(e, ctrl, val) {
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else if (event) keycode = event.keyCode;
            else return true;
            ph = ctrl.value;
            if (ph == null) {
                return false;
            }
            if (ctrl.value.lastIndexOf("+") == 0 || ctrl.value.lastIndexOf("+") == -1) {
                //return true
            }
            else {
                ctrl.value = ph;
                ctrl.focus();
                alert(Entervalid + val + AlertNumber);
                return false;
            }
            if (!(keycode == 58 && e.value.indexOf(":") > -1)) {
                if ((keycode == 40) || (keycode == 41) || (keycode == 43) || (keycode == 45) || (keycode >= 48 && keycode <= 57) || (keycode == 0) || (keycode == 8)) {
                    return true;
                }
                else {
                    return false;
                }
            }
            else {
                return false;
            }
            return true;
        }
        function checkPhone1(e) {
        }
        function checkPhone(e, ctrl, length, len) {
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else if (event) keycode = event.keyCode;
            else return true;
            //alert (e.value.split("+").length-1);
            //alert (e.value.lastIndexOf("+"));
            //       if (e.value.split("+").length-1>1)
            //       {
            //            return false;
            //       }
            //if (keycode==43)
            //{
            //alert(e.value.lastIndexOf("+"));
            //             if (e.value.lastIndexOf("+")==0 || e.value.lastIndexOf("+")==-1)
            //             {
            //                //return true
            //             }
            //             else
            //             {
            //                e.value = ph;
            //                return false
            //             }
            //}
            //alert(e.value.lastIndexOf("+") + "  " +e.value);
            //alert(e.value.search(regexp))
            //         if (keycode==43)
            //         {
            //            if (e.value.length==0)
            //            {
            //                return true;
            //            }
            //            else
            //            {
            //            return false;
            //            }
            //         }
            //         else
            //         {
            //            alert(e.value.lastIndexOf("+"));
            //         }
            if (!(keycode == 58 && e.value.indexOf(":") > -1)) {
                if ((keycode == 40) || (keycode == 41) || (keycode == 43) || (keycode == 45) || (keycode >= 48 && keycode <= 57) || (keycode == 0 || keycode == 8)) {
                    // return true;
                    return chkMaxLen(e, ctrl, length, len);
                }
                else {
                    return false;
                }
            }
            else {
                return false;
            }
            return true;
        }
        function checkZip(e, ctrl, length, len) {
            var keycode;
            if (window.event) keycode = window.event.keyCode;
            else if (e) keycode = e.which;
            else return true;
            if ((keycode >= 48 && keycode <= 57) || (keycode >= 65 && keycode <= 90) || (keycode >= 97 && keycode <= 122) || (keycode == 32) || (keycode == 13) || (keycode == 45) || (keycode == 0 || keycode == 8)) {
                //return true;
                return chkMaxLen(e, ctrl, length, len);
            }
            else return false;
        }
        function check() {
            debugger;
            if (document.getElementById("<%=txtPhone1.ClientID%>").value.length != 0) {
                if (document.getElementById("<%=txtPhone1.ClientID%>").value.length < 6) {
                    alert(Phonenumber);
                    document.getElementById("<%=txtPhone1.ClientID%>").focus();
                    return false
                }

                ph1 = document.getElementById("<%=txtPhone1.ClientID%>");
                ph2 = document.getElementById("<%=txtPhone2.ClientID%>");
                fax = document.getElementById("<%=txtFax.ClientID%>");
                mobi = document.getElementById("<%=txtMobile.ClientID%>");
                if (ph1.value.lastIndexOf("+") == 0 || ph1.value.lastIndexOf("+") == -1) {
                    //return true
                }
                else {
                    alert(Entervalidphonenumber);
                    ph1.focus();
                    return false
                }
                if (ph2.value.lastIndexOf("+") == 0 || ph2.value.lastIndexOf("+") == -1) {
                    //return true
                }
                else {
                    alert(Entervalidphonenumber);
                    ph2.focus();
                    return false
                }
                if (fax.value.lastIndexOf("+") == 0 || fax.value.lastIndexOf("+") == -1) {
                    //return true
                }
                else {
                    alert(EntervalidFaxnumber);
                    fax.focus();
                    return false
                }
                if (mobi.value.lastIndexOf("+") == 0 || mobi.value.lastIndexOf("+") == -1) {
                    //return true
                }
                else {
                    alert(EntervalidFaxnumber);
                    mobi.focus();
                    return false
                }
                if (Page_ClientValidate())
                    return confirm(ConfirmSave);
            }
            var hdnvalues = document.getElementById('ctl00_BodyContentPH_hdnRequestId').value;
            var SelectUTC = "Select Timezone";
            if (hdnvalues != "") {
                if (hdnvalues == 2) {
                    var index = document.aspnetForm.ctl00_BodyContentPH_ddlUTCTime.selectedIndex;
                    var ddlUTC = document.aspnetForm.ctl00_BodyContentPH_ddlUTCTime.options[index].value;
                    if (ddlUTC == "-Select-") {
                        alert(SelectUTC);
                        document.aspnetForm.ctl00_BodyContentPH_ddlUTCTime.focus();
                        return false;
                    }
                }
                //else {
                //    var index = document.aspnetForm.ctl00_BodyContentPH_ddlUTCTime.selectedIndex;
                //    var ddlUTC = document.aspnetForm.ctl00_BodyContentPH_ddlUTCTime.options[index].value;
                //    if (ddlUTC == 0) {
                //        alert(SelectUTC);
                //        document.aspnetForm.ctl00_BodyContentPH_ddlUTCTime.focus();
                //        return false;
                //    }
                //}
            }
            if (Page_ClientValidate())
                return confirm(ConfirmSave);
        }
        //function checkZip(e)
        //    {
        //       var keycode;
        //        if (window.event) keycode = window.event.keyCode;
        //            else if (event) keycode = event.keyCode;
        //                 else if (e) keycode = e.which;
        //                     else return true;
        //      // alert(keycode);
        //       
        //             if (keycode >= 48 && keycode <= 57)
        //             {
        //                    return true;
        //             }
        //            else
        //            {
        //                return false;
        //            }
        //       
        //     return true;
        //    }    
    </script>
    <div class="content-header">
        <h1 style="background-image: url('../dist/img/org-icon.png'); background-repeat: no-repeat; padding-left: 35px">
            <asp:Label ID="lblHead" ToolTip="test" runat="server"></asp:Label>
        </h1>
        <asp:SiteMapPath ID="site" runat="server" CssClass="breadcrumb">
            <NodeStyle CssClass="active" />
        </asp:SiteMapPath>
    </div>
    <div class="content">
        <div class="exda-table">
            <h6 style="padding-right:10px;padding-left:10px">
                <asp:Label ID="lbl_Man" runat="server"></asp:Label>
            </h6>
            <asp:Label ID="lblErr" runat="server" Style="display: none" ForeColor="Red"></asp:Label>
        </div>
        <div class="emp-filter">
            <div class="row">
                <div class="col-md-12">
                    <uc1:TA_uc_Levels ID="TA_uc_Levels1" runat="server" />
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2">
                    <asp:Label ID="lbl_Name" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtLevelName" CssClass="form-control mandatory"
                        runat="server" ondrop="return false" onkeypress="return acceptCharsNumAmpUnder_MaxLength(event,this,50,MaxLength);"
                        MaxLength="50"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtLevelName"
                        Display="None" ErrorMessage="Enter Name"></asp:RequiredFieldValidator>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="lbl_Description" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtDescription" TextMode="MultiLine" CssClass="form-control"
                        runat="server" ondrop="return false" onkeypress="return chkMaxLen(event,this,250,MaxLength);"
                        Style="resize: none" MaxLength="250"></asp:TextBox>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2">
                    <asp:Label ID="lbl_City" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtCity" CssClass="form-control" runat="server"
                        ondrop="return false" onkeypress="return chkMaxLen(event,this,25,MaxLength);"
                        MaxLength="25"></asp:TextBox>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="lbl_State" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtState" CssClass="form-control" runat="server"
                        ondrop="return false" onkeypress="return chkMaxLen(event,this,25,MaxLength);"
                        MaxLength="25"></asp:TextBox>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2">
                    <asp:Label ID="lbl_Country" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtCountry" CssClass="form-control" runat="server"
                        ondrop="return false" onkeypress="return chkMaxLen(event,this,25,MaxLength);"
                        MaxLength="25"></asp:TextBox>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="lbl_Zip" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtZip" CssClass="form-control" ondrop="return false"
                        runat="server" onkeypress="return checkZip(event,this,10,MaxLength);" MaxLength="10"></asp:TextBox>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2">
                    <asp:Label ID="lbl_Phone1" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtPhone1" CssClass="form-control" ondrop="return false"
                        onkeyup="return assignValue(event,this,'Phone')" onkeypress="return checkPhone(event,this,18,MaxLength)"
                        runat="server" MaxLength="18"></asp:TextBox>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="lbl_Phone2" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtPhone2" CssClass="form-control" runat="server"
                        ondrop="return false" onkeyup="return assignValue(event,this,'Phone')" onkeypress="return checkPhone(event,this,18,MaxLength)"
                        MaxLength="18"></asp:TextBox>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2">
                    <asp:Label ID="lbl_Fax" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtFax" CssClass="form-control" runat="server"
                        ondrop="return false" onkeyup="return assignValue(event,this,'Fax')" onkeypress="return checkPhone(event,this,18,MaxLength)"
                        MaxLength="18"></asp:TextBox>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="lbl_Mobile" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtMobile" CssClass="form-control" runat="server"
                        ondrop="return false" onkeyup="return assignValue(event,this,'Mobile')" onkeypress="return checkPhone(event,this,18,MaxLength)"
                        MaxLength="18"></asp:TextBox>
                </div>
            </div>
            <div class="row form-group">
                <div class="col-md-2">
                    <asp:Label ID="lbl_Email" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtEmail" CssClass="form-control" runat="server"
                        onkeypress="return chkMaxLen(event,this,80,MaxLength);" MaxLength="80"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail"
                        Display="None" ErrorMessage="Enter Valid Email Id" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="lbl_WebAdd" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                    <asp:TextBox onpaste="return true" ID="txtWeb" CssClass="form-control" runat="server"
                        onkeypress="return chkMaxLen(event,this,50,MaxLength);" MaxLength="50"></asp:TextBox>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtWeb"
                        Display="None" ErrorMessage="Enter Valid Web Address" ValidationExpression="(http)?(s)?(://)?([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"></asp:RegularExpressionValidator>
                </div>
            </div>

            <div class="row form-group" id="LogoId" runat="server">
                <div class="col-md-2">
                    <asp:Label ID="lbl_Logo" runat="server"></asp:Label>
                </div>
                <div class="col-md-3" align="left">
                    <asp:FileUpload ID="upLogo" onpaste='return false;' onkeydown="return false;" CssClass="fupload"
                        runat="server" />
                    <asp:Label runat="server" Text="[Only bmp file format is supported]"></asp:Label>
                </div>
                <div class="col-md-1">
                    
                </div>
                <div class="col-md-2">
                    
                </div>
                <div class="col-md-3">
                
                </div>
            </div>
            
             <div class="row form-group">
                <div class="col-md-2">
                   <asp:Label ID="Label2" runat="server"> Timezone </asp:Label>
                </div>
                <div class="col-md-4">
                   <asp:DropDownList ID="ddlUTCTime" runat="server" Width="270px" Height="35px" EnableViewState="true"
                                                    CssClass="form-control select2 man-dat" AppendDataBoundItems="true"
                                                    Style="border-radius: 15px">
                                                    <asp:ListItem Value="-Select-" Text="-Select-"></asp:ListItem>
                                                </asp:DropDownList>
                    <asp:HiddenField ID="hdnRequestId" runat="server"/>
                </div>
                <div class="col-md-1">
                </div>
                <div class="col-md-2">
                    <asp:Label ID="Label3" runat="server"></asp:Label>
                </div>
                <div class="col-md-3">
                   
                </div>
            </div>

            <div class="row">
                <div class="col-md-5">
                </div>
                <div class="col-md-6">
                    <div class="pull-right-button">
                        <asp:LinkButton ID="btn_save" CssClass="btn save-btn fa-floppy-o" runat="server"
                            OnClientClick="if(Page_ClientValidate()) return check();return false;" OnClick="btn_save_Click" />
                        <asp:LinkButton ID="btn_cancel" CssClass="btn save-btn fa-angle-left" runat="server"
                            OnClick="btn_cancel_Click" CausesValidation="False" />
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-md-6">
                    <div class="pull-right-button">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                            ShowSummary="False" />
                        <asp:HiddenField ID="hid_levelId" runat="server" EnableViewState="true" Visible="true" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
