<!--

// for testing: alert ('here'); 

// BEGIN AJAX SECTION

function toggleFav(jid) {
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
		}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
			catch (e) {
				alert("Function unavailable - your browser does not support AJAX"); return false;
				}
			}
		}
		xmlHttp.onreadystatechange=function() {
		if (xmlHttp.readyState==4) {document.getElementById("txtFav"+jid).innerHTML=xmlHttp.responseText;}
	}
	var url="crewtogglefav.asp?jid="+jid;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

// END AJAX SECTION

function CookieTest() {
	window.open("cookietest.asp","CookieTestWindow","scrollbars=yes,resizable=yes,toolbar=no,menubar=no,location=no,top=200,left=150,height=250,width=400");
	return false;
}

function checkLoginForm() {
	if (!checkText(document.frmLogin.strLoginUsername, 'UserType', 'username', true)) {return false;}
	if (!checkText(document.frmLogin.strLoginPassword, 'PasswordType', 'password', true)) {return false;}
	//alert('here'); // for testing
	//return false; // for testing
	return true;
}

function confirmHideSure() {
	return confirm('Hide this application?');
}

function confirmUnhideSure() {
	return confirm('Unhide this application?');
}

function confirmSure() {
	return confirm('Sure?');
}

function confirmCurr() {
	return confirm('WARNING: Changing currency will delete any contents of your basket. Continue?');
}

function bookmark() {
	if (document.all) {
		window.external.AddFavorite("http://www.flightdeckrecruitment.com", "Flightdeck Recruitment");
	}
	else {
		alert("Apologies, this function only works in Internet Explorer.  Please add the bookmark manually.");
	}
	return false;
}

function checkBugForm() {
	if (!checkText(document.frmBug.strBugDescription, 'TextAreaType', 'bug description', true)) {return false;}
	if (!checkText(document.frmBug.strFloodControl, 'IntegerType', 'check number', true)) {return false;}
	if (document.frmBug.strFloodControl.value.length!=4) {alert('Your check number must have 4 digits.  Please try again.');document.frmBug.strFloodControl.focus();return false;}

	if(false){ // set to true for testing
		alert('Got to end of JavaScript OK');
		return false;
	}
	else {
		return true;
	}
}

function checkTellfriendsForm() {
	if (!checkText(document.frmTellfriends.strTellfriendsYourname, 'NameType', 'name', true)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsEmailAddress1A, 'primary e-mail address', true)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsEmailAddress1B, 'primary e-mail address', true)) {return false;}
	if (!checkSame(document.frmTellfriends.strTellfriendsEmailAddress1A, document.frmTellfriends.strTellfriendsEmailAddress1B, 'primary e-mail address')) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress1, 'e-mail address (friend 1)', true)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress2, 'e-mail address (friend 2)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress3, 'e-mail address (friend 3)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress4, 'e-mail address (friend 4)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress5, 'e-mail address (friend 5)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress6, 'e-mail address (friend 6)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress7, 'e-mail address (friend 7)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress8, 'e-mail address (friend 8)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress9, 'e-mail address (friend 9)', false)) {return false;}
	if (!checkEmail(document.frmTellfriends.strTellfriendsTellAddress10, 'e-mail address (friend 10)', false)) {return false;}
	if (!checkText(document.frmTellfriends.strFloodControl, 'IntegerType', 'check number', true)) {return false;}
	if (document.frmTellfriends.strFloodControl.value.length!=4) {alert('Your check number must have 4 digits.  Please try again.');document.frmContacttact.strFloodControl.focus();return false;}

	if(false){ // set to true for testing
		alert('Got to end of JavaScript OK');
		return false;
	}
	else {
		return true;
	}
}

function checkPasswordForm() {
	if (!checkText(document.frmPassports.strPasswordSearchString, 'StringType', 'user name or e-mail address', true)) {return false;}
	if (!checkText(document.frmPassports.strFloodControl, 'IntegerType', 'check number', true)) {return false;}
	if (document.frmPassports.strFloodControl.value.length!=4) {alert('Your check number must have 4 digits.  Please try again.');document.frmPassports.strFloodControl.focus();return false;}

	if(false){ // set to true for testing
		alert('Got to end of JavaScript OK');
		return false;
	}
	else {
		return true;
	}
}

function checkContactForm() {
	if (!checkText(document.frmContact.strContactName, 'NameType', 'name', true)) {return false;}
	if (!checkEmail(document.frmContact.strContactEmail, 'e-mail address', true)) {return false;}
	if (!checkText(document.frmContact.strContactMessage, 'TextAreaType', 'message', true)) {return false;}
	if (document.frmContact.strContactMessage.value.length>1000){alert("Message is too long!  Please try again.  Reminder: CVs/resumes posted here will be disregarded."); return false;}
	if (!checkText(document.frmContact.strFloodControl, 'IntegerType', 'check number', true)) {return false;}
	if (document.frmContact.strFloodControl.value.length!=4) {alert('Your check number must have 4 digits.  Please try again.');document.frmContact.strFloodControl.focus();return false;}

	if(false){ // set to true for testing
		alert('Got to end of JavaScript OK');
		return false;
	}
	else {
		return true;
	}
}

function checkUsernameForm() {
	if (!checkText(document.frmCheckUsername.strCrewUsername, 'UserType', 'desired user name', true)) {return false;}
	if (document.frmCheckUsername.strCrewUsername.value.length<8) {alert('Your user name must have at least 8 characters.  Please try again.');document.frmCheckUsername.strCrewUsername.focus();return false;}
 	if (!checkText(document.frmCheckUsername.strFloodControl, 'IntegerType', 'check number', true)) {return false;}
	if (document.frmCheckUsername.strFloodControl.value.length!=4) {alert('Your check number must have 4 digits.  Please try again.');document.frmCheckUsername.strFloodControl.focus();return false;}

	if(false){ // set to true for testing
		alert('Got to end of JavaScript OK');
		return false;
	}
	else {
		return true;
	}
}

function termspopup() {
		window.open('termspopup.asp','termspop','height=300,width=500,top=50,left=50,directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no')
	return false;
}
// -->
