	// returns true if the index selected > 0
	function isSelectedIndexValid(fieldId, fieldName)
	{
		var field = document.getElementById(fieldId);
		
		if (field.selectedIndex <= 0)
		{
			alert("Please select a value for " + fieldName);
			field.focus();
			return false;
		}
		
		return true;
	}

	function isEntered(fieldId, name)
	{
		var field = document.getElementById(fieldId);
		
		if (field.value == "")
		{
			alert("Please enter a value for " + name );
			field.focus();
			return false;
		}
		
		return true;
	}

    function checkTextArea(e, textBox ){
		var key = window.event ? e.keyCode : e.which;
		//alert(key);
		//alert(textBox.value.length);
		if (key == 8 || key == 127){
			return true;
		}
	
		if (textBox.value.length >= 750) {
			alert('You can enter a maximum of 750 characters');
			return false;
		}

		updateCharsRemaining(textBox.value.length);
   }

	function changeLocation() {
		if ($('locationType').value=="Other")
		{
			$('otherLocation').style.visibility="visible";
		}
		else
		{
			$('otherLocation').style.visibility="hidden";
			$('otherLocation').value="";
		}
	}		 
 
	function updateCharsRemaining(len){
		var dispLen; 
		if (document.all)
			dispLen = document.all.charsRemaining;
		else
			dispLen = document.getElementById("charsRemaining");
		
		dispLen.innerHTML = 750 - len - 1;
	}
	

	function CheckValidEmail(fieldObject,fieldName)
	{
		var value;
		value = fieldObject.value;
		var wrongTestRE = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)|(^\s)/;
		var correctTestRE = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!wrongTestRE.test(value) && correctTestRE.test(value)) 
		{
			return true;
		}
	
		alert('You have not entered a valid email in : "' + fieldName + '"');

		fieldObject.focus();
		fieldObject.select();

		return false;
	}

	function FieldMatch(src, target, desc)
	{
		if (src.value != target.value)
		{
			alert("Values entered in " + desc + " do not match");
			src.focus();
			return false;
		}
		
		return true;
	}

	function CheckValidHttp(field, name)
	{
		var re = /http:\/\//;
		if (field.value != "" && !re.test(field.value))
		{
			alert("Please enter an address that begins with http:// in " + name);
			field.focus();
			return false;
		}
		
		return true;
	}	