function activatekeys(){
document.body.onkeypress = enterKey
}

function enterKey(evt) { 
  var evt = (evt) ? evt : event 
  var charCode = (evt.which) ? evt.which : evt.keyCode 
  if (charCode == 13) { 
    checkfields_login() 
  } 
} 

function changeimageo1()
{
document.maplinks.src="images/hp-bottom-links-o1.jpg"
}


function changeimageo2()
{
document.maplinks.src="images/hp-bottom-links-o2.jpg"
}


function changeimagewideo1()
{
document.maplinks.src="images/hp-bottom-links-wide-o1.jpg"
}


function changeimageregister()
{
document.maplinks.src="images/hp-bottom-links-register-o1.jpg"
}

function changeimagesend()
{
document.maplinks.src="images/hp-bottom-links-send-o1.jpg"
}


function revertimage()
{
document.maplinks.src="images/hp-bottom-links.jpg"
}


function revertimagewide()
{
document.maplinks.src="images/hp-bottom-links-wide.jpg"
}


function revertimageregister()
{
document.maplinks.src="images/hp-bottom-links-register.jpg"
}

function revertimagesend()
{
document.maplinks.src="images/hp-bottom-links-send.jpg"
}


function checkfields(){

if (document.registerform.fldname.value==""){
	document.registerform.fldname.focus();
	alert("Please enter your name")
	return;
}

var str=document.registerform.fldemail.value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
var testresults

if (filter.test(str))
testresults=true
else{
document.registerform.fldemail.focus()
alert("Please enter a valid email address")
return;
}

if (document.registerform.fldusername.value==""){
	document.registerform.fldusername.focus();
	alert("Please enter a username")
	return;
}

for ( var i = 0 ; i < document.registerform.fldusername.value.length ; i ++) 
{
	var chrAt = document.registerform.fldusername.value.charAt(i); 
	var string="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 
	if (string.indexOf(chrAt)==-1) 
	{ 
		alert("Sorry, username must not contain any spaces and must be alphanumeric - no symbols are allowed."); 
		document.registerform.fldusername.focus(); 
		return;
	} 
} 


if (document.registerform.fldpassword.value==""){
	document.registerform.fldpassword.focus();
	alert("Please enter a password")
	return;
}

if (document.registerform.fldterms.checked==false){
	alert("You must accept the Like it? Link it! terms and conditions before becoming a registered user. Please tick the checkbox to show you have read and agree to our terms.")
	return;
}


document.registerform.submit()

}


function checkfields_contact(){

if (document.contactform.fldname.value==""){
	document.contactform.fldname.focus();
	alert("Please enter your name")
	return;
}

var str=document.contactform.fldemail.value
var filter=/^(\w+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
var testresults

if (filter.test(str))
testresults=true
else{
document.contactform.fldemail.focus()
alert("Please enter a valid email address")
return;
}

if (document.contactform.fldmessage.value==""){
	document.contactform.fldmessage.focus();
	alert("Please enter your message")
	return;
}

document.contactform.submit()

}

function checkfields_reminder(){

if (document.reminderform.fldusername.value==""){
	document.reminderform.fldusername.focus();
	alert("Please enter your username")
	return;
}

document.reminderform.submit()

}


function checkfields_login(){
if (document.loginform.fldloginusername.value==""){
	document.loginform.fldloginusername.focus();
	alert("Please enter your username to login")
	return;
}
if (document.loginform.fldloginpassword.value==""){
	document.loginform.fldloginpassword.focus();
	alert("Please enter your password to login")
	return;
}
document.loginform.submit();
}
