/* Set Global Variables */
var BrowserName = '';
/* Get Browser Name */
var UserAgent=navigator.userAgent;
if (UserAgent.indexOf('MSIE')!=-1) { BrowserName='MSIE'; }
else if (UserAgent.indexOf('Firefox')!=-1) { BrowserName='Firefox'; }
else if (UserAgent.indexOf('Chrome')!=-1) { BrowserName='Chrome'; }
else if (UserAgent.indexOf('Safari')!=-1) { BrowserName='Safari'; }
else if (UserAgent.indexOf('Opera')!=-1) { BrowserName='Opera'; }
/* function to display navigator settings */
function fncNavigatorSettings() {
	var xTxt='navigator.appCodeName='+navigator.appCodeName+'\n';
	xTxt+='navigator.appname='+navigator.appname+'\n';
	xTxt+='navigator.appVersion='+navigator.appVersion+'\n';
	xTxt+='navigator.language='+navigator.language+'\n';
	xTxt+='navigator.mimeTypes='+navigator.mimeTypes+'\n';
	xTxt+='navigator.platform='+navigator.platform+'\n';
	xTxt+='navigator.plugins='+navigator.plugins+'\n';
	xTxt+='navigator.userAgent='+navigator.userAgent+'\n';
	xTxt+='\nBrowserName='+BrowserName+'\n';
	window.alert(xTxt);
}
/* function to stop evil wrong-doers harvesting our e-mail addresses */
function fncMailTag(user,domain,subject) {
	var xTxt='<a href="mailto:'+user+'@'+domain+'?subject='+subject+'">';
	xTxt+=user+'@'+domain+'</a>';
	document.write(xTxt);
}
/* Function to perform edit checks on input form data */
function fncEditForm() {
//	window.alert('Functionality not yet available.');
	var xError = '';
	var xCount = 0;
	var fCoverAmount = document.forms['Apply'].CoverAmount.value;
	var fCoverStatus = document.forms['Apply'].CoverStatus.value;
	var fTitle = document.forms['Apply'].Title.value;
	var fForename = document.forms['Apply'].Forename.value;
	var fSurname = document.forms['Apply'].Surname.value;
	var fDOBDay = document.forms['Apply'].DOBDay.value;
	var fDOBMonth = document.forms['Apply'].DOBMonth.value;
	var fDOBYear = document.forms['Apply'].DOBYear.value;
	var fHouse = document.forms['Apply'].House.value;
	var fStreet = document.forms['Apply'].Street.value;
	var fPostcode = document.forms['Apply'].Postcode.value;
	var fEMail = document.forms['Apply'].EMail.value;
	var fContactPhone = document.forms['Apply'].ContactPhone.value;
	var fOtherPhone = document.forms['Apply'].OtherPhone.value;
	var fAccepted = document.forms['Apply'].Accepted.checked;
//	var f = document.forms['Apply']..value;
	if (fCoverAmount == '') {
		xError+='You must enter the Amount of Cover required.\n';
	} else {
		if (isNaN(fCoverAmount) == true) {
			xError += 'Cover Amount must be Numeric.\n';
		}
	}
	if (fCoverStatus == 'none') xError+='You must select an Employment Status.\n';
	if (fTitle == 'none') xError+='You must select a Title.\n';
	if (fForename == '') xError+='You must enter your Forename.\n';
	if (fSurname == '') xError+='You must enter your Surname.\n';
	xCount = 0;
	if (fDOBDay == 'none') xCount++;
	if (fDOBMonth == 'none') xCount++;
	if (fDOBYear == 'none') xCount++;
	if (xCount > 0) xError+='You must enter your complete Date of Birth.\n';
	if (fHouse == '') xError+='You must enter your House Number/Name.\n';
	if (fStreet == '') xError+='You must enter your Street Name.\n';
	if (fPostcode == '') xError+='You must enter your Post Code.\n';
	xCount = 0;
	if (fContactPhone != '') {
		if (isNaN(fContactPhone) == true) {
			xError += 'Contact Phone Number, if entered, must be Numeric.\n';
		} else {
			xCount++;
		}
	}
	if (fOtherPhone != '') {
		if (isNaN(fOtherPhone) == true) {
			xError += 'Alternate Phone Number, if entered, must be Numeric.\n';
		} else {
			xCount++;
		}
	}
	if (fEMail != '') xCount++;
	if (xCount == 0) xError+='You must enter an e-mail address and/or a phone number.\n';
	if (fAccepted == false) xError+='You must read and accept our Terms and Conditions.\n';
	if (xError != '') {
		window.alert(xError);
	} else {
		document.forms['Apply'].submit();
	}
}
function fncEditForm0() {
//	window.alert('Functionality not yet available.');
	var xError = '';
	var xCount = 0;
	var fCoverAmount = document.form.Apply.CoverAmount.value;
	var fCoverStatus = document.form.Apply.CoverStatus.value;
	var fTitle = document.form.Apply.Title.value;
	var fForename = document.form.Apply.Forename.value;
	var fSurname = document.form.Apply.Surname.value;
	var fDOBDay = document.form.Apply.DOBDay.value;
	var fDOBMonth = document.form.Apply.DOBMonth.value;
	var fDOBYear = document.form.Apply.DOBYear.value;
	var fHouse = document.form.Apply.House.value;
	var fStreet = document.form.Apply.Street.value;
	var fPostcode = document.form.Apply.Postcode.value;
	var fEMail = document.form.Apply.EMail.value;
	var fContactPhone = document.form.Apply.ContactPhone.value;
	var fOtherPhone = document.form.Apply.OtherPhone.value;
	var fAccepted = document.form.Apply.Accepted.checked;
//	var f = document.form.Apply..value;
	if (fCoverAmount == '') {
		xError+='You must enter the Amount of Cover required.\n';
	} else {
		if (isNaN(fCoverAmount) == true) {
			xError += 'Cover Amount must be Numeric.\n';
		}
	}
	if (fCoverStatus == 'none') xError+='You must select an Employment Status.\n';
	if (fTitle == 'none') xError+='You must select a Title.\n';
	if (fForename == '') xError+='You must enter your Forename.\n';
	if (fSurname == '') xError+='You must enter your Surname.\n';
	xCount = 0;
	if (fDOBDay == 'none') xCount++;
	if (fDOBMonth == 'none') xCount++;
	if (fDOBYear == 'none') xCount++;
	if (xCount > 0) xError+='You must enter your complete Date of Birth.\n';
	if (fHouse == '') xError+='You must enter your House Number/Name.\n';
	if (fStreet == '') xError+='You must enter your Street Name.\n';
	if (fPostcode == '') xError+='You must enter your Post Code.\n';
	xCount = 0;
	if (fContactPhone != '') {
		if (isNaN(fContactPhone) == true) {
			xError += 'Contact Phone Number, if entered, must be Numeric.\n';
		} else {
			xCount++;
		}
	}
	if (fOtherPhone != '') {
		if (isNaN(fOtherPhone) == true) {
			xError += 'Alternate Phone Number, if entered, must be Numeric.\n';
		} else {
			xCount++;
		}
	}
	if (fEMail != '') xCount++;
	if (xCount == 0) xError+='You must enter an e-mail address and/or a phone number.\n';
	if (fAccepted == false) xError+='You must read and accept our Terms and Conditions.\n';
	if (xError != '') {
		window.alert(xError);
	} else {
		document.form.Apply.submit();
	}
}
//fncNavigatorSettings();

