
// REFER TO THIS FUNCTION THUSLY IN HTML
// <a href=" " onClick="popupwindow('users/login.asp', 'support');return false;">Link</a>

var popup = "";
var window_specs;

// DIFFERENT TYPES OF POP-UP WINDOWS ARE SET UP HERE.
function get_window_specs(window_type){
	switch (window_type){
		case 'support': // FOR USER HELP
			window_specs = "width=300,height=200,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no";
			break;

		case 'example':
			window_specs = "width=400,height=400,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no";
			break;
			
		case 'dialog':
			window_specs = "width=490,height=400,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no";
			break;

		case 'report': // FOR REDISTRICTING
			window_specs = "width=500,height=400,toolbar=yes,menubar=no,location=no,scrollbars=yes,resizable=yes";
			break;
	}
}

// SPAWNS WINDOW ACCORDING TO CORRECT SPECS. CLOSES OPEN WINDOW IF NEW WINDOW IS SPAWNED.
function popupwindow(page, window_type,varstring) {

	if (popup != ""){
		if (!popup.closed && (navigator.appName == "Netscape")) popup.close();
		popup = "";
	}

	dtstring = new Date();
	if (varstring) page += "?" + varstring + "&dtstring=" + dtstring.getMilliseconds();
	get_window_specs(window_type);

	popup = this.open(page, window_type, window_specs);

}

