
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


// checks validity of the form
function checkMandatory()
{
	var errorString="";
	if (window.document.miniquoteRequest.firstname.value == "")
		{
			errorString += "Please enter your first name information.\n";
		}

	// check last name field
	if (window.document.miniquoteRequest.lastname.value == "")
		{
			errorString += "Please enter your last name information.\n";
		}

	// check company field
	if (window.document.miniquoteRequest.company.value == "")
		{
			errorString += "Please enter your Company information.\n";
		}
		
	// check phone field
	if (window.document.miniquoteRequest.phone.value == "")
		{
			errorString += "Please enter your phone number.\n";
		}

	// check email field
	if (window.document.miniquoteRequest.email.value == "")
		{
			errorString += "Please enter your e-mail address.\n";
		}
		else
		{
			if (
				(errorString == "") &&
				(!checkEmail(window.document.miniquoteRequest.email.value))
				)
				{
					alert("Sorry, you e-mail address is invalid!");
					return false;
				}
		}

	if (errorString == "")
		{
			return true;
		}
		else
		{
			errorString = "We found some omissions in your form: \n\n" + errorString;
			alert(errorString);
			return false;
		}
}

function checkEmail(email)
{
	var at = email.indexOf("@");
	var dot = email.indexOf(".");
	var space = email.indexOf(" ");
	if (	(at != -1) && // if there is an '@'
			(at != 0) &&  // and it is not at position 0
			(dot != -1) && // if there is a '.'
			(dot < email.length - 1) && // if there is something after the '.'
		    (space == -1) // if there is no space
		)
		{
			return true;
		}
		else
		{
			return false;
		}
}
// -->