

// LOGON

function LogonAccess()
{
		var sReturn;
		var sParam;
		var divLogonMessage = document.getElementById('divLogonMessage');
		var divLogonExpire = document.getElementById('divLogonExpire');
		var divLogonInvalid = document.getElementById('divLogonInvalid');
		var sUserName = document.getElementById('txtUserName').value;

		sParam = 'logon=' + sUserName + '&password=emp0wer931';
		
		divLogonMessage.setAttribute("class", "working");
		divLogonMessage.style.display = 'block';
		divLogonInvalid.style.display = 'none';
		divLogonExpire.style.display = 'none';

		sReturn = onDemandLogon(sParam);

		//window.alert(sReturn);

		divLogonMessage.setAttribute("class", "");

		if (sReturn.substring(0, 2) == 'OK')
		{
			var aValues = sReturn.split('|');

			//window.alert(aValues[1]);

			if (aValues[0] == 'OK') 
			{

				if (unescape(aValues[1]) == "NO") 
				{
					if (aValues[2] == "LOGONFAILED")
					{
					divLogonInvalid.setAttribute("class", "loginText");
					divLogonInvalid.innerHTML = 'Password is invalid - please re-enter';	
					divLogonInvalid.style.display = 'block';
					}
				}
				else 
				{
				
					if (aValues[3] == "PASSWORDEXPIRED")
					{
					document.location.href = '/password_change';
					}
					else
					{		
					  if (unescape(aValues[1]) != "#") 
					  {					
					  	divLogonMessage.setAttribute("class", "loginText");
						divLogonMessage.style.height = '20px';
						divLogonMessage.innerHTML = "logon successful, logging in...";
						
						var redirect = document.getElementById('txtUserName').value;
						switch(redirect)
						{	
						case 'BusPlan8910':
						document.location.href = "http://www.empowersolutions.com.au/business_plan_download";
						break;
						
						case 'HowMuch8264':
						document.location.href = "http://www.empowersolutions.com.au/how_much_download";
						break;
						
						
						case 'BudGet1407':
						document.location.href = "http://www.empowersolutions.com.au/budgeting_download";
						break;
						}
						
						
					  }
					  
					   if (unescape(aValues[1]) == "#") 
					  {	
						divLogonInvalid.innerHTML = 'Your setup is not complete.  Please contact us.';	
						divLogonInvalid.style.display = 'block';
					  }
					}
				}
			}
		}
	}


// CONTACT FORMS


$(document).ready(function()
{

	if(msOnDemandDocumentId == 34349 || msOnDemandDocumentId == 34298 || msOnDemandDocumentId == 34359 ||  msOnDemandDocumentId == 34357 ||  msOnDemandDocumentId == 34346 ||  msOnDemandDocumentId == 34374 ||  msOnDemandDocumentId == 34341  || msOnDemandDocumentId == 34363 || msOnDemandDocumentId == 34295) {
		//window.alert('Main');
		loadCaptcha();
	}

})




function loadCaptcha()
	{
		var sReturn;
		var sParam;
		var divCaptcha = document.getElementById('divCaptcha');
		
		sParam = 'method=SITE_GET_RANDOM_NUMBER&length=4';
		sReturn = onDemandSite(sParam);
		
//		window.alert(sReturn);
		
		if (sReturn.substring(0, 2) == 'OK')
			{
			var aValues = sReturn.split('|');

			if (aValues[0] == 'OK') {
				divCaptcha.innerHTML = unescape(aValues[2]) + '&nbsp;' + unescape(aValues[3]) + '&nbsp;' + unescape(aValues[4]) + '&nbsp;' + unescape(aValues[5]);
				divCaptcha.style.display = 'block';
						}
			}
	}
	

function SubmitEnquiry()
{

		var sReturn;
		var sParam;

		var sPIN = document.getElementById('txtPIN').value;

		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;
		sReturn = onDemandSite(sParam);

		//window.alert(sReturn);

		if (sReturn.substring(4, 2) == 'OK')
		{
			//Do the form sumbit here
		}

}


