// JavaScript Document
// test

	var map2, bounds, southWest, northEast, lngSpan, latSpan;
    function initializehome() {
	
      if (GBrowserIsCompatible()) {
	  
        map2 = new GMap2(document.getElementById("minimap"));
        map2.setCenter(new GLatLng(56.19555, -4.3388), 9);
		
		map2.setUIToDefault();

		bounds = map2.getBounds();
		displayCoords();
		  GEvent.addListener(map2,"dblclick",function() {
			map2.setCenter(new GLatLng(56.19555, -4.3388), 9);				
		  });
		  
	}
	}
	
	var markerarr = new Array();
	function displayCoords() {
		var blueIcon = new GIcon(G_DEFAULT_ICON);
		var redIcon = new GIcon(G_DEFAULT_ICON);
		var yellowIcon = new GIcon(G_DEFAULT_ICON);
		var greenIcon = new GIcon(G_DEFAULT_ICON);
		redIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";
		blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
		yellowIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/yellow-dot.png";
		greenIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/green-dot.png";

		for (var i=0;i<acoords.length;i++) {
			var c = acoords[i];
			var ci = c.split('~');
			var location = new GLatLng(ci[0],ci[1]);
			var popup = "<div id=\"popup\"><h3>";
			switch (ci[6]) {
				case "Urgent": popup += '<img src="/img/traffic/major.gif" '; break;
				case "Important": popup += '<img src="/img/traffic/medium.gif" '; break;
				case "Information": popup += '<img src="/img/traffic/minor.gif" '; break;
				default: popup += '<img src="/img/traffic/general.gif" '; break;
			}
			popup += "hspace=\"5\">"+ci[4]+", "+ci[3]+"</h3><p>"+ci[5]+"<br /><span style=\"color: #666666\">"+ci[8];
			var d = ci[7];
			if (d != '') { popup += ci[7]; }
			popup += "</span></p></div>"; 
			switch (ci[6]) {
				case "Urgent": markerOption = {icon:redIcon}; break;
				case "Important": markerOption = {icon:yellowIcon}; break;
				case "Information": markerOption = {icon:greenIcon}; break;
				default: markerOption = {icon:blueIcon}; break;
			}
			createMarker(i,location);
			map2.addOverlay(markerarr[i]);
		}
      }
	  
	  function createMarker(n,l) {
		  //var pup = p;
		  markerarr[n] = new GMarker(l);
		  GEvent.addListener(markerarr[n],"click",function() {
				/*map.setZoom(16);
				markerarr[n].openInfoWindowHtml(pup);
				*/
				top.location.href = "/traffic/";
				
		  });
	  }
	  
