		//////////////////////////////////////////////////////DEFINE MY MARKER ICONS HERE/////////////////////////////////////
		var icon1 = new GIcon();
		icon1.image = "/images/marker1.png";
		icon1.iconSize = new GSize(30, 28);
		icon1.iconAnchor = new GPoint(10, 28);
		icon1.infoWindowAnchor = new GPoint(20, 0);
		var icon2 = new GIcon();
		icon2.image = "/images/marker2.png";
		icon2.iconSize = new GSize(30, 28);
		icon2.iconAnchor = new GPoint(10, 28);
		icon2.infoWindowAnchor = new GPoint(23, 4);
		var icon3 = new GIcon();
		icon3.image = "/images/marker3.png";
		icon3.iconSize = new GSize(30, 28);
		icon3.iconAnchor = new GPoint(10, 28);
		icon3.infoWindowAnchor = new GPoint(23, 4);
		var icon4 = new GIcon();
		icon4.image = "/images/marker4.png";
		icon4.iconSize = new GSize(30, 28);
		icon4.iconAnchor = new GPoint(10, 28);
		icon4.infoWindowAnchor = new GPoint(23, 4);
		var icon5 = new GIcon();
		icon5.image = "/images/marker5.png";
		icon5.iconSize = new GSize(30, 28);
		icon5.iconAnchor = new GPoint(10, 28);
		icon5.infoWindowAnchor = new GPoint(23, 4);
		var icon6 = new GIcon();
		icon6.image = "/images/marker6.png";
		icon6.iconSize = new GSize(30, 28);
		icon6.iconAnchor = new GPoint(10, 28);
		icon6.infoWindowAnchor = new GPoint(23, 4);
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		///////////////////////////////////////////////////GLOBAL VARIABLES HERE////////////////////////////////////////////////////////////
		var map;
		var OFFSET = 268435456;
		var RADIUS = 85445659.4471;
		var PI = 3.14159;
		var Zoom;
		var MyMarkers = new Array();
		var LoadingBlock;
		var point;
		var point2;
		////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
		
				
		function init() {
		  if (GBrowserIsCompatible()) {
			map = new GMap2(document.getElementById("Map"));
			map.setUIToDefault();
			
			map.setCenter(new GLatLng(53.04781795911469, -0.90087890625), 8);
			/*map.setCenter(new GLatLng(53.90835519671534, -1.2442657470703125), 8);*/
			GEvent.addListener(map,"zoomend",function(z_old,z_new) {
				Zoom=z_new;
				LaunchMarkers();				
			})
			GEvent.addListener(map, "dragend", function() {
			LaunchMarkers();
			});
			Zoom=map.getZoom();
			LaunchMarkers();
		  }
		}
		
		function LaunchMarkers(){			
			//$('[id^="mtgt_"]').fadeOut(1000,function(){});
			//GET THE MAP BOUNDS - WERE ONLY GOING TO PULL IN MARKERS LOCATED IN THE VIEW ZONE
			var bounds = map.getBounds();
			var southWest = bounds.getSouthWest();
			var northEast = bounds.getNorthEast();
			var East=northEast.lat();
			var West=southWest.lat();
			var North=northEast.lng();
			var South=southWest.lng();
			var PostData='East='+East+'&West='+West+'&North='+North+'&South='+South+'&Zoom='+Zoom; //Zoom isnt a requirement but at zoomed out levels you may have massive recursion in the loops. server side handling.
			AjaxPost('/Includes_ASP/AJAX_GetMarkers.asp',PostData,'HandleLaunchMarkers','');
			////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////			
		}

		function HandleLaunchMarkers(){
			var CData=CheckStatus();
			if (CData){
				var IncomingLength=Cdata.incoming.markers.length;
				if (IncomingLength>0) {
					map.clearOverlays();
					var i=IncomingLength;
					var MyMarkers = new Array();
					while(i--){
						MyMarkers[i] = new Array(4);
						MyMarkers[i][0]=Cdata.incoming.markers[i].lon;
						MyMarkers[i][1]=Cdata.incoming.markers[i].lat;
						MyMarkers[i][2]=0;
						MyMarkers[i][3]=Cdata.incoming.markers[i].mid;
					}					
					if (i==-1){
						var clustered = Getcluster(MyMarkers, 64, Zoom);
						for (i=0;i<clustered.length;i++){		
							if(clustered[i]){
								var Str=clustered[i].toString();
								var marker  = Str.split(',');
								if (marker[0]){
									point = new GLatLng(marker[0],marker[1]);
									if(marker[2]>6){
										var markerIcon=6;
									}else{
										var markerIcon=marker[2];
									}
									var markerPin = new GMarker(point,eval('icon'+markerIcon));
									markerPin.title=i;
									markerPin.id=i+1;
									markerPin.size=marker[2];
									markerPin.mid=marker[3];
									map.addOverlay(markerPin);
									GEvent.addListener(markerPin, "click", function(point,title,size) {
										if (this.size>1){
											map.openInfoWindowHtml(point,"<br/><span style='font-size:12px;font-family:arial;'><b>Too many results</b><br/><br/>There are more than 1 results assigned to this map marker.<br/>Please zoom in until these map markers have seperated!</span>");
										}
										else {											
											point2=point;
											var PostData='mid='+this.mid;
											AjaxPost('/Includes_ASP/AJAX_GetClickedMarker.asp',PostData,'HandleClickedMarker','');											
											
											//map.getInfoWindow().hide();
										}										
									});
								$('#mtgt_'+(i+1)).hover(function(){$(this).fadeTo(200,.5);},function(){$(this).fadeTo(200,1);});
								}
							}
						}
					}
				}
			}			
		}
		
		function tester(mid){
			//map.openInfoWindowHtml(mid);
		}
		
		function HandleClickedMarker(){
			var CData=CheckStatus();
			if (CData){
				var IncomingLength=Cdata.incoming.marker.length;
				if (IncomingLength>0) {
					var State=Cdata.incoming.marker[0].State;
					var Data=Cdata.incoming.marker[0].Data;
					if(State=='True'){						
						map.openInfoWindowHtml(point2,Data);
					}
					else{
						alert('errors occured whilst retreiving this markers data.');
					}
				}
				
			}
		}
		
		function Getcluster(markers, distance, zoom) {
			var clustered = new Array();
			var marker = new Array();
			var x=0;
			var j=0;
			var ClusterCount=0;
			while (markers.length) {
				marker  = markers.pop(); // Firstly i need to get 1 of the items from the marker array to compare against. Once taken the array size reduces by 1.
				for (i=0;i<markers.length;i++){	//Run through all my other markers and compare against the one i popped off.
					if (markers[i][0] && marker[0]){
						var pixels=pixelDistance(marker[0],marker[1],markers[i][0],markers[i][1],zoom);
					}
					if (distance > pixels) {
						markers[i][0]='' //Set it to blank so we know its been merged or is the same as another!!!
						ClusterCount++; //keep track of how many targets we've hit!!! We null the ones weve hit so we cant compare them again ;) -Sneaky skills.
						pixels=99999; //prevent next loop using old values - pwnage hack as it'll never be reached!
					}
				}
				if(marker[0]){
					cluster = new Array();
					cluster[0]=new Array(4)
					cluster[0][0] = marker[0];
					cluster[0][1] = marker[1];
					cluster[0][3] = marker[3];
					if (ClusterCount > 0) {
						cluster[0][2]=(ClusterCount+1);//Set icon type for multiple grouped results. Returns just an int in the 3rd array cell - pretty simple.
						clustered[j] = cluster;
						ClusterCount=0;
					} else {						
						cluster[0][2]='1';//Set icon type for none grouped results. Returns just an int in the 3rd array cell - pretty simple. Usually a 1 for single elements.
						clustered[j] = cluster;
					}					
				}
				j++;
			}
			return clustered;
		}
			
		function lonToX(lon) {
			return Math.round(OFFSET + RADIUS * lon * PI / 180);        
		}

		function latToY(lat) {
			return Math.round(OFFSET - RADIUS * 
				Math.log((1 + Math.sin(lat * PI / 180)) / 
				(1 - Math.sin(lat * PI / 180))) / 2);
		}

		function pixelDistance(lat1, lon1, lat2, lon2, zoom) {
			x1 = lonToX(lon1);
			y1 = latToY(lat1);
			x2 = lonToX(lon2);
			y2 = latToY(lat2);
			return Math.sqrt(Math.pow((x1-x2),2) + Math.pow((y1-y2),2)) >> (21 - zoom);
		}