// * common.js **01/09/2009**V08/1** 

// Form Helpers

// clears default form values
// call function as follows
// onblur="clearField(this,this.value)"
function clearField (theField, theValue) {
// store the initial field value in a variable for use later
theDefault = theValue;
// compare the field's current value with its initial value
if (theField.value == theDefault) {
// if they match, clear the fields
	theField.value = "";
	}
}

// reinstates default form values
// call function as follows
// onblur="resetField(this)"
function resetField (theField) {
// is the field's current value null (ie user has entered nothing)
if (theField.value == "") {
// reset the field to its initial value
	theField.value = theDefault;
	}
}

// set initial focus on an ID'd form field	
function focusField (theField) {
// create a variable to check whether an element with this ID exists
	if (theElement=getElement(theField)) {
			return (theElement.focus());
		}
	}

// Jump Menu (Choose Style)

function jumpTo(theItem) {
	theURL = theItem.options[theItem.selectedIndex].value;
	location.href=theURL;
}

// Popup Window (Print Page)

function popUp(winURL,winName,winWidth,winHeight,winScroll,winResize) {
	// set default scroll and resize behaviour if not defined by referer
	if (winScroll == undefined) {
		winScroll = 'no';
	}
	if (winResize == undefined) {
		winResize = 'yes';
	}
	// set variables to centre popup onscreen
	var winLeft = (screen.width - winWidth) / 2;
	var winUp = (screen.height - winHeight) / 2;
	// add 50px to allow for credits, close window link
	winHeight = (winHeight+50);
	// wrap up window properties in a single variable
	winProp = 'width='+winWidth+',height='+winHeight+',left="'+winLeft+',top='+winUp+',scrollbars='+winScroll+',resizable='+winResize+''
	// open named window; set focus in case it's already open behind another window
	window.open(winURL,winName,winProp).focus();
}