/*
common javascript functions included on all pages throughout site
*/

//change the url of a page
function changePage(url) {
	if (url != '') location.href = url;
}

//display a div
function displayBlock(ID) {
	if (ID != '') {	
		document.getElementByID(ID).style.display = 'block';
	}
}

//generic wndow opener
function openWin(url, winName, specs) {
	if (winName == '') winName = 'win';	
	window.open(url, winName, specs);								
}

//clear all form fields
//whichForm: name of form we're dealing with
//ignoreFields: comma-delimited list of field names we don't want to touch
function clearForm(whichForm, ignoreFields) {	
	for (var i=0; i<whichForm.elements.length; i++) {
		curElement = whichForm.elements[i];
		//alert(curElement.type)
		if (ignoreFields.indexOf(',' + curElement.name + ',') == -1) {
			if (curElement.type == 'text') {		
				curElement.value = '';
			}
			else if (curElement.type == 'select-one') {		
				curElement.selectedIndex = 0;
			}		
		}
	}
}

//mouseover function
function rollOver(name, source) { 
	if(document.getElementById) {
		document.getElementById(name).src = eval(source + ".src");
	}
	else if(document.images) {		
		document.images[name].src = eval(source + ".src");
	}	
}