$(function () {
  loadGoogleAnalytics();
  $('.jsreqd').remove();
});

function loadGoogleAnalytics () {
  var elGAScript = document.createElement('script');
  elGAScript.setAttribute('id', 'ga-script');
  elGAScript.setAttribute('src', (("https:" == document.location.protocol) ? "https://ssl." : "http://www.") + 'google-analytics.com/ga.js');
  elGAScript.setAttribute('type', 'text/javascript');
  document.getElementsByTagName('head')[0].appendChild(elGAScript);

  $('#ga-script').load(function () {
    try {
      var pageTracker = _gat._getTracker("UA-12776872-1");
      pageTracker._setDomainName(".interunis.co.uk");
      pageTracker._trackPageview();
    } catch(err) {
    }//try
  });
}//function

// This function is from Google's polyline utility.
function decodeEncodedPolyline (strEncoded) {
  var len = strEncoded.length;
  var index = 0;
  var array = [];
  var lat = 0;
  var lng = 0;

  while (index < len) {
    var b;
    var shift = 0;
    var result = 0;
    do {
      b = strEncoded.charCodeAt(index++) - 63;
      result |= (b & 0x1f) << shift;
      shift += 5;
    } while (b >= 0x20);
    var dlat = ((result & 1) ? ~(result >> 1) : (result >> 1));
    lat += dlat;

    shift = 0;
    result = 0;
    do {
      b = strEncoded.charCodeAt(index++) - 63;
      result |= (b & 0x1f) << shift;
      shift += 5;
    } while (b >= 0x20);
    var dlng = ((result & 1) ? ~(result >> 1) : (result >> 1));
    lng += dlng;

    array.push(new google.maps.LatLng(lat * 1e-5, lng * 1e-5));
  }//while

  return array;
}//function

