// Validates given check boxes
	function validateNDSForm()
	{
		
		// Initialise vars
		var strMsg = "";
		var dodgyFields = "";
		var temp_one = "";
		var temp_two = "";
		var temp_three = "";
		var temp_four = "";
		var tempPassword ="";
		var tempPasswordConfirm = "";
	
				
		// Get passed parameters
		var passed_args = validateNDSForm.arguments; 
		//alert(passed_args.length);
		//return false;
		try
		{
			var passed_arg_2 = validateNDSForm.arguments; 
			
			// For each element/passed parameter
			for(i = 0; i < passed_args.length; i++)
			{
			
				// Check for text boxes
				if (passed_args[i].type == "text" || passed_args[i].type == "password" || passed_args[i].type == "textarea")
				{
					
					// TOOK THIS OUT SINCE WE WE WILL HAVE FIELDS THAT ARE OPTIONAL  
					
					// Add a new line to the message if the value of the element is empty, null or starts with a blank character 
				
				if (passed_args[i].name == "forename" || passed_args[i].name == "surname" || passed_args[i].name == "jobTitle" || passed_args[i].name == "company" || passed_args[i].name == "address1"|| passed_args[i].name == "town" || passed_args[i].name == "postcode" || passed_args[i].name == "telephone" || passed_args[i].name == "email")
				{
			
					
					if ((passed_args[i].value == null) || (passed_args[i].value == "") || IsBlank(passed_args[i].value))
					{
							dodgyFields += "\n" + passed_args[i].name;
					}	
				}
					
					// Check the email field for validity
					if (passed_args[i].name == "email")
					{
						var tempemail = passed_args[i].value;
						var EmailVar = isEmailString (passed_args[i].value);
						if (EmailVar == 0)
						{	
							dodgyFields += "\nEmail address appears incorrect";
						}	
					}
				}
			// check if the email field matches the emailConfirm field
					if (passed_args[i].name == "confirmemail")
				{ 
					
					if (passed_args[i].value != tempemail)
					{
						dodgyFields += "\nYour email and email confirmation fields do not match";				
					}
				
				}
				
				// Check the email field for validity
					if (passed_args[i].name == "invoice_contact_email")
					{
						var invoicetempemail = passed_args[i].value;
					var newEmailVar = isEmailString (passed_args[i].value);
						if (newEmailVar == 0)
						{	
							dodgyFields += "\nYour invoice email address appears to be incorrect";
						}	
				}
				
				// check if the email field matches the emailConfirm field
					if (passed_args[i].name == "invoice_confirmemail")
				{ 
					
					if (passed_args[i].value != invoicetempemail)
					{
						dodgyFields += "\nYour invoice email and email confirmation fields do not match";				
					}
				
				}
				if (passed_args[i].name == "password")
				{
					tempPassword = passed_args[i].value;
					/*
					if (passed_args[i].value != tempPassword)
					{
						dodgyFields += "\nYour password and password confirmation fields do not match";				
					}
					*/
				
				}
		
				
				// check if the password field matches the passwordConfirm field
				if (passed_args[i].name == "passwordConfirm")
				{
					tempPasswordConfirm = passed_args[i].value;
					/*
					if (passed_args[i].value != tempPassword)
					{
						dodgyFields += "\nYour password and password confirmation fields do not match";				
					}
					*/
				
				}
					if (passed_args[i].name == "conference")
				{
					if (passed_args[i].value == "john_vane_memorial_2008")
					{
						// dodgyFields += "\nYou are suscribing for the conference";
						 
						
					
			
						
						}
				
				
				}
				var validate_extra = "true";
				if (validate_extra == "true")
			{
				
						if (passed_args[i].name == "invoice_name" || passed_args[i].name == "invoice_company" || passed_args[i].name == "invoice_company" || passed_args[i].name == "invoice_town" || passed_args[i].name == "invoice_address1" || passed_args[i].name == "invoice_postcode" || passed_args[i].name == "invoice_contact_email" || passed_args[i].name == "invoice_confirmemail")
				{
			
					
					if ((passed_args[i].value == null) || (passed_args[i].value == "") || IsBlank(passed_args[i].value))
					{
							dodgyFields += "\n" + passed_args[i].name;
					}	
				}
					
				
				}
		
	
				// Check the the agree radio button has been checked to Yes
				/*if (typeof(passed_args[i]) == "object" && passed_args[i].length > 0)
				{
					if (!passed_args[i][0].checked)
					{
						dodgyFields += "\n\nPlease confirm that the information is correct and you\nhave read and agree to the Terms of Business.";
					}
				}*/
				
				// Store date if there
				var tempString = ""
				var tempString = passed_args[i].name
				if (tempString != null)
				{
					if (tempString.indexOf("Mediatype") != -1)
					{
						temp_three += passed_args[i].options[passed_args[i].selectedIndex].value;					
					}
					
					if (tempString.indexOf("country") != -1)
					{
						temp_four += passed_args[i].options[passed_args[i].selectedIndex].value;					
					}				
				}			
			}
				
			
			// Check country
			if (temp_four == "0")
			{
				dodgyFields += "\n\nPlease make sure you have chosen\nyour appropriate country.";
			}
			if(tempPassword != tempPasswordConfirm)
			{
				dodgyFields += "\nYour password and password confirmation fields do not match";	
			}
			
			
			// Display message if theres anything in it and return false
			if (dodgyFields) 
			{			
				strMsg = "_________________________________________________\n\n";
				strMsg += "The form was not submitted due to error(s).\n";
				strMsg += "Please check that you provided the correct information\nfor the following and re-submit.\n";				
				strMsg += "_________________________________________________\n";						
				strMsg += dodgyFields;
				alert(strMsg);
				return false;
			} else {
				// Otherwise return true
				return true;
			}
		} 
		catch(e)
		{
			alert(e.message);
			return false;
		}
	}
	
	
