﻿function SwitchWrapperClass (itemId, classToSwitchTo) {
	document.getElementById(itemId).className = classToSwitchTo;
}

function SwitchClass (ob, classToSwitchTo) {
	ob.className = classToSwitchTo;
}

function clearOutTextBox (ob, textToCheckFor) {
    if ( ob.value == textToCheckFor ) 
    {
        ob.value = '';
    }
}

function openWindow(winURL,winName,features) {
  window.open(winURL,winName,features);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function resizeText(multiplier) {
    if (document.body.style.fontSize == "") 
    {
        document.body.style.fontSize = "1.0em";
    }
    document.body.style.fontSize = parseFloat(document.body.style.fontSize) + (multiplier * 0.2) + "em";
}

function insertMap() {
    //Insert the google map into the page
    var map = new GMap(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    //centre and zoom at slightly different point to marker - to show all three stations
    //threadneedle street:
    //map.centerAndZoom(new GPoint(-0.08372258529663086, 51.514970853021906), 2);
    //st mary's axe:
    map.centerAndZoom(new GPoint(-0.079319, 51.515464), 2);

    //Add the marker to the map very near the centre...
    //threadneedle street:
    //var point = new GPoint(-0.08512258529663086, 51.514070853021906);
    //st mary's axe:
    var point = new GPoint(-0.079319, 51.515464);
    var marker = new GMarker(point);
    map.addOverlay(marker);
}
