<!--
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 NewWindow2(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=200,left=200,scrollbars=yes')
}

function EditUserWindow(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=100,left=150,scrollbars=yes')
}

function ViewSurveyorWindow(theURL, h, w) 
{
	window.open(theURL, '', 'height='+h+',width='+w+',top=100,left=150,scrollbars=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_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,Page)
{
  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+"&Page="+Page;
  }
  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, Item_Type)
{
  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+"&Item_Type="+Item_Type;
  }
  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 PopupCentrer(page) {
  var top=(screen.height-200)/2;
  var left=(screen.width-450)/2;
  window.open(page,"","top="+top+",left="+left+",width="+450+",height="+200+","+"menubar=no,scrollbars=no,statusbar=no");
}

function ViewDisplayWindow(theURL, h, w) 
{
	window.open(theURL, '', 'height='+200+',width='+200+',top=50,left=50,scrollbars=yes')
}

function validateGuide(item, Item_Type) 
{
	var Item_Name = ""
	var Contact_Name = ""
	var City = ""
	var County = ""
	var Postcode = ""
	var Phone = ""
	var Email = ""
	var Price = ""
	var Att_Other = ""
	
/*
Validate common to all elements first...
*/
	if (Item_Type != "ADMIN-Attraction") {
		if (document.add_details.fContact_Name.value == '')
		{
			Contact_Name = "\nEnter a contact name";
		}
	}
	if (document.add_details.fCity.value == '')
	{
		City = "\nEnter a city";
	}
	
	if (document.add_details.fCounty.value == '')
	{
		County = "\nEnter a county";
	}
	
	if (document.add_details.fPostcode.value == '')
	{
		Postcode = "\nEnter a postcode";
	}
	if (Item_Type != "ADMIN-Attraction") {
		if (document.add_details.fPhone.value == '')
		{
			Phone = "\nEnter a phone number";
		}
	}
	if (Item_Type != "ADMIN-Attraction") {
		if (document.add_details.fEmail.value == '')
		{
			Email = "\nEnter an email address";
		}
	}
/*
Validate item specific elements...
*/
	switch (Item_Type) 
	{
		case "Hotel":
			if (document.add_details.fHotel_Name.value == '')
			{
				Item_Name = "\nEnter a hotel name";
			}
			if (document.add_details.fPrice.value == '')
			{
				Price = "\nEnter a price";
			}
			break;
		
		case "Restaurant":
			if (document.add_details.fRestaurant_Name.value == '')
			{
				Item_Name = "\nEnter a restaurant name";
			}
			if (document.add_details.fPrice.value == '')
			{
				Price = "\nEnter a price";
			}
			break;
			
		case "Theatre":
			if (document.add_details.fTheatre_Name.value == '')
			{
				Item_Name = "\nEnter a theatre name";
			}
			break;
			
		case "ADMIN-Attraction":
			if (document.add_details.fAttraction_Name.value == '')
			{
				Item_Name = "\nEnter an attraction name";
			}
			if ((document.add_details.fAttraction_Type.value == '0') && (document.add_details.fAttraction_Type_Other.value == ''))
			{
				Att_Other = "\nSpecify the type of attraction";
			}
			break;
			
		case "Attraction":
			if (document.add_details.fAttraction_Name.value == '')
			{
				Item_Name = "\nEnter an attraction name";
			}
			if ((document.add_details.fAttraction_Type.value == '0') && (document.add_details.fAttraction_Type_Other.value == ''))
			{
				Att_Other = "\nSpecify the type of attraction";
			}
			break;
			
		case "Pub":
			if (document.add_details.fPub_Name.value == '')
			{
				Item_Name = "\nEnter a pub name";
			}
			break;
			
		case "Club":
			if(document.add_details.fClub_Name == '')
			{
				Item_Name = "\nEnter a club name";
			}
			break;
	}
		
	if (Item_Name != '' || Contact_Name != '' || City != '' || County != '' || Postcode != '' || Phone != '' || Email != '' || Price != '' || Att_Other != '')
	{
		alert("You must:\n"+Item_Name+Contact_Name+City+County+Postcode+Phone+Email+Price+Att_Other);
		return false;
	}
}
	function enableOther(Item_Type) {
									
					if (document.add_details.fAttraction_Type.options[document.add_details.fAttraction_Type.options.selectedIndex].value == "0") {
						document.add_details.fAttraction_Type_Other.disabled=false;
					}	else {
						document.add_details.fAttraction_Type_Other.value = "";						
						document.add_details.fAttraction_Type_Other.disabled=true;
					}
				
				}
		

//-->

