function jumpTo(url) {
   alert(url);
   if(url != "" ) {
      document.location.href = url;
   }
}


/* the following functions and calls are necessary for the 
   tracking functionality for mailto links 
   on the astra site (consumer, business, dealers).
   This code work in combination with the provided javascript
   code from LegitiName which is stored in and sourced from the 
   file /resources/js/scd.js.
*/

function sumOnLoadEvents(additionalFunc) {
  var existingOnload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = additionalFunc;
  } else {
    window.onload = function() {
      if (existingOnload) {
        existingOnload();
      }
      additionalFunc();
    }
  }
}

function Helper_DCS(event) {
  var callingElement = (event.target) ? event.target : event.srcElement;
  var dcsPageIdentifier = callingElement.toString();
  dcsPageIdentifier = dcsPageIdentifier.split("@");
  dcsPageIdentifier = dcsPageIdentifier[0].split(":");
  dcsPageIdentifier = dcsPageIdentifier[0] + "_" + dcsPageIdentifier[1];
  /*
   alert('A link with mailto was clicked!!!! - selfUrl: '+window.location.pathname+'/'+dcsPageIdentifier);
  */
  dcsMultiTrack ('DCS.dcsuri',window.location.pathname+'/'+dcsPageIdentifier);
  dcsPageIdentifier = null;
  return true;
}

function AddEventToLinks() {
  /* too restricted pattern cause we want all mailto links 
     var searchPattern = /(info)|(sales)@/;
  */
  var searchPattern = /mailto:/;
  for (var i = 0; i < document.links.length; i++) {
    if (searchPattern.test(document.links[i])) {
      var matchingLink = document.links[i];
      matchingLink.onclick = Helper_DCS;
      matchingLink = null;
    }
  }
  return true;
}

sumOnLoadEvents(AddEventToLinks);

/* the following function is for OMS tracking purposes */

function spcfaIdentify() {
  match = (/spcfa=(\d+)/).exec(document.cookie);
  return match && match[1];
}
