var windowState = (function() {
	var readScroll = {scrollLeft:0,scrollTop:0};
	var readSize = {clientWidth:0,clientHeight:0};
	var readScrollX = 'scrollLeft';
	var readScrollY = 'scrollTop';
	var readWidth = 'clientWidth';
	var readHeight = 'clientHeight';

	function otherWindowTest(obj) {
		if((document.compatMode) && (document.compatMode == 'CSS1Compat') && (document.documentElement)) {
			return document.documentElement;
		}
		else if(document.body) {
			return document.body;
		}
		else if(document.documentElement) {
			return document.documentElement;
		}
		else {
			return obj;
		}
	};

	if((typeof this.innerHeight == 'number') && (typeof this.innerWidth == 'number')) {
		readSize = this;
		readWidth = 'innerWidth';
		readHeight = 'innerHeight';
	}
	else {
		readSize = otherWindowTest(readSize);
	}

	if((typeof this.pageYOffset == 'number') && (typeof this.pageXOffset == 'number')) {
		readScroll = this;
		readScrollY = 'pageYOffset';
		readScrollX = 'pageXOffset';
	}
	else {
		readScroll = otherWindowTest(readScroll);
	}

	return {
		getScrollX:function() {
			return (readScroll[readScrollX]||0);
		},
		getScrollY:function() {
			return (readScroll[readScrollY]||0);
		},
		getWidth:function() {
			return (readSize[readWidth]||0);
		},
		getHeight:function() {
			return (readSize[readHeight]||0);
		}
	};
})();

var xmlHttp = createXmlHttpRequestObject();
var xmlHttpemp = createXmlHttpRequestObject();
// retrieves the XMLHttpRequest object
function createXmlHttpRequestObject()
{
// will store the reference to the XMLHttpRequest object
var xmlHttp;
// if running Internet Explorer
	if(window.ActiveXObject)
	{
		try
		{
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e)
		{
		xmlHttp = false;
		}
	}
// if running Mozilla or other browsers
	else
	{
		try
		{
		xmlHttp = new XMLHttpRequest();
		}
		catch (e)
		{
		xmlHttp = false;
		}
	}
// return the created object or display an error message
	if (!xmlHttp)
	alert("Error creating the XMLHttpRequest object.");
	else
	return xmlHttp;
}
// make asynchronous HTTP request using the XMLHttpRequest object
function process()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
	email = encodeURIComponent(document.getElementById("username").value);
	password = encodeURIComponent(document.loginpage.txtpassword.value);
    
	// execute the quickstart.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?email=" + email + "&password="+ password, true);
	// define the method to handle server responses()
	xmlHttp.onreadystatechange = handleServerResponse;
	// make the server request
	xmlHttp.send(null);
	}
	else
	// if the connection is busy, try again after one second
	setTimeout('process()', 1000);
}

	// executed automatically when a message is received from the server
function handleServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		// extract the XML retrieved from the server
		xmlresponse = xmlHttp.responseXML;
		//var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		//var hellousername = docRoot.childNodes[0].firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			password=xmlresponse.getElementsByTagName('password').item(0);
			hellopassword=password.firstChild.data;
		// obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
			if (helloemail=="hi")
			{
				document.getElementById("divusername").innerHTML = "";
			}
			else
			{
				// error with email address
				document.getElementById("divusername").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("error_message").innerHTML=helloemail;
				document.getElementById("txtusername").focus();
				return false;
			}
			if (hellopassword=="hi")
			{
				document.getElementById("divpassword").innerHTML = "";
			}
			else
			{
				// error with password
				document.getElementById("divpassword").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("error_message").innerHTML=hellopassword;
				document.getElementById("txtpassword").focus();
				return false;
			}
			var confirma=1;
			// restart sequence
	/*	setTimeout('process()', 1000);
		return false;*/
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server:" + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.loginpage;				
								
				frm.submit();
			}
				
	}
}
//	edit profile


