    /*** <pre>
    *-------------------------------------------------------------------------------

    * Copyright © 2009 Sreyas . All rights reserved.

    *-------------------------------------------------------------------------------
    * File: WindowsOperations.js
    *-------------------------------------------------------------------------------
    * DESCRIPTION:
    * This file Contatins the functions to restrict multiple
    * instances of Child window of Agent Settings.
    *
    * AUTHOR:        Bijay
    * 
    *
    * 
    *-------------------------------------------------------------------------------
    * DEPENDENCIES
    *
    *-------------------------------------------------------------------------------
    * </pre>
    */


    var oAgentSetWin;
    /*  added for Destination Settings */
    var oDestAddrBkWin;
    var oDestAddrGrpWin;
    var oDestNewGrpWin;
    var oDestSearchWin;

    /* added for counters*/

    var OCntrDeptCodeNewWin;


    /**************************************************************************
    Function Name	:	fnnCloseChildWindows
    Parameters		:	None
    Return			:	none
    Description		:	Closes all the child windows when the parent unloads
    ***************************************************************************/

    function fnnCloseChildWindows() {
        if((oAgentSetWin != null) && (oAgentSetWin.closed == false) )
            oAgentSetWin.close();
    }


    /**************************************************************************
    Function Name	:	fnnOpenInNewWindow
    Parameters		:	pFile
    Return			:	none
    Description		:	Opens pFile in new window and holds the handle for it.
    ***************************************************************************/


    var iScrnW = screen.width;//width of the screen
    var iScrnH	= screen.height;//height of the screen

    function fnnOpenPageInNewWindow(pFile, pWinName, pWinFeatures, pWinWidth, pWindHeight) {
        var iWinW = pWinWidth;//window width
        var iWinH = pWindHeight;//window height

        var iXCoord = (iScrnW - iWinW) / 2;//new window X coordinate
        var iYCoord = (iScrnH - iWinH) / 2;//new window Y coordinate
        if((pWinName != null) && (pWinName.closed == false)) {
                pWinName.location = pFile;
                pWinName.focus();
        }
        else // if the window was not created then only create and display a new window in the middle of the screen.
            window.open(pFile,pWinName,pWinFeatures + ",left=" + iXCoord + ",top=" + iYCoord);

        return;
    }


    function fnnOpenInNewWindow(pFile) {
        var iWinW = 750;//window width
        var iWinH = 450;//window height

        var iXCoord = (iScrnW - iWinW) / 2;//new window X coordinate
        var iYCoord = (iScrnH - iWinH) / 2;//new window Y coordinate
        // if the window was created then bring the window in focus
        if((oAgentSetWin != null) && (oAgentSetWin.closed == false ) ){
                oAgentSetWin.location = pFile;
                oAgentSetWin.focus();
        }
        else  // if the window was not created then only create and display a new window in the middle of the screen.
            oAgentSetWin = window.open(pFile,"","toolbar=no,height=450,width=750,resizable=no,scrollbars=yes,left=" + iXCoord + ",top=" + iYCoord);
			//oAgentSetWin = window.open(pFile);
        return ;
    }

    
    /**************************************************************************
    Function Name	:	fnnOpenNewWindowWithSize
    Parameters		:	pFile, pWinWidth, pWinHeight, scrollYorN
    Return			:	none
    Description		:	Opens pFile in new window according to the User preffered width and height and holds the handle for it.
    ***************************************************************************/

    function fnnOpenNewWindowWithSize(pFile, pWinWidth, pWinHeight, scrollYorN) {
        var iWinW = pWinWidth;//window width
        var iWinH = pWinHeight;//window height

        var iXCoord = (iScrnW - iWinW) / 2;//new window X coordinate
        var iYCoord = (iScrnH - iWinH) / 2;//new window Y coordinate
        if(scrollYorN == null)
            scrollYorN = 'no'
        // if the window was created then bring the window in focus
        if((oAgentSetWin != null) && (oAgentSetWin.closed == false ) ){
            oAgentSetWin.location = pFile;
            oAgentSetWin.focus();
        }
        else  // if the window was not created then only create and display a new window in the middle of the screen.
            oAgentSetWin = window.open(pFile,"","toolbar=no,height="+pWinHeight+",width="+pWinWidth+",resizable=no,scrollbars="+scrollYorN+",left=" + iXCoord + ",top=" + iYCoord);
			//oAgentSetWin = window.open(pFile);
    }

    function fnnOpenPrintjobsWindow(pFile) {
        var iWinW = 500;//window width
        var iWinH = 170;//window height

        var iXCoord = (iScrnW - iWinW) / 2;//new window X coordinate
        var iYCoord = (iScrnH - iWinH) / 2;//new window Y coordinate

        if((oAgentSetWin != null) && (oAgentSetWin.closed == false ) ) {		
        // if the window was created then bring the window in focus

                oAgentSetWin.location = pFile;
                oAgentSetWin.focus();
        }
        else // if the window was not created then only create and display a new window in the middle of the screen.
            oAgentSetWin = window.open(pFile,"","toolbar=no,height=170,width=500,resizable=yes,scrollbars=yes,left=" + iXCoord + ",top=" + iYCoord);

        return ;
    }

	
    function showDivs(divlist) {
        eachDiv = divlist.split('~');
        for(i=0;i<(eachDiv.length);i++){
            currentDiv = eachDiv[i];
            obj = eval(document.getElementById(currentDiv))
            if (obj!=undefined)
                document.getElementById(currentDiv).style.display="";
        }
    }

    function hideDivs(divlist) {
        eachDiv=divlist.split('~');
        for(i=0;i<(eachDiv.length);i++) {
            currentDiv = eachDiv[i];
            obj=eval(document.getElementById(currentDiv))
            if (obj!=undefined)
                document.getElementById(currentDiv).style.display="none";
        }
    }
 


                 
