
			function validate_form() {
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[title]'].value == "" ) {
					alert ( "Please fill in the 'Event Title' field." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[title]'].focus();
					return(false);
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[title]'].value != "" ) {
					var alphaExp = /^[0-9a-zA-Z\s]+$/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[title]'].value.match(alphaExp)){
					}
					else {
						alert ( "Please fill in the 'Event Title' field with only letters, numbers and spaces." );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[title]'].focus();
						return(false);
					}
				}


				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].value == "" ) {
					alert ( "Please fill in the 'Description' field." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].focus();
					return(false);
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].value != "" ) {
					var alphaExp = /^[0-9a-zA-Z\s\,\'\.]+$/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].value.match(alphaExp)){
					}
					else {
						alert ( "Please fill in the 'Description' field with only letters, numbers, spaces, commas, apostrophe's and full stops." );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].focus();
						return(false);
					}
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].value != "" ) {
					var wwwExp = /(http|www)+/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[description]'].value.match(wwwExp)){
						alert ( "Website addresses not permitted in the 'Description' field. Please fill in the 'Description' field with only letters, numbers, spaces, apostrophe's and full stops. www or http not permitted." );
						return(false);
					}
				}


				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[city]'].value == "" ) {
					alert ( "Please fill in the 'City' field." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[city]'].focus();
					return(false);
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[city]'].value != "" ) {
					var alphaExp = /^[a-zA-Z\s]+$/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[city]'].value.match(alphaExp)){
					}
					else {
						alert ( "Please fill in the 'City' field with only letters and spaces." );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[city]'].focus();
						return(false);
					}
				}


				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[state]'].selectedIndex == "0" ) {
					alert ( "Please select a 'State'." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[state]'].focus();
					return(false);
				}

				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[country]'].selectedIndex == "0" ) {
					alert ( "Please select a 'Country'." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[country]'].focus();
					return(false);
				}


				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[contact]'].value == "" ) {
					alert ( "Please fill in the 'Contact Name' field." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[contact]'].focus();
					return(false);
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[contact]'].value != "" ) {
					var alphaExp = /^[a-zA-Z\s]+$/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[contact]'].value.match(alphaExp)){
					}
					else {
						alert ( "Please fill in the 'Contact Name' field with only letters and spaces." );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[contact]'].focus();
						return(false);
					}
				}


				if (( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[phone]'].value == "" ) && ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[mobile]'].value == "" )) {
					alert ( "Please fill in at least one of the 'Phone or Mobile' number fields." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[phone]'].focus();
					return(false);
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[phone]'].value != "" ) {
					var alphaExp = /^[0-9\s\+]+$/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[phone]'].value.match(alphaExp)){
					}
					else {
						alert ( "Please fill in the 'Phone' field with only numbers,spaces and plus symbol +. i.e. 8555 5555  or  +61 8 8555 5555" );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[phone]'].focus();
						return(false);
					}
				}
				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[mobile]'].value != "" ) {
					var alphaExp = /^[0-9\s\+]+$/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[mobile]'].value.match(alphaExp)){
					}
					else {
						alert ( "Please fill in the 'Mobile' field with only numbers,spaces and plus symbol +. i.e. 0455 555 555 or +61 455 555 555 " );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[mobile]'].focus();
						return(false);
					}
				}


				if (document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[email]'].value == "") {
					alert ( "Please fill in the \'Email\' field." );
					document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[email]'].focus();
					return(false);
				}

				if (document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[email]'].value != "") {
					var field = document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[email]']; // email field
					var str = field.value; // email string
					var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
					var reg2 = /^.+\@(\[?)[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
					}
					else {
						alert("\"" + str + "\" is an invalid e-mail!"); // this is also optional
						field.focus();
						field.select();
						return false;
					}
				}


				if ( document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[website]'].value != "" ) {
					var alphaExp = /^(http:\/\/|www\.)/;
					if(document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[website]'].value.match(alphaExp)){
					}
					else {
						alert ( "'Website' field is invalid. Only links starting with www. or http permitted. " );
						document.tx_swagevents_pi2_submitForm['tx_swagevents_pi2[website]'].focus();
						return(false);
					}
				}





			}


			function progressMeterShow() {
					document.getElementById("progressbar1").style.display='block';		// show progressbar1 div
			}
			function progressMeterHide() {
					document.getElementById("progressbar1").style.display='none';		// hide progressbar1 div
			}


			// textarea text counter with progress meter
			function textCounter(field,counter,maxlimit) {
				// text width//
				var fieldWidth =  parseInt(field.offsetWidth);
				var charcnt = field.value.length;        

				// trim the extra text
				if (charcnt > maxlimit) { 
					field.value = field.value.substring(0, maxlimit);
				}
				else { 
					// progress bar percentage
					var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
					document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
					document.getElementById(counter).innerHTML="Word limit: "+percentage+"%"
					// color correction on style from CCFFF -> CC0000
					setcolor(document.getElementById(counter),percentage,"background-color");
				}
			}

			function setcolor(obj,percentage,prop){
				obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
			}