function Registration()
{
	this.program="";
	this.title="";
	this.firstname="";
	this.lastname="";
	this.position="";
	this.organisation="";
	this.address="";
	//this.address2="";
	//this.address3="";
	this.suburb="";
	this.state="";
	this.country="";
	this.workphone="";
	this.fax="";
	this.email="";
	this.homephone="";
	this.mobile="";
	this.postcode="";
	this.privacyrequired="";
	this.Send=SendRegistration;
}

function SendRegistration()
{
	//Create the MIME headers for the PHP "mail()" function
	//Pass to the PHP page all the data necessary to send the email
	var mailaction="php/registration.php?program="+escape(this.program)+"&title="+escape(this.title)+"&firstname="+escape(this.firstname)
					+"&lastname="+escape(this.lastname)+"&position="+escape(this.position)+"&organisation="+escape(this.organisation)
					+"&address="+escape(this.address)
					+"&suburb="+escape(this.suburb)+"&state="+escape(this.state)+"&country="+escape(this.country)+"&workphone="
					+escape(this.workphone)+"&fax="+escape(this.fax)+"&email="+escape(this.email)+"&homephone="+escape(this.homephone)
					+"&mobile="+escape(this.mobile)+"&postcode="+escape(this.postcode)+"&privacyrequired="+escape(this.privacyrequired);

	//Open the popup window
	var emailwin=window.open(mailaction, "sendmail_win", "top=100,left=100,height=100,width=200,scrollbars=0,menubar=0,locationbar=0,statusbar=0,resizable=0");
}


function SendTheRegistration(form)
{	
	if(form.firstname.value=="" ||
	   form.lastname.value=="" ||
	   form.organisation.value=="" ||
	   form.address.value=="" ||
	   form.suburb.value=="" ||
	   form.state.value=="" ||
	   form.country.value=="" ||
	   form.workphone.value=="" ||
	   form.email.value=="")
	{
		document.getElementById('alert').innerHTML = "<strong>Please fill out all required fields</strong>";
		//window.alert("Please fill out all the required fields.");
	}
	else
	{
		//First create the Mail() object and set in on a variable
		var mail=new Registration();
		
		mail.program = form.program.value;//alert("1");
		mail.title = form.title.value;//alert("2");
		mail.firstname = form.firstname.value;//alert("3");
		mail.lastname = form.lastname.value;//alert("4");
		mail.position = form.position.value;//alert("5");
		mail.organisation = form.organisation.value;//alert("6");
		mail.address = form.address.value;//alert("7");
		//mail.address2 = form.address2.value;alert("8");
		//mail.address3 = form.address3.value;alert("9");
		mail.suburb = form.suburb.value;//alert("10");
		mail.state = form.state.value;//alert("11");
		mail.country = form.country.value;//alert("12");
		mail.workphone = form.workphone.value;//alert("13");
		mail.fax = form.fax.value;//alert("14");
		mail.email = form.email.value;//alert("15");
		mail.homephone = form.homephone.value;//alert("16");
		mail.mobile = form.mobile.value;//alert("17");
		mail.postcode = form.postcode.value;//alert("18");
		if(form.privacyrequired.checked)
		{
			mail.privacyrequired = "Yes";//alert("19a");
		}
		else
		{
			mail.privacyrequired = "No";//alert("19b");
		}
		
		//Send the email
		mail.Send();
	}
}

//SendTheEmail(this.form);