<!--
//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); }
}

function change(id, newClass) {
	//alert(id);
	//alert(newClass);
	identity=document.getElementById(id);
	identity.className=newClass;
}

function Close_Refresh()
{
  window.opener.location.reload();
  window.close();
}

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 Close_Refresh_ImageUpload(idKey)
{
  window.opener.location.href = "Image_Upload.asp?refresh=true&ID=" + idKey;
  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 checkForQuotesPoundsAndLength(what,limit) {
		if (limit != "") {
			if (what.value.length>=limit) {
					return false;
				}
		} 
		// alert(event.keyCode)
		// A single quote ' = 34 A double quote " = 39
		if ((event.keyCode == 34) || (event.keyCode == 39) || (event.keyCode == 163)) {
			return false;
		}
}

function checkForQuotesAndLength(what,limit) {
		if (limit != "") {
			if (what.value.length>=limit) {
					return false;
				}
		} 
		// alert(event.keyCode)
		// A single quote ' = 34 A double quote " = 39
		if ((event.keyCode == 34) || (event.keyCode == 39)) {
			return false;
		}
}

 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 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';
}

//-->
