// mYm global.js 2.1 - by brent@mimoYmima.com - edited Sept 28, 2007
		
// Add page load events ~ by Simon Willison
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
			}
			func();
		}
	}
}
// Functions added at bottom of this document


// Any Anchor With the Class of "Popup" will open in a new window ~ by Jeremy Keith
function makePopUp() {
	if (!document.getElementsByTagName) return false;
	var lnks = document.getElementsByTagName("a");
	for (var i=0; i<lnks.length; i++) {
		if (lnks[i].getAttribute("class") == "Popup") {
			lnks[i].onclick = function() {
				popUp(this.getAttribute("href"));
				return false;
			}
		}
	}
}
// Add Attributes to the PopUp
function popUp(winURL) {
  window.open(winURL,"Popup","width=950,height=750,scrollbars,resizable");
}


// GAAdd v.0.5 ~ Adds Google Analytics Code automatically when js is available ~ by Brent Lagerman
function GAAdd() {
	var GAAccount = 'UA-3129574-1'; //change this to your google account number
	//insert the first script tag
	var InsertGC1 = document.body.lastChild;
	var GoogCode1 = document.createElement('script');
	GoogCode1.src = 'http://www.google-analytics.com/urchin.js'
	GoogCode1.type = 'text/javascript';
	InsertGC1.parentNode.insertBefore(GoogCode1, InsertGC1.nextSibling); //same as insertAfter
	//insert the second script tag
	var InsertGC2 = document.body.lastChild;
	var GoogCode2 = document.createElement('script');
	GoogCode2.type = 'text/javascript';
	GoogCode2.appendChild(document.createTextNode('_uacct = "'+GAAccount+'"; urchinTracker();'));
	InsertGC2.parentNode.insertBefore(GoogCode2, InsertGC2.nextSibling);
}

// Add Load Events
addLoadEvent(makePopUp);
addLoadEvent(GAAdd);