// validations for User Registration***myregister.php file***mycause.com
function registrationprocess()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
	//title = encodeURIComponent(document.getElementById("seltitle").value);
	 firstname = encodeURIComponent(document.getElementById("txtfname").value);
	lastname = encodeURIComponent(document.getElementById("txtlname").value);
	email = encodeURIComponent(document.getElementById("txtuser").value);
	password = encodeURIComponent(document.getElementById("txtpass").value);
	vpassword  = encodeURIComponent(document.getElementById("txtrepass").value);
	
	dob_string = '';
	gender = '';
	if (document.getElementById('eventType').value == 'register') {
		gender = encodeURIComponent(document.getElementById("gender").value);
		dob_month = encodeURIComponent(document.getElementById("dob_month").value);
		dob_day = encodeURIComponent(document.getElementById("dob_day").value);
		dob_year = encodeURIComponent(document.getElementById("dob_year").value);
		dob_string = "&dob_month=" + dob_month + "&dob_day="+ dob_day  +"&dob_year="+ dob_year;
	}
	
	league = encodeURIComponent(document.getElementById("league").value);
	club = encodeURIComponent(document.getElementById("club").value);
	address1 = encodeURIComponent(document.getElementById("textstreet").value);
	country = encodeURIComponent(document.getElementById("selcountry").value);
	province = encodeURIComponent(document.getElementById("dostate").value);
	phone = encodeURIComponent(document.getElementById("txtphone").value);
	city = encodeURIComponent(document.getElementById("txtcity").value);
	postcode = encodeURIComponent(document.getElementById("textpost").value);
	check = encodeURIComponent(document.getElementById("trems").checked);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?firstname="+ firstname + "&lastname="+ lastname + "&email="+ email + "&password="+ password  + "&vpassword="+ vpassword + "&gender=" + gender + "&country="+ country  +"&phone="+ phone + dob_string +  "&address1="+ address1 + "&city="+ city+"&province="+ province+"&postcode="+ postcode+"&check="+ check + "&league=" + league + "&club=" + club, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = registrationprocessServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('registrationprocess()', 1000);
}
function registrationprocessServerResponse()
{
	var scrollX=0;
		var scrollY=100;
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
			document.getElementById('formErrorMessage').style.display = 'block';
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		/*var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;*/
		    firstname=xmlresponse.getElementsByTagName('firstname').item(0);
			hellofirstname=firstname.firstChild.data;
			lastname=xmlresponse.getElementsByTagName('lastname').item(0);
			hellolastname=lastname.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			password=xmlresponse.getElementsByTagName('password').item(0);
			hellopassword=password.firstChild.data;
			vpassword =xmlresponse.getElementsByTagName('vpassword').item(0);
			hellovpassword=vpassword.firstChild.data;
		    passwordcompare=xmlresponse.getElementsByTagName('passwordcompare').item(0);
		    hellopasswordcompare=passwordcompare.firstChild.data;
			gender=xmlresponse.getElementsByTagName('gender').item(0);
			hellogender=gender.firstChild.data;
			dob=xmlresponse.getElementsByTagName('dob').item(0);
			hellodob=dob.firstChild.data;
			address1=xmlresponse.getElementsByTagName('address1').item(0);
			helloaddress1=address1.firstChild.data;
			country=xmlresponse.getElementsByTagName('country').item(0);
			hellocountry=country.firstChild.data;
			province=xmlresponse.getElementsByTagName('province').item(0);
			helloprovince=province.firstChild.data;
			phone=xmlresponse.getElementsByTagName('phone').item(0);
			hellophone=phone.firstChild.data;
		    city=xmlresponse.getElementsByTagName('city').item(0);
			hellocity=city.firstChild.data;
			postcode=xmlresponse.getElementsByTagName('postcode').item(0);
			hellopostcode=postcode.firstChild.data;
			club=xmlresponse.getElementsByTagName('club').item(0);
			helloclub=club.firstChild.data;
			check=xmlresponse.getElementsByTagName('check').item(0);
			hellocheck=check.firstChild.data;
			
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloemail;
				document.getElementById("username").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (hellopassword=="hi")
			{
				document.getElementById("divpassword").innerHTML = "";
			}
			else 
			{
				document.getElementById("divpassword").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellopassword;
				document.getElementById("txtpass").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (hellovpassword=="hi")
			{
				document.getElementById("divpassword").innerHTML = "";
			}
			else
			{
				document.getElementById("divpassword").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellovpassword;
				document.getElementById("txtrepass").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (hellopasswordcompare=="hi")
			{
				document.getElementById("divpasswordcompare").innerHTML = "";
			}
			else
			{
				document.getElementById("divpasswordcompare").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellopasswordcompare;
				document.getElementById("txtrepass").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}

			
			if (hellofirstname=="hi")
			{
				document.getElementById("divfirstname").innerHTML = "";
			}
			else
			{
				document.getElementById("divfirstname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellofirstname;
				document.getElementById("txtfname").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (hellolastname=="hi")
			{
				document.getElementById("divlastname").innerHTML = "";
			}
			else 
			{
				document.getElementById("divlastname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellolastname;
				document.getElementById("txtlname").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			
			
			if (document.getElementById('eventType').value == 'register') {
				if (hellodob == "hi") { }
				else {
					document.getElementById("diverrormessage1").innerHTML=hellodob;
					document.getElementById("dob_year").focus();
					window.scroll(scrollX,scrollY);
					return false;	
				}
				
				if (hellogender=="hi") {}
				else 
				{
					//document.getElementById("divlastname").innerHTML = "<span class='txnormalboldred'>*</span>";
					document.getElementById("diverrormessage1").innerHTML=hellogender;
					document.getElementById("gender").focus();
					window.scroll(scrollX,scrollY);
					return false;
				}
			}
			
			if (hellophone=="hi")
			{
				document.getElementById("divphone").innerHTML = "";
			}
			else 
			{
				document.getElementById("divphone").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellophone;
				document.getElementById("txtphone").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (helloaddress1=="hi")
			{
				document.getElementById("divstreet").innerHTML = "";
			}
			else 
			{
				document.getElementById("divstreet").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloaddress1;
				document.getElementById("textstreet").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			
			
			
			if (hellocity=="hi")
			{
				document.getElementById("divcity").innerHTML = "";
			}
			else 
			{
				document.getElementById("divcity").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocity;
				document.getElementById("txtcity").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			
			if (helloprovince=="hi")
			{
				document.getElementById("divstate").innerHTML = "";
			}
			else
			{
				document.getElementById("divstate").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloprovince;
				//document.getElementById("txtstate").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			
			if (hellopostcode=="hi")
			{
				document.getElementById("divpostcode").innerHTML = "";
			}
			else 
			{
				document.getElementById("divpostcode").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellopostcode;
				document.getElementById("textpost").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}

			
			
			if (hellocountry=="hi")
			{
				document.getElementById("divcountry").innerHTML = "";
			}
			else 
			{
				document.getElementById("divcountry").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocountry;
				document.getElementById("selcountry").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (hellocheck=="hi")
			{
				document.getElementById("divcheck").innerHTML = "";
			}
			else
			{
				document.getElementById("divcheck").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocheck;
				
				document.getElementById("trems").focus();
				window.scroll(scrollX,scrollY);
				return false;
			}
			if (helloclub=="hi")
			{
//				document.getElementById("divclub").innerHTML = "";
			}
			else
			{
//				document.getElementById("divclub").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloclub;
				window.scroll(scrollX,scrollY);
				return false;
			}
		var confirma=1;
			// restart sequence
	/*	setTimeout('process()', 1000);
		return false;*/
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.regform;				
//				frm.action="register.php";				
				frm.submit();
			}
				
	}
}


function changepassword()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
	password2 = encodeURIComponent(document.getElementById("txtoldpass").value);
	password = encodeURIComponent(document.getElementById("txtnewpass").value);
    vpassword = encodeURIComponent(document.getElementById("txtrefpass").value);
	// execute the quickstart.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?&password2=" + password2 + "&password=" + password + "&vpassword="+ vpassword, true);
	// define the method to handle server responses
	xmlHttp.onreadystatechange = changepasswordServerResponse;
	// make the server request
	xmlHttp.send(null);
	}
	else
	// if the connection is busy, try again after one second
	setTimeout('changepassword()', 1000);
}

	// executed automatically when a message is received from the server
function changepasswordServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		// extract the XML retrieved from the server
		xmlresponse = xmlHttp.responseXML;
		//var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		//var hellousername = docRoot.childNodes[0].firstChild.data;
			  password2=xmlresponse.getElementsByTagName('password2').item(0);
		      hellopassword2=password2.firstChild.data;
			 password=xmlresponse.getElementsByTagName('password').item(0);
			 hellopassword=password.firstChild.data;
			 vpassword=xmlresponse.getElementsByTagName('vpassword').item(0);
			 hellovpassword=vpassword.firstChild.data;
			 passwordcompare=xmlresponse.getElementsByTagName('passwordcompare').item(0);
		     hellopasswordcompare=passwordcompare.firstChild.data;
		// obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
			if (hellopassword2=="hi")
			{
				document.getElementById("divoldpass").innerHTML = "";
			}
			else
			{
				document.getElementById("divoldpass").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellopassword2;
				document.getElementById("txtoldpass").focus();
				return false;
			}
	if (hellopassword=="hi")
			{
				document.getElementById("divpassword").innerHTML = "";
			}
			else 
			{
			document.getElementById("divpassword").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellopassword;
				document.getElementById("txtnewpass").focus();
				return false;
			}
				if (hellovpassword=="hi")
			{
				document.getElementById("divrepass").innerHTML = "";
			}
			else 
			{
				document.getElementById("divrepass").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellovpassword;
				document.getElementById("txtnewpass").focus();
				return false;
			}
			if (hellopasswordcompare=="hi")
			{
			}
			else
			{
				document.getElementById("divrepass").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellopasswordcompare;
				document.getElementById("txtrepass").focus();
				return false;
			}
			var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.frmchange;				
				//frm.action="changepassword.php";				
				frm.submit();
			}
				
	}
}
function forgott()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
	name = encodeURIComponent(document.getElementById("txtemailid").value);
	// execute the quickstart.php page from the server
	xmlHttp.open("GET", "xmlvalidation.php?email=" + name , true);
	// define the method to handle server responses
	xmlHttp.onreadystatechange = forgottServerResponse;
	// make the server request
	xmlHttp.send(null);
	}
	else
	// if the connection is busy, try again after one second
	setTimeout('forgott()', 1000);
}

	// executed automatically when a message is received from the server
function forgottServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		// extract the XML retrieved from the server
		xmlresponse = xmlHttp.responseXML;
		//var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		//var hellousername = docRoot.childNodes[0].firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
		// obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
			if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloemail;
				document.getElementById("txtemailid").focus();
				return false;
			}
			var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.frmforgott;				
				frm.action="forgott.php";				
				frm.submit();
			}
				
	}
}
function fundraising()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
	title = encodeURIComponent(document.getElementById("txttitle").value);
/*	seloption= encodeURIComponent(document.getElementById("seloption").value);
*/	content = encodeURIComponent(document.getElementById("txtcontent").value);
	amount = encodeURIComponent(document.getElementById("txtamount").value);
	sdate = encodeURIComponent(document.getElementById("txtsdate").value);
	edate = encodeURIComponent(document.getElementById("txtedate").value);
	selocc = encodeURIComponent(document.getElementById("selocc").value);
/*	selcharity = encodeURIComponent(document.getElementById("selcharity").value);
*/	selch = encodeURIComponent(document.getElementById("selch").value);
	selevn = encodeURIComponent(document.getElementById("selevn").value);
	// execute the quickstart.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?title=" + title + "&amount="+ amount  + "&sdate="+ sdate + "&edate="+ edate + "&selocc="+ selocc + "&selch="+ selch + "&selevn="+ selevn , true);
	// define the method to handle server responses
	xmlHttp.onreadystatechange = fundraisingServerResponse;
	// make the server request
	xmlHttp.send(null);
	}
	else
	// if the connection is busy, try again after one second
	setTimeout('fundraising()', 1000);
}

	// executed automatically when a message is received from the server
function fundraisingServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	// status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		// extract the XML retrieved from the server
		xmlresponse = xmlHttp.responseXML;
		//var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		//var hellousername = docRoot.childNodes[0].firstChild.data;
			title=xmlresponse.getElementsByTagName('title').item(0);
			hellotitle=title.firstChild.data;
		/*	
			seloption=xmlresponse.getElementsByTagName('seloption').item(0);
			helloseloption=seloption.firstChild.data;*/
			
			/*content=xmlresponse.getElementsByTagName('content').item(0);
			hellocontent=content.firstChild.data;*/
			
			amount=xmlresponse.getElementsByTagName('amount').item(0);
			helloamount=amount.firstChild.data;
			
			sdate=xmlresponse.getElementsByTagName('sdate').item(0);
			hellosdate=sdate.firstChild.data;
			
			edate=xmlresponse.getElementsByTagName('edate').item(0);
			helloedate=edate.firstChild.data;
			
			selocc=xmlresponse.getElementsByTagName('selocc').item(0);
			helloselocc=selocc.firstChild.data;
			
			/*selcharity=xmlresponse.getElementsByTagName('selcharity').item(0);
			helloselcharity=selcharity.firstChild.data;
			*/
			selch=xmlresponse.getElementsByTagName('selch').item(0);
			helloselch=selch.firstChild.data;
			
			selevn=xmlresponse.getElementsByTagName('selevn').item(0);
			helloselevn=selevn.firstChild.data;
			
		// obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
			if (hellotitle=="hi")
			{
				document.getElementById("divtitle").innerHTML = "";
			}
			else
			{
				document.getElementById("divtitle").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellotitle;
				document.getElementById("txttitle").focus();
				return false;
			}
			/*if (helloseloption=="hi")
			{
				document.getElementById("divoption").innerHTML = "";
			}
			else
			{
				document.getElementById("divoption").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage2").innerHTML=helloseloption;
				document.getElementById("txtseloption").focus();
				return false;
			}*/
			/*if (hellocontent=="hi")
			{
				document.getElementById("divcontent").innerHTML = "";
			}
			else
			{
				document.getElementById("divcontent").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage3").innerHTML=hellocontent;
				document.getElementById("txtcontent").focus();
				return false;
			}*/
			if (helloamount=="hi")
			{
				document.getElementById("divamount").innerHTML = "";
			}
			else
			{
				document.getElementById("divamount").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage4").innerHTML=helloamount;
				document.getElementById("txtamount").focus();
				return false;
			}
			if (helloselevn=="hi")
			{
				document.getElementById("selevn").innerHTML = "";
			}
			else
			{
				document.getElementById("selevn").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage5").innerHTML=helloselevn;
				document.getElementById("txtselevn").focus();
				return false;
			}
			/*if (helloselcharity=="hi")
			{
				document.getElementById("divselcharity").innerHTML = "";
			}
			else
			{
				document.getElementById("divselcharity").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage6").innerHTML=helloselcharity;
				document.getElementById("txtselcharity").focus();
				return false;
			}*/
			if (hellosdate=="hi")
			{
				document.getElementById("divsdate").innerHTML = "";
			}
			else
			{
				document.getElementById("divsdate").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage7").innerHTML=hellosdate;
				document.getElementById("txtsdate").focus();
				return false;
			}
			if (helloedate=="hi")
			{
				document.getElementById("divedate").innerHTML = "";
			}
			else
			{
				document.getElementById("divedate").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage8").innerHTML=helloedate;
				document.getElementById("txtedate").focus();
				return false;
			}
			if (helloedate=="hi")
			{
				document.getElementById("divedate").innerHTML = "";
			}
			else
			{
				document.getElementById("divedate").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage8").innerHTML=helloedate;
				document.getElementById("txtedate").focus();
				return false;
			}
			if (helloselocc=="hi")
			{
				document.getElementById("divselocc").innerHTML = "";
			}
			else
			{
				document.getElementById("divselocc").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage8").innerHTML=helloedate;
				document.getElementById("txtselocc").focus();
				return false;
			}
			var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.frmpage;				
				frm.action="fundrais.php";				
				frm.submit();
			}
				
	}
}


function personaldetails()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
    
	 firstname = encodeURIComponent(document.getElementById("txtfrst").value);
	lastname = encodeURIComponent(document.getElementById("txtlast").value);
	email = encodeURIComponent(document.getElementById("txtemail").value);
	address1 = encodeURIComponent(document.getElementById("txtaddres1").value);
	suburb = encodeURIComponent(document.getElementById("txtsub").value);
	country = encodeURIComponent(document.getElementById("selcountry").value);
	province = encodeURIComponent(document.getElementById("txtstate").value);
	phone = encodeURIComponent(document.getElementById("txtphone").value);
	postcode = encodeURIComponent(document.getElementById("txtpost").value);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?firstname=" + firstname +"&lastname="+ lastname + "&email="+ email + "&address1="+ address1 + "&suburb="+ suburb  + "&country="+ country + "&province="+ province  +"&phone="+ phone +  "&postcode="+ postcode, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = personaldetailsServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('personaldetails()', 1000);
}
function personaldetailsServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;
		    firstname=xmlresponse.getElementsByTagName('firstname').item(0);
			hellofirstname=firstname.firstChild.data;
			lastname=xmlresponse.getElementsByTagName('lastname').item(0);
			hellolastname=lastname.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			address1=xmlresponse.getElementsByTagName('address1').item(0);
			vpassword=xmlresponse.getElementsByTagName('vpassword').item(0);
			hellovpassword =vpassword.firstChild.data;
			address1=xmlresponse.getElementsByTagName('address1').item(0);
			helloaddress1=address1.firstChild.data;
			suburb=xmlresponse.getElementsByTagName('suburb').item(0);
			hellosuburb=suburb.firstChild.data;
			country=xmlresponse.getElementsByTagName('country').item(0);
			hellocountry=country.firstChild.data;
			province=xmlresponse.getElementsByTagName('province').item(0);
			helloprovince=province.firstChild.data;
			phone=xmlresponse.getElementsByTagName('phone').item(0);
			hellophone=phone.firstChild.data;
			postcode=xmlresponse.getElementsByTagName('postcode').item(0);
			hellopostcode=postcode.firstChild.data;
			//agree=xmlresponse.getElementsByTagName('agree').item(0);
//			helloagree=agree.firstChild.data;
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (hellofirstname=="hi")
			{
				document.getElementById("divfirstname").innerHTML = "";
			}
			else
			{
				document.getElementById("divfirstname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellofirstname;
				document.getElementById("txtfrst").focus();
				return false;
			}
			if (hellolastname=="hi")
			{
				document.getElementById("divlastname").innerHTML = "";
			}
			else 
			{
				document.getElementById("divlastname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellolastname;
				document.getElementById("txtlast").focus();
				return false;
			}
			if (helloaddress1=="hi")
			{
				document.getElementById("divaddress1").innerHTML = "";
			}
			else 
			{
				document.getElementById("divaddress1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloaddress1;
				document.getElementById("txtaddres1").focus();
				return false;
			}
			if (hellosuburb=="hi")
			{
				document.getElementById("divsuburb").innerHTML = "";
			}
			else
			{
				document.getElementById("divsuburb").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellosuburb;
				document.getElementById("txtsub").focus();
				return false;
			}
			if (helloprovince=="hi")
			{
				document.getElementById("divstate").innerHTML = "";
			}
			else
			{
				document.getElementById("divstate").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloprovince;
				document.getElementById("txtstate").focus();
				return false;
			}
			
			if (hellopostcode=="hi")
			{
				document.getElementById("divpostcode").innerHTML = "";
			}
			else 
			{
				document.getElementById("divpostcode").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellopostcode;
				document.getElementById("txtpost").focus();
				return false;
			}
			if (hellocountry=="hi")
			{
				document.getElementById("divcountry").innerHTML = "";
			}
			else 
			{
				document.getElementById("divcountry").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellocountry;
				document.getElementById("selcountry").focus();
				return false;
			}
				
			if (hellophone=="hi")
			{
				document.getElementById("divphone").innerHTML = "";
			}
			else 
			{
				document.getElementById("divphone").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellophone;
				document.getElementById("txtphone").focus();
				return false;
			}
			
		if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloemail;
				document.getElementById("txtemail").focus();
				return false;
			}
		var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.detailsfrm;				
			//frm.action="my_per.php";				
				frm.submit();
			}
				
	}
}

