function clearBox(input) {
	if(input.value=input.defaultValue) {
		input.value = '';	
	}
}

function resetBox(input) {
	if(!input.value) {
		input.value = input.defaultValue;	
	}
}

function validateEmail(email){
	var myEmail = email.value;

	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myEmail))){
		alert('Please enter a valid email address');
		return false;
	}

	return true;
}

function loadMap() {
	if (GBrowserIsCompatible()) {
		var map = new GMap2(document.getElementById("map"));
		var point = new GLatLng(54.00797,-0.31878);
		map.addControl(new GLargeMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(point, 10);
		
		function createMarker(point, icon, html) {
			var marker = new GMarker(point, icon);
			GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(html);
			});
			return marker;
		}
		
		/* add Practice details */
		var addresses = Array();	
		addresses[0] = Array(53.97101,-0.2986,'green.png',"<div style='height: 110px;'><strong>Garth Veterinary Practice</strong><br />Straight Lane,<br />Beeford,<br />Driffield,<br />East Yorkshire. YO25 8BE</div>");
		addresses[1] = Array(54.09433,-0.21016,'blue.png',"<div style='height: 95px;'><strong>Bridlington Priory Veterinary Group</strong><br />17 Market Place,<br />Bridlington,<br />East Yorkshire. YO16 4QJ</div>");
		addresses[2] = Array(54.00595,-0.44164,'red.png',"<div style='height: 95px;'><strong>Driffield Priory Veterinary Group</strong><br />Unit X, Spencer Centre Westgate,<br />Driffield,<br />East Yorkshire. YO25 6TJ</div>");

		var icon = new GIcon();
		icon.shadow = "/images/msmarker_shadow.png";
		icon.iconSize = new GSize(12, 20);  // sets the size of the icon
		icon.shadowSize = new GSize(22, 20);  // sets the size of the shadow
		icon.iconAnchor = new GPoint(6, 20);  // sets the bottom position of the anchor - (half the width of the iconSize, full height of iconSize)
		icon.infoWindowAnchor = new GPoint(12, 0);  // sets the offset of the information speach bubble
	
		for(i=0;i<addresses.length;i++) {
			icon.image = "/images/"+addresses[i][2];		
			var point = new GLatLng(addresses[i][0], addresses[i][1]);
			map.addOverlay(createMarker(point, icon, addresses[i][3]));
		}
	}
}
