/**
 * Clears and re-instates default values in form inputs
 *
 * <code>
 * <input id="whatever" name="whatever" type="text" value="Enter your email address"
 *     onfocus="scClearInputs( this, event, '#000', '#90896F' )"
 *     onblur="scClearInputs( this, event, '#000', '#90896F' )" />
 * </code>
 */

if ( !window.scSetInputs )
{
	function scSetInputs( self, evnt, colorActive, colorInactive )
	{
		var colorActive   = ( colorActive   == null ) ? '#000' : colorActive;
		var colorInactive = ( colorInactive == null ) ? '#BBB' : colorInactive;
		switch ( evnt.type )
		{
			case 'focus':
				if ( self.value == self.defaultValue )
				{
					self.value       = '';
					self.style.color = colorActive;
				}
				break;
			case 'blur':
				if ( self.value == '' )
				{
					self.value       = self.defaultValue;
					self.style.color = colorInactive;
				}
				break;
		}
	}
}


/* Form validation code */
function validateOptions() {
	var obj = document.getElementById('product-info-area');
	var valid = true;
	if (obj) {
		var selects = obj.getElementsByTagName('select');
		for (var i = 0, j = selects.length; i < j && valid; i++) {
			if ((selects[i].value.match(/Select Below/i))&&(selects[i].selectedIndex==0)) {
				alert("Please select '" + selects[i].name.replace(/^vwattr_/, '') + "'");
				selects[i].focus();
				valid = false;
			}
		}
	}
	return valid;
}

