function revertcontactfield(fieldname)
{
	if(fieldname=="where_do_you_go1")
	{
		if(document.frmcontact.where_do_you_go1.value=="")
		{
			document.frmcontact.where_do_you_go1.value="Type here...";
			return false;
		}
	}
	if(fieldname=="where_do_you_go2")
	{
		if(document.frmcontact.where_do_you_go2.value=="")
		{
			document.frmcontact.where_do_you_go2.value="Type here...";
			return false;
		}
	}
	if(fieldname=="where_do_you_go3")
	{
		if(document.frmcontact.where_do_you_go3.value=="")
		{
			document.frmcontact.where_do_you_go3.value="Type here...";
			return false;
		}
	}

	if(fieldname=="holiday_destination1")
	{
		if(document.frmcontact.holiday_destination1.value=="")
		{
			document.frmcontact.holiday_destination1.value="Type here...";
			return false;
		}
	}
	if(fieldname=="holiday_destination2")
	{
		if(document.frmcontact.holiday_destination2.value=="")
		{
			document.frmcontact.holiday_destination2.value="Type here...";
			return false;
		}
	}
	if(fieldname=="holiday_destination3")
	{
		if(document.frmcontact.holiday_destination3.value=="")
		{
			document.frmcontact.holiday_destination3.value="Type here...";
			return false;
		}
	}


	if(fieldname=="title")
	{
		if(document.frmcontact.title.value=="")
		{
			document.frmcontact.title.value="Type here...";
			return false;
		}
	}

		if(fieldname=="fname")
	{
		if(document.frmcontact.fname.value=="")
		{
			document.frmcontact.fname.value="Type here...";
			return false;
		}
	}

		if(fieldname=="lname")
	{
		if(document.frmcontact.lname.value=="")
		{
			document.frmcontact.lname.value="Type here...";
			return false;
		}
	}

		if(fieldname=="postcode")
	{
		if(document.frmcontact.postcode.value=="")
		{
			document.frmcontact.postcode.value="Type here...";
			return false;
		}
	}
		if(fieldname=="email")
	{
		if(document.frmcontact.email.value=="")
		{
			document.frmcontact.email.value="Type here...";
			return false;
		}
	}

	return true;
}

function refreshcontactfield(value,fieldname)
{

	if((fieldname=="where_do_you_go1") && (value=="Type here..."))
	{
		document.frmcontact.where_do_you_go1.value="";
		return false;
	}
	if((fieldname=="where_do_you_go2") && (value=="Type here..."))
	{
		document.frmcontact.where_do_you_go2.value="";
		return false;
	}
	if((fieldname=="where_do_you_go3") && (value=="Type here..."))
	{
		document.frmcontact.where_do_you_go3.value="";
		return false;
	}

	if((fieldname=="holiday_destination1") && (value=="Type here..."))
	{
		document.frmcontact.holiday_destination1.value="";
		return false;
	}
	if((fieldname=="holiday_destination2") && (value=="Type here..."))
	{
		document.frmcontact.holiday_destination2.value="";
		return false;
	}
	if((fieldname=="holiday_destination3") && (value=="Type here..."))
	{
		document.frmcontact.holiday_destination3.value="";
		return false;
	}


	if((fieldname=="title") && (value=="Type here..."))
	{
		document.frmcontact.title.value="";
		return false;
	}

		if((fieldname=="fname") && (value=="Type here..."))
	{
		document.frmcontact.fname.value="";
		return false;
	}

		if((fieldname=="lname") && (value=="Type here..."))
	{
		document.frmcontact.lname.value="";
		return false;
	}
		if((fieldname=="postcode") && (value=="Type here..."))
	{
		document.frmcontact.postcode.value="";
		return false;
	}

		if((fieldname=="email") && (value=="Type here..."))
	{
		document.frmcontact.email.value="";
		return false;
	}
			if((fieldname=="postcode") && (value=="Type here..."))
	{
		document.frmcontact.postcode.value="";
		return false;
	}
	
				if((fieldname=="postcode1") && (value=="Type here..."))
	{
		document.frmcontact.postcode1.value="";
		return false;
	}


	return true;

}
function isEmailAddr(email)
{
	var result = false
  	var theStr = new String(email)
  	var index = theStr.indexOf("@");
 	if (index > 0)
  	{
    	var pindex = theStr.indexOf(".",index);
    	if ((pindex > index+1) && (theStr.length > pindex+1))
		result = true;
 	}
  return result;
}

