function referfriend ()
{
	var errors ="";
	
	if (document.getElementById('ref_their_name').value == '')
		errors += "- You must enter their name\n";
	
	if (document.getElementById('ref_their_email').value == '')
		errors += "- You must enter their email\n";
	else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('ref_friend').value) == false)		
		errors += "- Their email address must be valid\n";
	
	if (document.getElementById('ref_my_name').value == '')
		errors += "- You must enter your name\n";
	
	if (document.getElementById('ref_my_email').value == '')
		errors += "- You must enter your email address\n";
	else if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('ref_my').value) == false)		
		errors += "- Your email address must be valid\n";

	if (errors != '')
	{
		errors = "The following errors have occurred:\n\n" + errors + "\nPlease fill in these boxes and try sending again.";		
		alert(errors);
		return false;
	}
	else
	{
		return true;
	}
}

function checkapp ()
{
  var errors = "";

  if (document.getElementById('housename').value == '')
    errors += "- You must enter the house name\n";

  if (document.getElementById('address').value == '')
    errors += "- You must enter the address\n";

  if (document.getElementById('housedescription').value == '')
    errors += "- You must enter the house description\n";
    
  if (errors != '')
  {
    errors = "The following errors have occurred:\n\n" + errors + "\nPlease fill in these boxes and submit the application again.";
    
    alert(errors);
    
    return false;
  }
  
  return true;
}

function loaddef (def)
{
  if (def == 'kitchenfacilities')
  {
    var val = '';   

    val += "fully fitted kitchen \n";
    val += "gas hob and oven \n";
    val += "microwave, large fridge/freezer, dishwasher \n";
    val += "washing machine, tumble dryer in separate room \n";
    val += "dining area with patio doors to rear garden \n";
    val += "outside clothes line, iron and ironing board \n";
    val += "bed linen and towels provided \n";
    val += "oil fired central heating included";
    
    document.getElementById('kitchenfacilities').value = val;
  }
  else if (def == 'otherfacilities')
  {
    var val = '';   
       
    val += "tv, cd/stereo \n";
    val += "compact kitchen \n";
    val += "electric cooker \n";
    val += "microwave, fridge with icebox \n";
    val += "washing machine \n";
    val += "outside clothes line, iron and ironing board \n";
    val += "cot, highchair available by request \n";
    val += "bed linen and towels provided \n";
    val += "oil fired central heating included \n";
    val += "patio area with patio furniture \n";
    val += "5 min walk to lovely sandy beach \n";
    val += "10 min walk to shops, pub etc";
    
    document.getElementById('otherfacilities').value = val;
  }
  else if (def == 'keyfeatures')
  {
    var val = '';   
       
    val += "linen supplied free of charge \n";
    val += "(please supply own towels) \n";
    val += "electricity included \n";
    val += "central heating included";
    
    document.getElementById('keyfeatures').value = val;
  }
  else if (def == 'paymentanddeposit')
  {    
    document.getElementById('paymentanddeposit').value = "Booking deposit (non-refundable) of 100 euros per week - with balance to be paid six weeks prior to the letting period.";
  }
  else if (def == 'ownerinfo')
  {    
    document.getElementById('ownername').value = "Inishowen Self Catering";
    document.getElementById('ownerphone').value = "+353 86 2338380";
    document.getElementById('ownerfax').value = "+353 86 2338380";
    document.getElementById('ownermobile').value = "+353 86 2338380";
    document.getElementById('owneremail').value = "info@inishowenselfcatering.com";
  }
  
  return false;
}

function profsrc (newsrc)
{
  document.getElementById('profmain').src = newsrc;
}

var map = null;
var geocoder = null;

function initialize() {
  if (GBrowserIsCompatible()) {
    map = new GMap2(document.getElementById("map_canvas"));
    map.setUIToDefault();
    map.setMapType(G_HYBRID_MAP);
    geocoder = new GClientGeocoder();
  }
}

function showAddress(address) {
  if (geocoder) {
    geocoder.getLatLng(
      address,
      function(point) {
        if (!point) {
          alert(address + " not found");
        } else {
          map.setCenter(point, 13);
          var marker = new GMarker(point);
          map.addOverlay(marker);
          marker.openInfoWindowHtml(address);
        }
      }
    );
  }
}

var RecaptchaOptions = {
   theme : 'clean'
};
