
var map;
var point;

function initialise() {

      if (GBrowserIsCompatible()) 
	  {
        map = new GMap2(document.getElementById("map_canvas"));
		map.setCenter(new GLatLng(54.23170, -0.62334), 15);
		map.setMapType(G_HYBRID_MAP);
		
		point = new GLatLng(54.23170, -0.62334);
		
		var tinyIcon = new GIcon();
		tinyIcon.image = "http://maps.google.com/intl/en_uk/mapfiles/arrow.png";
		tinyIcon.shadow = "http://maps.google.com/intl/en_uk/mapfiles/arrowshadow.png";
		tinyIcon.iconSize = new GSize(39, 34);
		tinyIcon.iconAnchor = new GLatLng(54.23159 - 19, -0.62334 + 17);
		
		// Set up our GMarkerOptions object literal
		markerOptions = { icon:tinyIcon };
		
		var marker = new GMarker(point, markerOptions);
		
		GEvent.addListener(marker, "click", function() {
   bubbleHome();
  });
		
		
		
		map.addOverlay(marker);
		
		
		
		bubbleHome();
		
                   
      }
    }

function getDirectionsTo()
{
	//alert('Get Directions To');
	
	var text = "<div class=\"bubbleContent\"><div class=\"bubbleHeader\">Chapel Guitars</div>";
	text += "<div class=\"address\">50 Main Street, Ebberston</div>";
	text += "<span class=\"dir\" jstcache=\"0\">";
	text += "<br>Get Directions: ";
	text += "To here";
	text += " - ";
	text += "<a href=\"javascript:void(0)\" onclick=\"getDirectionsFrom()\" id=\"dcf\" class=\"wizardpush\" jstcache=\"0\">From here</a>";
	text += "</span>";
	
	text += "<div class=\"address\">Start address</div>";
	
	text += "<form style=\"display:inline\" action=\"http://maps.google.co.uk/maps\" method=\"get\" target=\"_blank\" onsubmit=\"setTimeout('bubbleHome()', 200)\">";
	text += "<input type=\"text\" name=\"saddr\" value = \"\">";
	text += "<input type=\"submit\" value=\"Go\"></br>";
	text += "<input type=\"hidden\" name=\"daddr\" value=\"50, Main Street, Ebberston\" />";
	text += "<input type=\"hidden\" name=\"hl\" value=\"en\" />";
	text += "</form>";
	
	text += "<a href=\"javascript:void(0)\" onclick=\"bubbleHome()\" id=\"dh\" class=\"back\" jstcache=\"0\"><< Back</a>";
	
	//map.setCenter(new GLatLng(54.23159, -0.62334), 15);
	map.setMapType(G_HYBRID_MAP);
	
	map.openInfoWindowHtml(point, text);
}

function submit_form() {
alert('HERE');
document.FormName.submit();
alert('HERE');

alert('HERE');
}

function getDirectionsFrom()
{
	var text = "<div class=\"bubbleContent\"><div class=\"bubbleHeader\">Chapel Guitars</div>";
	text += "<div class=\"address\">50 Main Street, Ebberston</div>";
	text += "<span class=\"dir\" jstcache=\"0\">";
	text += "<br>Get Directions: ";
	text += "<a href=\"javascript:void(0)\" onclick=\"getDirectionsTo()\" id=\"dct\" class=\"wizardpush\" jstcache=\"0\">To here</a>";
	text += " - ";
	text += "From Here";
	text += "</span>";
	
	text += "<div class=\"address\">End address</div>";
	
	text += "<form style=\"display:inline\" action=\"http://maps.google.co.uk/maps\" method=\"get\" target=\"_blank\" onsubmit=\"setTimeout('bubbleHome()', 200)\">";
	text += "<input type=\"text\" name=\"daddr\" value = \"\">";
	text += "<input type=\"submit\" value=\"Go\"></br>";
	text += "<input type=\"hidden\" name=\"saddr\" value=\"50, Main Street, Ebberston\" />";
	text += "<input type=\"hidden\" name=\"hl\" value=\"en\" />";
	text += "</form>";
	
	text += "<a href=\"javascript:void(0)\" onclick=\"bubbleHome()\" id=\"dh\" class=\"back\" jstcache=\"0\"><< Back</a>";
	
	//map.setCenter(new GLatLng(54.23159, -0.62334), 15);
	map.setMapType(G_HYBRID_MAP);
	
	map.openInfoWindowHtml(point, text);
	
	
}

function bubbleHome()
{
	var text = "<div class=\"bubbleContent\"><div class=\"bubbleHeader\">Chapel Guitars</div>";
	text += "<div class=\"address\">50 Main Street, Ebberston</div>";
	text += "<p><span id=\"dir\" jstcache=\"0\">";
	text += "Get Directions: ";
	text += "<a href=\"javascript:void(0)\" onclick=\"getDirectionsTo()\" id=\"dct\" class=\"wizardpush\" jstcache=\"0\">To here</a>";
	text += " - ";
	text += "<a href=\"javascript:void(0)\" onclick=\"getDirectionsFrom()\" id=\"dcf\" class=\"wizardpush\" jstcache=\"0\">From here</a>";
	text += "</span>";
	text+= "</div>";
	
	//map.setCenter(new GLatLng(54.23159, -0.62334), 15);
	
	
	map.openInfoWindowHtml(point, text);
}
	
