var uniqueWin = true;

function popup(path,w,h,wresizeable,wscrollbars,wtop,wleft,wmenubar,wtoolbar,wlocation,wstatus) {
	// setup defaults for everything but path, w, h
	if (wresizeable != "no") wresizeable = "yes";
	if (!wtop) wtop = 10;
	if (!wleft) wleft = 10;
	if (wmenubar != "yes") wmenubar = "no";
	if (wtoolbar != "yes") wtoolbar = "no";
	if (wlocation != "yes") wlocation = "no";
	if (wscrollbars != "no") wscrollbars = "yes";
	if (wscrollbars == "yes") {
		w += 16; 
		h += 16;
	}
	if (wstatus != "yes") wstatus = "no";
	
	// Set window name
	var windowName = "newWin";
	// check flag for unique windows
	if ((uniqueWin != 'undefined') && (uniqueWin)) {
		winIndex = parseInt(Math.random() * 100000);
		windowName = 'window' + winIndex;
		// alert(windowName); // left in for testing purposes
	}
	
	// Open the window and set the parameters
	newWin = window.open(path,windowName,"width=" + w + ",innerwidth="+ w + ",height=" + h + ",innerHeight="+ h + ",resizable=" + wresizeable + ",top=" + wtop + ",pixelTop=" + wtop + ",left=" + wleft + ",pixelLeft=" + wleft + ",menubar=" + wmenubar + ",toolbar=" + wtoolbar + ",location=" + wlocation + ",scrollbars=" + wscrollbars + ",status=" + wstatus);
	
	// focus the window
	newWin.focus();
}
