<!--
/**
 *  Popup window.
 * 
 * @param string url - The url to show in the popup window
 * @param integer width - (optional) The width in pixels
 * @param integer height - (optional) The height in pixels
 * @param string scrollbars - (optional) 'yes'/'no' values
 * @param string targetName - (optional) Changes the target name of the window, use this for sub popups.
 * @param string modal - (optional) 'yes'/'no' values,  yes give the popup a modal dialog box effect.
 */
var __popupWin = null;

function popup(url) 
{ 
    var width = arguments[1] ? arguments[1] : 800;
    var height = arguments[2] ? arguments[2] : 500;
    var scrollbars = arguments[3] ? arguments[3] : 'no';
    var resizable = arguments[4] ? arguments[4] : 'no';
    var targetName = arguments[5] ? arguments[5] : 'info';
    var modal = arguments[6] ? arguments[6] : 'no';

    var LeftPosition = 0;
    var TopPosition = 0;

    if (__popupWin != null && !__popupWin.closed) {
        __popupWin.close(); 
    }

    try {
        if(window.opener){
            LeftPosition =(window.opener.innerWidth-width) / 2;
            TopPosition =((window.opener.innerHeight-height)/2) + 60;
        } else if(window.innerWidth) {
            LeftPosition =(window.innerWidth-width) / 2;
            TopPosition =((window.innerHeight-height)/2) + 60;
        } else {
            LeftPosition =(parseInt(window.screen.width) - width)/2;
            TopPosition=((parseInt(window.screen.height) - height)/2) + 60;
        }
    } catch(e) {}

    __popupWin = window.open(url,targetName,'scrollbars='+scrollbars+',width='+width+
        ',height='+height+',resizable='+resizable+',left=' + LeftPosition + 
        ',top=' + TopPosition+',modal='+modal);

    if (window.focus) {
        __popupWin.focus();
    }
    return __popupWin;
}
// -->

