function setupMap() {	
	if (GBrowserIsCompatible()) 
		{ 		
		map_1 = new GMap2(document.getElementById("map"));
		map_1.addControl(new GMapTypeControl());
		map_1.addControl(new GLargeMapControl());
//		map_1.enableDoubleClickZoom();
		map_1.setCenter(new GLatLng(51.77201407983699, 0.09065330028533936), 12);
		map_1.addMapType(G_NORMAL_MAP);
		map_1.setMapType(G_NORMAL_MAP);
		var marker = new GMarker(new GLatLng(51.77201407983699, 0.09065330028533936))
		map_1.addOverlay(marker);
		}
	}

function Trim(str)
{  while(str.charAt(0) == (" ") )
  {  str = str.substring(1);
  }
  while(str.charAt(str.length-1) == " " )
  {  str = str.substring(0,str.length-1);
  }
  return str;
}


function bEmpty(ss)
	{
	return ( Trim(ss).length < 1 )
	}
	
function bCheckContact( form )
	{
	 var errormessage = new String();
	 var name = Trim(form.name.value);
	 var email = Trim(form.email.value);
	 var formOk = false;

	if(bEmpty(name))
	  {errormessage += "\n\nPlease enter your name";}

	if(bEmpty(email) && bEmpty(form.phone.value) )
		 {errormessage += "\n\nPlease enter your phone or your email address";}
	if(!bEmpty(email) && !bOkEmail(email))
		  {errormessage += "\n\nPlease check - that does not appear to be a valid email address";}
	formOk = ! (errormessage.length > 2);			
	if (! formOk)
		{alert("There's a small problem with the form  :" + errormessage + '\n'); }
	else
		{alert('Dear ' + name + '\n\nThanks for contacting us.\n\nWe will get in touch as soon as possible.' + '\n');	}

	return formOk;
	} 

function bOkEmail(ss)
	{
	var retval = true;
	var split;
	ss = Trim(ss);
//Check the field is not too small	
	if (5 > ss.length  )
		retval = false;

//Check the @ is present in the middle of some text, and split into name and domain			
	if ( retval )
      {
      var split = ss.match("^(.+)@(.+)$");
      if(split == null || split[1] == null || split[2] == null) 
         retval = false;
     	}

//Check the name
	if ( retval )
      {
	    var regexp_name=/^\"?[\w-_\.]*\"?$/;
	    if(split[1].match(regexp_name) == null) 
	      retval = false;
	  	}

//Check the domain
   if ( retval )
      {
	    var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
	    if(split[2].match(regexp_domain) == null)
	      retval=false;
	    }
	    
	return retval;
	}

function ClearTextareaMsg( field, defaultMsg )
{
	if ( field.value == defaultMsg )
		field.value="";
}
	