function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function validate_profile_manager_form() {
	valid = true;

	if ( document.form1.firstName.value == "" )
	{
		document.getElementById('nameError').innerHTML="<p>Please enter your first name</p>";
		valid = false;
	}
	
	if ( document.form1.firstName.value != "" && document.form1.lastName.value == "" )
	{
		document.getElementById('nameError').innerHTML="<p>Please enter your last name</p>";
		valid = false;
	}
	
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.form1.emailAddress.value;

	// search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) {
		document.getElementById('emailError').innerHTML="<p>Email address not valid</p>";
		valid = false;
	}
	
	if ( document.form1.emailAddress.value != "" && document.form1.confirmEmail.value != document.form1.emailAddress.value )
	{
		document.getElementById('emailError').innerHTML="<p>Email confirmation does not match</p>";
		valid = false;
	}
	
	if ( document.form1.password.value == "" )
	{
		document.getElementById('passwordError').innerHTML="<p>Please enter a password</p>";
		valid = false;
	}
	
	if ( document.form1.password.value != "" && document.form1.confirmPassword.value != document.form1.password.value )
	{
		document.getElementById('passwordError').innerHTML="<p>Password confirmation does not match</p>";
		valid = false;
	}

	return valid;
}

function validate_add_edit_image_form() {
	valid = true;

	if ( document.form1.image.value == "" )
	{
		document.getElementById('imageError').innerHTML="<p>Please select a file</p>";
		valid = false;
	}

	return valid;
}

function validate_comment_form() {
	valid = true;

	if ( document.form1.comment.value == "" )
	{
		document.getElementById('commentError').innerHTML="<p>Please enter a comment</p>";
		valid = false;
	}

	return valid;
}

function validate_friend_search_form() {
	valid = true;

	if ( document.form1.emailAddress.value == "" && document.form1.firstName.value == "" && document.form1.lastName.value == "" )
	{
		document.getElementById('searchError').innerHTML="<p>Please enter your friend's email or name</p>";
		valid = false;
	}
	
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.form1.emailAddress.value;

	// search email text for regular exp matches
	if (document.form1.emailAddress.value && strEmail.search(validRegExp) == -1) {
		document.getElementById('emailError').innerHTML="<p>Email address not valid</p>";
		valid = false;
	}

	return valid;
}

function validate_invite_friend_form() {
	valid = true;
	
	strEmail = document.form1.emailAddress.value;
	
	if ( strEmail == "" )
	{
		document.getElementById('emailError').innerHTML="<p>Please enter an email address</p>";
		valid = false;
	}
	else if (strEmail.indexOf ('@', 0) == -1)
	{
		document.getElementById('emailError').innerHTML="<p>Email address not valid</p>";
		valid = false;
	}

	return valid;
}

function validate_login_form() {
	valid = true;
	
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.form1.emailAddress.value;

	// search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) {
		document.getElementById('emailError').innerHTML="<p>Email address not valid</p>";
		valid = false;
	}
	
	if ( document.form1.password.value == "" )
	{
		document.getElementById('passwordError').innerHTML="<p>Please enter a password</p>";
		valid = false;
	}

	return valid;
}

function validate_password_recover_form() {
	valid = true;
	
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.form1.pREmailAddress.value;

	// search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) {
		document.getElementById('emailError').innerHTML="<p>Email address not valid</p>";
		valid = false;
	}

	return valid;
}

function validate_invite_join_form() {
	valid = true;

	if ( document.form1.firstName.value == "" )
	{
		document.getElementById('nameError').innerHTML="<p>Please enter your first name</p>";
		valid = false;
	}
	
	if ( document.form1.firstName.value != "" && document.form1.lastName.value == "" )
	{
		document.getElementById('nameError').innerHTML="<p>Please enter your last name</p>";
		valid = false;
	}
	
	if ( document.form1.password.value == "" )
	{
		document.getElementById('passwordError').innerHTML="<p>Please enter a password</p>";
		valid = false;
	}
	
	if ( document.form1.password.value != "" && document.form1.confirmPassword.value != document.form1.password.value )
	{
		document.getElementById('passwordError').innerHTML="<p>Password confirmation does not match</p>";
		valid = false;
	}
	
	if ( document.form1.countries.value == "" )
	{
		document.getElementById('countriesError').innerHTML="<p>Please select your country</p>";
		valid = false;
	}

	return valid;
}

function validate_join_form() {
	valid = true;

	if ( document.form1.firstName.value == "" )
	{
		document.getElementById('nameError').innerHTML="<p>Please enter your first name</p>";
		valid = false;
	}
	
	if ( document.form1.firstName.value != "" && document.form1.lastName.value == "" )
	{
		document.getElementById('nameError').innerHTML="<p>Please enter your last name</p>";
		valid = false;
	}
	
	validRegExp = /^[^@]+@[^@]+.[a-z]{2,}$/i;
	strEmail = document.form1.emailAddress.value;

	// search email text for regular exp matches
	if (strEmail.search(validRegExp) == -1) {
		document.getElementById('emailError').innerHTML="<p>Email address not valid</p>";
		valid = false;
	}
	
	if ( document.form1.emailAddress.value != "" && document.form1.confirmEmail.value != document.form1.emailAddress.value )
	{
		document.getElementById('emailError').innerHTML="<p>Email confirmation does not match</p>";
		valid = false;
	}
	
	if ( document.form1.password.value == "" )
	{
		document.getElementById('passwordError').innerHTML="<p>Please enter a password</p>";
		valid = false;
	}
	
	if ( document.form1.password.value != "" && document.form1.confirmPassword.value != document.form1.password.value )
	{
		document.getElementById('passwordError').innerHTML="<p>Password confirmation does not match</p>";
		valid = false;
	}
	
	if ( document.form1.countries.value == "" )
	{
		document.getElementById('countriesError').innerHTML="<p>Please select your country</p>";
		valid = false;
	}

	return valid;
}

function validate_contact_form() {
	valid = true;

	if ( document.form1.message.value == "" )
	{
		document.getElementById('messageError').innerHTML="<p>Please enter a message</p>";
		valid = false;
	}

	return valid;
}

function GP_popupConfirmMsg(msg) { //v1.0
  document.MM_returnValue = confirm(msg);
}
