function _unrulyEC(a){
	var b="";
	for(i=a.length-1;i>=0;i--) {
		b+=a.charCodeAt(i)+1+"x";
	}
	return b;
};


/**
 * This file should have no external JS dependencies (not even unrulyInfo)
 */

var unrulyUtil = unrulyUtil || {};

(function() {
	unrulyUtil.getFixedUrl = function(url, protocol) {
		if (url.indexOf('http') != 0) {
			url = protocol + url;
		}
		
		var encProtocol = encodeURIComponent(protocol);
		var doubleEncProtocol = encodeURIComponent(encProtocol);
		
		if (protocol === 'https:') {
			url = url.replace(/cloud\.video\.unrulymedia\.com/g, 'video.unrulymedia.com');
		}
		
		return (url.replace(/https?:/g,     protocol)
				   .replace(/https?%3A/g,   encProtocol)
				   .replace(/https?%253A/g, doubleEncProtocol));
	};
		
})();

var UnrulyTrackingUtils;

////
if (typeof UnrulyTrackingUtils == 'undefined') {
	UnrulyTrackingUtils =  {
			
		parsePublisherMacros : function(url) {
			var localPublisherMacros = [];
			
			var publisherMacrosString = url.substring(url.indexOf('#'));
	
			if ( typeof publisherMacrosString == 'undefined' ||
				 publisherMacrosString.length < 2 ||
				 publisherMacrosString.indexOf('#') !== 0 || 
				 publisherMacrosString.indexOf('=') === -1) {
				return localPublisherMacros;
			}
			
			var macros = publisherMacrosString.substring(1).split('&');
			
			for (var i=0; i < macros.length; i++) {
				var macro_pair = macros[i].split('=');
				var macro_name = macro_pair[0];
				var macro_value = macro_pair[1];
				localPublisherMacros[macro_name] = decodeURIComponent(macro_value);
			}
			
			return localPublisherMacros;
		},
	
		encodePublisherMacros : function(publisherMacros) {
			var encodedMacroString = "";
			
			if (typeof publisherMacros == 'undefined') {
				return encodedMacroString;
			}
			
			for (var macroName in publisherMacros ) {
				
				if ( !publisherMacros.hasOwnProperty(macroName) ||
					  typeof publisherMacros[macroName] == 'undefined' || 
					  publisherMacros[macroName].indexOf("%%") == 0 || 
					  macroName==='uuid') {
					continue;
				}
				
				if (encodedMacroString.length > 0) {
					encodedMacroString +="&";
				}
				
				encodedMacroString += macroName + '=' + encodeURIComponent(publisherMacros[macroName]); 
			}
			
			return encodedMacroString;
		}
	
	};
}var unrulyHttpsUtil = unrulyHttpsUtil || {};

(function() {
	unrulyHttpsUtil.getFixedUrl = function(url) {
		var allowHttps = true;
					allowHttps = true;
				var protocol = (allowHttps ? document.location.protocol : 'http:');
		return unrulyUtil.getFixedUrl(url, protocol);
	};
})();


function _unrulyCollapseAd() {
	return false;
}

        	function _unrulyGetContentType(supportedFormats) {
            var listHasItem = function (formats, format) {
                for(i=0;i<formats.length;i++) {
                    if(formats[i] == format) {
                        return true;
                    }
                }
                return false;
            };
            
			if(listHasItem(supportedFormats, "html5")) {
                return ((navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.indexOf("Mac") == -1 &&   navigator.appVersion.indexOf("3.1") == -1) 
                     || (navigator.plugins && navigator.plugins["Shockwave Flash"]) || navigator.plugins["Shockwave Flash 2.0"])
                    ? "flash" : "html5";
            }
            else {
                return "flash";
            }
    	}
	function _unrulyRefUrl() {
	if (top === self || typeof(document.referrer) == "undefined" || document.referrer.length < 1) { 
		return document.location.href;
	} else { 
		return document.referrer;
	}
}


