// retrieve the value from a pulldown menu
function getOption(pulldown){
	return pulldown.options[pulldown.options.selectedIndex].value;
}

// retrieve the value associated with a radio button group
function getRadio(radio){
	for (i=0; i<radio.length; i++){
		if (radio[i].checked) return radio[i].value;
	}
	return "";
}

// retrieve the value(s) associated with a check box (group)
function getCheck(check){
	if (check.length == undefined) return check.value;
	values = [];
	for (i=0; i<check.length; i++){
		if (check[i].checked) values[values.length] = check[i].value;
	}
	return values;
}

// parse a variable from the query string
function getURLValue(variable){
	queryString = document.location.search.substring(1);
	if (queryString == "") return "";
	pairs = queryString.split("&");
	for (i=0; i<pairs.length; i++){
		if (pairs[i].split("=")[0].toLowerCase() == variable.toLowerCase()) return unescape(pairs[i].split("=")[1]);
	}
	return "";
}
function capitalize(string){
	// capitalizes all words in a string
	tmp = "";
	string = string.split(/\s+/); // split on any white space
	for (i=0; i<string.length; i++){
		tmp += ((i==0)?"":" ") + string[i].charAt(0).toUpperCase() + string[i].substring(1).toLowerCase();
	}
	return tmp;
}
function popup(url, name, w, h){	
	var left = (screen.width - w) / 2;
	var top = (screen.height - h) / 2;
	features = 'width='+w+',height='+h+',top='+top+',left='+left+',toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no';
	window.open(url,name,features);
}

function popupScroll(url, name, w, h){	
	var left = (screen.width - w) / 2;
	var top = (screen.height - h) / 2;
	features = 'width='+w+',height='+h+',top='+top+',left='+left+',toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
	window.open(url,name,features);
}