﻿//<![CDATA[


    //moving google maps to api version 2
    
    
    // Create our "tiny" marker icon
	var icon = new GIcon();//inherit from default icon so all properties get valid default values
	//icon.image = "http://www.cbg.ie/mapping/images/mm_20_blue.png";
	icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
	icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
	icon.iconSize = new GSize(12, 20);
	icon.shadowSize = new GSize(22, 20);
	icon.iconAnchor = new GPoint(6, 20);
	icon.infoWindowAnchor = new GPoint(5, 1);
	
	// Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    baseIcon.infoShadowAnchor = new GPoint(18, 25);

	
	var iconA = new GIcon(baseIcon);    iconA.image = "http://www.google.com/mapfiles/markerA.png";
    var iconB = new GIcon(baseIcon);    iconB.image = "http://www.google.com/mapfiles/markerB.png";
    var iconC = new GIcon(baseIcon);    iconC.image = "http://www.google.com/mapfiles/markerC.png";
    var iconD = new GIcon(baseIcon);    iconD.image = "http://www.google.com/mapfiles/markerD.png";
    var iconE = new GIcon(baseIcon);    iconE.image = "http://www.google.com/mapfiles/markerE.png";
    var iconF = new GIcon(baseIcon);    iconF.image = "http://www.google.com/mapfiles/markerF.png";
    var iconG = new GIcon(baseIcon);    iconG.image = "http://www.google.com/mapfiles/markerG.png";
    var iconH = new GIcon(baseIcon);    iconH.image = "http://www.google.com/mapfiles/markerH.png";
    var iconI = new GIcon(baseIcon);    iconI.image = "http://www.google.com/mapfiles/markerI.png";
    var iconJ = new GIcon(baseIcon);    iconJ.image = "http://www.google.com/mapfiles/markerJ.png";
    var iconK = new GIcon(baseIcon);    iconK.image = "http://www.google.com/mapfiles/markerK.png";
    var iconL = new GIcon(baseIcon);    iconL.image = "http://www.google.com/mapfiles/markerL.png";
    var iconM = new GIcon(baseIcon);    iconM.image = "http://www.google.com/mapfiles/markerM.png";
    var iconN = new GIcon(baseIcon);    iconN.image = "http://www.google.com/mapfiles/markerN.png";
    var iconO = new GIcon(baseIcon);    iconO.image = "http://www.google.com/mapfiles/markerO.png";
    var iconP = new GIcon(baseIcon);    iconP.image = "http://www.google.com/mapfiles/markerP.png";
    var iconQ = new GIcon(baseIcon);    iconQ.image = "http://www.google.com/mapfiles/markerQ.png";
    var iconR = new GIcon(baseIcon);    iconR.image = "http://www.google.com/mapfiles/markerR.png";
    var iconS = new GIcon(baseIcon);    iconS.image = "http://www.google.com/mapfiles/markerS.png";
    var iconT = new GIcon(baseIcon);    iconT.image = "http://www.google.com/mapfiles/markerT.png";
    var iconU = new GIcon(baseIcon);    iconU.image = "http://www.google.com/mapfiles/markerU.png";
    var iconV = new GIcon(baseIcon);    iconV.image = "http://www.google.com/mapfiles/markerV.png";
    var iconW = new GIcon(baseIcon);    iconW.image = "http://www.google.com/mapfiles/markerW.png";
    var iconX = new GIcon(baseIcon);    iconX.image = "http://www.google.com/mapfiles/markerX.png";
    var iconY = new GIcon(baseIcon);    iconY.image = "http://www.google.com/mapfiles/markerY.png";
    var iconZ = new GIcon(baseIcon);    iconZ.image = "http://www.google.com/mapfiles/markerZ.png";
    


	
    
    var map = null;
    var mapInitialised = false;
    
    
    
    
    var ireland =   new GLatLng(53.59902495724183,-7.822265625);         //ireland
    var carlow =    new GLatLng(52.89564866211353,-6.6082763671875);     //carlow
    var cavan =     new GLatLng(53.996468534299375,-7.3615264892578125); //cavan
    var clare =     new GLatLng(52.796119005678506,-9.2010498046875);    //clare
    var dublin =    new GLatLng(53.34399288223421,-6.2786865234375);     //dublin
    var cork =      new GLatLng(51.896833883012484,-8.4869384765625);    //cork
    var donegal =   new GLatLng(54.667477840945736,-8.0914306640625);    //donegal
    var galway =    new GLatLng(53.28492154619621,-9.0582275390625);     //galway
    var kerry =     new GLatLng(52.01193653675363,-9.8052978515625);     //kerry
    var kildare =   new GLatLng(53.173119202640635,-6.5863037109375);    //kildare
    var kilkenny =  new GLatLng(52.656393941988,-7.2235107421875);       //kilkenny
    var laois =     new GLatLng(53.1072166918934,-7.0367431640625);      //laois
    var leitrim =   new GLatLng(54.059387886623575,-7.8936767578125);    //leitrim
    var limerick =  new GLatLng(52.6830427622774,-8.6077880859375);      //limerick
    var longford =  new GLatLng(53.73084156491151,-7.787933349609375);   //longford
    var louth =     new GLatLng(53.91970735505101,-6.5828704833984375);  //louth
    var mayo =      new GLatLng(54.05455131593229,-9.441375732421875);   //mayo
    var meath =     new GLatLng(53.72271667491848,-6.8829345703125);     //meath
    var monaghan =  new GLatLng(54.25238930276849,-6.9488525390625);     //monaghan
    var offaly =    new GLatLng(53.26521293124656,-7.6409912109375);     //offaly
    var roscommon = new GLatLng(53.64463782485651,-8.2122802734375);     //roscommon
    var sligo =     new GLatLng(54.27805485967281,-8.4869384765625);     //sligo
    var tipperary = new GLatLng(52.482780222078205,-8.1463623046875);    //tipperary
    var westmeath = new GLatLng(53.525615259225226,-7.502288818359375);  //westmeath
    var wexford =   new GLatLng(52.328625488430184,-6.4544677734375);    //wexford
    var wicklow =   new GLatLng(52.99495027026798,-6.0369873046875);     //wicklow
    
    
    function updateMapArea(point)
    {	
        if (!mapInitialised)
        {
            initMap();
        }
	    map.setCenter(eval(point), 10);
    } 
    function centerAndZoomJMN(point,zoom)
    {
	    if (point != null && point != -1 && zoom != null && zoom != -1 && map != null)
	    {
		    eval("map.centerAndZoom(" + point + "," + zoom + ");");
	    }
    } 
    
    function initMap()
    {
        alert('initMap() called');
        initMapj(new GLatLng(53.59902495724183,-7.822265625), 6);        
    }
    
    function initMapj(point, zoom)
    {
        if (document.getElementById("map") != null)
        {            
            map = new GMap2(document.getElementById("map"));
	        map.addControl(new GSmallMapControl());
	        map.addControl(new GMapTypeControl());
	        map.addControl(new GOverviewMapControl());
	        map.setCenter(point, zoom);	
	        mapInitialised = true; 
		}
    }
    
    function showRestaurantLocation(point, zoom, restaurantBubbleDetails)
    {
        if (document.getElementById("map") != null)
        {            
            map = new GMap2(document.getElementById("map"));
	        initMapj(point, zoom);
	        var marker = new GMarker(point);
	        map.addOverlay(marker);   
	        marker.openInfoWindowHtml(restaurantBubbleDetails);
	        GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml(restaurantBubbleDetails);
            });
		}
    }
    
    function DisplayInfoWindow(pointString,markerObj,zoom, html)
    {				
		eval(markerObj + ".openInfoWindowHtml('" + html + "');");
    }    

	function DisplayInfoWindowTabs(markerObj,infoTabs)
    {				
		eval(markerObj + ".openInfoWindowTabsHtml(" + infoTabs + ");");
    }  
    
   
   
//]]>