/************** globalmoo.js *************************************************/
/* 
	Requires Mootools v1.2  - mootools.js
*/

//James Scott - To put the DART tag ord variable once in the global JS
var ord=Math.random()*10000000000000000;

/* 
Use mootools equivalent $()
function returnObjById( id ) { } 
*/

/*Attach events*/
//	alert('Browser.Engine.name = "' + Browser.Engine.name + '"\nBrowser.Engine.version=' + Browser.Engine.version + '\nnavigator.appVersion=' + navigator.appVersion);
//if ( (! Browser.Engine.trident) || (! navigator.appVersion.toLower().indexOf("msie 5///"))) {  // if browser is NOT ie, or if browser version is above 5.5
window.addEvent('domready', function() {
	if ((! Browser.Engine.trident) || (document.compatMode && document.all)) {  // if browser is NOT ie, or if IE 6+

		//Check all links and modify external links to go via bounce.aspx
		var bounceURL = "redirect/bounce.aspx?cid=";
		var myDomain = location.hostname.toLowerCase();

		$$('a').each( function(currA, i){
			//If external link, modify href to go via bounce.aspx
			if (currA.href != '' && currA.protocol.toLowerCase().search(/https?:/) != -1 && currA.hostname.toLowerCase() != myDomain) { 
				var thisCID;
				var replacementCID = currA.className.match(/cid(\d+)/i);
				if (replacementCID) { thisCID = replacementCID[1]; }else{ thisCID = pageCID;}
				currA.href = bounceURL + thisCID + "&url=" + currA.href;
			}
		
			//If class="newWin", force link to open in new window
			if (currA.className.match("newWin")) {
				currA.addEvent('click', function() {
					window.open(this.href);
					return false;
				})
			}
		});


	} else {
		//alert('Browser not supported - upgrade!\n\n' + navigator.appVersion);
	}

});

window.addEvent('unload', function() {
	if ($('divGMap')) { GUnload();}
});

/************** globalmoo.js *************************************************/