function personalimage()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
	 ecardname = encodeURIComponent(document.getElementById("txtchar").value);
	/*charity = encodeURIComponent(document.getElementById("newsel").value);*/
	image = encodeURIComponent(document.getElementById("txtimg").value);
	 //execute the xmlvalidations12.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?ecardname=" + ecardname  + "&image="+ image, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange =personalimageServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('personalimage()', 1000);
}
function personalimageServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
//		var hellousername = docRoot.childNodes[0].firstChild.data;
		    ecardname=xmlresponse.getElementsByTagName('ecardname').item(0);
			helloecardname=ecardname.firstChild.data;
			/*charity=xmlresponse.getElementsByTagName('charity').item(0);
			hellocharity=charity.firstChild.data;*/
			image=xmlresponse.getElementsByTagName('image').item(0);
			hellimage=image.firstChild.data;
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (helloecardname=="hi")
			{
				document.getElementById("divecardname").innerHTML = "";
			}
			else
			{
				document.getElementById("divecardname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloecardname;
				document.getElementById("txtname").focus();
				return false;
			}
			
			//if (hellocharity=="hi")
			//{
				//document.getElementById("divcharity").innerHTML = "";
			//}
			//else 
			//{
			//	document.getElementById("divcharity").innerHTML = "<span class='txnormalboldred'>*</span>";
			//	document.getElementById("diverrormessage").innerHTML=hellocharity;
			//	document.getElementById("newsel").focus();
			////	return false;
		//	}//
         if (hellimage=="hi")
			{
				document.getElementById("divimage").innerHTML = "";
			}
			else 
			{
				document.getElementById("divimage").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellimage;
				document.getElementById("txtimg").focus();
				return false;
			}

		var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.form1;				
				//frm.action="image.php";				
				frm.submit();
			}
				
	}
}
function frndmsg()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
    
	 frndname = encodeURIComponent(document.getElementById("txtfname").value);
	 message = encodeURIComponent(document.getElementById("txtmsg").value);
	 email = encodeURIComponent(document.getElementById("txtfemail").value);
	 lastname = encodeURIComponent(document.getElementById("txtname").value);
         /* ******************************************************************************
         ************ Ale NEW Change *******************************************************
         ********* MantisID 757. ********************************************************
         ********************************************************************************* */
            amountDonationEcard = encodeURIComponent(document.getElementById("hiddenamount").value);
            
        /* ******************************************************************************
        ************ Ale NEW Change *******************************************************
        ********* MantisID 757. ********************************************************
        ********************************************************************************* */
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?frndname=" + frndname +"&message="+ message + "&email="+ email + "&lastname="+ lastname + "&amountDonationEcard="+ amountDonationEcard, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = frndmsgServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('frndmsg()', 1000);
}
function frndmsgServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;
		    frndname=xmlresponse.getElementsByTagName('frndname').item(0);
			hellofrndname=frndname.firstChild.data;
			message=xmlresponse.getElementsByTagName('message').item(0);
			hellomessage=message.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			lastname=xmlresponse.getElementsByTagName('lastname').item(0);
			hellolastname=lastname.firstChild.data;
                        /* ******************************************************************************
                        ************ Ale NEW Change *******************************************************
                        ********* MantisID 757. ********************************************************
                        ********************************************************************************* */
                        amountDonationEcard=xmlresponse.getElementsByTagName('amountDonationEcard').item(0);
			helloamountDonationEcard=amountDonationEcard.firstChild.data;
                        /* ******************************************************************************
                        ************ Ale NEW Change *******************************************************
                        ********* MantisID 757. ********************************************************
                        ********************************************************************************* */
			//firstname=xmlresponse.getElementsByTagName('firstname').item(0);
//			hellofirstname=firstname.fristChild.data;
			//agree=xmlresponse.getElementsByTagName('agree').item(0);
//			helloagree=agree.firstChild.data;
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (hellomessage=="hi")
			{
				document.getElementById("divmessage").innerHTML = "";
			}
			else 
			{
				document.getElementById("divmessage").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellomessage;
				document.getElementById("txtmsg").focus();
				return false;
			}
		if (hellofrndname=="hi")
			{
				document.getElementById("divfrndname").innerHTML = "";
			}
			else
			{
				document.getElementById("divfrndname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellofrndname;
				document.getElementById("txtfname").focus();
				return false;
			}
			if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloemail;
				document.getElementById("txtfemail").focus();
				return false;
			}
			if (hellolastname=="hi")
			{
				document.getElementById("divname").innerHTML = "";
			}
			else 
			{
				document.getElementById("divname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellolastname;
				document.getElementById("txtname").focus();
				return false;
			}

                        /* ******************************************************************************
                        ************ Ale NEW Change *******************************************************
                        ********* MantisID 757. ********************************************************
                        ********************************************************************************* */
                        if (helloamountDonationEcard=="hi")
			{
				document.getElementById("divname").innerHTML = "";
			}
			else
			{
				document.getElementById("divname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloamountDonationEcard;
				document.getElementById("txtname").focus();
				return false;
			}
                        /* ******************************************************************************
                        ************ Ale NEW Change *******************************************************
                        ********* MantisID 757. ********************************************************
                        ********************************************************************************* */
		
		var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.mymsgfrm;				
			//frm.action="my_per.php";				
				frm.submit();
			}
				
	}
}

function frndmsg1()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
    
	 frndname = encodeURIComponent(document.getElementById("txtfname1").value);
	 message = encodeURIComponent(document.getElementById("txtmsg1").value);
	 email = encodeURIComponent(document.getElementById("txtfemail1").value);
	 lastname = encodeURIComponent(document.getElementById("txtname1").value);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?frndname=" + frndname +"&message="+ message + "&email="+ email + "&lastname="+ lastname, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = frndmsg1ServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('frndmsg()', 1000);
}


function frndmsg1ServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;
		    frndname=xmlresponse.getElementsByTagName('frndname').item(0);
			hellofrndname=frndname.firstChild.data;
			message=xmlresponse.getElementsByTagName('message').item(0);
			hellomessage=message.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			lastname=xmlresponse.getElementsByTagName('lastname').item(0);
			hellolastname=lastname.firstChild.data;
			//firstname=xmlresponse.getElementsByTagName('firstname').item(0);
//			hellofirstname=firstname.fristChild.data;
			//agree=xmlresponse.getElementsByTagName('agree').item(0);
//			helloagree=agree.firstChild.data;
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (hellomessage=="hi")
			{
				document.getElementById("divmessage1").innerHTML = "";
			}
			else 
			{
				document.getElementById("divmessage1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellomessage;
				document.getElementById("txtmsg1").focus();
				return false;
			}
		if (hellofrndname=="hi")
			{
				document.getElementById("divfrndname1").innerHTML = "";
			}
			else
			{
				document.getElementById("divfrndname1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellofrndname;
				document.getElementById("txtfname1").focus();
				return false;
			}
			if (helloemail=="hi")
			{
				document.getElementById("divemail1").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=helloemail;
				document.getElementById("txtfemail1").focus();
				return false;
			}
			if (hellolastname=="hi")
			{
				document.getElementById("divname1").innerHTML = "";
			}
			else 
			{
				document.getElementById("divname1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage").innerHTML=hellolastname;
				document.getElementById("txtname1").focus();
				return false;
			}
		
		var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.mymsgfrm1;				
			//frm.action="my_per.php";				
				frm.submit();}}
}


