﻿//<![CDATA[

var map;
var marker;

//Init How to find us
function HowToFindUsInit() {
    map = new GMap(document.getElementById("map")); 
    map.addControl(new GLargeMapControl());
    map.addControl(new GScaleControl());
}
//Init the how to find us marker
function MarkerInit() {
    marker = createMarker(new GPoint(-2.516824,52.190101), 1)
    map.addOverlay(marker);
}
// Create a marker whose info window displays the given number.
function createMarker(point, number) {
    var marker = new GMarker(point);
    // Show this marker's index in the info window when it is clicked.
    var html = "<b>Wildesoft.net</b><br/>Bromyard, HR7 4UT<br/>01885 483006";
    GEvent.addListener(marker, 'click', function() {marker.openInfoWindowHtml(html);});
    return marker;
}
//How to find us in
function HowToFindUs() {
    if (!map) HowToFindUsInit();
    map.centerAndZoom(new GPoint(-2.516824, 52.190101), 2);
    if (!marker) MarkerInit();    
}
//How to find us out
function HowToFindUsOut() {
    if (!map) HowToFindUsInit();
    map.centerAndZoom(new GPoint(-2.516824,52.190101), 9);    
    if (!marker)MarkerInit();    
}



//Toggles an element on/off
function toggle(on) {
  var divOn  = returnStyle(on);
  if (divOn.display == "none"){show(on);}else{hide(on)}
}  
function show (which) {
	if (document.all)  { var style = self.document.all[which].style; }
	else { var style = document.getElementById(which).style; }
	
	style.visibility = "visible";
	style.display = "block";
}
function hide (which) {
	if (document.all) { var style = self.document.all[which].style; }
	else { var style = document.getElementById(which).style; }
	
	style.visibility = "hidden";
	style.display = "none";
}
function returnStyle(what) {
  return  (document.all) ? self.document.all[what].style : document.getElementById(what).style;
}

//]]>

