﻿/*********************************
    SOS Site - Global JS
    Version 1
	
    28/11/2010
*********************************/

// Flag to determine whether we show errors or not
var _debugMe = true;

// Proxy function for tracking Google Analytic events
function fnTrackEvent(strCategory, strAction) {
    if (_gaq) {
        try {
            _gaq.push(['_trackEvent', strCategory, strAction]);
        } catch (e) {
            if (_debugMe) {
                alert("A problem occured with fnTrackEvent: " + e.toString());
            }
        }
    }
}

// Create XHTML friendly external links based on rel attribute of an anchor tag
function fnCreateExternalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
            anchor.target = "_blank";
    }
}
