// miscellaneous utilities



// manage the login form on the home page
var gEmailValidator	= /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ ;

function checkLogin() {

	var emailFieldValue = document.forms.login.elements['email'].value; 

	if(gEmailValidator.test(emailFieldValue) == false) {
		alert('Please enter your email address in the email field. It must be a valid email address.');
		document.forms.login.elements['email'].focus();
		return false;
	}

	if (document.forms.login.elements['pass'].value.length == 0) {
		alert('Please enter your password in the password field');
		document.forms.login.elements['pass'].focus();
		return false;
	}

	document.login.submit();

}



// manage the tours pages (they require js)

//  if js is available 
//  hide the elements that show when there is there is no js 
//  show the js enabled elements

function setupHomePage() {
	document.getElementById('noscriptSection').style.display	="none"  ;
	document.getElementById('loginFormDiv').style.display		="block" ;
	document.getElementById('forgotPassword').style.display		="block" ;
}

function setupATourPage() {
	document.getElementById('jsIsNotAvailable').style.display	="none"  ;
	document.getElementById('jsIsAvailable').style.display		="block" ;
	document.getElementById('container').style.display			="block" ;
}