function _unrulyTrackCollapsedAd() {
	var trackingCode = [
		'(function() {',
        '	var unrulyTracking = new UnrulyTracking(', 
        '		unrulyHttpsUtil.getFixedUrl("http://stats.unrulymedia.com/"), ', 
        '		unrulyHttpsUtil.getFixedUrl("http://stats2.unrulymedia.com/"), ', 
        '		unrulyHttpsUtil.getFixedUrl("http://stats3.unrulymedia.com/"), ', 
        '       5829,', 
        '       255228,', 
        '       15099,', 
        '       226,', 
        '       5872,', 
        '       2785,', 
        '       "425x375",', 
        '       false,', 
        '       true,', 
        '       4646', 
        '	);',
		'	unrulyTracking.track("collapsed");',
		'}());'
	];

	document.write('<scr'+'ipt src="' + unrulyHttpsUtil.getFixedUrl("http://video.unrulymedia.com/") + 'tracking_v40.js" type="text/javascr'+'ipt"></scr'+'ipt>');
	document.write('<scr'+'ipt type="text/javascr'+'ipt">');
	document.write(trackingCode.join('\n'));
	document.write('</scr'+'ipt>');
}
	
			function UnrulyAP(sk, date, dom, apid, type, supportedFormats) {
	this.sk = sk;
	this.date = date;
	this.dom = dom;
	this.apid = "" + apid;
	this.type = type;
	this.supportedFormats = supportedFormats;
}
UnrulyAP.prototype.isViral = function() {
	return this.type == 'VIRAL';
};
UnrulyAP.prototype.url = function() {
	var url = this.dom;
	var ap = this.apid.length > 0 ? '_' + this.apid : '';
	if (this.isViral()){
		var cType = _unrulyGetContentType(this.supportedFormats);
		
		var macros = '';
		if (typeof unrulyMacros != 'undefined') {
			macros = UnrulyTrackingUtils.encodePublisherMacros(unrulyMacros);
			if (macros.length > 0) {
			   macros += '&';
			}
		}
		var fragment = '#' + macros + 'uuid=' + encodeURIComponent(_unrulyEC(_unrulyRefUrl()));
		
		if ("image" !== cType) {
			url += "iframe_" + this.sk +  "%s_" + cType + ".html?d=" + this.date +
				(typeof wildfireAddParams != "undefined" ? wildfireAddParams : '') + fragment;
		} else {
			url += "default_viral_fallback.html";
		}
	} else {
		url += 'wildfire_' + this.sk + '%s_eclipse.js';
	}
	return url.replace("%s", ap);
};		function UnrulyGeo(fback,noGeo,onHold,sk,time,dom) {
	this.fback = fback;
	this.noGeo = noGeo;
	this.onHold = onHold;
	this.map = {};
	this.sk = sk;
	this.time = time;
	this.dom = dom;
}
UnrulyGeo.prototype.add = function(countryCode, apid, unitType, supportedFormats) {
	this.map[countryCode.toLowerCase()] = new UnrulyAP(this.sk,this.time,this.dom,apid,unitType, supportedFormats);
};
UnrulyGeo.prototype.chooseAp = function(code) {
	if (this.onHold || typeof code == "undefined") {
		return this.noGeo;
	}
	if (code.toLowerCase()=="xx") {
		return this.noGeo;
	} else { 
		var ap = this.map[code.toLowerCase()];
		if (typeof ap == "undefined") {
			return this.fback;
		} else {
			return ap;
		}
	}
};		var writeViral = function(ap) {
			var i = document.getElementById("unruly1328338262458");
			i.style.display="block";
			i.src = ap.url();
		};
		unrulyGeoUrl = function() {
			function getQsParams(){
				var qsParams = {length:0, keys:new Array()};
				var usestr = _unrulyRefUrl();
				if(usestr.split("?").length == 2) {
					var paramInline = usestr.split("?")[1].split("&");
					for(var i = 0; i < paramInline.length; i++){
						qsParams.keys.push(paramInline[i].split("=")[0]);
						qsParams[paramInline[i].split("=")[0]] = paramInline[i].split("=")[1];
						qsParams.length++;
					}
				} 
				return qsParams;
			}
			var href = _unrulyRefUrl();
			if (href.indexOf("unrulyCountry") != -1) {
				var params = getQsParams();
				if (params["unrulyCountry"] != null) {
					unrulyGeoCountryCode = params["unrulyCountry"].toLowerCase();
				}
			}
			var fallback = new UnrulyAP('7409204','1328338262458', unrulyHttpsUtil.getFixedUrl("http://video.unrulymedia.com/"),'default','VIRAL', ["flash","html5"]);
			var geo = new UnrulyGeo(fallback, fallback, false,'7409204', '1328338262458', unrulyHttpsUtil.getFixedUrl("http://video.unrulymedia.com/"));
			var numTerritories = 5;
						geo.add('de', '15063','VIRAL',["flash","html5"]);
						geo.add('it', '15063','VIRAL',["flash","html5"]);
						geo.add('fr', '15063','VIRAL',["flash","html5"]);
						geo.add('es', '15063','VIRAL',["flash","html5"]);
						geo.add('gb', '15099','VIRAL',["flash","html5"]);
				
			var ap = geo.chooseAp(unrulyGeoCountryCode);
			
			if (typeof UNRULY_DEFAULT == 'undefined') {
				UNRULY_DEFAULT = {};
			}
			UNRULY_DEFAULT['' + ap.sk] = ( ap.apid == 'default' );
			if ((numTerritories == 0 || ap.apid == "default") && 2 == 2) {
				document.writeln("<p><div align=\"center\"><object id=\"FlashID\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\"460\" height=\"294\">");
document.writeln("<param name=\"movie\" value=\"http://epltable.com/previewplayer/previewplayer.swf?teams=Watch Premier League Live - Members Only&site=EPLTable.com&ConversionLink=http://epltable.com/watch-football-pc/\" />");
document.writeln("<param name=\"quality\" value=\"high\" />");
document.writeln("<param name=\"wmode\" value=\"opaque\" />");
document.writeln("<param name=\"swfversion\" value=\"6.0.65.0\" />");
document.writeln("<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->");
document.writeln("<param name=\"expressinstall\" value=\"scripts/expressInstall.swf\" />");
document.writeln("<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->");
document.writeln("<!--[if !IE]>-->");
document.writeln("<object type=\"application/x-shockwave-flash\" data=\"http://epltable.com/previewplayer/previewplayer.swf?teams=Watch Premier League with SatelliteDirect&site=EPLTable.com&ConversionLink=http://epltable.com/watch-football-pc/\" width=\"460\" height=\"294\">");
document.writeln("<!--<![endif]-->");
document.writeln("<param name=\"quality\" value=\"high\" />");
document.writeln("<param name=\"wmode\" value=\"opaque\" />");
document.writeln("<param name=\"swfversion\" value=\"6.0.65.0\" />");
document.writeln("<param name=\"expressinstall\" value=\"scripts/expressInstall.swf\" />");
document.writeln("<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->");
document.writeln("<div>");
document.writeln("<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>");
document.writeln("<p><a href=\"http://www.adobe.com/go/getflashplayer\"><img src=\"http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif\" alt=\"Get Adobe Flash player\" /></a></p>");
document.writeln("</div>");
document.writeln("<!--[if !IE]>-->");
document.writeln("</object>");
document.writeln("<!--<![endif]-->");
document.writeln("</object></div></p>");

			} else if (ap.isViral()) {
				writeViral(ap);
			} else {
				document.write('<scr'+'ipt src="' + ap.url() + '" type="text/javascr'+'ipt"></scr'+'ipt>');
			}
		}

		if (_unrulyCollapseAd()) {
			_unrulyTrackCollapsedAd();
		} else {
    		document.write('<iframe id="unruly1328338262458" style="display:none;" frameborder="0" scrolling="no" width="425" height="375" src="javascript:\'\'"></iframe>');
    		document.write('<scr'+'ipt src="' + unrulyHttpsUtil.getFixedUrl('http://video.unrulymedia.com/') + 'country_code.js?version=5" type="text/javascr'+'ipt"></scr'+'ipt>');
		}
	
