﻿//Author: Kishore Gorjala
var popWin = null;

function OpenPopUp(pageName,windowName,width,height,pos,queryString,scrollbar)
{
    var status      = "no";
    var toolbar     = "no";
    //var scrollbar   = "no";
    var menubar     = "no";
    var resizable   = "auto";
    var directories = "yes";
    var posLeft     = 0;
    var posTop      = 25;
    var windowstring;
    if(pos=="random"){posLeft=(screen.width)?Math.floor(Math.random()*(screen.width-width)):100;posTop=(screen.height)?Math.floor(Math.random()*((screen.height-height)-75)):100;}
    if(pos=="center"){posLeft=(screen.width)?(screen.width-width)/2:100;posTop=(screen.height)?(((screen.height-height)/2)- 100):100;}
    else if((pos!="center" && pos!="random") || pos==null){posLeft=0;posTop=25}
    //
    windowstring = "'toolbar=" + toolbar + ",status=" + status + ",menubar=" + menubar;
    windowstring += ",resizable=" + resizable + ",scrollbars=" + scrollbar + ",directories=" + directories;
    windowstring += ",left=" + posLeft + ",top=" + posTop + ",location=no";
    if (width != 0 && height != 0)
    {
        windowstring += ",width=" + width + ",height=" + height + "'";
    }
    if(popWin != null)
    {
        if(!popWin.closed)
        {
            popWin.close();
        }
    }
    popWin = window.open(pageName, windowName, windowstring);
    popWin.focus();
}
function ClosePopUp()
{
    popWin.close();
}
//kigo
