if (typeof(WWE) == 'undefined') WWE = {};
if (typeof(WWE.Tracking) == 'undefined') {
            WWE.Tracking = function() {
                        var rn = new String(Math.random());
                        var random = rn.substring(2, rn.length);

	                       function createImage (url,r) {
                                    var img = new Image();
                                    img.src = url + (r ? random : '');
                        }

                        return {
                                    registerPage: function (data) {
                                                if (eval(data.exp)) {
                                                            data.urls.each(function(url) {
                                                                        createImage(url, data.bustCache);
                                                            });
                                                }
                                    }
                        };
            }();
}
/**
 * Matches shows found in the current URL
 * 
 * Additional shows:
 * 'survivorseries', 'omgoriginalecwmomentoftheweek',
 * 'wordup', 'santinoscasa', 'dirtsheet', 'weeklytopfive', 'smackdownquickcut',
 * 'rawquickcut', 'ecwquickcut', 'wwemagazine', 'entrancevideo', 'dvdpreviews',
 * 'heat', 'wwerollin', 'lifestylesofthebuiltanddangerous', 'wweuncut', 'wweemergencyroom',
 * 'wwesidesplitters', 'bestworstweek', 'onmydayoff'
 * 
 * @author Kirk R. Gordon
 */
if (typeof(WWE.MatchShows) == 'undefined') {
	WWE.MatchShows = function() {
		var shows = new Array (
						'raw','ecw','smackdown'
					);
		
		var defaultShow = 'other';
		var url = location.href;
		
		return {
			Match: function() {
				for (var i = 0; i < shows.length; i++) {
					var regExp = new RegExp("\/" + shows[i] + "\/");
					if (regExp.test(url)) {
						return shows[i];
					}
				}	
				
				return defaultShow;
			}
		};
	}();
}

/**
 * Returns the correct protocol to use depending
 * on the protocol of the current page. 
 * 
 * If the current page is over a secure connection,
 * JS URLs should use SSL (HTTPS) as well. Otherwise,
 * use standard HTTP.
 * 
 * @author Kirk R. Gordon
 */
if (typeof(WWE.getProtocol) == 'undefined') {
	WWE.getProtocol = function() {
		var url = location.href;
		var regExp = new RegExp("https:\/\/");
		if ( regExp.test(url) ) {
			return "https";
		}
		return "http";
	}
}

var matchedShow = WWE.MatchShows.Match();
document.write('<s'+'cript language="JavaScript" src="' + WWE.getProtocol() + '://view.atdmt.com/jaction/MSFT_WWE_AE_EXT_DATA/v3/ato.ORDERID/atc1.'+matchedShow+'"></s'+'cript>');
document.write('<s'+'cript language="JavaScript" src="' + WWE.getProtocol() + '://resource.wwe.com/wwefooter/jsiswwefooter.js"></s'+'cript>');