function donationprocess()
{
	scrollTo(0, 100);
	// display and center the popup:
	var centerpopup = document.getElementById("centerpopup").value;
	var donationpopup = document.getElementById("donationpopup");
	
	// fix for Mantis issue 18
    donationpopup.style.display = 'block';

	if(!centerpopup || centerpopup == 'undefined' || centerpopup == 'true') {
		// get window details (width, height, scroll position):
		var viewPortWidth = windowState.getWidth();
		var viewPortHeight = windowState.getHeight();
		var horizontalScroll = windowState.getScrollX();
		var verticalScroll = windowState.getScrollY();
		donationpopup.style.marginLeft = "-" + parseInt(donationpopup.offsetWidth / 2) + "px";
		donationpopup.style.marginTop = (verticalScroll - (parseInt(donationpopup.offsetHeight / 2))) + "px";
	}

// proceed only if the xmlHttp object isn't busy

	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
	//selMem=encodeURIComponent(document.getElementById("selmem").value);
    amount=encodeURIComponent(document.getElementById("amt").value);
	dupname=encodeURIComponent(document.getElementById("doalias").value);
	aliasmandatory=encodeURIComponent(document.getElementById("aliasmandatory").value);
	membermandatory=encodeURIComponent(document.getElementById("membermandatory").value);
	firstname = encodeURIComponent(document.getElementById("doname").value);
	lastname = encodeURIComponent(document.getElementById("dolast").value);
	email = encodeURIComponent(document.getElementById("doemail").value);
//	demail = encodeURIComponent(document.getElementById("doreeamil").value);
	address1 = encodeURIComponent(document.getElementById("doaddress").value);
	city = encodeURIComponent(document.getElementById("dosuburb").value);
	postcode = encodeURIComponent(document.getElementById("dopost").value);
	province = encodeURIComponent(document.getElementById("dostate").value);
	cardtype=encodeURIComponent(document.getElementById("selcard").value);
	cardholdername=encodeURIComponent(document.getElementById("docardholder").value);
	month=encodeURIComponent(document.getElementById("txtmnth").value);
	year=encodeURIComponent(document.getElementById("txtyear").value);
    cnum=encodeURIComponent(document.getElementById("doccv").value);
     check=encodeURIComponent(document.getElementById("dotrems").checked);

	if(!aliasmandatory || aliasmandatory == 'undefined') {
		aliasmandatory = 'true';
	}

	if(!membermandatory || membermandatory == 'undefined') {
		membermandatory = 'false';
		var member = '';
	}
	else {
		//alert("I am in else");
		member=encodeURIComponent(document.getElementById("selmem").value);
		//alert("Member value:"+member);
	}
	//alert("/xmlvalidations.php?selMem="+member+"&amount="+ amount+"&firstname="+firstname+"&lastname="+lastname+"&email="+email+"&address1="+address1+"&city="+city+"&postcode="+postcode+ "&province="+province+"&cardtype="+cardtype+"&cardholdername="+cardholdername+"&month="+month+"&dupname="+dupname+"&year="+year+"&cnum="+cnum+"&aliasmandatory="+aliasmandatory+"&member="+member+"&membermandatory="+membermandatory+"&check="+check);
	xmlHttp.open("GET", "/xmlvalidations.php?selMem="+member+"&amount="+ amount+"&firstname="+firstname+"&lastname="+lastname+"&email="+email+"&address1="+address1+"&city="+city+"&postcode="+postcode+ "&province="+province+"&cardtype="+cardtype+"&cardholdername="+cardholdername+"&month="+month+"&dupname="+dupname+"&year="+year+"&cnum="+cnum+"&aliasmandatory="+aliasmandatory+"&member="+member+"&membermandatory="+membermandatory+"&check="+check,true);
	xmlHttp.onreadystatechange = donationprocessServerResponse;
	 //make the server request
	xmlHttp.send(null);

	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('donationprocess()', 1000);
}

	function donationprocessServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
			// hide the popup:
			var donationpopup = document.getElementById("donationpopup");
			donationpopup.style.display = 'none';
			document.getElementById('diverrormessage1').style.display = 'block';
			
		 //extract the XML retrieved from the server
			var xmlresponse = xmlHttp.responseXML;
		    amount=xmlresponse.getElementsByTagName('amount').item(0);
			helloamount=amount.firstChild.data;
			firstname=xmlresponse.getElementsByTagName('firstname').item(0);
			hellofirstname=firstname.firstChild.data;
			lastname=xmlresponse.getElementsByTagName('lastname').item(0);
			hellolastname=lastname.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
//			demail=xmlresponse.getElementsByTagName('demail').item(0);
//			hellodemail=demail.firstChild.data;
//			emailcompare=xmlresponse.getElementsByTagName('emailcompare').item(0);
//		    helloemailcompare=emailcompare.firstChild.data;
			address1=xmlresponse.getElementsByTagName('address1').item(0);
			helloaddress1=address1.firstChild.data;
			city=xmlresponse.getElementsByTagName('city').item(0);
			hellocity=city.firstChild.data;
			postcode=xmlresponse.getElementsByTagName('postcode').item(0);
			hellopostcode=postcode.firstChild.data;
			province=xmlresponse.getElementsByTagName('province').item(0);
			helloprovince=province.firstChild.data;

			member=xmlresponse.getElementsByTagName('member').item(0);
			hellomember=member.firstChild.data;
			dupname=xmlresponse.getElementsByTagName('dupname').item(0);
			hellodupname=dupname.firstChild.data;
			cardtype=xmlresponse.getElementsByTagName('cardtype').item(0);
			hellocardtype=cardtype.firstChild.data;
			cardholdername=xmlresponse.getElementsByTagName('cardholdername').item(0);
			hellocardholdername=cardholdername.firstChild.data;
			month=xmlresponse.getElementsByTagName('month').item(0);
			hellomonth=month.firstChild.data;
			year=xmlresponse.getElementsByTagName('year').item(0);
			helloyear=year.firstChild.data;
			cnum=xmlresponse.getElementsByTagName('cnum').item(0);
			hellocnum=cnum.firstChild.data;
			check=xmlresponse.getElementsByTagName('check').item(0);
			hellocheck=check.firstChild.data;

			// to explain errors
			/*if (helloselMem=="hi")
			{
				alert("in If");
				document.getElementById("divselmem").innerHTML = "";
			}
			else
			{
				alert("in elses");
				document.getElementById("divselmem").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML="Please select a Team member";
				document.getElementById("selmem").focus();
				return false;
			}*/

/*This is added for Mantis issue 36 ---- on 20th may 09 === Code start here */			
			if (hellomember == "hi")
			{
			    document.getElementById("diverrormessage1").innerHTML = "";
			}
			else
			{
				document.getElementById("diverrormessage1").innerHTML=hellomember;
				document.getElementById("selmem").focus();
				window.scroll(0,100);
				return false;
			}
