/**
 * Google's ga.js is a pretty big file, so we don't want the user to have to
 * wait for it to load -- Google wants you to put the code at the end of the
 * <body>. However, it's bad for some browsers to have <script> tags in the
 * body at all, so we use JavaScript to dynamically include the GA JavaScript.
 */
function loadGoogleAnalytics() {
	var d = document;
	var t = 'text/javascript';
	var h = d.getElementsByTagName('head')[0];

	// The G.A. JavaScript file:
	var gaJsHost = "http://www.google-analytics.com/ga.js";
	// If our site is using SSL at the moment we use a slightly different URL.
	if (d.location.protocol == "https:") {
		gaJsHost = "https://ssl.google-analytics.com/ga.js";
	}

	// First <script> loads the ga.js file
	var gajs = d.createElement('script');
	gajs.id = 'gajs';
	gajs.type = t;
	gajs.src = gaJsHost;
	h.appendChild(gajs);

	// Second script tells G.A. our tracker info
	var gatr = d.createElement('script');
	gatr.id = 'gatr';
	gatr.type = t;
	gatr.src = '/portal_javascripts/Nazareth%20College%20Admissions/++resource++plonetheme.nazadmissions.javascript/ga_tracker.js';
	h.appendChild(gatr);
}
/**
 * If we need to unload G.A. JS for some reason.
 */
function unloadGoogleAnalytics() {
	var d = document;
	var h = d.getElementsByTagName('head')[0];
	var gajs = document.getElementById('gajs');
	var gatr = document.getElementById('gatr');
	h.removeChild(gajs);
	h.removeChild(gatr);
}

if (!jQuery){
	var errMsg="jQuery is required for this script to work properly.\nPlease install jQuery 1.2 or higher.";
	alert(errMsg);
	throw new Error(errMsg);
}

jQuery.noConflict();

jQuery(document).ready(loadGoogleAnalytics);
