		var strDelimiter = ",";
		var strEmpty = '';
		var lngNoneSelected = -1;
	
	function submitForm(){
		document.frmMain.submit();
	}

	// function to check all the fields if the form is submitted.
	function attemptLeasingSubmitForm(){
		
		var strErrorCheck = '';
		var pattern    = /[a-z]\@[a-z]/ig;
		var text = '';
		var result;

		if (checkItem(document.frmMain.emailFrom) == false){
			strErrorCheck = strErrorCheck + 'Please enter a valid email address\n';
		} else {
		  //Check there is an @ symbol in the field.
		  text = document.frmMain.emailFrom.value;
 		  result = text.match(pattern);
 		  if (result == null) {
		    strErrorCheck = strErrorCheck + 'Please enter a valid email address\n';
		  }
		}

		if (checkItem(document.frmMain.Message) == false){
			strErrorCheck = strErrorCheck + 'Please enter a message\n';
		}
		//If an error display a message, or else exit...
		if (strErrorCheck != strEmpty) {
			//strErrorCheck = 'Please check the following fields: ' + strErrorCheck;
			alert(strErrorCheck);
		}
		else {
			submitForm();
		}
	}

	function checkItem(oItem){
		var blnResult = false;
		if (oItem.value == strEmpty){
			oItem.focus();
			blnResult = false;
		} else {
			blnResult = true;
		}
		return blnResult;
	}

	function selectItems(objName, intSelect){
		var i = 0;
		for(i=0;i<objName.length;i++) {
			if (objName.options[i].value == intSelect){
						objName.options[i].selected = true;
			}
		}
	}

