// Returns the first non-null, non-empty parameter value
function getDefault() {
	var i,value,iArgLen=arguments.length;
	for(i=0;i<iArgLen;i++){
		value = arguments[i];
		if(typeof value!='undefined' && value!=null && value!='') return value;
	}
}

// Opens a pop-up window using the specified parameters.  Uses default parameters for any not specified
function popWin(url,target_window,return_object,w,h,scrollbars,resizable,status,toolbar,location,menubar,titlebar,l,t) {
	//'left=0,top=0,width=620,height=400,titlebar=no,menubar=no,location=no,resizable=yes,toolbar=no,scrollbars=yes,status=no'
	target_window = getDefault(target_window,'NewWindow');
	return_object = getDefault(return_object,false);
	w = getDefault(w,620);
	h = getDefault(h,400);
	scrollbars = getDefault(scrollbars,'yes');
	resizable = getDefault(resizable,'yes');
	status = getDefault(status,'yes');
	toolbar = getDefault(toolbar,'no');
	location = getDefault(location,'no');
	menubar = getDefault(menubar,'no');
	titlebar = getDefault(titlebar,'yes');
	l = getDefault(l,(screen.width-w)/2);
	t = getDefault(t,(screen.height-h)/2);
	
	var oPopupWindow = window.open(url,target_window,'left='+l+',top='+t+',width='+w+',height='+h+',scrollbars='+scrollbars+',resizable='+resizable+',status='+status+',toolbar='+toolbar+',location='+location+',menubar='+menubar+',titlebar='+titlebar);
	oPopupWindow.opener = window;
	if (oPopupWindow.focus()) oPopupWindow.focus();
	if (return_object) return oPopupWindow;
}