/*This is added for Mantis issue 36 ---- on 20th may 09 === Code ends here */
			
			if (helloamount=="hi")
			{
				document.getElementById("divamount").innerHTML = "";
			}
			else
			{
				//alert("in else");
				document.getElementById("divamount").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloamount;
				document.getElementById("amt").focus();
				window.scroll(0,100);
				return false;
			}
			
			
			if (hellofirstname=="hi")
			{
				document.getElementById("divfirstname").innerHTML = "";
			}
			else
			{
				document.getElementById("divfirstname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellofirstname;
				document.getElementById("doname").focus();
				window.scroll(0,100);
				return false;
			}
			if (hellolastname=="hi")
			{
				document.getElementById("divlastname").innerHTML = "";
			}
			else
			{
				document.getElementById("divlastname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellolastname;
				document.getElementById("dolast").focus();
				window.scroll(0,100);
				return false;
			}
			
			if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloemail;
				document.getElementById("doemail").focus();
				window.scroll(0,100);
				return false;
			}
//			if (hellodemail=="hi")
//			{
//				document.getElementById("divemail").innerHTML = "";
//			}
//			else
//			{
//				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
//				document.getElementById("diverrormessage1").innerHTML=hellodemail;
//				document.getElementById("doreeamil").focus();
//				return false;
//			}
//			if (helloemailcompare=="hi")
//			{
//				document.getElementById("divemailcompare").innerHTML = "";
//			}
//			else
//			{
//				document.getElementById("divemailcompare").innerHTML = "<span class='txnormalboldred'>*</span>";
//				document.getElementById("diverrormessage1").innerHTML=helloemailcompare;
//				document.getElementById("doreeamil").focus();
//				return false;
//			}
			if (helloaddress1=="hi")
			{
				document.getElementById("divstreet").innerHTML = "";
			}
			else
			{
				document.getElementById("divstreet").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloaddress1;
				document.getElementById("doaddress").focus();
				window.scroll(0,100);
				return false;
			}
			
			if (hellocity=="hi")
			{
				document.getElementById("divcity").innerHTML = "";
			}
			else
			{
				document.getElementById("divcity").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocity;
				document.getElementById("dosuburb").focus();
				window.scroll(0,100);
				return false;
			}
			
			
			
			
			if (helloprovince=="hi")
			{
//				document.getElementById("divstate").innerHTML = "";
			}
			else
			{
//				document.getElementById("divstate").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloprovince;
//				document.getElementById("dostate").focus();
				window.scroll(0,100);
				return false;				
			}
			
			
			if (hellopostcode=="hi")
			{
//				document.getElementById("divpostcode").innerHTML = "";
			}
			else
			{
//				document.getElementById("divpostcode").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellopostcode;
				document.getElementById("dopost").focus();
				window.scroll(0,100);
				return false;
			}
/*			if (hellodupname=="hi")
			{ 
				document.getElementById("divname").innerHTML = "";
			}
			else 
			{
				document.getElementById("divname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellodupname;
				document.getElementById("doalias").focus();
				return false;
			}*/
			
			
			if (hellocardholdername=="hi")
			{
				document.getElementById("divholder").innerHTML = "";
			}
			else
			{
				document.getElementById("divholder").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocardholdername;
				document.getElementById("docardholder").focus();
				window.scroll(0,100);
				return false;
			}
			
			
			if (hellocardtype=="hi")
			{
				document.getElementById("divcardtype").innerHTML = "";
			}
			else
			{
				document.getElementById("divcardtype").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocardtype;
				document.getElementById("selcard").focus();
				window.scroll(0,100);
				return false;
			}
			if (hellomonth=="hi")
			{ 
				document.getElementById("divmonth").innerHTML = "";
			}
			else 
			{
				document.getElementById("divmonth").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellomonth;
				document.getElementById("txtmnth").focus();
				window.scroll(0,100);
				return false;
			}
			
			if (helloyear=="hi")
			{
				document.getElementById("divyear").innerHTML = "";
			}
			else 
			{
				document.getElementById("divyear").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloyear;
				document.getElementById("txtyear").focus();
				window.scroll(0,100);
				return false;
			}
			if (hellocnum=="hi")
			{
				document.getElementById("divcvv").innerHTML = "";
			}
			else 
			{ 
				document.getElementById("divcvv").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocnum;
				document.getElementById("doccv").focus();
				window.scroll(0,100);
				return false;
			}
			if (hellocheck=="hi")
			{
				document.getElementById("divcheck").innerHTML = "";
			}
			else 
			{ 
				document.getElementById("divcheck").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocheck;
				document.getElementById("dotrems").focus();
				window.scroll(0,100);
				return false;
			}
	var confirma=1;
			// restart sequence
	/*	setTimeout('process()', 1000);
		return false;*/
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				// display and center the popup:
				var donationpopup = document.getElementById("donationpopup");
				donationpopup.style.display = 'block';
				document.getElementById('diverrormessage1').style.display = 'none';
				var frm=document.doantion;		
				document.getElementById('btnSubmit').disabled = true;
				frm.submit();
			}
	}
}
	


function edonationprocess()
{
	scrollTo(0, 100);
	// display and center the popup:
	var donationpopup = document.getElementById("donationpopup");

	// get window details (width, height, scroll position):
	var viewPortWidth = windowState.getWidth();
	var viewPortHeight = windowState.getHeight();
	var horizontalScroll = windowState.getScrollX();
	var verticalScroll = windowState.getScrollY();

	donationpopup.style.display = 'block';
	donationpopup.style.marginLeft = "-" + parseInt(donationpopup.offsetWidth / 2) + "px";
	donationpopup.style.marginTop = (verticalScroll - (parseInt(donationpopup.offsetHeight / 2))) + "px";

// 	document.getElementById("spinner").style.display = 'block';
//	document.getElementById("buttons").style.display = 'none';

// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
    
	if (document.getElementById("doname"))
            firstname = encodeURIComponent(document.getElementById("doname").value);
	if (document.getElementById("dolast"))
            lastname = encodeURIComponent(document.getElementById("dolast").value);
	email=encodeURIComponent(document.getElementById("doemail").value);
	address1 = encodeURIComponent(document.getElementById("doaddress").value);
	city = encodeURIComponent(document.getElementById("dosuburb").value);
	postcode = encodeURIComponent(document.getElementById("dopost").value);
	province = encodeURIComponent(document.getElementById("dostate").value);	
	cardtype= encodeURIComponent(document.getElementById("selcard").value);
	cardholdername=encodeURIComponent(document.getElementById("docardholder").value);
	month=encodeURIComponent(document.getElementById("txtmnth").value);
	year=encodeURIComponent(document.getElementById("txtyear").value);
	check = encodeURIComponent(document.getElementById("dotrems").checked);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?email="+email+"&firstname="+firstname+"&lastname="+lastname+"&address1="+address1+"&city="+city+"&postcode="+postcode+"&province="+province+"&cardtype="+ cardtype+"&cardholdername="+ cardholdername+"&month="+ month+"&year="+ year+"&check="+ check, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = edonationprocessServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('edonationprocess()', 1000);
}
function edonationprocessServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
			document.getElementById('diverrormessage1').style.display = 'block';
			// hide popup:
			var donationpopup = document.getElementById("donationpopup");
			donationpopup.style.display = 'none';

		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		    
			firstname=xmlresponse.getElementsByTagName('firstname').item(0);
			hellofirstname=firstname.firstChild.data;
			lastname=xmlresponse.getElementsByTagName('lastname').item(0);
			hellolastname=lastname.firstChild.data;			
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			address1=xmlresponse.getElementsByTagName('address1').item(0);
			helloaddress1=address1.firstChild.data;
			city=xmlresponse.getElementsByTagName('city').item(0);
			hellocity=city.firstChild.data;
			postcode=xmlresponse.getElementsByTagName('postcode').item(0);
			hellopostcode=postcode.firstChild.data;
			province=xmlresponse.getElementsByTagName('province').item(0);
			helloprovince=province.firstChild.data;			
			cardtype=xmlresponse.getElementsByTagName('cardtype').item(0);
			hellocardtype=cardtype.firstChild.data;
			cardholdername=xmlresponse.getElementsByTagName('cardholdername').item(0);
			hellocardholdername=cardholdername.firstChild.data;
			month=xmlresponse.getElementsByTagName('month').item(0);
			hellomonth=month.firstChild.data;
			year=xmlresponse.getElementsByTagName('year').item(0);
			helloyear=year.firstChild.data;
			check=xmlresponse.getElementsByTagName('check').item(0);
			hellocheck=check.firstChild.data;
			
			//obtain the document element (the root element) of the XML structure
			// update the client display using the data received from the server
		
			if (helloemail!="hi") {
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloemail;
				document.getElementById("doemail").focus();
				return false;
			}
			
			if (hellofirstname!="hi") {
				document.getElementById("divfirstname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellofirstname;
				document.getElementById("doname").focus();
				window.scroll(0,100);
				return false;
			}
			if (hellolastname!="hi") {
				document.getElementById("divlastname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellolastname;
				document.getElementById("dolast").focus();
				window.scroll(0,100);
				return false;
			}
			
			if (helloaddress1!="hi") {
				document.getElementById("divstreet").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloaddress1;
				document.getElementById("doaddress").focus();
				window.scroll(0,100);
				return false;
			}
			
			if (hellocity!="hi") {
				document.getElementById("divcity").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocity;
				document.getElementById("dosuburb").focus();
				window.scroll(0,100);
				return false;
			}
			
			if (helloprovince!="hi"){
				document.getElementById("diverrormessage1").innerHTML=helloprovince;
				window.scroll(0,100);
				return false;				
			}
			
			
			if (hellopostcode!="hi") {
				document.getElementById("diverrormessage1").innerHTML=hellopostcode;
				document.getElementById("dopost").focus();
				window.scroll(0,100);
				return false;
			}			
			
			if (hellocardholdername=="hi")
			{
				document.getElementById("divholder").innerHTML = "";
			}
			else 
			{
				document.getElementById("divholder").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocardholdername;
				document.getElementById("docardholder").focus();
				return false;
			}
			
			if (hellocardtype=="hi")
			{
				document.getElementById("divcardtype").innerHTML = "";
			}
			else 
			{
				document.getElementById("divcardtype").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocardtype;
				document.getElementById("selcard").focus();
				return false;
			}
			if (hellomonth=="hi")
			{
				document.getElementById("divmonth").innerHTML = "";
			}
			else 
			{
				document.getElementById("divmonth").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellomonth;
				document.getElementById("txtmnth").focus();
				return false;
			}
			
			if (helloyear=="hi")
			{
				document.getElementById("divmonth").innerHTML = "";
			}
			else 
			{
				document.getElementById("divmonth").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloyear;
				document.getElementById("txtyear").focus();
				return false;
			}
			if (hellocheck=="hi")
			{
				document.getElementById("divchek").innerHTML = "";
			}
			else 
			{
				document.getElementById("divchek").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellocheck;
				document.getElementById("dotrem").focus();
				return false;
			}
			
		var confirma=1;
			// restart sequence
	/*	setTimeout('process()', 1000);
		return false;*/
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				document.getElementById('diverrormessage1').style.display = 'none';
				// display and center the popup:
				var donationpopup = document.getElementById("donationpopup");
				donationpopup.style.display = 'block';
				var frm=document.edoantion;				
				frm.submit();
			} 
	}
}
function personalde()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
    
	 name1 = encodeURIComponent(document.getElementById("txtfrst").value);
	email = encodeURIComponent(document.getElementById("txtemail").value);
	phone1 = encodeURIComponent(document.getElementById("txtphone").value);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?name1=" + name1  + "&email="+ email  +"&phone1="+ phone1, true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = personaldetailsServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('personalde()', 1000);
}
function personaldetailsServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;
		    name1=xmlresponse.getElementsByTagName('name1').item(0);
			helloname1=name1.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			phone1=xmlresponse.getElementsByTagName('phone1').item(0);
			hellophone1=phone1.firstChild.data;
			//agree=xmlresponse.getElementsByTagName('agree').item(0);
