var ddlDate;
function the_date(){
  var arrivalDate = "-- Arrival Date --";    
  var shortDayName = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
  var shortMonthName = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
	
	var date = new Date();
	var select = ddlDate;
	
	var firstDay = date.getDate();
	if(parseInt(firstDay) < 10) firstDay = "0" + firstDay;
	var firstMonth = date.getMonth() + 1;
	if(parseInt(firstMonth) < 10) firstMonth = "0" + firstMonth;
		
	var firstOption = new Option(arrivalDate);
	firstOption.value = date.getFullYear() + firstMonth + firstDay;
	
	document.writeln("<SELECT name=\"d\" class=\"lateroomssearchboxes\">");
	
	for(var d=0;d<366;d++)
	{
		var day = date.getDate();
	    if(parseInt(day) < 10) day = "0" + day;
		var month = date.getMonth() + 1;
		if(parseInt(month) < 10) month = "0" + month;
		var option = new Option(shortDayName[date.getDay()] + " " + date.getDate() + " " + shortMonthName[date.getMonth()] + " " + date.getFullYear());
		option.value = date.getFullYear() + "" + month +  "" +  day;
		document.writeln("<OPTION value=" + option.value + ">" + shortDayName[date.getDay()] + " " + date.getDate() + " " + shortMonthName[date.getMonth()] + " " + date.getFullYear() + "</option>");
		date.setDate(date.getDate() + 1);
	}
	
	document.writeln("</SELECT>");
}

function QuickSearchForm()

