function externalLinks() {   
 if (!document.getElementsByTagName) return;   
 var anchors = document.getElementsByTagName("a");   
 for (var i=0; i<anchors.length; i++) {   
   var anchor = anchors[i];   
   if (anchor.getAttribute("href") &&   
       anchor.getAttribute("rel") == "external")   
     anchor.target = "_blank";   
 }   
}   

	var errors = new Array();
		
		function isEmpty(field) {
			if(field.value === "") {
				var msg = "Please complete the " + field.name + " field.";
				errors.push(msg);
			}
		}
		
		function fullCheck(form) {
			
			var arrayLength = errors.length;
			// Emptying the array
			for (var i=0; i<arrayLength; i++) {
				errors.pop();
			}
			
			for (var i=0; i<form.elements.length; i++) {
				isEmpty(form.elements[i]);
			}/*
			isEmpty(form.elements['first']);
			isEmpty(form.elements['second']);
			isEmpty(form.elements['dob']);
			isEmpty(form.elements['From_Email']);
			isEmpty(form.elements['street']);
			isEmpty(form.elements['town']);
			isEmpty(form.elements['postcode']);*/
			
			if(errors.length > 0) {
				var msg = "";
				for(error in errors) {
					msg += "\n" + errors[error];
				}
				alert(msg);
				return false;
			}
			 
			return true;
		}

function resizeText(multiplier) 
{
  if (document.body.style.fontSize == "") 
  
  {    document.body.style.fontSize = "1.0em";  
  
  }  document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
  
}

var map;
var icon0;
var newpoints = new Array();
 
function addLoadEvent(func) { 
	var oldonload = window.onload; 
	if (typeof window.onload != 'function'){ 
		window.onload = func
	} else { 
		window.onload = function() {
			oldonload();
			func();
		}
	}
}
 
function loadMap() {
	map = new GMap2(document.getElementById("map"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GMapTypeControl());
	map.setCenter(new GLatLng( 55.87196723082525, -3.9775818586349487), 16);
	map.setMapType(G_HYBRID_MAP);
 
	icon0 = new GIcon();
	icon0.image = "http://www.google.com/mapfiles/marker.png";
	icon0.shadow = "http://www.google.com/mapfiles/shadow50.png";
	icon0.iconSize = new GSize(20, 34);
	icon0.shadowSize = new GSize(37, 34);
	icon0.iconAnchor = new GPoint(9, 34);
	icon0.infoWindowAnchor = new GPoint(9, 2);
	icon0.infoShadowAnchor = new GPoint(18, 25);
}
 
function addPoints() {
 
	newpoints[0] = new Array(55.87198378403374, -3.977678418159485, icon0, 'Hope', 'The Hope Centre,<br />145 Chapel Street<br />Airdrie ML6 6LH<br /><br />01236 779 191<br /><a href="http://maps.google.co.uk/maps?hl=en&safe=off&rls=com.microsoft:en-gb:IE-SearchBox&wrapid=tlif12845098634462&um=1&ie=UTF-8&cid=0,0,15871505716262669267&fb=1&hq=The+HOPE+Centre&hnear=145+Chapel+St,+Airdrie,+North+Lanarkshire+ML6+6&gl=uk&daddr=The+Hope+Centre,+145+Chapel+Street,+Airdrie+ML6+6LH&geocode=5312825439964829547,55.872003,-3.977342&ei=vRCQTP7rNo2l4QbC25XvDg&sa=X&oi=local_result&ct=directions-to&resnum=1&ved=0CBcQngIwAA"/>Get Directions</a>'); 
 
	for(var i = 0; i < newpoints.length; i++) {
		var point = new GPoint(newpoints[i][1],newpoints[i][0]);
		var popuphtml = newpoints[i][4] ;
		var marker = createMarker(point,newpoints[i][2],popuphtml);
		map.addOverlay(marker);
	}
}
 
	function createMarker(point, icon, popuphtml) {
	var popuphtml = "<div id=\"popup\">" + popuphtml + "<\/div>";
	var marker = new GMarker(point, icon);
	GEvent.addListener(marker, "click", function() {
		marker.openInfoWindowHtml(popuphtml);
	});
	return marker;
}


function random() {
 var r_text = new Array ();
r_text[0] = "All the leaves are brown";
r_text[1] = "And the sky is grey";
r_text[2] = "I've been for a walk";
r_text[3] = "On a winter's day";
r_text[4] = "I'd be safe and warm";
r_text[5] = "If I was in L.A.";
r_text[6] = "California dreaming, On such a winter's day";
var i = Math.floor(7*Math.random())
}







