function requiredFieldsCheck(formObj)
		{	
			missingFields = '';		
						
						if (document.getElementById("hotel"))
						 	{
							var firstName = document.getElementById("hotel").value;
							if (firstName.toUpperCase().replace("", "").length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ",Hotel ";
								} else {
									missingFields = "Hotel";
								}
							}
						}
						
						if (document.getElementById("golfers")) {
							var lastName = document.getElementById("golfers").value;
							if (lastName.toUpperCase().replace("", "").length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ",Golphers";
								} else {
									missingFields = "Golphers";
								}
							}
						}	
		
		
			if (document.getElementById("initial")) {
							var Initial = document.getElementById("initial").value;
							if (Initial.toUpperCase().replace("", "").length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ", Initial";
								} else {
									missingFields = "Initial";
								}
							}
						}	
		
		
		if (document.getElementById("surname")) {
							var Surname = document.getElementById("surname").value;
							if (Surname.toUpperCase().replace("", "").length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ", Surname";
								} else {
									missingFields = "Surname";
								}
							}
						}	
		if (document.getElementById("ADD1")) {
							var Address1 = document.getElementById("ADD1").value;
							if (Address1.toUpperCase().replace("", "").length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ", Address1";
								} else {
									missingFields = "Address1";
								}
							}
						}	
		
		if (document.getElementById("PCODE")) {
							var PCODE = document.getElementById("PCODE").value;
							if (PCODE.toUpperCase().replace("", "").length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ", Post Code";
								} else {
									missingFields = "Post Code";
								}
							}
						}	
		if (document.getElementById("email"))
						 	{
							var email = document.getElementById("email").value;
							if (email.length < 1)
							{
								if (missingFields.length)
								{
									missingFields = missingFields + ",e-mail ";
								} else {
									missingFields = "e-mail";
								}
							}
						}
			
			if (missingFields.length)
				{
				var missingFieldArray = missingFields.split(",");
				
				
				missingFields = missingFieldArray[0];
				
				for (var i=1; i<missingFieldArray.length; i++) 
					{
					if (missingFieldArray.length == 2)
						{
						missingFields = missingFields + ' and ' + missingFieldArray[i];
						} 
					else 
						{ 
						if (i == (missingFieldArray.length - 1))
							{	
						 	missingFields = missingFields + ', and ' + missingFieldArray[i];
							} 
						else 
							{
							missingFields = missingFields + ', ' + missingFieldArray[i];
							}
						}
					}
				alert ('You are missing the following required fields :\n\n ' + missingFields + '\t\n');
				return (false);
				} 
			else
				{
				var email1=document.getElementById("email").value;
				if(email1!='')
					{	
				if(CheckEmailFormat(email1))
						{				
						return (true);
						}
					else 
						{
						alert ('Invalid email Address!');
						return (false);
						}
					}
				}
				return (true);
		}
			
	function checkdate(formObj)	
				{
				alert("Please select the date!");
				}	
			
		function finalizeZipContents (countryID) {
			var zip5 = document.getElementById("snZip5");
			var zip4 = document.getElementById("snZip4");
			var zipCanada = document.getElementById("snZipCanada");
			var zipNonUS = document.getElementById("snZipGeneric");

			
			if (countryID == 1) { 	// US
				zipCanada.value="";
				zipNonUS.value="";
			} else if ((countryID < 28 && countryID > 14) || (countryID == 2)) { // Canada
				zip5.value="";
				zip4.value="";
				zipNonUS.value="";
			} else if (countryID != 0) { // Non-US Country and not "not specified"
				zip5.value="";
				zip4.value="";
				zipCanada.value="";
			} else {
				zip5.value="";
				zip4.value="";
				zipCanada.value="";
				zipNonUS.value="";
			}
			
			return;
		
		}
		
		function trim(str)
		{
		   return str.replace(/^\s*|\s*$/g,"");
		}
		
		function CheckEmailFormat(str)
		
		{
			var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
			var reg2 = /^[a-zA-Z0-9\_]+[a-zA-Z0-9\.\-_]+\@(\[?)[a-zA-Z0-9\-\_\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
			if (!reg1.test(str) && reg2.test(str)) 
			{ // if syntax is valid
			return true;
			}
			return false;		
		}
		
		
		function changeCountry (countryID)
		{
		
			var usZipLabel = document.getElementById("snUSZipLabel");
			var foreignZipLabel = document.getElementById("snNonUSZipLabel");
			var zipStar = document.getElementById("zipStar");
		
			var usZip = document.getElementById("snZipUSDiv");
			var canadaZip = document.getElementById("snZipCanada");
			var nonUsZip = document.getElementById("snZipGeneric");
			
			if (countryID == 1) { 	// US
				usZipLabel.style.display = "";
				foreignZipLabel.style.display = "none";
				if (zipStar) zipStar.style.display = "";
				
				usZip.style.display = "";
				canadaZip.style.display = "none";
				nonUsZip.style.display = "none"; 
			} else if ((countryID < 28 && countryID > 14) || (countryID == 2)) { // Canada
				usZipLabel.style.display = "none";
				foreignZipLabel.style.display = "";
				if (zipStar) zipStar.style.display = "";
				
				usZip.style.display = "none";
				canadaZip.style.display = "";
				nonUsZip.style.display = "none";
			} else if (countryID != 0) { // Non-US Country and not "not specified"
				usZipLabel.style.display = "none";
				foreignZipLabel.style.display = "";
				if (zipStar) zipStar.style.display = "";
				
				usZip.style.display = "none";
				canadaZip.style.display = "none";
				nonUsZip.style.display = "";
			} else {
				usZipLabel.style.display = "";
				foreignZipLabel.style.display = "none";
				if (zipStar) zipStar.style.display = "";
				
				usZip.style.display = "";
				canadaZip.style.display = "none";
				nonUsZip.style.display = "none";
			}
			
			finalizeZipContents (countryID);
			return;
		}
		
		function showCountryConfirm(newCountry) {
			countryConfirmObj = document.getElementById("countryConfirm");
			countryConfirmedObj = document.getElementById("countryConfirmed");
			dynCNameObj = document.getElementById("dynCName");
			
			if (countryConfirmObj && dynCNameObj) {
				countryConfirmedObj.checked = "";
				countryConfirmObj.style.display = "";
				dynCNameObj.innerHTML = document.getElementById ("snCR").options[document.getElementById ("snCR").selectedIndex].text;
			}
			return;
		}
			
	
function convertCase(field) {
var tmpStr = field.value.toLowerCase();
	
	tmpStr = tmpStr.replace (/(\S*)\"(\D+)\"(\S*)/g, '$1 "$2" $3'); // put spaces around "string" (force uppercase)
	tmpStr = tmpStr.replace (/(\d+)([a-z]{3,})/gi, "$1 $2"); // add space after numbers when 3+ alphachars follow
	tmpStr = tmpStr.replace (/^o\'/gi, "O'~ ");         // change o' to O'+~space (O'~Reilly) (force uppercase)
	tmpStr = tmpStr.replace (/(\s*)o\'/gi, "O'~ ");         // change o' to O'+space (O' Reilly) (force uppercase)
	tmpStr = tmpStr.replace (/(^mc|\s+mc)([a-z])/gi, "$1~ $2"); // add tilde space combination after Mc (force uppercase)
	tmpStr = tmpStr.replace (/(\D)\./g, "$1. "); // add space after literal . (B. M. Smith > uppercase)
	tmpStr = tmpStr.replace (/\-([a-z])/g, "~ -~ $1"); // add spaces around hyphens (force uppercase)
	tmpStr = tmpStr.replace (/(^\s+)/, ""); // remove spaces at start of string
	tmpStr = tmpStr.replace (/\s{4,}/g, " "); // remove excessive spaces > 4
	
	var SplitStuff = tmpStr.split(" ");
	var ArrLen = SplitStuff.length;
	
	for (var k=0; k<ArrLen; k++) { 
		var word = SplitStuff[k];
		// roman numerals should be uppercased 
		if (word.match (/^m?m?m?(c[md]|d?c{0,3})(x[lc]|l?x{0,3})(i[xv]|v?i{0,3})$/)) { word = word.toUpperCase() }
		if (/\d/.test(word)) {word = word.toUpperCase()}
		var wordLen = word.length;
		var posn = word.search(/[a-zA-Z]/); 
		var firstChars = word.substring(0, posn+1).toUpperCase();
		var postString = word.substring(posn+1,wordLen);
		word = firstChars + postString;
		word = word.replace (/\bPhd\b/, "PhD");
		word = word.replace ( /\bPo\b/g, "PO" );
		word = word.replace (/\'a/, "'A"); // De'Ath and D'Arcy!
		
		SplitStuff[k] = word;
	}
	
	var newline = SplitStuff.join(" "); 
	newline = newline.replace (/\~\s/g, ""); // remove the spaces added by function
	newline = newline.replace (/\.\s/g, "."); // re-format names B. M. Smith > B.M.Smith
	field.value = newline;
}


