
var popWin=null;

function NewWindow(myPage,myTitle,w,h,scrollbars,pos)
{
	//center window
	if(pos=="center"){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	
	//no position means top 0left 20 hard coded
	else if((pos!="center") || pos==null)
	{
		LeftPosition=0;TopPosition=20;
	}

    //create popup window parameters for call
	Settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbars+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';

    //if window does not exist, create window
	if (!popWin || popWin.closed) {
	    popWin=window.open(myPage,myTitle,Settings);
	} else { //window exists so just focus it
	    if (window.focus) { //test for browser support of window.focus script
	        popWin.focus()
	    }
    }
}

function NewWindowEveryTime(myPage, myTitle, w, h, scrollbars, pos) {
    //center window
    if (pos == "center") {
        LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
        TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
    }

    //no position means top 0left 20 hard coded
    else if ((pos != "center") || pos == null) {
        LeftPosition = 0; TopPosition = 20;
    }

    //create popup window parameters for call
    Settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scrollbars + ',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=no';

    //if window does not exist, create window
    if (!popWin || popWin.closed) {
        popWin = window.open(myPage, myTitle, Settings);
    } else { //window exists close and reopen
        if (window.focus) { //test for browser support of window.focus script
            popWin.close()
            popWin = window.open(myPage, myTitle, Settings);
        }
    }

}

function NewHelpWindow(myPage,myTitle,w,h,scrollbars,pos)
{
	//center window
	if(pos=="center"){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	}
	
	//no position means top 0 left 20 hard coded
	else if((pos!="center") || pos==null)
	{
		LeftPosition=0;TopPosition=20;
	}

    //create popup window parameters for call
	Settings = 'width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollbars+',location=no,directories=no,status=yes,menubar=no,toolbar=no,resizable=yes';

    // Create help window, and bring it to front update URL
	helpWin=window.open(myPage,myTitle,Settings);
	if (window.focus) { //test for browser support of window.focus script
	        helpWin.focus()
   
    }
} 