//Create the global Immage Array
var images = new Array();
images[0] = "top.jpg";
images[1] = "top2.jpg";
images[2] = "top3.jpg";
images[3] = "top4.jpg";

var pickArr = new Array(); // The array that will be formed
var count=0;
var doFlag=false;
var iterations=0;

function pickNums(nums)
{
 iterations+=1;
 var currNum = Math.round((images.length-1)*Math.random());
 if(count!=0)
 {
  for(var i=0; i<pickArr.length; i++)
  {
   if(images[currNum]==pickArr[i])
   {
    doFlag=true;
    break;
   }
  }
 }
 if(!doFlag)
 {
  pickArr[count]=images[currNum];
 // document.write('<b>' + images[currNum] + '</b> <font color="#808080">|</font> ');
  count+=1;
 }
 if(iterations<(images.length*3)) // Compare for max iterations you want
 {
  if((count<nums))
  {
   pickNums(nums);
  }
 }
}

pickNums(images.length)

function timer(i,path){
	//Reset the number if greater than the last value
	if (i>pickArr.length-1){
		i = 0;
	}
	//alert(path+"images/"+pickArr[i]);
	document.Test.src = path+"images/"+pickArr[i]

	i++;
	var Timer = setTimeout("timer("+i+",'"+path+"')", 5000);
}

<!--
//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 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 emailCheck (emailStr) {
 
 /* The following variable tells the rest of the function whether or not
 to verify that the address ends in a two-letter country or well-known
 TLD.  1 means check it, 0 means don't. */
 
 var checkTLD=1;
 
 /* The following is the list of known TLDs that an e-mail address must end with. */
 
 var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
 
 /* The following pattern is used to check if the entered e-mail address
 fits the user@domain format.  It also is used to separate the username
 from the domain. */
 
 var emailPat=/^(.+)@(.+)$/;
 
 /* The following string represents the pattern for matching all special
 characters.  We don't want to allow special characters in the address. 
 These characters include ( ) < > @ , ; : \ " . [ ] */
 
 var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
 
 /* The following string represents the range of characters allowed in a 
 username or domainname.  It really states which chars aren't allowed.*/
 
 var validChars="\[^\\s" + specialChars + "\]";
 
 /* The following pattern applies if the "user" is a quoted string (in
 which case, there are no rules about which characters are allowed
 and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
 is a legal e-mail address. */
 
 var quotedUser="(\"[^\"]*\")";
 
 /* The following pattern applies for domains that are IP addresses,
 rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
 e-mail address. NOTE: The square brackets are required. */
 
 var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
 
 /* The following string represents an atom (basically a series of non-special characters.) */
 
 var atom=validChars + '+';
 
 /* The following string represents one word in the typical username.
 For example, in john.doe@somewhere.com, john and doe are words.
 Basically, a word is either an atom or quoted string. */
 
 var word="(" + atom + "|" + quotedUser + ")";
 
 // The following pattern describes the structure of the user
 
 var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
 
 /* The following pattern describes the structure of a normal symbolic
 domain, as opposed to ipDomainPat, shown above. */
 
 var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
 
 /* Finally, let's start trying to figure out if the supplied address is valid. */
 
 /* Begin with the coarse pattern to simply break up user@domain into
 different pieces that are easy to analyze. */
 
 var matchArray=emailStr.match(emailPat);
 
 if (matchArray==null) {
 
 /* Too many/few @'s or something; basically, this address doesn't
 even fit the general mould of a valid e-mail address. */
 
 //alert("Email address seems incorrect (check @ and .'s)");
 return false;
 }
 var user=matchArray[1];
 var domain=matchArray[2];
 
 // Start by checking that only basic ASCII characters are in the strings (0-127).
 
 for (i=0; i<user.length; i++) {
 if (user.charCodeAt(i)>127) {
 //alert("Ths username contains invalid characters.");
 return false;
   }
 }
 for (i=0; i<domain.length; i++) {
 if (domain.charCodeAt(i)>127) {
 //alert("Ths domain name contains invalid characters.");
 return false;
   }
 }
 
 // See if "user" is valid 
 
 if (user.match(userPat)==null) {
 
 // user is not valid
 
 //alert("The username doesn't seem to be valid.");
 return false;
 }
 
 /* if the e-mail address is at an IP address (as opposed to a symbolic
 host name) make sure the IP address is valid. */
 
 var IPArray=domain.match(ipDomainPat);
 if (IPArray!=null) {
 
 // this is an IP address
 
 for (var i=1;i<=4;i++) {
 if (IPArray[i]>255) {
 //alert("Destination IP address is invalid!");
 return false;
   }
 }
 return true;
 }
 
 // Domain is symbolic name.  Check if it's valid.
  
 var atomPat=new RegExp("^" + atom + "$");
 var domArr=domain.split(".");
 var len=domArr.length;
 for (i=0;i<len;i++) {
 if (domArr[i].search(atomPat)==-1) {
 //alert("The domain name does not seem to be valid.");
 return false;
   }
 }
 
 /* domain name seems valid, but now make sure that it ends in a
 known top-level domain (like com, edu, gov) or a two-letter word,
 representing country (uk, nl), and that there's a hostname preceding 
 the domain or country. */
 
 if (checkTLD && domArr[domArr.length-1].length!=2 && 
 domArr[domArr.length-1].search(knownDomsPat)==-1) {
 //alert("The address must end in a well-known domain or two letter " + "country.");
 return false;
 }
 
 // Make sure there's a host name preceding the domain.
 
 if (len<2) {
 //alert("This address is missing a hostname!");
 return false;
 }
 
 // If we've gotten this far, everything's valid!
 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("Please select an entry.");
	}
}


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("Please select an entry.");
	}
}
	
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 popupwidth=420;
  var popupheight=165;
  var top=(screen.height-popupheight)/2;
  var left=(screen.width-popupwidth)/2;
  window.open(page,"","top="+top+",left="+left+",width="+popupwidth+",height="+popupheight+","+"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';
}

//-->