function validatelayer1()
{

	where_do_you_go1=document.getElementById("where_do_you_go1").value;
	where_do_you_go2=document.getElementById("where_do_you_go2").value;
	where_do_you_go3=document.getElementById("where_do_you_go3").value;
	how_often1=document.getElementById("how_often1").value;
	how_often2=document.getElementById("how_often2").value;
	how_often3=document.getElementById("how_often3").value;
	prepared_to_pay1=document.getElementById("prepared_to_pay1").value;
	prepared_to_pay2=document.getElementById("prepared_to_pay2").value;
	prepared_to_pay3=document.getElementById("prepared_to_pay3").value;

	if ($('currently_fly_for_business').checked == false){
		$('currently_use_airport').options[0].text = 'N/A';
		$('currently_prefer_airport').options[0].text = 'N/A';
	}
	else {
		$('currently_use_airport').options[0].text = 'Please select';
		$('currently_prefer_airport').options[0].text = 'Please select';
	}

	if($('currently_fly_for_business').checked &&
	((where_do_you_go1=="" || where_do_you_go1=="Type here...") || how_often1=="Please select" || (prepared_to_pay1=="" || isNaN(prepared_to_pay1))) && ((where_do_you_go2=="" || where_do_you_go2=="Type here...") || how_often2=="Please select" || (prepared_to_pay2=="" || isNaN(prepared_to_pay2))) && ((where_do_you_go3=="" || where_do_you_go3=="Type here...") || how_often3=="Please select" || (prepared_to_pay3=="" || isNaN(prepared_to_pay3))))
	{

				document.getElementById("where_do_you_go").className="error_textfield_bg";
				document.getElementById("how_often").className="error_textfield_bg";
				document.getElementById("prepared_to_pay").className="error_textfield_bg";
				if(how_often1=="Please select")
					box1="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please select an option.";
				else if(isNaN(prepared_to_pay1))
					box1="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please enter a valid price.";
				else
					box1="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please write your answer(s) before proceeding.";
				document.getElementById("error1div").innerHTML=box1;

	}
	else
	{
		document.getElementById("where_do_you_go").className="textfield_bg";
		document.getElementById("how_often").className="textfield_bg";
		document.getElementById("prepared_to_pay").className="textfield_bg";
		box1="";
		document.getElementById("error1div").innerHTML=box1;

	}
	if( box1=="")
	{
		//MM_showHideLayers('Layer1','','hide');
		//MM_showHideLayers('Layer2','','show');
		slideShow(2, 'continue');

		return false;
	}
	else
	{
		return false;
	}
}

function validatelayer2()
{

	currently_use_airport=document.getElementById("currently_use_airport").value;
	currently_prefer_airport=document.getElementById("currently_prefer_airport").value;

	holiday_destination1=document.getElementById("holiday_destination1").value;
	holiday_destination2=document.getElementById("holiday_destination2").value;
	holiday_destination3=document.getElementById("holiday_destination3").value;
	holiday_price1=document.getElementById("holiday_price1").value;
	holiday_price2=document.getElementById("holiday_price2").value;
	holiday_price3=document.getElementById("holiday_price3").value;

	if(
		$('currently_fly_for_business').checked &&
		(currently_use_airport=="Please select" || currently_prefer_airport=="Please select") || (((holiday_destination1=="" || holiday_destination1=="Type here...") || (holiday_price1=="" || isNaN(holiday_price1))) || ((holiday_destination2=="" || holiday_destination2=="Type here...") || (holiday_price2=="" || isNaN(holiday_price2))) || ((holiday_destination3=="" || holiday_destination3=="Type here...") || (holiday_price3=="" || isNaN(holiday_price3)))))
	{

				if($('currently_fly_for_business').checked && currently_use_airport=="Please select")
				{
				document.getElementById("div_currently_use_airport").className="step2_error_textfield_bg";
				box2="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please select an option.";
				document.getElementById("error_currently_use_airport").innerHTML=box2;
				}
				else
				{
					document.getElementById("div_currently_use_airport").className="step2_textfield_bg";
					box2="";
					document.getElementById("error_currently_use_airport").innerHTML=box2;
				}
				if($('currently_fly_for_business').checked && currently_prefer_airport=="Please select")
				{
				document.getElementById("div_currently_prefer_airport").className="step2_error_textfield_bg";
				box3="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please select an option.";
				document.getElementById("error_currently_prefer_airport").innerHTML=box3;
				}
				else
				{
					document.getElementById("div_currently_prefer_airport").className="step2_textfield_bg";
					box3="";
					document.getElementById("error_currently_prefer_airport").innerHTML=box3;
				}

				if(holiday_destination1=="" || holiday_destination1=="Type here..." || holiday_price1=="")
				{
					document.getElementById("holiday_destination").className="error_textfield_bg";
					document.getElementById("holiday_price").className="error_textfield_bg";
					box4="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please write your answer(s) before proceeding.";
				}
				else if(isNaN(holiday_price1))
					box4="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please enter a valid price.";
				else
				{
					document.getElementById("holiday_destination").className="textfield_bg";
					document.getElementById("holiday_price").className="textfield_bg";
					box4="";
				}

				document.getElementById("error2div").innerHTML=box4;

	}
	else
	{
		document.getElementById("div_currently_use_airport").className="step2_textfield_bg";
		box2="";
		document.getElementById("error_currently_use_airport").innerHTML=box2;
		document.getElementById("div_currently_prefer_airport").className="step2_textfield_bg";
		box3="";
		document.getElementById("error_currently_prefer_airport").innerHTML=box3;

		document.getElementById("holiday_destination").className="textfield_bg";
		document.getElementById("holiday_price").className="textfield_bg";
		box4="";
		document.getElementById("error2div").innerHTML=box4;

	}
	if( box2=="" && box3=="" && box4=="")
	{
		slideShow(3);
		return true;
	}
	else
	{
		return false;
	}
}
function validatelayer3()
{

currently_leisure_travel=document.getElementById("currently_leisure_travel").value;
if(currently_leisure_travel=="Please select"){

document.getElementById("div_currently_leisure_travel").className="step2_error_textfield_bg";
box5="<img src='norwich-airport-images/error_star.gif' alt='Please write your answer(s) before proceeding.' /> &nbsp;Please select an option.";
document.getElementById("error_currently_leisure_travel").innerHTML=box5;
}
else
{
	document.getElementById("div_currently_leisure_travel").className="step2_textfield_bg";
	box5="";
	document.getElementById("error_currently_leisure_travel").innerHTML=box5;
}
if( box5=="")
	{
		if(document.getElementById("like_to_receive_offers").checked)
		{
			slideShow(4);
		}
		else
		{
			slideShow(5);
		}
		return true;
	}
	else
	{
		return false;
	}
}

