function validate(obj)
{
	//define objects to validate
	var allElements = obj.elements;
	var coCount = 0;
	var errors = "";

	for( i=0 ; i<allElements.length; i++)
	{
		//CHECK DROPDOWN TITLE LIST
		if (allElements[i].name == "title")
		{
			var otitle = allElements[i].value;
			if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
			{
				errors += "-> Title is a Mandatory field, please select your Title\n";
			}
		}
		
		//CHECK FULLNAME NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "name")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 )
			{
				errors += "-> Full Name is a Mandatory field, please enter your Full Name\n";
			}			
		}
		
		//CHECK FULLNAME NOT EMPTY
		else if (allElements[i].type=="text" && allElements[i].name == "company")
		{
			var oFullName = allElements[i].value;
			if ( oFullName.length <= 0 )
			{
				errors += "-> Company Name is a Mandatory field, please enter your Company Name\n";
			}			
		}	
		
		
		//CHECK EMAIL ADDRESS NOT EMPTY AND VALID
		else if (allElements[i].type == "text" && allElements[i].name == "email")
		{
			var oEmail = allElements[i].value;
			var chkDot = true;
			var result = false;
			var ndxAt = ndxDot =  0;
			var ndxAt = ndxDot =  0;

			if (oEmail.length <= 0 )
			{
				errors += "-> Email address is a Mandatory field, please enter your Email Address\n";
			}
			else //not empty start email address validation
			{
				ndxAt  = oEmail.indexOf("@");
				ndxDot = oEmail.indexOf(".");
				ndxDot2 = oEmail.lastIndexOf(".");
									
				var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
				
			        if (oEmail.match(illegalChars)) { 
			                errors += "The Email Address contains illegal characters\n";
			        }
				else if ( (ndxDot < 0) ) //check for a '.' sign
				{
					errors += "->The Email Address lacks '.'\n\tThe format is 'you@domain.com'";
				}
				else if ( (ndxAt < 0) ) //check for an '@' sign
				{
					errors += "->The Email Address lacks an '@'\n\tThe format is 'you@domain.com'";
				}
				else if (ndxDot2 - 3 <= ndxAt)
				{
					errors += "->You may be missing your domain name\n\tThe format is 'you@domain.com'";
				}
			}
		}
		
		//CHECK PHONE NUMBER VALID		
		else if (allElements[i].type=="text" && allElements[i].name == "telcode") 
		{
			var oContCou = allElements[i].value;	
			if (oContCou.length <= 0)
			{
				errors += "-> Fill-in the Telephone area code\n";
				coCount++;	
			}		
			else if (isNaN(oContCou))
			{
				errors += "-> Telephone Country code must be numeric\n";
			}			
		}
		else if (allElements[i].type=="text" && allElements[i].name == "telephone") 
		{
			var oContCou = allElements[i].value;	
			if (oContCou.length <= 0)
			{
				errors += "-> Fill-in the Telephone number\n";
				coCount++;	
			}		
			else if (isNaN(oContCou))
			{
				errors += "-> Telephone number must be numeric\n";
			}			
		}
		
		else if (allElements[i].type=="text" && allElements[i].name == "cellcode") 
		{
			var oContAre = allElements[i].value;
			if (oContAre.length <= 0)
			{
				errors += "-> Fill-in the Cellphone Prefix\n";
				coCount++;	
			}
			else if (isNaN(oContAre))
			{
				errors += "-> Cellphone Prefix code must be numeric\n";
			}
		}
		else if (allElements[i].type=="text" && allElements[i].name == "cellphone") 
		{
			var oContNum = allElements[i].value;
			if (oContAre.length <= 0)
			{
				errors += "-> Fill-in the Cellphone number\n";
				coCount++;	
				//var coCount = 0;	
			}
			else if (isNaN(oContNum))
			{
				errors += "-> Cellphone number must be numeric\n";
			}			
		}
		
		//CHECK DROPDOWN WORKSHOP LIST
		if (allElements[i].name == "workshop")
		{
		var otitle = allElements[i].value;
		if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
			{
				errors += "-> Workshop is a Mandatory field, please select Workshop\n";
			}
		}
		
		//CHECK DROPDOWN KEYNOTE ADDRESS LIST
		if (allElements[i].name == "keynote_address")
		{
			var otitle = allElements[i].value;
			if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
			{
				errors += "-> Keynote Address is a Mandatory field, please select Attendance\n";
			}
		}
		
		//CHECK DROPDOWN COLOUR GROUPING LIST
		if (allElements[i].name == "dot_colour")
		{
			var otitle = allElements[i].value;
			if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
			{
				errors += "-> Dot Colour is a Mandatory field, please select your Colour\n";
			}
		}
		
		//CHECK DROPDOWN COLOUR GROUPING LIST
		if (allElements[i].name == "dietary_requirements")
		{
			var otitle = allElements[i].value;
			if  ( ( otitle.length <= 0 ) || (allElements[i].selectedIndex == 0) )
			{
				errors += "-> Dietary Requirements is a Mandatory field, please select your Requirement\n";
			}
		}		
		
	}
	if (coCount == 2) 
	{			
		errors += "-> Please fill in the neccesary area codes and phone numbers in the Contact Details\n";
	}
	
	if(errors)
	{
		alert("The following form fields are mandatory:\n" + errors);
		errors = "";
		returnVal = false;
	}
	else
	{
		returnVal = true;
	}
	return returnVal; 
}