//			helloagree=agree.firstChild.data;
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (helloname1=="hi")
			{
				document.getElementById("divname").innerHTML = "";
			}
			else
			{
				document.getElementById("divname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage5").innerHTML=helloname1;
				document.getElementById("txtfrst").focus();
				return false;
			}
			if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage5").innerHTML=helloemail;
				document.getElementById("txtemail").focus();
				return false;
			}
			if (hellophone1=="hi")
			{
				document.getElementById("divphone1").innerHTML = "";
			}
			else 
			{
				document.getElementById("divphone1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage5").innerHTML=hellophone1;
				document.getElementById("txtphone").focus();
				return false;
			}
			
		
		var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.frmcontact;				
						
				frm.submit();
			}
				
	}
}
function teamdo()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
    
	 teamname = encodeURIComponent(document.getElementById("txtfrst").value);
	 password = encodeURIComponent(document.getElementById("txtpass").value);
	 eventsel= encodeURIComponent(document.getElementById("txtevent").value);
	 eventsel= encodeURIComponent(document.getElementById("txtevent").value);
	 phone=encodeURIComponent(document.getElementById("txtphone").value);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?teamname=" + teamname  + "&password="+ password + "&eventsel="+ eventsel + "&phone="+ phone  , true);
	 //define the method to handle server responses
	xmlHttp.onreadystatechange = teamServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('teamdo()', 1000);
}
function teamServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;
		    teamname=xmlresponse.getElementsByTagName('teamname').item(0);
			helloteamname=teamname.firstChild.data;
			password=xmlresponse.getElementsByTagName('password').item(0);
		    hellopassword=password.firstChild.data;
			eventsel=xmlresponse.getElementsByTagName('eventsel').item(0);
		    helloeventsel=eventsel.firstChild.data;
			phone=xmlresponse.getElementsByTagName('phone').item(0);
		    hellophone=phone.firstChild.data;
			//agree=xmlresponse.getElementsByTagName('agree').item(0);
//			helloagree=agree.firstChild.data;
		 //obtain the document element (the root element) of the XML structure
		// update the client display using the data received from the server
		if (helloteamname=="hi")
			{
				document.getElementById("divname").innerHTML = "";
			}
			else
			{
				document.getElementById("divname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage6").innerHTML=helloteamname;
				document.getElementById("txtfrst").focus();
				return false;
			}
			if (helloeventsel=="hi")
			{
				document.getElementById("divevent").innerHTML = "";
			}
			else
			{
				document.getElementById("divevent").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage6").innerHTML=helloeventsel;
				document.getElementById("txtevent").focus();
				return false;
			}
		if (hellopassword=="hi")
			{
				document.getElementById("divpassword").innerHTML = "";
			}
			else 
			{
				document.getElementById("divpassword").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage6").innerHTML=hellopassword;
				document.getElementById("txtpass").focus();
				return false;
			}
			if (hellophone=="hi")
			{
				document.getElementById("divphone").innerHTML = "";
			}
			else 
			{
				document.getElementById("divphone").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage6").innerHTML=hellophone;
				document.getElementById("txtphone").focus();
				return false;
			}
			
			
		
		var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.frmteam;				
			//frm.action="my_per.php";				
				frm.submit();
			}	
	}
}

function eventprocess()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
    
	firstname = encodeURIComponent(document.getElementById("title").value);
	email = encodeURIComponent(document.getElementById("email").value);
	phone = encodeURIComponent(document.getElementById("phone").value);
	//image= encodeURIComponent(document.getElementById("eimage").value);
	message1=encodeURIComponent(document.getElementById("emessage").value);
	xmlHttp.open("GET", "/xmlvalidations.php?firstname="+firstname+"&email="+email+"&phone="+phone+"&message1="+message1,true);
	xmlHttp.onreadystatechange = eventprocessServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('eventprocess()', 1000);
}

	function eventprocessServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		    
			firstname=xmlresponse.getElementsByTagName('firstname').item(0);
			hellofirstname=firstname.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			phone=xmlresponse.getElementsByTagName('phone').item(0);
			hellophone=phone.firstChild.data;
			//image=xmlresponse.getElementsByTagName('eimage').item(0);
//			helloimage=phone.firstChild.data;
			message1=xmlresponse.getElementsByTagName('message1').item(0);
			hellomessage1=phone.firstChild.data;
			
			if (hellofirstname=="hi")
			{
				document.getElementById("divtitle").innerHTML = "";
			}
			else
			{
				document.getElementById("divtitle").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellofirstname;
				document.getElementById("title").focus();
				return false;
			}
			
			
			
			if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=helloemail;
				document.getElementById("email").focus();
				return false;
			}
			
			if (hellophone=="hi")
			{
				document.getElementById("divphone").innerHTML = "";
			}
			else
			{
				document.getElementById("divphone").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellophone;
				document.getElementById("phone").focus();
				return false;
			}
			
			//if (helloimage=="hi")
//			{
//				document.getElementById("divimage").innerHTML = "";
//			}
//			else
//			{
//				document.getElementById("divimage").innerHTML = "<span class='txnormalboldred'>*</span>";
//				document.getElementById("diverrormessage1").innerHTML=helloimage;
//				document.getElementById("eimage").focus();
//				return false;
//			}
			
			if (hellomessage1=="hi")
			{
				document.getElementById("divmess").innerHTML = "";
			}
			else
			{
				document.getElementById("divmess").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage1").innerHTML=hellomessage1;
				document.getElementById("emessage").focus();
				return false;
			}
			
			var confirma=1;
			// restart sequence
	/*	setTimeout('process()', 1000);
		return false;*/
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.media_form;				
//				frm.action="register.php";				
				frm.submit();
			}
				
	}
}