//////////////CONTACT US FORM////////////////////


function EnquiryForm()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (EnquiryFormValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=994&site=1309';

			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstName').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail').value; //email
			sParam = sParam + '&phone=' + document.getElementById('txtPhone').value; //phone
			sParam = sParam + '&mailingaddress1=' + document.getElementById('txtmAddress1').value;//special code offer
			sParam = sParam + '&notes=' + document.getElementById('txtCustomerNotes').value;//confirm email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/contact_response.html'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function EnquiryFormValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstName', 'First Name', '');
	onDemandValidate('txtSurname', 'Surname', '');
	onDemandValidate('txtEmail', 'Email', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}

    onDemandValidate('txtCustomerNotes', 'Message', '');


	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	

//////////////MISSION STATEMENT FORM////////////////////


function MissionForm()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (MissionFormValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=1018&site=1309&group=6791&type=692';

			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstName').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/mission_statement_tool_response'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function MissionFormValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstName', 'First Name', '');
	onDemandValidate('txtSurname', 'Surname', '');
	onDemandValidate('txtEmail', 'Email', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	
//////////////Business Evaluation Form////////////////////


function Business_EvaluationForm()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (Business_EvaluationFormValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=992&site=1309&type=462';

			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstName').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/ComplimentaryBusEvalResponse.html'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function Business_EvaluationFormValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstName', 'First Name', '');
	onDemandValidate('txtSurname', 'Surname', '');
	onDemandValidate('txtEmail', 'Email', '');
	onDemandValidate('txtBusinessName', 'BusinessName', '');
	onDemandValidate('txtSurveyTEXT4977', 'Type of Business', '');
	onDemandValidate('txtmAddress1', 'Business Address', '');
	onDemandValidate('txtPhone', 'Phone', '');
	onDemandValidate('cboSurvey4978', 'No. Employees', '');
	onDemandValidate('cboSurvey4979', 'Years in Operation', '');
	onDemandValidate('cboSurvey4980', 'Annual Turnover', '');
	onDemandValidate('txtSurveyTEXT4981', 'What are the three biggest challenges you face in your business today? ', '');
	onDemandValidate('txtSurveyTEXT4982', 'I would like to find out more information about the following Programs', '');
	onDemandValidate('txtSurveyTEXT4983', 'When is the best time to contact you?', '');
	onDemandValidate('txtSurveyTEXT4984', 'How did you hear about us?', '');
	
	
	if (!onDemandIsEmail(document.getElementById('txtEmail').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	

//////////////NEWS SUB FORM - USED ON http://site1309.1blankspace.com/marketing_tips_newsletter.shtml ///////////////////






function NewsletterSubPage()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (NewsletterSubPageValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=987&site=1309&type=689&group=6729&sendnews=1';


			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstname3').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname3').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail3').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/newsletter_response'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function NewsletterSubPageValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstname3', 'First Name', '');
	onDemandValidate('txtSurname3', 'Surname', '');
	onDemandValidate('txtEmail3', 'Email', '');

	
	
	if (!onDemandIsEmail(document.getElementById('txtEmail3').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	



//////////////NEWS SUB FORM - USED IN HEADER////////////////////

function NewsletterSub()
{

	var sReturn;
	var sParam;
	
	var divLoading = document.getElementById('divLoading');
	var news_form = document.getElementById('news_form');

	divLoading.style.display = 'none';

	if (NewsletterSubValidate())
	{

			sReturn = onDemandSite(sParam);

			sParam = 'method=SITE_SEND_ENQUIRY&select=987&site=1309&type=689&group=6729&sendnews=1';

			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstname2').value; //first name
			sParam = sParam + '&email=' + document.getElementById('txtEmail22').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				news_form.style.display = 'none';
				divLoading.innerHTML = 'Thank you for subscribing to our newsletter!';
				divLoading.style.width = '300px';
				divLoading.style.display = 'block';	
				
			}
			else
			{
				
				window.alert('Could not send!');
			}
		}

}

function NewsletterSubValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstname2', 'First Name', '');
	onDemandValidate('txtEmail22', 'Email', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail22').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		//document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	





//////////////EBOOK FORM////////////////////

function ebookForm()
{

	var sReturn;
	var sParam;
	
	var divLoading = document.getElementById('divLoading');
	

	divLoading.style.display = 'none';

	if (ebookFormValidate())
	{

			sReturn = onDemandSite(sParam);

			sParam = 'method=SITE_SEND_ENQUIRY&select=1000&site=1309&type=465&group=3585';

			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstName').value; //first name
			sParam = sParam + '&email=' + document.getElementById('txtEmail').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				parent.location.href = '/ebookresponse.html'
				
			}
			else
			{
				
				window.alert('Could not send!');
			}
		}

}

function ebookFormValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstName', 'First Name', '');
	onDemandValidate('txtEmail', 'Email', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		//document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	
//////////////Remove_email FORM////////////////////

function Remove_emailForm()
{

	var sReturn;
	var sParam;
	
	var divLoading = document.getElementById('divLoading');
	

	divLoading.style.display = 'none';

	if (Remove_emailFormValidate())
	{

			sReturn = onDemandSite(sParam);

			sParam = 'method=SITE_SEND_ENQUIRY&select=998&site=1309&group=3584&sendnews=0';

			//PERSONAL DETAILS

			
			sParam = sParam + '&email=' + document.getElementById('txtEmail').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				parent.location.href = '/Unsubscribe_Return.html'
				
			}
			else
			{
				
				window.alert('Could not send!');
			}
		}

}

function Remove_emailFormValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	
	onDemandValidate('txtEmail', 'Email', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		//document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}

//////////////BLOG FORM////////////////////


function EnquiryFormBlog()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (EnquiryFormValidateBlog())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			

			sParam = 'method=SITE_SEND_ENQUIRY&select=1004&site=1309&group=6607&type=656';

			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstName').value; //first name
			sParam = sParam + '&email=' + document.getElementById('txtEmail').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{	
				window.top.location.href = '/free_ebook_response'
			}
			else
			{
				window.alert('Could not send!');
			}
		}
	}
}




function EnquiryFormValidateBlog() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstName', 'Name', '');
	onDemandValidate('txtEmail', 'Email', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}


	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	


////////////// ASSESSMENT Business or Job////////////////////

			
function AssessmentJob()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (AssessmentJobValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=997&site=1309&type=475&sendnews=1';

			//SURVEY FIELDS
			
			sParam = sParam + '&sq5067=' + document.getElementById('cboSurvey5067').value;
			sParam = sParam + '&sq5068=' + document.getElementById('cboSurvey5068').value;
			sParam = sParam + '&sq5069=' + document.getElementById('cboSurvey5069').value;
			sParam = sParam + '&sq5070=' + document.getElementById('cboSurvey5070').value;
			sParam = sParam + '&sq5071=' + document.getElementById('cboSurvey5071').value;
			sParam = sParam + '&sq5072=' + document.getElementById('cboSurvey5072').value;
			sParam = sParam + '&sq5073=' + document.getElementById('cboSurvey5073').value;
			sParam = sParam + '&sq5074=' + document.getElementById('cboSurvey5074').value;
			sParam = sParam + '&sq5075=' + document.getElementById('cboSurvey5075').value;
			sParam = sParam + '&sq5076=' + document.getElementById('cboSurvey5076').value;
			sParam = sParam + '&sq5077=' + document.getElementById('cboSurvey5077').value;
			sParam = sParam + '&sq5078=' + document.getElementById('cboSurvey5078').value;
			sParam = sParam + '&sq5079=' + document.getElementById('cboSurvey5079').value;
			sParam = sParam + '&sq5080=' + document.getElementById('cboSurvey5080').value;
			sParam = sParam + '&sq5081=' + document.getElementById('cboSurvey5081').value;
			sParam = sParam + '&sq5082=' + document.getElementById('cboSurvey5082').value;
			sParam = sParam + '&sq5083=' + document.getElementById('cboSurvey5083').value;
			sParam = sParam + '&sq5084=' + document.getElementById('cboSurvey5084').value;
			sParam = sParam + '&sq5085=' + document.getElementById('cboSurvey5085').value;
			sParam = sParam + '&sq5086=' + document.getElementById('cboSurvey5086').value;



			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstname3').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname3').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail3').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/assessment_response'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function AssessmentJobValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstname3', 'First Name', '');
	onDemandValidate('txtSurname3', 'Surname', '');
	onDemandValidate('txtEmail3', 'Email', '');
	onDemandValidate('cboSurvey5067', 'Question1', '');
	onDemandValidate('cboSurvey5068', 'Question2', '');
	onDemandValidate('cboSurvey5069', 'Question3', '');
	onDemandValidate('cboSurvey5070', 'Question4', '');
	onDemandValidate('cboSurvey5071', 'Question5', '');
	onDemandValidate('cboSurvey5072', 'Question6', '');
	onDemandValidate('cboSurvey5073', 'Question7', '');
	onDemandValidate('cboSurvey5074', 'Question8', '');
	onDemandValidate('cboSurvey5075', 'Question9', '');
	onDemandValidate('cboSurvey5076', 'Question10', '');
	onDemandValidate('cboSurvey5077', 'Question11', '');
	onDemandValidate('cboSurvey5078', 'Question12', '');
	onDemandValidate('cboSurvey5079', 'Question13', '');
	onDemandValidate('cboSurvey5080', 'Question14', '');
	onDemandValidate('cboSurvey5081', 'Question15', '');
	onDemandValidate('cboSurvey5082', 'Question16', '');
	onDemandValidate('cboSurvey5083', 'Question17', '');
	onDemandValidate('cboSurvey5084', 'Question18', '');
	onDemandValidate('cboSurvey5085', 'Question19', '');
	onDemandValidate('cboSurvey5086', 'Question20', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail3').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	
////////////// ASSESSMENT Is Your Business at Risk?  ////////////////////

			
function AssessmentRisk()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (AssessmentRiskValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=1025&site=1309&type=474&sendnews=1';

			//SURVEY FIELDS
			sParam = sParam + '&sq5046=' + document.getElementById('cboSurvey5046').value;
			sParam = sParam + '&sq5047=' + document.getElementById('cboSurvey5047').value;
			sParam = sParam + '&sq5048=' + document.getElementById('cboSurvey5048').value;
			sParam = sParam + '&sq5049=' + document.getElementById('cboSurvey5049').value;
			sParam = sParam + '&sq5050=' + document.getElementById('cboSurvey5050').value;
			sParam = sParam + '&sq5051=' + document.getElementById('cboSurvey5051').value;
			sParam = sParam + '&sq5052=' + document.getElementById('cboSurvey5052').value;
			sParam = sParam + '&sq5053=' + document.getElementById('cboSurvey5053').value;
			sParam = sParam + '&sq5054=' + document.getElementById('cboSurvey5054').value;
			sParam = sParam + '&sq5056=' + document.getElementById('cboSurvey5056').value;
			sParam = sParam + '&sq5057=' + document.getElementById('cboSurvey5057').value;
			sParam = sParam + '&sq5058=' + document.getElementById('cboSurvey5058').value;
			sParam = sParam + '&sq5059=' + document.getElementById('cboSurvey5059').value;
			sParam = sParam + '&sq5060=' + document.getElementById('cboSurvey5060').value;
			sParam = sParam + '&sq5061=' + document.getElementById('cboSurvey5061').value;
			sParam = sParam + '&sq5062=' + document.getElementById('cboSurvey5062').value;
			sParam = sParam + '&sq5063=' + document.getElementById('cboSurvey5063').value;
			sParam = sParam + '&sq5064=' + document.getElementById('cboSurvey5064').value;
			sParam = sParam + '&sq5065=' + document.getElementById('cboSurvey5065').value;
			sParam = sParam + '&sq5066=' + document.getElementById('cboSurvey5066').value;



			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstname3').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname3').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail3').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/assessment_response'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function AssessmentRiskValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstname3', 'First Name', '');
	onDemandValidate('txtSurname3', 'Surname', '');
	onDemandValidate('txtEmail3', 'Email', '');
	onDemandValidate('cboSurvey5046', 'Question1', '');
	onDemandValidate('cboSurvey5047', 'Question2', '');
	onDemandValidate('cboSurvey5048', 'Question3', '');
	onDemandValidate('cboSurvey5049', 'Question4', '');
	onDemandValidate('cboSurvey5050', 'Question5', '');
	onDemandValidate('cboSurvey5051', 'Question6', '');
	onDemandValidate('cboSurvey5052', 'Question7', '');
	onDemandValidate('cboSurvey5053', 'Question8', '');
	onDemandValidate('cboSurvey5054', 'Question9', '');
	onDemandValidate('cboSurvey5056', 'Question10', '');
	onDemandValidate('cboSurvey5057', 'Question11', '');
	onDemandValidate('cboSurvey5058', 'Question12', '');
	onDemandValidate('cboSurvey5059', 'Question13', '');
	onDemandValidate('cboSurvey5060', 'Question14', '');
	onDemandValidate('cboSurvey5061', 'Question15', '');
	onDemandValidate('cboSurvey5062', 'Question16', '');
	onDemandValidate('cboSurvey5063', 'Question17', '');
	onDemandValidate('cboSurvey5064', 'Question18', '');
	onDemandValidate('cboSurvey5065', 'Question19', '');
	onDemandValidate('cboSurvey5066', 'Question20', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail3').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	
////////////// Assessment_Smart_Marketer  ////////////////////

			
function AssessmentSmart()
{

	var sReturn;
	var sParam;

	var sPIN = document.getElementById('txtPIN').value;

	if (AssessmentSmartValidate())
	{
		sParam = 'method=SITE_CHECK_RANDOM_NUMBER_MATCH&number=' + sPIN;

		sReturn = onDemandSite(sParam);
		if (sReturn.substr(3,2) != 'OK')
		{
			window.alert('Verfication PIN does not match - please reenter!');
		}	
		else
		{
			
			var divLoading = document.getElementById('divLoading');
	
			divLoading.innerHTML = 'Sending...';
			divLoading.style.width = '100px';
			divLoading.setAttribute("class", "working smlText");
			divLoading.style.display = 'block';	
		
			sParam = 'method=SITE_SEND_ENQUIRY&select=1001&site=1309&type=473&sendnews=1';

			//SURVEY FIELDS
			sParam = sParam + '&sq4995=' + document.getElementById('cboSurvey4995').value;
			sParam = sParam + '&sq4996=' + document.getElementById('cboSurvey4996').value;
			sParam = sParam + '&sq4997=' + document.getElementById('cboSurvey4997').value;
			sParam = sParam + '&sq4998=' + document.getElementById('cboSurvey4998').value;
			sParam = sParam + '&sq4999=' + document.getElementById('cboSurvey4999').value;
			sParam = sParam + '&sq5000=' + document.getElementById('cboSurvey5000').value;
			sParam = sParam + '&sq5001=' + document.getElementById('cboSurvey5001').value;
			sParam = sParam + '&sq5002=' + document.getElementById('cboSurvey5002').value;
			sParam = sParam + '&sq5003=' + document.getElementById('cboSurvey5003').value;
			sParam = sParam + '&sq5004=' + document.getElementById('cboSurvey5004').value;
			sParam = sParam + '&sq5005=' + document.getElementById('cboSurvey5005').value;
			sParam = sParam + '&sq5006=' + document.getElementById('cboSurvey5006').value;
			sParam = sParam + '&sq5007=' + document.getElementById('cboSurvey5007').value;
			sParam = sParam + '&sq5008=' + document.getElementById('cboSurvey5008').value;
			sParam = sParam + '&sq5009=' + document.getElementById('cboSurvey5009').value;
			sParam = sParam + '&sq5010=' + document.getElementById('cboSurvey5010').value;
			sParam = sParam + '&sq5011=' + document.getElementById('cboSurvey5011').value;
			sParam = sParam + '&sq5012=' + document.getElementById('cboSurvey5012').value;
			sParam = sParam + '&sq5013=' + document.getElementById('cboSurvey5013').value;
			sParam = sParam + '&sq5014=' + document.getElementById('cboSurvey5014').value;



			//PERSONAL DETAILS

			sParam = sParam + '&firstname=' + document.getElementById('txtFirstname3').value; //first name
			sParam = sParam + '&surname=' + document.getElementById('txtSurname3').value; //surname
			sParam = sParam + '&email=' + document.getElementById('txtEmail3').value; //email

			sReturn = onDemandSite(sParam);

			if (sReturn.substring(0, 2) == 'OK')
			{
			
				document.location.href = '/assessment_response'
			}
			else
			{
				divLoading.style.display = 'none';
				window.alert('Could not send!');
			}
		}
	}
}


function AssessmentSmartValidate() 
{

	sOnDemandValidateMessage = '';
	sOnDemandValidateObject = '';

	onDemandValidate('txtFirstname3', 'First Name', '');
	onDemandValidate('txtSurname3', 'Surname', '');
	onDemandValidate('txtEmail3', 'Email', '');
	onDemandValidate('cboSurvey4995', 'Question1', '');
	onDemandValidate('cboSurvey4996', 'Question2', '');
	onDemandValidate('cboSurvey4997', 'Question3', '');
	onDemandValidate('cboSurvey4998', 'Question4', '');
	onDemandValidate('cboSurvey4999', 'Question5', '');
	onDemandValidate('cboSurvey5000', 'Question6', '');
	onDemandValidate('cboSurvey5001', 'Question7', '');
	onDemandValidate('cboSurvey5002', 'Question8', '');
	onDemandValidate('cboSurvey5003', 'Question9', '');
	onDemandValidate('cboSurvey5004', 'Question10', '');
	onDemandValidate('cboSurvey5005', 'Question11', '');
	onDemandValidate('cboSurvey5006', 'Question12', '');
	onDemandValidate('cboSurvey5007', 'Question13', '');
	onDemandValidate('cboSurvey5008', 'Question14', '');
	onDemandValidate('cboSurvey5009', 'Question15', '');
	onDemandValidate('cboSurvey5010', 'Question16', '');
	onDemandValidate('cboSurvey5011', 'Question17', '');
	onDemandValidate('cboSurvey5012', 'Question18', '');
	onDemandValidate('cboSurvey5013', 'Question19', '');
	onDemandValidate('cboSurvey5014', 'Question20', '');
	
	if (!onDemandIsEmail(document.getElementById('txtEmail3').value))
	{
		sOnDemandValidateMessage = sOnDemandValidateMessage + '\r\n # Not a valid email address.';
	}



	if (sOnDemandValidateMessage != '')
	{
		window.alert('Sorry can\'t submit your registration as:\r\n' + sOnDemandValidateMessage);
		document.getElementById(sOnDemandValidateObject).focus();
		return (false);
	}
	else
	{
		return (true);
	}
}	