{

if (document.quicksearchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if(document.quicksearchform.eventtype.options[0].selected) {

alert('Please choose an event type.');

event.returnValue=false;

  }

  else

  return true;

}

function QuickSearchRedirect()
{
  if(document.quicksearchform.eventtype.value == 'Wedding')
  {
   document.quicksearchform.action ="wedding-search-results.php";
  }
  else
 if(document.quicksearchform.eventtype.value == 'Conference')
  {
   document.quicksearchform.action ="conference-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Exhibition')
  {
   document.quicksearchform.action ="exhibition-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Corporate Function')
  {
   document.quicksearchform.action ="corporate-function-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Party')
  {
   document.quicksearchform.action ="party-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Restaurant')
  {
   document.quicksearchform.action ="restaurant-search-results.php";
  }
  return true;
}

function QuickSearchRedirect2()
{
  if(document.quicksearchform.eventtype.value == 'Wedding')
  {
   document.quicksearchform.action ="../wedding-search-results.php";
  }
  else
 if(document.quicksearchform.eventtype.value == 'Conference')
  {
   document.quicksearchform.action ="../conference-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Exhibition')
  {
   document.quicksearchform.action ="../exhibition-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Corporate Function')
  {
   document.quicksearchform.action ="../corporate-function-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Party')
  {
   document.quicksearchform.action ="../party-search-results.php";
  }
  else
  if(document.quicksearchform.eventtype.value == 'Restaurant')
  {
   document.quicksearchform.action ="../restaurant-search-results.php";
  }
  return true;
}

var regiondb = new Object(  )

regiondb["Scotland"] = [{value:"Aberdeenshire", text:"Aberdeenshire"},{value:"Angus", text:"Angus"},{value:"Argyllshire", text:"Argyllshire"},{value:"Ayrshire", text:"Ayrshire"},{value:"Berwickshire", text:"Berwickshire"},{value:"Berwickshire", text:"Berwickshire"},{value:"Buteshire", text:"Buteshire"},{value:"Cromartyshire", text:"Cromartyshire"},{value:"Caithness", text:"Caithness"},{value:"Clackmannanshire", text:"Clackmannanshire"},{value:"Dumfriesshire", text:"Dumfriesshire"},{value:"Dunbartonshire", text:"Dunbartonshire"},{value:"East Lothian", text:"East Lothian"},{value:"Fife", text:"Fife"},{value:"Inverness-shire", text:"Inverness-shire"},{value:"Kincardineshire", text:"Kincardineshire"},{value:"Kinross-shire", text:"Kinross-shire"},{value:"Kirkcudbrightshire", text:"Kirkcudbrightshire"},{value:"Lanarkshire", text:"Lanarkshire"},{value:"Midlothian", text:"Midlothian"},{value:"Morayshire", text:"Morayshire"},{value:"Nairnshire", text:"Nairnshire"},{value:"Orkney", text:"Orkney"},{value:"Peeblesshire", text:"Peeblesshire"},{value:"Perthshire", text:"Perthshire"},{value:"Renfrewshire", text:"Renfrewshire"},{value:"Ross-shire", text:"Ross-shire"},{value:"Roxburghshire", text:"Roxburghshire"},{value:"Selkirkshire", text:"Selkirkshire"},{value:"Shetland", text:"Shetland"},{value:"Stirlingshire", text:"Stirlingshire"},{value:"Sutherland", text:"Sutherland"},{value:"West Lothian", text:"West Lothian"},{value:"Wigtownshire", text:"Wigtownshire"}];

regiondb["Northern Ireland"] = [{value:"County Antrim", text:"County Antrim"},{value:"County Armagh", text:"County Armagh"},{value:"County Down", text:"County Down"},{value:"County Fermanagh", text:"County Fermanagh"},{value:"County Londonderry", text:"County Londonderry"},{value:"County Tyrone", text:"County Tyrone"}];

regiondb["Republic of Ireland"] = [{value:"Carlow", text:"Carlow"},{value:"Cavan", text:"Cavan"},{value:"Clare", text:"Clare"},{value:"Cork", text:"Cork"},{value:"Donegal", text:"Donegal"},{value:"Dublin", text:"Dublin"},{value:"Galway", text:"Galway"},{value:"Kerry", text:"Kerry"},{value:"Kildare", text:"Kildare"},{value:"Kilkenny", text:"Kilkenny"},{value:"Laois", text:"Laois"},{value:"Leitrim", text:"Leitrim"},{value:"Limerick", text:"Limerick"},{value:"Longford", text:"Longford"},{value:"Louth", text:"Louth"},{value:"Mayo", text:"Mayo"},{value:"Meath", text:"Meath"},{value:"Monaghan", text:"Monaghan"},{value:"Offaly", text:"Offaly"},{value:"Roscommon", text:"Roscommon"},{value:"Sligo", text:"Sligo"},{value:"Tipperary", text:"Tipperary"},{value:"Waterford", text:"Waterford"},{value:"Westmeath", text:"Westmeath"},{value:"Wexford", text:"Wexford"},{value:"Wicklow", text:"Wicklow"}];

regiondb["North West"] = [{value:"Cheshire", text:"Cheshire"}, {value:"Cumberland", text:"Cumberland"},{value:"Lancashire", text:"Lancashire"},{value:"Merseyside", text:"Merseyside"},{value:"Westmorland", text:"Westmorland"}];

regiondb["North East"] = [{value:"Durham", text:"Durham"},{value:"Northumberland", text:"Northumberland"},{value:"North Yorkshire", text:"North Yorkshire"},{value:"West Yorkshire", text:"West Yorkshire"},{value:"South Yorkshire", text:"South Yorkshire"},{value:"East Riding of Yorkshire", text:"East Riding of Yorkshire"}];

regiondb["Wales"] = [{value:"Anglesey", text:"Anglesey"},{value:"Brecknockshire", text:"Brecknockshire"},{value:"Caernarfonshire", text:"Caernarfonshire"},{value:"Carmarthenshire", text:"Carmarthenshire"},{value:"Cardiganshire", text:"Cardiganshire"},{value:"Denbighshire", text:"Denbighshire"},{value:"Flintshire", text:"Flintshire"},{value:"Glamorgan", text:"Glamorgan"},{value:"Merioneth", text:"Merioneth"},{value:"Monmouthshire", text:"Monmouthshire"},{value:"Montgomeryshire", text:"Montgomeryshire"},{value:"Pembrokeshire", text:"Pembrokeshire"},{value:"Radnorshire", text:"Radnorshire"}];

regiondb["West Midlands"] = [{value:"Gloucestershire", text:"Gloucestershire"},{value:"Herefordshire", text:"Herefordshire"},{value:"Shropshire", text:"Shropshire"},{value:"Staffordshire", text:"Staffordshire"},{value:"Warwickshire", text:"Warwickshire"},{value:"West Midlands", text:"West Midlands"},{value:"Worcestershire", text:"Worcestershire"}];

regiondb["East Midlands"] = [{value:"Bedfordshire", text:"Bedfordshire"},{value:"Cambridgeshire", text:"Cambridgeshire"},{value:"Derbyshire", text:"Derbyshire"},{value:"Hertfordshire", text:"Hertfordshire"},{value:"Huntingdonshire", text:"Huntingdonshire"},{value:"Leicestershire", text:"Leicestershire"},{value:"Lincolnshire", text:"Lincolnshire"},{value:"Northamptonshire", text:"Northamptonshire"},{value:"Nottinghamshire", text:"Nottinghamshire"},{value:"Rutland", text:"Rutland"}];

regiondb["East Anglia"] = [{value:"Essex", text:"Essex"},{value:"Norfolk", text:"Norfolk"},{value:"Suffolk", text:"Suffolk"}];

regiondb["South West"] = [{value:"Cornwall", text:"Cornwall"},{value:"Devon", text:"Devon"},{value:"Dorset", text:"Dorset"},{value:"Somerset", text:"Somerset"}];

regiondb["The South"] = [{value:"Berkshire", text:"Berkshire"},{value:"Buckinghamshire", text:"Buckinghamshire"},{value:"Hampshire", text:"Hampshire"},{value:"Middlesex", text:"Middlesex"},{value:"Oxfordshire", text:"Oxfordshire"},{value:"Wiltshire", text:"Wiltshire"}];

regiondb["Greater London"] = [{value:"Greater London", text:"Greater London"}];

regiondb["South East"] = [{value:"Kent", text:"Kent"},{value:"Surrey", text:"Surrey"},{value:"East Sussex", text:"East Sussex"},{value:"West Sussex", text:"West Sussex"}];



function setCounty(chooser) {

    var countyChooser = chooser.form.elements["county"];

    // empty previous settings

    countyChooser.options.length = 0;

    // get chosen value to act as index to regiondb hash table

    var choice = chooser.options[chooser.selectedIndex].value;

    var db = regiondb[choice];

    // insert default first item

    countyChooser.options[0] = new Option("Choose County", "", true, false);

    if (choice != "") {

        // loop through array of the hash table entry, and populate options

        for (var i = 0; i < db.length; i++) {

            countyChooser.options[i + 1] = new Option(db[i].text, db[i].value);

        }

    }

}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function testForEnter()

{

	if (event.keyCode == 13)

	{

		event.cancelBubble = true;

		event.returnValue = false;

         }

}

function OnSubmitWeddingForm()

{

if (document.searchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if (document.searchform.county.options[0].selected) {

alert('Please choose a county.');

event.returnValue=false;

}

if (document.searchform.settingtype.options[0].selected) {

alert('Please choose a venue setting.');

event.returnValue=false;

}

else

{

document.searchform.action ="detailed-wedding-results.php";

}

return true;

}

function OnSubmitConferenceForm()

{

if (document.searchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if (document.searchform.county.options[0].selected) {

alert('Please choose a county.');

event.returnValue=false;

}

if (document.searchform.settingtype.options[0].selected) {

alert('Please choose a venue setting.');

event.returnValue=false;

}

else

{

document.searchform.action ="detailed-conference-results.php";

}

return true;

}

function OnSubmitExhibitionForm()

{

if (document.searchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if (document.searchform.county.options[0].selected) {

alert('Please choose a county.');

event.returnValue=false;

}

else

{

document.searchform.action ="detailed-exhibition-results.php";

}

return true;

}

function OnSubmitCorporateForm()

{

if (document.searchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if (document.searchform.county.options[0].selected) {

alert('Please choose a county.');

event.returnValue=false;

}

if (document.searchform.settingtype.options[0].selected) {

alert('Please choose a venue setting.');

event.returnValue=false;

}

else

{

document.searchform.action ="detailed-corporate-results.php";

}

return true;

}

function OnSubmitPartyForm()

{

if (document.searchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if (document.searchform.county.options[0].selected) {

alert('Please choose a county.');

event.returnValue=false;

}

if (document.searchform.settingtype.options[0].selected) {

alert('Please choose a venue setting.');

event.returnValue=false;

}

else

{

document.searchform.action ="detailed-party-results.php";

}

return true;

}

function OnSubmitRestaurantForm()

{

if (document.searchform.region.options[0].selected) {

alert('Please choose a region.');

event.returnValue=false;

}

if (document.searchform.county.options[0].selected) {

alert('Please choose a county.');

event.returnValue=false;

}

if (document.searchform.cuisine.options[0].selected) {

alert('Please choose a type of cuisine.');

event.returnValue=false;

}

if (document.searchform.settingtype.options[0].selected) {

alert('Please choose a venue setting.');

event.returnValue=false;

}

else

{

document.searchform.action ="detailed-restaurant-results.php";

}

return true;

}

function go(loc) {

window.location.href = loc;

}

function createInfoMarker(point, address) {
   var marker = new GMarker(point);
   GEvent.addListener(marker, "click",
      function() {
         marker.openInfoWindowHtml(address);
      }
   );
  return marker;
}

function basicadvertisingformverify() {

if (document.basicadvertisingform.description.value.length > 250)

{

alert("Please enter at most 250 characters in the brief description field.");

document.basicadvertisingform.description.focus();

return (false);

}

else {

document.basicadvertisingform.action ="basic-advertising-submission.php";

}

return true;

}

function validatepasswordconfirm() {
var e = basicadvertisingform.elements;

/* Your validation code. */

if(e['password'].value != e['confirmpassword'].value) {
alert('Your passwords do not match. Please type more carefully.');
return false;
}
return true;
}