var UsaMegaClient = {
	UserAgent: navigator.userAgent,
	BrowserVersion: 0,

	BanManRot: function () {
		var obj = document.getElementById("HeaderAd");
		
		if (obj && document.createElement && document.getElementsByTagName && document.removeChild) {
		
			function coda() {
				if ((typeof(tagtext) == "string") && (tagtext.length > 0)) {
					obj.innerHTML = tagtext;
					s.parentNode.removeChild(s);
					UsaMegaClient.BanManTick();
					UsaMegaClient.TileManRot();
				}
			};
			
			tagtext = "";
			var id = (Math.random().toString().substring(2) + Math.random().toString().substring(2)).substring(0, 8);
			var url = "http://servedby.advertising.com/site=740656/size=468060/bnum=" + id + "/optn=1";
			var s = document.createElement("script");
			s.id = "BanManScript";
			s.setAttribute("src", url);
			s.setAttribute("type", "text/javascript");
			document.getElementsByTagName("head")[0].appendChild(s);
			window.setTimeout(coda, 3000);
		}
	},
	
	BanManTick: function () {
		window.setTimeout(UsaMegaClient.BanManRot, (60 + (Math.random() * 30)) * 1000);
	},
	
	TileManRot: function () {
		var obj = document.getElementById("TileAd");
		
		if (obj) {
		
			function coda() {
				if ((typeof(tagtext) == "string") && (tagtext.length > 0)) {
					obj.innerHTML = tagtext;
					s.parentNode.removeChild(s);
				}
			};
			
			tagtext = "";
			var id = (Math.random().toString().substring(2) + Math.random().toString().substring(2)).substring(0, 8);
			var url = "http://servedby.advertising.com/site=740570/size=120060/bnum=" + id + "/optn=1";
			var s = document.createElement("script");
			s.id = "TileManScript";
			s.setAttribute("src", url);
			s.setAttribute("type", "text/javascript");
			document.getElementsByTagName("head")[0].appendChild(s);
			window.setTimeout(coda, 3000);
		}
	}
};

// BROWSER DETECTION
var isOpera = !!window.opera; if (isOpera) { var v=UsaMegaClient.UserAgent.match(/Opera\D(\d+(?:\.\d+)?)/); if(v){ UsaMegaClient.BrowserVersion = parseFloat(v[1]); } }
var isOpera75 = ((isOpera) && (UsaMegaClient.BrowserVersion >= 7.5));
var isIE = !!((!window.opera) && (window.attachEvent)); if (isIE) { var v=UsaMegaClient.UserAgent.match(/MSIE\D(\d+(?:\.\d+)?)/); if(v){ UsaMegaClient.BrowserVersion = parseFloat(v[1]); } }
var isIE55 = ((isIE) && (UsaMegaClient.BrowserVersion >= 5.5));
var isIE6 = ((isIE55) && (UsaMegaClient.BrowserVersion >= 6));
var isIE7 = ((isIE6) && (UsaMegaClient.BrowserVersion >= 7.5));
var isIE55or6 = ((isIE55) && (!isIE7));
var isSafari = ((!isOpera) && (!isIE) && (UsaMegaClient.UserAgent.indexOf("AppleWebKit") > -1)); if (isSafari) { var v=UsaMegaClient.UserAgent.match(/Version\D(\d+(?:\.\d+)?)/i); if(v){ UsaMegaClient.BrowserVersion = parseFloat(v[1]); } }
var isSafari2 = ((isSafari) && (UsaMegaClient.BrowserVersion >= 2));
var isSafari3 = ((isSafari2) && (UsaMegaClient.BrowserVersion >= 3));
var isFirefox = ((!isOpera) && (!isIE) && (!isSafari) && (UsaMegaClient.UserAgent.indexOf("Firefox") > -1)); if (isFirefox) { var v=UsaMegaClient.UserAgent.match(/Firefox\D(\d+(?:\.\d+)?)/); if(v){ UsaMegaClient.BrowserVersion = parseFloat(v[1]); } }
var isFirefox2 = ((isFirefox) && (UsaMegaClient.BrowserVersion >= 2));
var isMozilla = (isFirefox) || ((!isOpera) && (!isIE) && (UsaMegaClient.UserAgent.indexOf("Gecko") > -1) && (UsaMegaClient.UserAgent.indexOf("KHTML") == -1));

// BROWSER CAPABILITY
var hasXPath = !!document.evaluate;

if (isIE55) {
	UsaMegaClient.BanManTick();
}