function validatelayer4()
{

title_select=document.getElementById("title_select").value;
title=document.getElementById("title").value;
fname=document.getElementById("fname").value;
lname=document.getElementById("lname").value;
email=document.getElementById("email").value;
if(title_select=="Other")
{
	document.getElementById("title_select").style.display='block';
}
if(title_select=="Other" && (title=="" || title=="Type here..."))
{
document.getElementById("titlemenu").className="title_error_textfield_bg";
document.getElementById("titleother").className="title_error_textfield_bg";
box6="<img src='norwich-airport-images/error_star.gif' alt='Please choose your title.' /> &nbsp;Please choose your title.";
document.getElementById("divtitle").innerHTML=box6;
}
else
{
document.getElementById("titlemenu").className="title_menulist_bg";
document.getElementById("titleother").className="title_textfield_bg";
box6="";
document.getElementById("errortitle").innerHTML=box6;
}
if(fname=="" || fname=="Type here...")
{
document.getElementById("div_fname").className="error_textfield_bg";
box7="<img src='norwich-airport-images/error_star.gif' alt='Please enter your first name.' /> &nbsp;Please enter your first name.";
document.getElementById("errorfname").innerHTML=box7;
}
else
{
document.getElementById("div_fname").className="textfield_bg";
box7="";
document.getElementById("errorfname").innerHTML=box7;
}

if(lname=="" || lname=="Type here...")
{
document.getElementById("div_lname").className="error_textfield_bg";
box8="<img src='norwich-airport-images/error_star.gif' alt='Please enter your last name.' /> &nbsp;Please enter your last name.";
document.getElementById("errorlname").innerHTML=box8;
}
else
{
document.getElementById("div_lname").className="textfield_bg";
box8="";
document.getElementById("errorlname").innerHTML=box8;
}

if(email=="" || email=="Type here...")
{
document.getElementById("div_email").className="error_textfield_bg";
box9="<img src='norwich-airport-images/error_star.gif' alt='Please enter your email address.' /> &nbsp;Please enter your email address.";
document.getElementById("erroremail").innerHTML=box9;
}
else if(!isEmailAddr(email)&& email!="")
{
document.getElementById("div_email").className="error_textfield_bg";
box9="<img src='norwich-airport-images/error_star.gif' alt='Email must be in a valid format e.g. name@domain.com' /> &nbsp;Email must be in a valid format e.g. name@domain.com.";
document.getElementById("erroremail").innerHTML=box9;
}
else
{
document.getElementById("div_email").className="textfield_bg";
box9="";
document.getElementById("erroremail").innerHTML=box9;
}


if( box6=="" && box7=="" && box8=="" && box9=="")
	{
		document.frmcontact.submit();
		return true;
	}
	else
	{
		return false;
	}
}
function validatelayer5()
{
	document.frmcontact.submit();
}