// Google Analytics tracking

function trackIt(qstring, ignoredir) {
//we've been forced to disable this until we get an answer from Google about how to use both the Google Shopping Cart AND pageTracker.trackPageview()
/*   
if (pageTracker) {
        if (ignoredir) {
            if (qstring.length == 0){
				pageTracker._trackPageview();
			}else{
				pageTracker._trackPageview("/" + qstring);
			}
        }else{
            if (qstring.length == 0){
				//get page URL, hash and QueryString for pass-through under the host directory
				qs = location.search;
				hash = location.hash;
				path = location.pathname;
				if (path.length < 2){
					path = '';
				}else{
					path = path.substring(1); //removes starting slash
				}
				
				//combine
				fullpath = path + qs + hash;
				
				pageTracker._trackPageview("/" + hostdir + "/" + fullpath);
			}else{
				pageTracker._trackPageview("/" + hostdir + "/" + qstring);
			}
        }
    }
*/
}

function setLinkAnalytics() {
    // Add click event for Google Analtyics
	$("a:pdf, a:zip").click(function() {
        trackIt(this.href, false);   
    });
    $("a:external").click(function() {
        trackIt('linkout/' + this.href.replace('http://', '').replace('https://', ''), true);
    });
    $("a:mailto").click(function() {
        trackIt('mailto/' + this.href.replace('mailto:', ''), true);   
    });
}

