  var site = {
  
  parseUri: function(str) {
      var o = {
          strictMode: false,
          key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
          q:   {
              name:   "queryKey",
              parser: /(?:^|&)([^&=]*)=?([^&]*)/g
          },
          parser: {
              strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
              loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
          }
      },
          m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
          uri = {},
          i   = 14;

      while (i--) uri[o.key[i]] = m[i] || "";
        uri[o.q.name] = {};
        uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
          if ($1) uri[o.q.name][$1] = $2;
      });

      return uri;
  },
  
  // local, meltqa.com, Avastin.com keys
  //flowplayerKeys : ["#@6263f56a17815ecf71f", "#@8236c16f17f3207d55f", "#@bef9e4ba42d434a431d"],

  isDev: (
    window.location.href.indexOf('://localhost:80') > -1 ||
    window.location.href.indexOf('.local:80') > -1 ||
    /.*(172|192|10|127)\.\d{1,3}\.\d{1,3}\.\d{1,3}:80.*/.test(window.location.href)
  ),
  
  listCookies: function() {
        var theCookies = document.cookie.split(';');
        return theCookies;
  },
  
  
  /** Logic to retrieve a cookie for the site **/
  getCookie: function(name) {
    var pattern = new RegExp('(^|; )' + name + '=([^;]*)');
    var m = document.cookie.match(pattern);
    return m && unescape(m[2]);
  },
  
  /** Logic to create a cookie for the site **/
  setCookie: function(name, value, days, path, domain, secure) {
    var c = name + '=' + escape(value);
    var expires = null;
    if (days)
      expires = new Date(new Date().getTime() + (days * 24 * 60 * 60 * 1000));
    if (expires)
      c += '; expires=' + expires.toUTCString();
    if (path)
      c += '; path=' + path;
    if (domain)
      c += '; domain=' + domain;
    if (secure)
      c += '; secure';
    document.cookie = c;
    return "woo";
  },
  
  mocTrackingInit: function() {
    var moc = site.parseUri(window.location.href).queryKey.c || site.getCookie('moc');
    if (moc) site.setCookie('moc', moc, 0, '/');
  }
  
};
  

$(document).ready(function() {
  
  site.mocTrackingInit();
  
	$(".scroll").click(function(e){
	    e.preventDefault();
	  	$("html, body").animate({ scrollTop: $('#safety').offset().top }, 1000);
	  });
  
  
  // Print Page
  $('.print').click(function(e){
    e.preventDefault();
    site.analytics.callAdapters('printPage');	
  	window.print();
  });
  
  $('.downloadM').click(function(){
    site.analytics.callAdapters('trackDownload');
  });
  
});

