
//windowPopUp function starts here
var strWin              /* declaring needed variables */
var strURL
var strWinName
var strScrollBar
var strResize
var strFeatures
var iWinWidth
var iWinHeight
var iWinLeft
var iWinTop
var iScreenWidth
var iScreenHeight

function windowPopUp(strURL,strWinName,strScrollBar,strResize,strFeatures,iWinWidth,iWinHeight)    /* this function needs 4 arguments */
{

if (strScrollBar == "yes")	/* check if we use scrollbars */
    {
    if (is.ie == true || is.ns == true)
        {
        iWinWidth = iWinWidth + 16;
        }
    }

if (strResize == "yes")	/* check if we will be able to resize the window */
{
	strResize = ",resizable=1";
}else{
	strResize = ",resizable=0";
}
	
if (strFeatures == "yes")	/* check if we will have all features like on anormal window */
{
	strFeatures = "menubar=1,toolbar=1,location=1,directories=1,status=1"+strResize;
}else{
	strFeatures = "menubar=0,toolbar=0,location=0,directories=0,status=1"+strResize;
}


	if (strWin!=null)    /* check if the window exists */
	{	
		if(!strWin.closed)    /* if it exists */
		{
			strWin.focus();   /* focus on it */
			strWin 	/* load the content again */  
			return;
		}
	}
    
    iScreenWidth = screen.availWidth;
    iScreenHeight = screen.availHeight;

    iWinLeft = Math.round((iScreenWidth/2)-(iWinWidth/2));
    iWinTop = Math.round(iScreenHeight*0.25);
    
    if (iWinHeight >= (iScreenHeight - iWinTop))
    {
    iWinHeight = Math.round(iScreenHeight*0.7);
    }
        
	strWin = window.open(strURL,strWinName, "scrollbars="+strScrollBar+","+strFeatures+",width="+iWinWidth+",height="+iWinHeight+",screenX="+iWinLeft+",screenY="+iWinTop+",left="+iWinLeft+",top="+iWinTop);	/* open the window */
}
//windowPopUp function ends here

