<!--
function change(id, newClass) {
	//alert(id);
	//alert(newClass);
	identity=document.getElementById(id);
	identity.className=newClass;
}

//Layer display functions
var origWidth, origHeight;
if (document.layers) {
	origWidth = window.innerWidth; origHeight = window.innerHeight;
	window.onresize = function() { if (window.innerWidth != origWidth || window.innerHeight != origHeight) history.go(0); }
}

var cur_lyr;	
function swapLayers(id) {
  if (cur_lyr) hideLayer(cur_lyr);
  showLayer(id);
  cur_lyr = id;
}

function showLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "block";
}

function hideLayer(id) {
  var lyr = getElemRefs(id);
  if (lyr && lyr.css) lyr.css.display = "none";
}

function getElemRefs(id) {
	var el = (document.getElementById)? document.getElementById(id): (document.all)? document.all[id]: (document.layers)? document.layers[id]: null;
	if (el) el.css = (el.style)? el.style: el;
	return el;
}
//End Layer Display Function

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function NewWindow(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=200,left=200,scrollbars=no')
}

function EditUserWindow(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=100,left=150,scrollbars=yes')
}

function ViewDisplayWindow(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=50,left=50,scrollbars=yes')
}

function ViewDisplayWindow2(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=50,left=50,scrollbars=yes,resizable=yes')
}

function redirect(item, country)
{
	var Country = item.value;
	var Name = document.Search.Name.value;
	document.location.href="../index.asp?Name="+Name+"&Country="+Country
}

function redirectHD(item, hdcountry)
{
	var hdCountry = item.value;
	document.location.href="index.asp?hdCountry="+hdCountry
}

function redirectCity(item, country)
{
	var City = item.value;
	var Name = document.Search.Name.value;
	document.location.href="../index.asp?Name="+Name+"&Country="+ country +"&City="+City
}

function ASredirect(item, country)
{
	var Country = item.value;
	document.location.href="Advanced_Search.asp?Country="+Country
}

function ASredirectCity(item, country)
{
	var City = item.value;
	document.location.href="Advanced_Search.asp?Country="+ country +"&City="+City
}

function Validate_Register(item)
{
  if (item.Name.value == '')
  {
    var name_flag = "0"
    var name_value = " \nName"
  }
  else
  {
    var name_value = ""
  }

  if (item.Email.value == '')
  {
    var email_flag = "0"
    var email_value = " \nEmail"
  }
  else
  {
    var email_value = ""
  }

  if (name_flag == '0' || email_flag =='0')
  {
    alert("You must enter:\n"+name_value+email_value);
    return false;
  }
}

function confirm_delete(Record_ID, Item)
{
  var con_delete = confirm("Are you sure you want to delete this "+Item+"?");

  if (con_delete== true)
  {
     window.location="Delete_Advert.asp?Item_Type="+Item+"&Advert_ID="+Record_ID;
  }
  else
  {
  }

}


function confirm_delete2(ID, Item)
{
  var con_delete = confirm("Are you sure you want to delete this "+Item+"?");
  var bobo = "Delete.asp?Items="+Item+"&ID="+ID;

  if (con_delete== true)
  {
     ViewDisplayWindow(bobo, 100, 100);
  }
  else
  {
  }

}