function newaddmem()
	{
	// proceed only if the xmlHttp object isn't busy
		if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
		{
	// retrieve the name typed by the user on the form
    
	 frstname = encodeURIComponent(document.getElementById("txtfirst").value);
	lasname = encodeURIComponent(document.getElementById("txtlast").value);
	email = encodeURIComponent(document.getElementById("txtemail").value);
	 //execute the /xmlvalidations.php page from the server
	xmlHttp.open("GET", "/xmlvalidations.php?frstname=" + frstname  + "&lasname="+ lasname  +"&email="+ email, true);
	xmlHttp.onreadystatechange = newaddmemServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('newaddmem()', 1000);
}
function newaddmemServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		var docRoot = xmlresponse.getElementsByTagName("validation")[0];
		var hellousername = docRoot.childNodes[0].firstChild.data;
		   frstname=xmlresponse.getElementsByTagName('frstname').item(0);
			hellofrstname=frstname.firstChild.data;
			lasname=xmlresponse.getElementsByTagName('lasname').item(0);
			hellolasname=lasname.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			if (hellofrstname=="hi")
			{
				document.getElementById("divfrstname").innerHTML = "";
			}
			else 
			{
				document.getElementById("divfrstname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessagemem").innerHTML=hellofrstname;
				document.getElementById("txtfirst").focus();
				return false;
			}
			if (hellolasname=="hi")
			{
				document.getElementById("divlasname").innerHTML = "";
			}
			else 
			{
				document.getElementById("divlasname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessagemem").innerHTML=hellolasname;
				document.getElementById("txtlast").focus();
				return false;
			}
			
			if (helloemail=="hi")
			{
				document.getElementById("divemail1").innerHTML = "";
			}
			else 
			{
				document.getElementById("divemail1").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessagemem").innerHTML=helloemail;
				document.getElementById("txtemail").focus();
				return false;
			}
		var confirma=1;
			// restart sequence
		//setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.frmaddmem;				
				frm.submit();
			}
				
	}
}
function contactprocess()
{
// proceed only if the xmlHttp object isn't busy
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
	{
	// retrieve the name typed by the user on the form
    
	name = encodeURIComponent(document.getElementById("txtname").value);
	email = encodeURIComponent(document.getElementById("txtemail").value);
	phone = encodeURIComponent(document.getElementById("txtphone").value);
	xmlHttp.open("GET", "/xmlvalidations.php?name="+name+"&email="+email+"&phone="+phone,true);
	xmlHttp.onreadystatechange = contactprocessServerResponse;
	 //make the server request
	xmlHttp.send(null);
	}
	else
	 //if the connection is busy, try again after one second
	setTimeout('contactprocess()', 1000);
}

	function contactprocessServerResponse()
{
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		    
			name=xmlresponse.getElementsByTagName('name').item(0);
			helloname=name.firstChild.data;
			email=xmlresponse.getElementsByTagName('email').item(0);
			helloemail=email.firstChild.data;
			phone=xmlresponse.getElementsByTagName('phone').item(0);
			hellophone=phone.firstChild.data;
			
			if (helloname=="hi")
			{
				document.getElementById("divname").innerHTML = "";
			}
			else
			{
				document.getElementById("divname").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage7").innerHTML=helloname;
				document.getElementById("txtname").focus();
				return false;
			}
			
			
			
			if (helloemail=="hi")
			{
				document.getElementById("divemail").innerHTML = "";
			}
			else
			{
				document.getElementById("divemail").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage7").innerHTML=helloemail;
				document.getElementById("txtemail").focus();
				return false;
			}
			
			if (hellophone=="hi")
			{
				document.getElementById("divphone").innerHTML = "";
			}
			else
			{
				document.getElementById("divphone").innerHTML = "<span class='txnormalboldred'>*</span>";
				document.getElementById("diverrormessage7").innerHTML=hellophone;
				document.getElementById("txtphone").focus();
				return false;
			}
			
			
			
			var confirma=1;
			// restart sequence
		setTimeout('process()', 1000);
//		return false;
		}
		// a HTTP status different than 200 signals an error
		else
		{
		alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
		if (confirma==1)
			{
				var frm=document.formcon;				
//				frm.action="email/emcontact.php?p=1";				
				frm.submit();
			}
				
	}
}
	
//validate individual cause (charity) registration form
function individualCauseProcess(){
// proceed only if the xmlHttp object isn't busy
	scrollTo(0, 100);
	if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0){
		var causeName = encodeURIComponent(document.getElementById("txtCauseName").value);//not null
		var contactName = encodeURIComponent(document.getElementById("txtContactName").value);//not null
		var bsb = encodeURIComponent(document.getElementById("txtBSB").value);//not null,valid number
		var accountNo = encodeURIComponent(document.getElementById("txtAccountNo").value);//not null, valid number
		var accountEmail = encodeURIComponent(document.getElementById("txtAccountEmail").value);//not null
		var accountName = encodeURIComponent(document.getElementById("txtAccountName").value);//not null
		var readTerms = encodeURIComponent(document.getElementById("terms").checked); 
		//send validation request
		xmlHttp.open("GET", "/xmlvalidations.php?causename="+causeName+"&contactname="+contactName+"&bsb="+bsb+"&accountnumber="+accountNo+"&accountEmail="+accountEmail+"&accountname="+accountName+"&readterms="+readTerms,true);
		xmlHttp.onreadystatechange = individualCauseProcessServerResponse;
		 //make the server request
		xmlHttp.send(null);
		}
		else
		 //if the connection is busy, try again after one second
		setTimeout('individualCauseProcess()', 1000);
}


function individualCauseProcessServerResponse(){
	// move forward only if the transaction has completed
	if (xmlHttp.readyState == 4)
	{
	 //status of 200 indicates the transaction completed successfully
		if (xmlHttp.status == 200)
		{
		 //extract the XML retrieved from the server
		var xmlresponse = xmlHttp.responseXML;
		    
		var name=xmlresponse.getElementsByTagName('causename').item(0);
		var causeName=name.firstChild.data;
		var name=xmlresponse.getElementsByTagName('contactname').item(0);
		var contactName=name.firstChild.data;
		var hellobsb=xmlresponse.getElementsByTagName('bsb').item(0);
		var bsb=hellobsb.firstChild.data;
		var accountnumber=xmlresponse.getElementsByTagName('accountnumber').item(0);
		var accountNo=accountnumber.firstChild.data;
		var helloaccountemail=xmlresponse.getElementsByTagName('accountemail').item(0);
		var accountemail=helloaccountemail.firstChild.data;
		var accountname=xmlresponse.getElementsByTagName('accountname').item(0);
		var accountName=accountname.firstChild.data;
		var helloterms=xmlresponse.getElementsByTagName('readterms').item(0);
		var terms=helloterms.firstChild.data;
			
			if (causeName!="hi"){
			    document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=causeName;
				document.getElementById("txtCauseName").focus();
				scrollTo(0, 100);
				return false;
			}
			if (contactName!="hi"){
			    document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=contactName;
				document.getElementById("txtContactName").focus();
				scrollTo(0, 100);
				return false;
			}
  	        if (accountemail!="hi"){
  	            document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=accountemail;
				document.getElementById("txtAccountEmail").focus();
				scrollTo(0, 100);
				return false;
			}
			if (bsb!="hi"){
			    document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=bsb;
				document.getElementById("txtBSB").focus();
				scrollTo(0, 100);
				return false;
			}
			if (accountNo!="hi"){
			    document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=accountNo;
				document.getElementById("txtAccountNo").focus();
				scrollTo(0, 100);
				return false;
			}
			if (accountName!="hi"){
			    document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=accountName;
				document.getElementById("txtAccountName").focus();
				scrollTo(0, 100);
				return false;
			}
			if (terms!="hi"){
			    document.getElementById("divErrorMsg").style.display = "block";
				document.getElementById("divErrorMsg").innerHTML=terms;
				document.getElementById("terms").disabled=false;
				document.getElementById("terms").focus();
				scrollTo(0, 100);
				return false;
			}

			var confirma=1;
            document.getElementById("divErrorMsg").style.display = "none";
			// restart sequence
		//setTimeout('process()', 1000);
//		return false;
		}// a HTTP status different than 200 signals an error
		else{
		 alert("There was a problem accessing the server: " + xmlHttp.statusText);
		}
        
      if(confirma==1){
		 var frm=document.frmpage;								
		 frm.submit();
       }
				
	}
}

