<%@ page language="C#" masterpagefile="~/Pages/Common/MasterPages/MainMasterPage.master" autoeventwireup="true" inherits="TemplateMaster, App_Web_gcstfo31" uiculture="auto" meta:resourcekey="PageResource1" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Src="../../../UserControls/GridViewPager/GridViewPager.ascx" TagName="GridViewPager" TagPrefix="uc1" %>
<%@ Register Assembly="Sapphire.Ohu.Web.ControlToolKit.Controls" Namespace="Sapphire.Ohu.Web.ControlToolKit.Controls" TagPrefix="Ctk" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/UserControls/HTMLEditor/HTMLEditorControl.ascx" TagName="HTMLEditor" TagPrefix="uc1" %>
<%@ Register Src="~/UserControls/Common/ScreenGroup/ScreenGroup.ascx" TagName="ScreenGroupControl" TagPrefix="ScreenGroup" %>

<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
    <asp:UpdatePanel ID="UP1" runat="server">
        <ContentTemplate>
            <div id="divContentPage">
                <div style="width: 100%">
                    <table width="100%" cellpadding="0" cellspacing="0">
                    </table>
                    <div class="spacer5">
                        <asp:Image ID="Image5" runat="server" ImageUrl="~/Images/spacer.gif"></asp:Image>
                    </div>
                    <table width="100%" border="0" style="vertical-align: top; margin-top: -1px" cellpadding="0" cellspacing="0">
                        <tr>
                            <td class="dashBoardLeftCont" style="width: 160px" valign="top">
                                <div id="leftContainer">
                                    <dl class="expandMenu">
                                        <table width="100%" border="0">
                                            <tr>
                                                <td>
                                                    <div class="himssuHeader3WireBox">
                                                        <dt id="dtSETTINGS" onclick="showHideSwitch('ddSETTINGS')">
                                                            <table width="100%" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>
                                                                        <div class="himsBoxHeader">
                                                                            <div class="leftdiv">
                                                                            </div>
                                                                            <div class="himsBoxTitle">
                                                                                <table width="100%">
                                                                                    <tr>
                                                                                        <td style="width: 100%">
                                                                                            <div class="headerText">
                                                                                                Master
                                                                                            </div>
                                                                                        </td>
                                                                                        <td>
                                                                                            <img name="ddSETTINGSButton" id="ddSETTINGSButton" src="../../../Images/buttonCollapse.gif"></img>
                                                                                        </td>
                                                                                    </tr>
                                                                                </table>
                                                                            </div>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </dt>
                                                        <dd style="text-align: left; margin: 0px" id="ddSETTINGS">
                                                            <table width="100%" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td>
                                                                        <div class="himsBoxContent leftTableContainer">
                                                                            <div class="leftUlMenu">
                                                                                <ul id="sidebarmenu1">
                                                                                    <ScreenGroup:ScreenGroupControl EnableViewState="true" ID="ScreenGroupControl" ScreenGroupId="124"
                                                                                        Visible="true" runat="server" />
                                                                                </ul>
                                                                            </div>
                                                                        </div>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                            <div class="himsBoxFooter">
                                                                <div>
                                                                </div>
                                                            </div>
                                                        </dd>
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </dl>
                                </div>
                            </td>
                            <td class="minMaxButton" style="width: 1%; margin: 0; vertical-align: top">
                                <asp:Image ID="Image7" runat="server" ImageUrl="~/Images/spacer.gif"></asp:Image>
                            </td>
                            <td style="vertical-align: top">
                                <div class="himssuHeader2WireBox">
                                    <div class="himsBoxHeader">
                                        <asp:Panel ID="TopPanel" runat="server" meta:resourcekey="TopPanelResource1">
                                            <div class="leftdiv">
                                            </div>
                                            <div class="himsBoxTitle">
                                                <asp:Image ID="Image1" runat="server" class="fLeft"
                                                    meta:resourcekey="Image1Resource1" />
                                                <div class="headerText">
                                                    <asp:Label ID="Label3" runat="server" meta:resourcekey="Label3Resource1"></asp:Label>
                                                    <cc1:CollapsiblePanelExtender ID="cpe" runat="server" TargetControlID="DetailPanel"
                                                        ExpandControlID="Image1" CollapseControlID="Image1" TextLabelID="Label3" Collapsed="True"
                                                        CollapsedText="  Search" ExpandedText="  Search" ImageControlID="Image1" ExpandedImage="~/images/buttonCollapse.gif"
                                                        CollapsedImage="~/images/buttonExpand.gif" Enabled="True" />
                                                </div>
                                            </div>
                                        </asp:Panel>
                                    </div>
                                    <asp:Panel ID="DetailPanel" runat="server"
                                        meta:resourcekey="DetailPanelResource1">
                                        <div class="himsBoxContent">
                                            <div class="contentHolder">
                                                <div class="outerBoxPreBtn pTop5">
                                                    <div class="controlLabelWidth">
                                                        <asp:Label ID="TemplateNameSearchlabel" Text="Name" runat="server"
                                                            meta:resourcekey="TemplateNameSearchlabelResource1"></asp:Label>
                                                    </div>
                                                    <div class="fLeft pRight5">
                                                        <asp:TextBox ID="TemplateNameSearchTextBox" runat="server"
                                                            meta:resourcekey="TemplateNameSearchTextBoxResource1"></asp:TextBox>
                                                    </div>
                                                </div>
                                                <div class="fLeft pRight5 pTop10">
                                                    <asp:Button runat="server" ID="SearchButton" Text="Search"
                                                        OnClick="SearchButton_Click" SkinID="0" CssClass="PrimaryButton" />
                                                    <asp:Button ID="ClearSearchButton" CausesValidation="False" Text="Clear" runat="server"
                                                        OnClick="ClearSearchButton_Click"
                                                        meta:resourcekey="ClearSearchButtonResource1" />
                                                </div>
                                                <div class="cBoth">
                                                </div>
                                                <div id="AllergyGridDiv" runat="server" visible="False">
                                                    <div class="spacer">
                                                        <asp:Image ID="Image4" runat="server" ImageUrl="~/Images/spacer.gif"
                                                            meta:resourcekey="Image4Resource1" />
                                                    </div>
                                                    <div class="himssuHeader1WireBox" id="PatientRelationDiv" runat="server" style="width: 100%">
                                                        <div class="himsBoxHeader" id="ListDiv" runat="server" visible="False">
                                                            <div class="leftdiv">
                                                            </div>
                                                            <div class="himsBoxTitle" style="width: 99%">
                                                                <div class="headerText">
                                                                    <div class="fLeft">
                                                                        List
                                                                    </div>
                                                                </div>
                                                                <div align="right" class="fRight" style="margin-top: -3px;">
                                                                    <uc1:GridViewPager ParentGridView="TemplateGridView" ID="TemplateGridView_GridViewPager"
                                                                        runat="server" OnFirstRecordClick="TemplateGridView_GridViewPager_FirstRecordClick"
                                                                        OnLastRecordClick="TemplateGridView_GridViewPager_LastRecordClick" OnNextRecordClick="TemplateGridView_GridViewPager_NextRecordClick"
                                                                        OnPrevRecordClick="TemplateGridView_GridViewPager_PrevRecordClick" OnTextBoxValueChange="TemplateGridView_GridViewPager_TextBoxValueChange" />
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="himsBoxContent">
                                                            <div id="DivHeader" style="vertical-align: top; width: 100%;">
                                                                <asp:Table ID="TemplateMasterGridViewTable" runat="server" CellPadding="0" CellSpacing="0"
                                                                    BackColor="#E8E8E8" ForeColor="Black" Width="100%" GridLines="Both"
                                                                    CssClass="GridViewTableRow"
                                                                    meta:resourcekey="TemplateMasterGridViewTableResource1">
                                                                </asp:Table>
                                                            </div>
                                                            <div class="himsBoxContentMsg" id="GridMessageDiv" runat="server"
                                                                visible="False">
                                                            </div>
                                                            <div id="DivData" class="Container" style="vertical-align: top; height: 109px; width: 99.6%;">
                                                                <asp:GridView Width="100%" ID="TemplateGridView" runat="server" AutoGenerateColumns="False"
                                                                    OnSelectedIndexChanged="TemplateGridView_SelectedIndexChanged" DataKeyNames="TemplateId,IsObsolete,CreatedUserId,EventId,Title,Remark"
                                                                    OnPageIndexChanging="TemplateGridView_PageIndexChanging"
                                                                    AllowPaging="True" EmptyDataText="No records found"
                                                                    PageSize="5" ShowHeader="False"
                                                                    OnRowDataBound="TemplateGridView_RowDataBound"
                                                                    meta:resourcekey="TemplateGridViewResource1">
                                                                    <Columns>
                                                                        <asp:CommandField ShowHeader="True" ShowSelectButton="True"
                                                                            meta:resourcekey="CommandFieldResource1">
                                                                            <HeaderStyle HorizontalAlign="Center" />
                                                                            <ItemStyle HorizontalAlign="Center" Width="10%" />
                                                                        </asp:CommandField>
                                                                        <asp:TemplateField Visible="False" meta:resourcekey="TemplateFieldResource1">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="TemplateIdLabel" runat="server" Text='<%# Bind("TemplateId") %>' ToolTip='<%# Bind("TemplateId") %>'
                                                                                    Visible="False"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ItemStyle Width="0%" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField Visible="False" meta:resourcekey="TemplateFieldResource2">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="IsObsoleteLabel" runat="server" Text='<%# Bind("IsObsolete") %>' ToolTip='<%# Bind("IsObsolete") %>'
                                                                                    Visible="False"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ItemStyle Width="0%" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField Visible="False" meta:resourcekey="TemplateFieldResource3">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="CreatedUserIdLabel" runat="server" Text='<%# Bind("CreatedUserId") %>'
                                                                                    ToolTip='<%# Bind("CreatedUserId") %>' Visible="False"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ItemStyle Width="0%" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField Visible="False" meta:resourcekey="TemplateFieldResource4">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="EventIdLabel" runat="server" Text='<%# Bind("EventId") %>' ToolTip='<%# Bind("EventId") %>'
                                                                                    Visible="False"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ItemStyle Width="0%" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="Name" meta:resourcekey="TemplateFieldResource5">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="TitleLabel" runat="server" Width="200px" Text='<%# Bind("Title") %>'
                                                                                    ToolTip='<%# Bind("Title") %>' CssClass="boxEllips"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ItemStyle Width="45%" />
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="Description"
                                                                            meta:resourcekey="TemplateFieldResource6">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="RemarkLabel" runat="server" Width="400px" Text='<%# Bind("Remark") %>'
                                                                                    CssClass="boxEllips" ToolTip='<%# Bind("Remark") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                            <ItemStyle Width="45%" />
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                    <PagerSettings Visible="False" />
                                                                </asp:GridView>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </asp:Panel>
                                </div>
                                <div class="spacer">
                                    <asp:Image ID="Image3" runat="server" ImageUrl="~/Images/spacer.gif" meta:resourcekey="Image3Resource1" />
                                </div>
                                <div class="himssuHeader1WireBox">
                                    <div class="himsBoxHeader">
                                        <div class="leftdiv">
                                        </div>
                                        <div class="himsBoxTitle">
                                            <div class="headerText">
                                                Maintainance
                                            </div>
                                        </div>
                                    </div>
                                    <div class="himsBoxContent">
                                        <div class="contentHolder">
                                            <div class="outerBox pTop5">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="TemplateNameLabel" runat="server" Text="Name"
                                                        SkinID="MandatoryLabel" meta:resourcekey="TemplateNameLabelResource1"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:TextBox ID="TemplateNameTextBox" runat="server" AutoPostBack="True" MaxLength="100"
                                                        OnTextChanged="TemplateNameTextBox_TextChanged" onmouseleave="showHideTooltip()"
                                                        onmouseenter="showHideTooltip()" SkinID="CustomWidthTextbox" Width="150px"
                                                        meta:resourcekey="TemplateNameTextBoxResource1"></asp:TextBox>
                                                </div>
                                            </div>
                                            <div class="cBoth">
                                            </div>
                                            <div class="outerBox pTop5">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="Label2" runat="server" Text="Description"
                                                        SkinID="MandatoryLabel" meta:resourcekey="Label2Resource1"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:TextBox SkinID="CustomWidthTextbox" ID="TemplateDescriptionTextBox" MaxLength="300"
                                                        runat="server" Width="150px" onmouseleave="showHideTooltip()"
                                                        onmouseenter="showHideTooltip()"
                                                        meta:resourcekey="TemplateDescriptionTextBoxResource1"></asp:TextBox>&nbsp;
                                                </div>
                                            </div>
                                            <div class="cBoth">
                                            </div>
                                            <div class="outerBox pTop5">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="Label12" runat="server" Text="Type"
                                                        meta:resourcekey="Label12Resource1"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:RadioButton ID="MailRadioButton" runat="server" Checked="True" GroupName="B"
                                                        OnCheckedChanged="MailRadioButton_CheckedChanged" AutoPostBack="True"
                                                        meta:resourcekey="MailRadioButtonResource1"></asp:RadioButton>
                                                    <asp:Label ID="MailLabel" runat="server" Text="Mail"
                                                        meta:resourcekey="MailLabelResource1"></asp:Label>
                                                    <asp:RadioButton ID="SMSRadioButton" runat="server" GroupName="B" OnCheckedChanged="SMSRadioButton_CheckedChanged"
                                                        AutoPostBack="True" meta:resourcekey="SMSRadioButtonResource1"></asp:RadioButton>
                                                    <asp:Label ID="SMSLabel" runat="server" Text="SMS"
                                                        meta:resourcekey="SMSLabelResource1"></asp:Label>
                                                </div>
                                            </div>
                                            <div class="cBoth">
                                            </div>
                                            <div class="outerBox pTop5">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="ModuleLabel" SkinID="MandatoryLabel" runat="server"
                                                        Text="Module" meta:resourcekey="ModuleLabelResource1"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:DropDownList ID="ModuleDropDownList" SkinID="CustomWidthDropDownList" Width="154px"
                                                        runat="server" AutoPostBack="True" OnSelectedIndexChanged="ModuleNameDropDownList_SelectedIndexChanged"
                                                        onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                        meta:resourcekey="ModuleDropDownListResource1">
                                                    </asp:DropDownList>
                                                </div>
                                            </div>
                                            <div class="cBoth">
                                            </div>
                                            <div class="outerBox pTop5">
                                                <div class="controlLabelWidth">
                                                    <asp:Label ID="EventLabel" runat="server" SkinID="MandatoryLabel" Text="Event"
                                                        meta:resourcekey="EventLabelResource1"></asp:Label>
                                                </div>
                                                <div class="fLeft pRight5">
                                                    <asp:DropDownList ID="EventDropDownList" SkinID="CustomWidthDropDownList" runat="server"
                                                        Width="154px" AutoPostBack="True" OnSelectedIndexChanged="EventDropDownList_SelectedIndexChanged"
                                                        onmouseleave="showHideTooltip()" onmouseenter="showHideTooltip()"
                                                        meta:resourcekey="EventDropDownListResource1">
                                                    </asp:DropDownList>
                                                </div>
                                            </div>
                                            <div class="cBoth">
                                            </div>
                                            <table>
                                                <tr>
                                                    <td>
                                                        <div class="spacer5">
                                                            <asp:Image ID="Image2" runat="server" ImageUrl="~/Images/spacer.gif"
                                                                meta:resourcekey="Image2Resource1" />
                                                        </div>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width: 20%">
                                                        <asp:ListBox Height="200px" Width="200px" ID="lstParameter" runat="server" DataTextField="ColumnNames"
                                                            DataValueField="ColumnNames" onmousedown="d = new drag(this)" onmouseup="d.drop(this.form.SMSTextBox)"
                                                            onmouseout="if (typeof d != 'undefined') d.setIndex()"
                                                            meta:resourcekey="lstParameterResource1"></asp:ListBox>
                                                    </td>
                                                    <td colspan="2">
                                                        <asp:Panel ID="MailPanel" runat="server" Height="198px" Width="100%"
                                                            meta:resourcekey="MailPanelResource1">
                                                            <uc1:HTMLEditor ID="MailTextBox" runat="server" />
                                                        </asp:Panel>
                                                        <asp:TextBox SkinID="MultiLineTextbox" ID="SMSTextBox" runat="server" Height="198px"
                                                            Width="200px" multiline="true" TextMode="MultiLine" Visible="False" onmouseleave="showHideTooltip()"
                                                            onmouseenter="showHideTooltip()" meta:resourcekey="SMSTextBoxResource1"></asp:TextBox>
                                                    </td>
                                                </tr>
                                            </table>
                                            <div class="cBoth">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
            <div class="spacer">
                <img src="../../../Images/spacer.gif" />
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:ScriptManagerProxy ID="MyManagerProxy" runat="server">
        <Scripts>
            <asp:ScriptReference Path="../../../JavaScript/Validations.js" />
            <asp:ScriptReference Path="../../../JavaScript/Template.js"></asp:ScriptReference>
        </Scripts>
        <Scripts>
            <asp:ScriptReference Path="../../../JavaScript/Template.js" />
        </Scripts>
    </asp:ScriptManagerProxy>
    <script language="javascript" type="text/javascript" src="../../../JavaScript/CommonSearch.js"></script>
    <script type="text/javascript" language="javascript" src="../../../JavaScript/CommonMaster.js"></script>
    <script language="javascript" type="text/javascript">
        function storeCur(txtMsg) {
            if (txtMsg.createTextRange)
                txtMsg.caretPos = document.selection.createRange().duplicate();
        }
        function drag(objSource) {
            this.select = objSource;
        }
        function drag.prototype.drop(objDest) {
            var objDest = document.getElementById('<%=SMSTextBox.ClientID%>')
            if (!this.dragStart) return;
            this.dest = objDest;
            var pt = this.option.cloneNode(true);
            if (objDest.createTextRange && objDest.caretPos) {
                var caretPos = objDest.caretPos;
                if (caretPos.text.charAt(caretPos.text.length - 1) == '') {
                    caretPos.text = "[" + pt.value + "]";
                }
            }
        }
        function drag.prototype.setIndex() {
            var i = this.select.selectedIndex;
            window.status = "selectedIndex = " + i;
            if (i == -1) return;
            this.option = this.select.options[i];
            this.dragStart = true;
            var myField = document.getElementById('<%=lstParameter.ClientID%>')
            var myValue = document.getElementById('<%=SMSTextBox.ClientID%>').value;
            if (myField.selectionStart || myField.selectionStart == '0') {
                var startPos = myField.selectionStart;
                var endPos = myField.selectionEnd;
                myField.value = myField.value.substring(0, startPos) + myValue
                                + myField.value.substring(endPos, myField.value.length);
            }
            else {
                myField.value += myValue;
            }
        }
        function fnSaveTemplate() {
            var himsValidator = [new hims_ctl_val("<%= TemplateNameTextBox.ClientID %>", "Name", "T", "", "", "", 20),
                                            new hims_ctl_val("<%= TemplateDescriptionTextBox.ClientID %>", "Description", "T", "", "", "", 20),
                                            new hims_ctl_val("<%= ModuleDropDownList.ClientID %>", "Module", "T", "", "", "", 20),
                                            new hims_ctl_val("<%= EventDropDownList.ClientID %>", "Event", "T", "", "", "", 20)];

            if (fnDoValidate(himsValidator))
                return true;
            else
                return false;
        }
    </script>
    <script type="text/javascript" language="javascript">
        function showHideSwitch(theid) {
            if (document.getElementById) {
                var switch_id = document.getElementById(theid);
                var imgid = theid + 'Button';
                var button_id = document.getElementById(imgid);
                if (menus_status_array[theid] != 'show') {
                    button_id.setAttribute('ImageUrl', img_close);
                    switch_id.className = 'showSwitch';
                    menus_status_array[theid] = 'show';
                    document.cookie = theid + '=show';
                    if (theid == "ddSETTINGS") {
                        menus_status_array[ddSETTINGS] = 'hide';
                        var theid2 = "ddSETTINGS";
                        document.cookie = theid2 + '=hide';
                    }
                    //Added for reseting after setting cookie
                    resetMenu();
                } else {
                    button_id.setAttribute('ImageUrl', img_open);
                    switch_id.className = 'hideSwitch';
                    menus_status_array[theid] = 'hide';
                    document.cookie = theid + '=hide';
                }
            }
        }
        function resetMenu() { // read cookies and set menus to last visited state
            if (document.getElementById) {
                for (var i = 0; i < menus_array.length; i++) {
                    var idname = menus_array[i];
                    var switch_id = document.getElementById(idname);
                    var imgid = idname + 'Button';
                    var button_id = document.getElementById(imgid);
                    if (getCookie(idname) == 'show') {
                        button_id.setAttribute('ImageUrl', img_open);
                        // switch_id.className = 'showSwitch';
                        //menus_status_array[idname] = 'show';
                    } else {
                        button_id.setAttribute('ImageUrl', img_close);
                        //switch_id.className = 'hideSwitch';
                        //menus_status_array[idname] = 'hide';
                    }
                }
            }
        }
    </script>
    <script language="JavaScript" type="text/javascript">
        /****************************************************************************************
        Function/Procedure  Name            :- fnDbtNonModalWin
        functionality                       :- Function to open Search Window.
        ****************************************************************************************/
        var childPopupArray = new Array(30);
        function fnDbtNonModalWin(strFullWindowName, strWindowTitle, dialogSize) {
            var targetWin = null;
            var CurrentPopUpIndex = 0;
            for (var PopUpCount = 0; PopUpCount < childPopupArray.length - 1; PopUpCount++) {
                if (childPopupArray[PopUpCount] != undefined)
                    if (childPopupArray[PopUpCount][0] == strWindowTitle) {
                        targetWin = childPopupArray[PopUpCount][1];
                        if (targetWin.closed)
                            childPopupArray[PopUpCount] = undefined;
                        break;
                    }
            }
            if (targetWin != null && targetWin.closed)
                targetWin = null;
            if (targetWin == null) {
                targetWin = window.open(strFullWindowName, '', 'height=1000,width=1200,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=yes');

            }
            else {
                targetWin.location = strFullWindowName;
                targetWin.focus();
            }
            for (var ExistingPopUpCount = 0; ExistingPopUpCount < childPopupArray.length - 1; ExistingPopUpCount++) {
                if (childPopupArray[ExistingPopUpCount] != undefined)
                    if (childPopupArray[ExistingPopUpCount][0] == strWindowTitle) {
                        childPopupArray[ExistingPopUpCount][1] = targetWin;
                        CurrentPopUpIndex = ExistingPopUpCount;
                        break;
                    }
            }
            if (CurrentPopUpIndex == 0) {
                for (var EmptyPopUpCount = 0; EmptyPopUpCount < childPopupArray.length - 1; EmptyPopUpCount++) {
                    if (childPopupArray[EmptyPopUpCount] == undefined) {
                        childPopupArray[EmptyPopUpCount] = new Array(2);
                        childPopupArray[EmptyPopUpCount][0] = strWindowTitle;
                        childPopupArray[EmptyPopUpCount][1] = targetWin;
                        break;
                    }
                }
            }
        }
        function setScroll(val, posId) {
            posId.value = val.scrollTop;
        }
        //only required for w/o ajax page ScrollWOAjax.
        function scrollTo(what, posId) {
            if (what != "0")
                document.getElementById(what).scrollTop = document.getElementById(posId).value;
        }
        function getCookie(name) {
            var dc = document.cookie;
            var prefix = name + "=";
            var begin = dc.indexOf("; " + prefix);
            if (begin == -1) {
                begin = dc.indexOf(prefix);
                if (begin != 0) return null;
            } else
                begin += 2;
            var end = document.cookie.indexOf(";", begin);
            if (end == -1)
                end = dc.length;
            return unescape(dc.substring(begin + prefix.length, end));
        }
        // LIST ALL SHOW/HIDE ELEMENT IDS HERE
        menus_array = new Array('ddSETTINGS');
        menus_status_array = new Array(); // remembers state of switches
        img_close = '../../Images/buttonExpand.gif';
        img_open = '../../Images/buttonCollapse.gif';
        popwindow = null;
        function popUp(pageURL, title, w, h) {
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
        }
        function popUpReportViewer(pageURL, title, w, h) {
            var left = (screen.width / 2) - (w / 2);
            var top = (screen.height / 2) - (h / 2);
            var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
            targetWin.moveTo(0, 0);
            targetWin.resizeTo(screen.availWidth, screen.availHeight);
        }
    </script>
</asp:Content>