function confirm_Club_Type_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this club type?");

  if (con_delete== true)
  {
     window.location="Delete_Club_Type.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_Pub_Facility_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this pub facility?");

  if (con_delete== true)
  {
     window.location="Delete_Pub_Facility.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_Attraction_Type_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this type of attraction?");

  if (con_delete== true)
  {
     window.location="Delete_Attraction_Type.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_Restaurant_Entertainment_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this entertainment?");

  if (con_delete== true)
  {
     window.location="Delete_Restaurant_Entertainment.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_Restaurant_Cuisine_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this cuisine?");

  if (con_delete== true)
  {
     window.location="Delete_Restaurant_Cuisine.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_city_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this City?");

  if (con_delete== true)
  {
     window.location="Delete_City.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_Hotel_Facility_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this hotel facility?");

  if (con_delete== true)
  {
     window.location="Delete_Hotel_Facility.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}
function confirm_county_delete(Record_ID)
{
  var con_delete = confirm("Are you sure you want to delete this County?");

  if (con_delete== true)
  {
     window.location="Delete_County.asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_article_delete(Record_ID, Item)
{
  var con_delete = confirm("Are you sure you want to delete this "+Item+"?");

  if (con_delete== true)
  {
     window.location="Delete_Article.asp?ArticleID="+Record_ID;
  }
  else
  {
  }
}

function confirm_delete_Links(Record_ID, Item)
{
  var con_delete = confirm("Are you sure you want to delete this "+Item+"?");

  if (con_delete== true)
  {
     window.location="Delete_"+Item+".asp?Advert_ID="+Record_ID;
  }
  else
  {
  }

}

function confirm_delete_Advert_types(ID)
{
  var con_delete = confirm("Are you sure you want to delete this Advert type?");

  if (con_delete== true)
  {
     window.location="Delete_Advert_types.asp?ID="+ID;
  }
  else
  {
  }

}

function Close_Refresh()
{
  window.opener.location.reload();
  window.close();
}

function enforcechar(what,limit)
{
  if (what.value.length>=limit)
  {
    return false
  }
}

function validate(Item)
{
  if (Item.name.value == '')
  {
    var name_flag = "0"
    var name_value = " \nName"
  }
  else
  {
    var name_value = ""
  }

  if (Item.url.value == '')
  {
    var url_flag = "0"
    var url_value = " \nURL"
  }
  else
  {
    var url_value = ""
  }

  if (Item.category.value == '0')
  {
    var category_flag = "0"
    var category_value = " \nCategory"
  }
  else
  {
    var category_value = ""
  }

  if (name_flag == '0' || url_flag =='0' || category_flag =='0')
  {
    alert("You must enter:\n"+name_value+url_value+category_value);
    return false;
  }
}

function validateSearchBar(Item)
{
  if (Item.Name.value == '')
  {
    var name_flag = "0"
  }

  if (Item.Country.value == '0')
  {
    var country_flag = "0"
  }
  
  if (name_flag == '0' && country_flag =='0')
  {
    alert("You must Enter a Name or Select a Country.");
    return false;
  }
}

function validate2()
{
  if (window.document.edit_user.username.value == '')
  {
    var username_flag = "0"
    var username_value = " \nUsername"
  }
  else
  {
    var username_value = ""
  }

  if (window.document.edit_user.password.value == '')
  {
    var password_flag = "0"
    var password_value = " \nPassword"
  }
  else
  {
    var password_value = ""
  }

  if (username_flag == '0' || password_flag =='0')
  {
    alert("You must enter:\n"+username_value+password_value);
    return false;
  }
}

function validateRenewal(Item)
{
  var Date_Started_value = ""
  if (Item.Date_Started.value == '')
  {
    var Date_Started_flag = "0"
    var Date_Started_value = " \nDate Started"
  }
  
  var Renewal_value = ""
  if (Item.Renewal_Date.value == '')
  {
    var Renewal_flag = "0"
    var Renewal_value = " \nRenewal Date"
  }
  
  var Recieved_value = ""
  if (Item.Date_Payment_Recieved.value == '')
  {
    var Recieved_flag = "0"
	var Recieved_value = " \nDate Payment Recieved"
  }

  if (Date_Started_flag == '0' || Renewal_flag =='0' || Recieved_flag == '0')
  {
    alert("You must enter:\n"+Date_Started_value+Renewal_value+Recieved_value);
    return false;
  }

}

function checkForQuotesAndLength(what,limit) {
		if (limit != "") {
			if (what.value.length>=limit) {
					return false;
				}
		} 
		// A single quote ' = 34 A double quote " = 39
		if ((event.keyCode == 34) || (event.keyCode == 39)) {
			return false;
		}
		//alert(event.keyCode)
}




 function verif_email(email) {
	var arobase = email.indexOf("@");
	var point = email.lastIndexOf(".");
	if((arobase < 3)||(point + 2 > email.lengtd)||(point < arobase+3)) return false;
	return true;
	}
	

function validateGuide(Item_Type)
{
	var Advert_name_value = ""
	var city_value = ""
	var county_value = ""
	var postcode_value = ""
	var country_value = ""
	var ptype_value = ""
	var email_value = ""
	
	if (document.add_details.fCompany_Name.value == '')
				{
					 Advert_name_value = " \nEnter a Name"
				}	
	
	if (!verif_email(document.add_details.fEmail.value))
				{
					 email_value = " \nEnter a correct Email"
				}
				
	if (document.add_details.fCity.value == '')
				{
					 city_value = " \nEnter a City"
				}

	if (document.add_details.fCounty.value == '')
				{
					 county_value = " \nEnter a County/Province/State"
				}
				
	if (document.add_details.fPostcode.value == '')
				{
					 postcode_value = " \nEnter a Postcode"
				}
				
	if (document.add_details.fCountry.value == '')
				{
					 country_value = " \nEnter a Country"
				}

	/*if (isNaN(document.add_details.fSize_of_Company.value) == true)
		{document.add_details.fSize_of_Company.value = 0;}
	if (isNaN(document.add_details.fYear_Established.value) == true)
		{document.add_details.fYear_Established.value = 0;}
	if (isNaN(document.add_details.fPrice.value) == true)
		{document.add_details.fPrice.value = 0;}
	*/
	if (Advert_name_value != "" || city_value != "" || county_value != "" || postcode_value != "" || country_value != "" || email_value != "" )//|| ptype_value != "")
			{
				alert("You must:\n"+Advert_name_value + city_value + county_value + postcode_value + country_value + email_value)//+ ptype_value);
				return false;
			}
			
}

function Deplacer1(l1,l2, hidden) {
	if (l1.options.selectedIndex >= 0) {
		hidden.value = hidden.value + l1.options[l1.options.selectedIndex].value + ",";
		l2.options[l2.options.length]=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);
		l1.options[l1.options.selectedIndex]=null;
	}else{
		alert("No entry is select");
	}
}


function Deplacer2(l1,l2, hidden) {
	if (l1.options.selectedIndex >= 0) {
		var Resultat = l1.options[l1.options.selectedIndex].value + ',' ;
		hidden.value = hidden.value.replace(Resultat, "");	
		l2.options[l2.options.length]=new Option(l1.options[l1.options.selectedIndex].text,l1.options[l1.options.selectedIndex].value);
		l1.options[l1.options.selectedIndex]=null;
	}else{
		alert("No entry is select");
	}
}
	
function enableOther(Item_Type) {
	switch (Item_Type) {
			case "Property Type": 		
					//alert("Property Type")
					if (document.add_details.fProperty_Type.options[document.add_details.fProperty_Type.options.selectedIndex].value == "0") {
						document.add_details.fProperty_Type_Other.disabled=false;
					} else {
						document.add_details.fProperty_Type_Other.value = "";						
						document.add_details.fProperty_Type_Other.disabled=true;
					}
					break
					
			case "Agent Type": 		
					//alert("Agent Type")			
					if (document.add_details.fAgent_Type.options[document.add_details.fAgent_Type.options.selectedIndex].value == "0") {
						document.add_details.fAgent_Type_Other.disabled=false;
					}	else {
						document.add_details.fAgent_Type_Other.value = "";						
						document.add_details.fAgent_Type_Other.disabled=true;
					}
					break
					
			case "Estate Agent": 		
					//alert("Estate Agent")			
					if (document.add_details.fEstate_Agent.options[document.add_details.fEstate_Agent.options.selectedIndex].value == "0") {
						document.add_details.fContact_Name.disabled=false;
						document.add_details.fContact_Address.disabled=false;
						document.add_details.fContact_Phone.disabled=false;
						document.add_details.fContact_Fax.disabled=false;
						document.add_details.fContact_Email.disabled=false;				
					}	else {
						document.add_details.fContact_Name.value = "";						
						document.add_details.fContact_Name.disabled=true;
						document.add_details.fContact_Address.value = "";						
						document.add_details.fContact_Address.disabled=true;
						document.add_details.fContact_Phone.value = "";						
						document.add_details.fContact_Phone.disabled=true;
						document.add_details.fContact_Fax.value = "";						
						document.add_details.fContact_Fax.disabled=true;
						document.add_details.fContact_Email.value = "";						
						document.add_details.fContact_Email.disabled=true;				
					}
					break
					
	}
}


function PopupCentrer(page) {
  var top=(screen.height-150)/2;
  var left=(screen.width-400)/2;
  window.open(page,"","top="+top+",left="+left+",width="+420+",height="+165+","+"menubar=no,scrollbars=no,statusbar=no");
}

function loadPage() {
if (document.getElementById) {  // DOM3 = IE5, NS6
//document.getElementById('layout').style.visibility = 'visible';
//document.getElementById('prepage').style.visibility = 'hidden';
//document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
	if (document.layers) {  // Netscape 4
	//document.layout.visibility = 'visible';
	//document.prepage.visibility = 'hidden';	
	//document.hidepage.visibility = 'hidden';
	}
	else {  // IE 4
	//document.all.layout.style.visibility = 'visible';
	//document.all.prepage.style.visibility = 'hidden';
	//document.all.hidepage.style.visibility = 'hidden';
	}
   }
	//document.getElementById('loadBanner').style.visibility = 'visible';
}

function getLocation(Item) {
	if (Item.options[Item.options.selectedIndex].value != "0") {
		location.href = "Displays/Display_" + Item.options[Item.options.selectedIndex].value + ".asp";
	}
}

function getLocation2(Item) {
	if (Item.options[Item.options.selectedIndex].value != "0") {
		location.href = "../Displays/Display_" + Item.options[Item.options.selectedIndex].value + ".asp";
	}
}
function change(id, newClass) {
	//alert(id);
	identity=document.getElementById(id);
	identity.className=newClass;
}

function selectApplicantForm(Item) {
	if (Item.value == "yes") {
		change("a1", "form-table appear");
		change("a2", "form-table appear");
	} else {
		change("a1", "form-table appear");
		change("a2", "form-table disappear");
	}
}

function help_dialog() {
	var txt = "";
		
	// check section 1
	//if (document.add_details.fS1_Q1.disabled == false) {
		if (((document.add_details.fS1_Q1[0].value != "") || (document.add_details.fS1_Q1[1].value != "")) && (document.add_details.fS1_Q2.options[document.add_details.fS1_Q2.selectedIndex].value != 0)){
			section_complete = 1;
			//txt = "";
		} else {
			txt = "<strong>Section 1: Application Type</strong><br><br>";
			if ((document.add_details.fS1_Q1[0].value != "") || (document.add_details.fS1_Q1[1].value != "")) {
				
			} else {
				txt = txt +	"Select whether this is a joint application or single.<br><br>";
			}
			if (document.add_details.fS1_Q2.options[document.add_details.fS1_Q2.selectedIndex].value == 0) {
				txt = txt + "Select the mortgage type you are interested in.<br><br>"
			}
		}
	//}
	
	// check section 2
	if (document.add_details.fS2_Q1.disabled == false) {
		if ((document.add_details.fS2_Q1.options[document.add_details.fS2_Q1.selectedIndex].value != 0) && (document.add_details.fS2_Q2.value != "") && (document.add_details.fS2_Q3.value != "") && (document.add_details.fS2_Q4_DD.options[document.add_details.fS2_Q4_DD.selectedIndex].value != 0) && (document.add_details.fS2_Q4_MM.options[document.add_details.fS2_Q4_MM.selectedIndex].value != 0) && (document.add_details.fS2_Q4_YYYY.options[document.add_details.fS2_Q4_YYYY.selectedIndex].value != 0) && (document.add_details.fS2_Q5.options[document.add_details.fS2_Q5.selectedIndex].value != 0) && (document.add_details.fS2_Q6.options[document.add_details.fS2_Q6.selectedIndex].value != 0)) {
			section_complete = 2;
			//txt = ""
		} else {
			txt = txt + "<strong>Section 2: 1st Applicant - Personal Details</strong><br><br>";
			if (document.add_details.fS2_Q1.options[document.add_details.fS2_Q1.selectedIndex].value == 0) {
				txt = txt + "Select title<br><br>";
			}
			if (document.add_details.fS2_Q2.value == "") {
				txt = txt + "Enter forename<br><br>";
			}
			if (document.add_details.fS2_Q3.value == "") {
				txt = txt + "Enter surname<br><br>";
			}
			if ((document.add_details.fS2_Q4_DD.options[document.add_details.fS2_Q4_DD.selectedIndex].value == 0) || (document.add_details.fS2_Q4_MM.options[document.add_details.fS2_Q4_MM.selectedIndex].value == 0) || (document.add_details.fS2_Q4_YYYY.options[document.add_details.fS2_Q4_YYYY.selectedIndex].value == 0)) {
				txt = txt + "Select date of birth<br><br>";
			}
			if (document.add_details.fS2_Q5.options[document.add_details.fS2_Q5.selectedIndex].value == 0) {
				txt = txt + "Select marital status<br><br>";
			}
			if (document.add_details.fS2_Q6.options[document.add_details.fS2_Q6.selectedIndex].value == 0) {
				txt = txt + "Select your housing status<br><br>";
			}
		}
	}
	
	// check section 3
	var date = new Date();
	if (document.add_details.fS3_Q1.disabled == false) {
		if (document.add_details.fS3_Q9_YYYY.options[document.add_details.fS3_Q9_YYYY.selectedIndex].value > date.getFullYear()-3) {
			if ((document.add_details.fS3_Q1.value != "") && (document.add_details.fS3_Q2.value != "") && (document.add_details.fS3_Q3.value != "") && (document.add_details.fS3_Q5.value != "") && (document.add_details.fS3_Q6.value != "") && (document.add_details.fS3_Q7.value != "") && (document.add_details.fS3_Q8.value != "") && (document.add_details.fS3_Q9_DD.options[document.add_details.fS3_Q9_DD.selectedIndex].value != 0) && (document.add_details.fS3_Q9_MM.options[document.add_details.fS3_Q9_MM.selectedIndex].value != 0) && (document.add_details.fS3_Q9_YYYY.options[document.add_details.fS3_Q9_YYYY.selectedIndex].value != 0) && (document.add_details.fS3_Q10.value != "") && (document.add_details.fS3_Q12.value != "") && (document.add_details.fS3_Q13.value != "") && (document.add_details.fS3_Q14.value != "") && (document.add_details.fS3_Q15.value != "")) {
				section_complete = 3;
				//txt = "";
			} else {
				txt = txt + "<strong>Section 3: 1st Applicant - Contact Details / Addresses</strong><br><br>";
				if (document.add_details.fS3_Q1.value == "") {
					txt = txt + "Enter telephone number<br><br>";
				}
				if (document.add_details.fS3_Q2.value == "") {
					txt = txt + "Enter email address<br><br>";
				}
				if (document.add_details.fS3_Q3.value == "") {
					txt = txt + "Enter address line 1 of your current address<br><br>";
				}
				if (document.add_details.fS3_Q5.value == "") {
					txt = txt + "Enter postal city of your current address<br><br>";
				}
				if (document.add_details.fS3_Q6.value == "") {
					txt = txt + "Enter county of your current address<br><br>";
				}
				if (document.add_details.fS3_Q7.value == "") {
					txt = txt + "Enter postcode of your current address<br><br>";
				}
				if (document.add_details.fS3_Q8.value == "") {
					txt = txt + "Enter country of your current address<br><br>";
				}
				if ((document.add_details.fS3_Q9_DD.options[document.add_details.fS3_Q9_DD.selectedIndex].value == 0) || (document.add_details.fS3_Q9_MM.options[document.add_details.fS3_Q9_MM.selectedIndex].value == 0) || (document.add_details.fS3_Q9_YYYY.options[document.add_details.fS3_Q9_YYYY.selectedIndex].value == 0)) {
					txt = txt + "Select the date you moved<br><br>";
				}
				if (document.add_details.fS3_Q10.value == "") {
					txt = txt + "Enter address line 1 of your previous address<br><br>";
				}
				if (document.add_details.fS3_Q12.value == "") {
					txt = txt + "Enter postal city of your previous address<br><br>";
				}
				if (document.add_details.fS3_Q13.value == "") {
					txt = txt + "Enter county of your previous address<br><br>";
				}
				if (document.add_details.fS3_Q14.value == "") {
					txt = txt + "Enter postcode of your previous address<br><br>";
				}
				if (document.add_details.fS3_Q15.value == "") {
					txt = txt + "Enter country of your previous address<br><br>";
				}
			}
		} else {
			if ((document.add_details.fS3_Q1.value != "") && (document.add_details.fS3_Q2.value != "") && (document.add_details.fS3_Q3.value != "") && (document.add_details.fS3_Q5.value != "") && (document.add_details.fS3_Q6.value != "") && (document.add_details.fS3_Q7.value != "") && (document.add_details.fS3_Q8.value!= "") && (document.add_details.fS3_Q9_DD.options[document.add_details.fS3_Q9_DD.selectedIndex].value != 0) && (document.add_details.fS3_Q9_MM.options[document.add_details.fS3_Q9_MM.selectedIndex].value != 0) && (document.add_details.fS3_Q9_YYYY.options[document.add_details.fS3_Q9_YYYY.selectedIndex].value != 0) ) {
				section_complete = 3;
				//txt = "";
			} else {
				txt = txt + "<strong>Section 3: 1st Applicant - Contact Details / Addresses</strong><br><br>";
				if (document.add_details.fS3_Q1.value == "") {
					txt = txt + "Enter telephone number<br><br>";
				}
				if (document.add_details.fS3_Q2.value == "") {
					txt = txt + "Enter email address<br><br>";
				}
				if (document.add_details.fS3_Q3.value == "") {
					txt = txt + "Enter address line 1 of your current address<br><br>";
				}
				if (document.add_details.fS3_Q5.value == "") {
					txt = txt + "Enter postal city of your current address<br><br>";
				}
				if (document.add_details.fS3_Q6.value == "") {
					txt = txt + "Enter county of your current address<br><br>";
				}
				if (document.add_details.fS3_Q7.value == "") {
					txt = txt + "Enter postcode of your current address<br><br>";
				}
				if (document.add_details.fS3_Q8.value == "") {
					txt = txt + "Enter country of your current address<br><br>";
				}
				if ((document.add_details.fS3_Q9_DD.options[document.add_details.fS3_Q9_DD.selectedIndex].value == 0) || (document.add_details.fS3_Q9_MM.options[document.add_details.fS3_Q9_MM.selectedIndex].value == 0) || (document.add_details.fS3_Q9_YYYY.options[document.add_details.fS3_Q9_YYYY.selectedIndex].value == 0)) {
					txt = txt + "Select the date you moved<br><br>";
				}
			}
		}
	}
	
	// check section 4
	if (document.add_details.fS4_Q1.disabled == false) {
		if (document.add_details.fS4_Q1.options[document.add_details.fS4_Q1.selectedIndex].value == 3) {
			section_complete = 4;
		} else {
			if ((document.add_details.fS4_Q1.options[document.add_details.fS4_Q1.selectedIndex].value != 0) && (document.add_details.fS4_Q2.value != "") && (document.add_details.fS4_Q3_DD.options[document.add_details.fS4_Q3_DD.selectedIndex].value != 0) && (document.add_details.fS4_Q3_MM.options[document.add_details.fS4_Q3_MM.selectedIndex].value != 0) && (document.add_details.fS4_Q3_YYYY.options[document.add_details.fS4_Q3_YYYY.selectedIndex].value != 0)) {
				section_complete = 4;
				//txt = ""
			} else {
				txt = txt + "<strong>Section 4: 1st Applicant - Employment Details</strong><br><br>"
				if (document.add_details.fS4_Q1.options[document.add_details.fS4_Q1.selectedIndex].value == 0) {
					txt = txt + "Select employment status<br><br>";
				}
				if (document.add_details.fS4_Q2.value == "") {
					txt = txt + "Enter job title<br><br>";
				}
				if ((document.add_details.fS4_Q3_DD.options[document.add_details.fS4_Q3_DD.selectedIndex].value == 0) || (document.add_details.fS4_Q3_MM.options[document.add_details.fS4_Q3_MM.selectedIndex].value == 0) || (document.add_details.fS4_Q3_YYYY.options[document.add_details.fS4_Q3_YYYY.selectedIndex].value == 0)) {
					txt = txt + "Select start date of current employment<br><br>";
				}
			}
		}
	}
	
	//check section 5
	if (document.add_details.fS5_Q1.disabled == false) {
		if (document.add_details.fS5_Q1.value != "") {
			section_complete = 5;
			//txt = "";
		} else {
			txt = txt + "<strong>Section 5: 1st Applicant - Income Details</strong><br><br>";
			if (document.add_details.fS5_Q1.value == "") {
				txt = txt + "Enter gross basic salary (£)<br><br>";
			}
		}
	}
	
	//check section 6
	if (document.add_details.fS6_Q1.disabled == false) {
		if ((document.add_details.fS6_Q1.value != "") && (document.add_details.fS6_Q2.value == "")) {
			txt = txt + "<strong>Section 6: 1st Applicant - Credit Cards and Loans etc.</strong><br><br>";
			txt = txt + "Enter outstanding balance<br><br>";
		} else {
			if (section_complete == 5) {
				section_complete = 7;
			}
			//txt = "";
		}
	}
	
	//check section 7
	//if (document.add_details.fS7_Q1.disabled == false) {
	//	if (section_complete == 6) {
	//			section_complete = 7;
	//	}
	//}
	
	// check section 8
	if (document.add_details.fS1_Q1[0].checked == true) {
		
		if (document.add_details.fS8_Q1.disabled == false) {
			if ((document.add_details.fS8_Q1.options[document.add_details.fS8_Q1.selectedIndex].value != 0) && (document.add_details.fS8_Q2.value != "") && (document.add_details.fS8_Q3.value != "") && (document.add_details.fS8_Q4_DD.options[document.add_details.fS8_Q4_DD.selectedIndex].value != 0) && (document.add_details.fS8_Q4_MM.options[document.add_details.fS8_Q4_MM.selectedIndex].value != 0) && (document.add_details.fS8_Q4_YYYY.options[document.add_details.fS8_Q4_YYYY.selectedIndex].value != 0) && (document.add_details.fS8_Q5.options[document.add_details.fS8_Q5.selectedIndex].value != 0) && (document.add_details.fS8_Q6.options[document.add_details.fS8_Q6.selectedIndex].value != 0)) {
				section_complete = 8;
				//txt = ""
			} else {
				txt = txt + "<strong>Section 8: 2nd Applicant - Personal Details</strong><br><br>";
				if (document.add_details.fS8_Q1.options[document.add_details.fS8_Q1.selectedIndex].value == 0) {
					txt = txt + "Select title<br><br>";
				}
				if (document.add_details.fS8_Q2.value == "") {
					txt = txt + "Enter forename<br><br>";
				}
				if (document.add_details.fS8_Q3.value == "") {
					txt = txt + "Enter surname<br><br>";
				}
				if ((document.add_details.fS8_Q4_DD.options[document.add_details.fS8_Q4_DD.selectedIndex].value == 0) || (document.add_details.fS8_Q4_MM.options[document.add_details.fS8_Q4_MM.selectedIndex].value == 0) || (document.add_details.fS8_Q4_YYYY.options[document.add_details.fS8_Q4_YYYY.selectedIndex].value == 0)) {
					txt = txt + "Select date of birth<br><br>";
				}
				if (document.add_details.fS8_Q5.options[document.add_details.fS8_Q5.selectedIndex].value == 0) {
					txt = txt + "Select marital status<br><br>";
				}
				if (document.add_details.fS8_Q6.options[document.add_details.fS8_Q6.selectedIndex].value == 0) {
					txt = txt + "Select your housing status<br><br>";
				}
			}
		}
		
		
		// check section 9
		//var date = new Date();
		if (document.add_details.fS9_Q1.disabled == false) {
			if (document.add_details.fS9_Q9_YYYY.options[document.add_details.fS9_Q9_YYYY.selectedIndex].value > date.getFullYear()-3) {
				if ((document.add_details.fS9_Q1.value != "") && (document.add_details.fS9_Q2.value != "") && (document.add_details.fS9_Q3.value != "") && (document.add_details.fS9_Q5.value != "") && (document.add_details.fS9_Q6.value != "") && (document.add_details.fS9_Q7.value != "") && (document.add_details.fS9_Q8.value != "") && (document.add_details.fS9_Q9_DD.options[document.add_details.fS9_Q9_DD.selectedIndex].value != 0) && (document.add_details.fS9_Q9_MM.options[document.add_details.fS9_Q9_MM.selectedIndex].value != 0) && (document.add_details.fS9_Q9_YYYY.options[document.add_details.fS9_Q9_YYYY.selectedIndex].value != 0) && (document.add_details.fS9_Q10.value != "") && (document.add_details.fS9_Q12.value != "") && (document.add_details.fS9_Q13.value != "") && (document.add_details.fS9_Q14.value != "") && (document.add_details.fS9_Q15.value != "")) {
					section_complete = 9;
					//txt = "";
				} else {
					txt = txt + "<strong>Section 9: 2nd Applicant - Contact Details / Addresses</strong><br><br>";
					if (document.add_details.fS9_Q1.value == "") {
						txt = txt + "Enter telephone number<br><br>";
					}
					if (document.add_details.fS9_Q2.value == "") {
						txt = txt + "Enter email address<br><br>";
					}
					if (document.add_details.fS9_Q3.value == "") {
						txt = txt + "Enter address line 1 of your current address<br><br>";
					}
					if (document.add_details.fS9_Q5.value == "") {
						txt = txt + "Enter postal city of your current address<br><br>";
					}
					if (document.add_details.fS9_Q6.value == "") {
						txt = txt + "Enter county of your current address<br><br>";
					}
					if (document.add_details.fS9_Q7.value == "") {
						txt = txt + "Enter postcode of your current address<br><br>";
					}
					if (document.add_details.fS9_Q8.value == "") {
						txt = txt + "Enter country of your current address<br><br>";
					}
					if ((document.add_details.fS9_Q9_DD.options[document.add_details.fS9_Q9_DD.selectedIndex].value == 0) || (document.add_details.fS9_Q9_MM.options[document.add_details.fS9_Q9_MM.selectedIndex].value == 0) || (document.add_details.fS9_Q9_YYYY.options[document.add_details.fS9_Q9_YYYY.selectedIndex].value == 0)) {
						txt = txt + "Select the date you moved<br><br>";
					}
					if (document.add_details.fS9_Q10.value == "") {
						txt = txt + "Enter address line 1 of your previous address<br><br>";
					}
					if (document.add_details.fS9_Q12.value == "") {
						txt = txt + "Enter postal city of your previous address<br><br>";
					}
					if (document.add_details.fS9_Q13.value == "") {
						txt = txt + "Enter county of your previous address<br><br>";
					}
					if (document.add_details.fS9_Q14.value == "") {
						txt = txt + "Enter postcode of your previous address<br><br>";
					}
					if (document.add_details.fS9_Q15.value == "") {
						txt = txt + "Enter country of your previous address<br><br>";
					}
				}
			} else {
				if ((document.add_details.fS9_Q1.value != "") && (document.add_details.fS9_Q2.value != "") && (document.add_details.fS9_Q3.value != "") && (document.add_details.fS9_Q5.value != "") && (document.add_details.fS9_Q6.value != "") && (document.add_details.fS9_Q7.value != "") && (document.add_details.fS9_Q8.value!= "") && (document.add_details.fS9_Q9_DD.options[document.add_details.fS9_Q9_DD.selectedIndex].value != 0) && (document.add_details.fS9_Q9_MM.options[document.add_details.fS9_Q9_MM.selectedIndex].value != 0) && (document.add_details.fS9_Q9_YYYY.options[document.add_details.fS9_Q9_YYYY.selectedIndex].value != 0) ) {
					section_complete = 9;
					//txt = "";
				} else {
					txt = txt + "<strong>Section 9: 2nd Applicant - Contact Details / Addresses</strong><br><br>";
					if (document.add_details.fS9_Q1.value == "") {
						txt = txt + "Enter telephone number<br><br>";
					}
					if (document.add_details.fS9_Q2.value == "") {
						txt = txt + "Enter email address<br><br>";
					}
					if (document.add_details.fS9_Q3.value == "") {
						txt = txt + "Enter address line 1 of your current address<br><br>";
					}
					if (document.add_details.fS9_Q5.value == "") {
						txt = txt + "Enter postal city of your current address<br><br>";
					}
					if (document.add_details.fS9_Q6.value == "") {
						txt = txt + "Enter county of your current address<br><br>";
					}
					if (document.add_details.fS9_Q7.value == "") {
						txt = txt + "Enter postcode of your current address<br><br>";
					}
					if (document.add_details.fS9_Q8.value == "") {
						txt = txt + "Enter country of your current address<br><br>";
					}
					if ((document.add_details.fS9_Q9_DD.options[document.add_details.fS9_Q9_DD.selectedIndex].value == 0) || (document.add_details.fS9_Q9_MM.options[document.add_details.fS9_Q9_MM.selectedIndex].value == 0) || (document.add_details.fS9_Q9_YYYY.options[document.add_details.fS9_Q9_YYYY.selectedIndex].value == 0)) {
						txt = txt + "Select the date you moved<br><br>";
					}
				}
			}
		}
		
		// check section 10
		if (document.add_details.fS10_Q1.disabled == false) {
			if (document.add_details.fS10_Q1.options[document.add_details.fS10_Q1.selectedIndex].value == 3) {
			section_complete = 10;
			}
			else
			{
				if ((document.add_details.fS10_Q1.options[document.add_details.fS10_Q1.selectedIndex].value != 0) && (document.add_details.fS10_Q2.value != "") && (document.add_details.fS10_Q3_DD.options[document.add_details.fS10_Q3_DD.selectedIndex].value != 0) && (document.add_details.fS10_Q3_MM.options[document.add_details.fS10_Q3_MM.selectedIndex].value != 0) && (document.add_details.fS10_Q3_YYYY.options[document.add_details.fS10_Q3_YYYY.selectedIndex].value != 0)) {
					section_complete = 10;
					//txt = ""
				} else {
					txt = txt + "<strong>Section 10: 2nd Applicant - Employment Details</strong><br><br>"
					if (document.add_details.fS10_Q1.options[document.add_details.fS10_Q1.selectedIndex].value == 0) {
						txt = txt + "Select employment status<br><br>";
					}
					if (document.add_details.fS10_Q2.value == "") {
						txt = txt + "Enter job title<br><br>";
					}
					if ((document.add_details.fS10_Q3_DD.options[document.add_details.fS10_Q3_DD.selectedIndex].value == 0) || (document.add_details.fS10_Q3_MM.options[document.add_details.fS10_Q3_MM.selectedIndex].value == 0) || (document.add_details.fS10_Q3_YYYY.options[document.add_details.fS10_Q3_YYYY.selectedIndex].value == 0)) {
						txt = txt + "Select start date of current employment<br><br>";
					}
				}
			}
		}
		
		//check section 11
		if (document.add_details.fS11_Q1.disabled == false) {
			if (document.add_details.fS11_Q1.value != "") {
				section_complete = 11;
				//txt = "";
			} else {
				txt = txt + "<strong>Section 11: 2nd Applicant - Income Details</strong><br><br>";
				if (document.add_details.fS11_Q1.value == "") {
					txt = txt + "Enter gross basic salary (£)<br><br>";
				}
			}
		}
		
		//check section 12
		if (document.add_details.fS12_Q1.disabled == false) {
			if ((document.add_details.fS12_Q1.value != "") && (document.add_details.fS12_Q2.value == "")) {
				txt = txt + "<strong>Section 12: 2nd Applicant - Credit Cards and Loans etc.</strong><br><br>";
				txt = txt + "Enter outstanding balance<br><br>";
			} else {
				if (section_complete == 11) {
					section_complete = 13;
				}
				//txt = "";
			}
		}
		
		//check section 13
		//if (document.add_details.fS13_Q1.disabled == false) {
		//	if (section_complete == 12) {
		//			section_complete = 13;
		//	}
		//}
		
	}
	
	
	if(document.getElementById){
		  document.getElementById("myLayer").innerHTML=txt;
	}else if(document.all){
		  document.all["myLayer"].innerHTML=txt;
	}else if(document.layers){
		  with(document.layers["myLayer"].document){
				open();
				write(txt);
				close();
		  }
	}

	   
	   
	if ((document.add_details.fS1_Q1[0].checked == true) && (section_complete == 13) && (txt == "")) {
		change("submitBtn", "but-submit appear")
	} else if ((document.add_details.fS1_Q1[0].checked != true) && (section_complete == 7) && (txt == "")) {
		change("submitBtn", "but-submit appear")
	} else {
		change("submitBtn", "but-submit disappear")
	}

}

function highlightBox(Item) {
	var completed_section = ""
	help_dialog();
	//alert(section_complete);
	switch (section_complete) {
		case 0:
			document.add_details.fS1_Q1.disabled = false;
			break;
		case 1:
			document.add_details.fS2_Q1.disabled = false;
			document.add_details.fS2_Q2.disabled = false;
			document.add_details.fS2_Q3.disabled = false;
			document.add_details.fS2_Q4_DD.disabled = false;
			document.add_details.fS2_Q4_MM.disabled = false;
			document.add_details.fS2_Q4_YYYY.disabled = false;
			document.add_details.fS2_Q5.disabled = false;
			document.add_details.fS2_Q6.disabled = false;
			break;
		case 2:
			document.add_details.fS3_Q1.disabled = false;
			document.add_details.fS3_Q2.disabled = false;
			document.add_details.fS3_Q3.disabled = false;
			document.add_details.fS3_Q4.disabled = false;
			document.add_details.fS3_Q5.disabled = false;
			document.add_details.fS3_Q6.disabled = false;
			document.add_details.fS3_Q7.disabled = false;
			document.add_details.fS3_Q8.disabled = false;
			document.add_details.fS3_Q9_DD.disabled = false;
			document.add_details.fS3_Q9_MM.disabled = false;
			document.add_details.fS3_Q9_YYYY.disabled = false;
			document.add_details.fS3_Q10.disabled = false;
			document.add_details.fS3_Q11.disabled = false;
			document.add_details.fS3_Q12.disabled = false;
			document.add_details.fS3_Q13.disabled = false;
			document.add_details.fS3_Q14.disabled = false;
			document.add_details.fS3_Q15.disabled = false;
			break;
		case 3:
			document.add_details.fS4_Q1.disabled = false;
			document.add_details.fS4_Q2.disabled = false;
			document.add_details.fS4_Q3_DD.disabled = false;
			document.add_details.fS4_Q3_MM.disabled = false;
			document.add_details.fS4_Q3_YYYY.disabled = false;
			break;
		case 4:
			document.add_details.fS5_Q1.disabled = false;
			document.add_details.fS5_Q2.disabled = false;
			document.add_details.fS5_Q3.disabled = false;
			document.add_details.fS5_Q4.disabled = false;
			break;
		case 5:
			document.add_details.fS6_Q1.disabled = false;
			document.add_details.fS6_Q2.disabled = false;
			document.add_details.fS6_Q3.disabled = false;
			break;
		case 7:
			document.add_details.fS7_Q1[0].disabled = false;
			document.add_details.fS7_Q1[1].disabled = false;
			document.add_details.fS7_Q2[0].disabled = false;
			document.add_details.fS7_Q2[1].disabled = false;
			document.add_details.fS7_Q3.disabled = false;
		//	break;
		//case 7:
			document.add_details.fS8_Q1.disabled = false;
			document.add_details.fS8_Q2.disabled = false;
			document.add_details.fS8_Q3.disabled = false;
			document.add_details.fS8_Q4_DD.disabled = false;
			document.add_details.fS8_Q4_MM.disabled = false;
			document.add_details.fS8_Q4_YYYY.disabled = false;
			document.add_details.fS8_Q5.disabled = false;
			document.add_details.fS8_Q6.disabled = false;
			break;
		case 8:
			document.add_details.fS9_Q1.disabled = false;
			document.add_details.fS9_Q2.disabled = false;
			document.add_details.fS9_Q3.disabled = false;
			document.add_details.fS9_Q4.disabled = false;
			document.add_details.fS9_Q5.disabled = false;
			document.add_details.fS9_Q6.disabled = false;
			document.add_details.fS9_Q7.disabled = false;
			document.add_details.fS9_Q8.disabled = false;
			document.add_details.fS9_Q9_DD.disabled = false;
			document.add_details.fS9_Q9_MM.disabled = false;
			document.add_details.fS9_Q9_YYYY.disabled = false;
			document.add_details.fS9_Q10.disabled = false;
			document.add_details.fS9_Q11.disabled = false;
			document.add_details.fS9_Q12.disabled = false;
			document.add_details.fS9_Q13.disabled = false;
			document.add_details.fS9_Q14.disabled = false;
			document.add_details.fS9_Q15.disabled = false;
			break;
		case 9:
			document.add_details.fS10_Q1.disabled = false;
			document.add_details.fS10_Q2.disabled = false;
			document.add_details.fS10_Q3_DD.disabled = false;
			document.add_details.fS10_Q3_MM.disabled = false;
			document.add_details.fS10_Q3_YYYY.disabled = false;
			break;
		case 10:
			document.add_details.fS11_Q1.disabled = false;
			document.add_details.fS11_Q2.disabled = false;
			document.add_details.fS11_Q3.disabled = false;
			document.add_details.fS11_Q4.disabled = false;
			break;
		case 11:
			document.add_details.fS12_Q1.disabled = false;
			document.add_details.fS12_Q2.disabled = false;
			document.add_details.fS12_Q3.disabled = false;
			break;
		case 13:
			document.add_details.fS13_Q1[0].disabled = false;
			document.add_details.fS13_Q1[1].disabled = false;
			document.add_details.fS13_Q2[0].disabled = false;
			document.add_details.fS13_Q2[1].disabled = false;
			document.add_details.fS13_Q3.disabled = false;
			break;
	}
	
	switch (Item.toLowerCase()) {
		case "s1": 
			completed_section = 0;
			break
		case "s2": 
			completed_section = 1;
			break
		case "s3": 
			completed_section = 2;
			break
		case "s4": 
			completed_section = 3;
			break
		case "s5": 
			completed_section = 4;
			break
		case "s6": 
			completed_section = 5;
			break
		case "s7": 
			completed_section = 6;
			break
		case "s8": 
			completed_section = 7;
			break
		case "s9": 
			completed_section = 8;
			break
		case "s10": 
			completed_section = 9;
			break
		case "s11": 
			completed_section = 10;
			break
		case "s12": 
			completed_section = 11;
			break
		case "s13": 
			completed_section = 12;
			break
	}
	
	if (completed_section <= section_complete) {
		for (var i=1; i <= 13; i++){
			if ("s"+i == Item.toLowerCase()) {
				change("s"+i, "blue-box");
				change("myLayer", "blue-box bTextBlack s"+i);
				
				if(document.getElementById){
				  if (document.getElementById("myLayer").innerHTML == "") {
				  	change("myLayer", "disappear");
				  }
				}
				if (document.all)
					if (document.all.myLayer.innerHTML == "") {
						change("myLayer", "disappear");
					}
				else if (document.layers) {
					obj = document.layers["myLayer"].document.open();
	        		if (obj.toString == "") {
						change("myLayer", "disappear");
					}
	        		obj.close();
	   				}
					
			} else {
				change("s"+i, "grey-box");	
			}
		}
	}
	
	
}

//MENU SCRIPT
var currently_open;
currently_open = 25;

function Collapse(which) {
	if (currently_open == which) {
		domCollapseAll(0);
		currently_open = 25;
	} else {
		domCollapseAll(0); 
		domCollapse(which);
		currently_open = which;
	}
}

function domCollapse(which){
	if (document.getElementById && document.createTextNode){
		if (which=="dispall") {domCollapseAll(1);}
		else if (which=="hideall") {domCollapseAll(0);}
		else {
			m=document.getElementById("menu");
			trig=m.getElementsByTagName("div").item(which).style.display;
			t=m.getElementsByTagName("span").item(which);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (trig=="block") trig="none";
			else if (trig=="" || trig=="none") trig="block";
			if (trig=="none"){

				}
			else {

				}
			m.getElementsByTagName("div").item(which).style.display=trig;
		}
	}
} 


function domCollapseAll(show){
	if (document.getElementById && document.createTextNode){
		m=document.getElementById("menu");
		for (i=0;i<m.getElementsByTagName("div").length;i++){
			t=m.getElementsByTagName("span").item(i);
			h=t.getElementsByTagName("a").item(0).firstChild;
			if (show==1){
				m.getElementsByTagName("div").item(i).style.display="block";
			}
			else {
				m.getElementsByTagName("div").item(i).style.display="none";
			}
		}
	}
}

// Adding backwards compatibility
if (document.getElementById && document.createTextNode){
	document.write('<style type="text/css">#menu div{display:none;}</style>')
	}

//END Menu Scripts
//-->