function navOver(imgTag) {
    var theImage = imgTag;
    if (theImage.src.indexOf("_off.") != -1) {
        theImage.src = theImage.src.replace("_off.", "_on.");
    }
    else {
        theImage.src = theImage.src.replace("_on.", "_off.");
    }
}

function validateForm(theForm)
{	
	valid = true;
	message = "Please complete the following fields before proceeding:\n\n";
	
	if(theForm.elements["firstname"].value == "")
	{
		message += "Your first name\n";
		valid = false;
	}

	if(theForm.elements["surname"].value == "")
	{
		message += "Your surname\n";
		valid = false
	}


	if(theForm.elements["email"].value == "")
	{
		message += "Your email address\n";
		valid = false
	}	
		
	if(theForm.elements["email"].value != "")	
	{	
		var supEmail = theForm.elements["email"].value;
		var emLen = supEmail.length;
		var posAt = supEmail.indexOf('@')
		var posDot = supEmail.lastIndexOf('.')
		if((emLen < 7) || (posAt < 1) || (posDot <= (posAt + 1)) || (posDot >= (emLen - 1)))
		{
			message += "Valid email address\n";
			valid = false;
		}
	}	
	
	if(theForm.elements["address"].value == "")
	{
		message += "Your address\n";
		valid = false
	}
	
	if(valid)
	{			
		return true;
	}
	else
	{		
		alert(message);
		return false;
	}		
}

function changeBorder(theElement)
{		
	theElement.style.backgroundColor = "#f4fffe";											
}
function resetBorder(theElement)
{		
	theElement.style.backgroundColor = "#ffffff";									
}
