(function () {
	var SCRIPT_PATH = window.nfl && nfl.constants ? nfl.constants.SCRIPT_PATH : 'http://scripts.static.nfl.com/static/site'; // 'http://local.nfl.com:8080';
	
	function setup() {
		/*************************** START CONFIGURATION SECTION ******************************/
		/*
		 example below has one filter for all ads on the draft 2009 tracker page that are in slot rightrailfirst
		 and another for all ads across the entire news section.

		 !!! do not remove example below, other people may need this :D !!!


			var n_internal_ads		= [
				               		[{type:'url',match:'/draft/2009/tracker'},{type:'slot',match:'rightrailfirst'}],
				               		[{type:'section',match:'/news'}]
			];

		*/
		/**************************** END CONFIGURATION SECTION *******************************/

		/**
		 * ****************************** START LIB SECTION
		 * **********************************
		 */
		Date.ET_OFFSET = -4 * 60 * 60 * 1000; // milliseconds behind GMT for ET
		Date.EDT_OFFSET = -4 * 60 * 60 * 1000; // milliseconds behind GMT for ET
		// JS version of Ruby on Rails' distance_of_time_in_words
		Date.distance_of_time_in_words = function (from_time, to_time, include_s) {
			var include_seconds, distance_in_minutes, distance_in_seconds;
			include_seconds = include_s || false;
			distance_in_minutes = Math.round(Math.abs(to_time - from_time) / 60000);
			distance_in_seconds = Math.round(Math.abs(to_time - from_time) / 1000);
			if (distance_in_minutes < 2) {
				if (include_seconds) {
					if (distance_in_seconds < 5) { return 'less than 5 seconds'; }
					if (distance_in_seconds < 10) { return 'less than 10 seconds'; }
					if (distance_in_seconds < 20) { return 'less than 20 seconds'; }
					if (distance_in_seconds < 40) { return 'half a minute'; }
					if (distance_in_seconds < 59) { return 'almost a minute'; }
					return '1 minute';
				}
				return (distance_in_minutes === 0) ? 'less than a minute' : '1 minute';
			}
			if (distance_in_minutes < 45) { return distance_in_minutes + ' minutes'; }
			if (distance_in_minutes < 89) { return 'about 1 hour'; }
			if (distance_in_minutes < 1439) { return 'about ' + Math.round(distance_in_minutes / 60) + ' hours'; }
			if (distance_in_minutes < 2879) { return '1 day'; }
			if (distance_in_minutes < 43199) { return Math.round(distance_in_minutes / 1440) + ' days'; }
			if (distance_in_minutes < 86399) { return 'about 1 month'; }
			if (distance_in_minutes < 525599) { return Math.round(distance_in_minutes / 43200) + ' months'; }
			if (distance_in_minutes < 1051199) { return 'about 1 year'; }
			return 'over ' + Math.round(distance_in_minutes / 525600) + ' years';
		};
		Object.extend(Date.prototype, {
			/**
			 * Returns the current month in AP Style
			 */
			getAPStyleMonth: function() {
				switch(this.getMonth()) {
					case  0: return 'Jan.';
					case  1: return 'Feb.';
					case  2: return 'March';
					case  3: return 'April';
					case  4: return 'May';
					case  5: return 'June';
					case  6: return 'July';
					case  7: return 'Aug.';
					case  8: return 'Sept.';
					case  9: return 'Oct.';
					case 10: return 'Nov.';
					case 11: return 'Dec.';
				}
			},
			/**
			 * Returns the current time in AP Style
			 */
			getAPStyleTime: function(_includeSeconds) {
				var h, m, a, s = '';
				h = this.getHours();
				a = (h > 11) ? ' p.m.' : ' a.m.';
				if (h === 0 && ! _includeSeconds) { return 'midnight'; }
				else if (h === 0) { h = 12;}
				else if (h === 12 && ! _includeSeconds) { return 'noon';}
				else if (h > 12) { h -= 12;}
				m = this.getMinutes();
				m = (m === 0 && ! _includeSeconds) ? '' :
				    (m < 10) ? ':0' + m :
				    ':' + m;
				if (_includeSeconds) {
					s = this.getSeconds();
					s = (s < 10) ? ':0' + s : ':' + s;
				}
				return h + m + s + a;
			},
			/**
			 * Converts the current date to the equivalent time in ET.
			 */
			toET: function() {
				return new Date( this.getTime() + this.getTimezoneOffset() * 60000 + nfl.constants.ET_OFFSET );
			},
			/**
			 * Converts a date to its string representation in AP Style, ET.
			 */
			toAPStyle: function( _includeTime, _includeSeconds ) {
				var etDate = this.toET();
				return etDate.getAPStyleMonth() + ' ' + etDate.getDate() + ', ' + etDate.getFullYear() + ( ( _includeTime ) ? ' at ' + etDate.getAPStyleTime(_includeSeconds) : '' );
			},
			/**
			 * Returns the full name of the date's day.
			 */
			getDayName: (function(){
				var NAMES = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"];
				return function() { return NAMES[this.getDay()]; };
			}()),
			/**
			 * Returns the time since this date in English
			 */
			time_ago_in_words: function (include_seconds) {
				var now, direction;
				now = new Date();
				direction = (now - this > 0) ? ' ago' : ' from now';
				return Date.distance_of_time_in_words(this, now, include_seconds) + direction;
			}
		});
		Object.extend(String.prototype,{
			similarColor: function(c){
				var v1		= this;
				var v2		= c;
				if(this.indexOf('#') !== -1 || arguments[0].indexOf("#") !== -1){
					/* has hex hash sign, strip em */
					v1	= v1.replace('#','');
					v2	= v2.replace('#','');
				}
				if(this.indexOf('rgb') !== -1 && arguments[0].indexOf("rgb") !== -1){
					/* has rgb values */
				}
				// if((v1.length !== 6 || v2.length !== 6) && v){ return false; }
				var tol		= 78;
				var c0 		= (v1.indexOf('0x') > -1)?{'r':(parseInt(v1.substring(2,4), 16)),'g':(parseInt(v1.substring(4,6), 16)),'b':(parseInt(v1, 10) & 0xff)}:{'r':(parseInt(v1.substring(1,3), 16) >> 16),'g':(parseInt(v1.substring(3,5), 16) >> 8),'b':(parseInt(v1.substring(5,7), 16))};
				var c1 		= (v2.indexOf('0x') > -1)?{'r':(parseInt(v2.substring(2,4), 16)),'g':(parseInt(v2.substring(4,6), 16)),'b':(parseInt(v2, 10) & 0xff)}:{'r':(parseInt(v2.substring(1,3), 16) >> 16),'g':(parseInt(v2.substring(3,5), 16) >> 8),'b':(parseInt(v2.substring(5,7), 16))};
				var d 		= {'r':(Math.abs(c0.r - c1.r)),'g':(Math.abs(c0.g - c1.g)),'b':(Math.abs(c0.b - c1.b))};
				//console.info('similarColors: ',c0,c1,d);
				if ( (d.r + d.g < tol && d.r + d.b < tol) || (d.r + d.g < tol && d.b + d.g < tol) || (d.r + d.b < tol && d.b + d.g < tol)) {
					// console.log('similarColor: returning true for '+v1+'
					// '+v2+'\n\r'+(d.r + d.g < tol && d.r + d.b < tol)+'\n\r'+(d.r +
					// d.g < tol && d.b + d.g < tol)+'\n\r'+(d.r + d.b < tol && d.b +
					// d.g < tol));
					return true;
				}
				// console.log('similarColor: returning false for '+v1+'
				// '+v2+'\n\r'+(d.r + d.g < tol && d.r + d.b < tol)+'\n\r'+(d.r + d.g <
				// tol && d.b + d.g < tol)+'\n\r'+(d.r + d.b < tol && d.b + d.g < tol));
				return false;
			}
		});
		/*
		 * Prototype Document level events to YUI Global events bridge
		 * document.fire now fires both prototypes document.fire AND yui's global event using same event name
		 * 
		 * @author a.w.
		 * @todo remove once ALL prototype based components are migrated to yui
		 * */
		if (Object.isFunction(nfl.use)) {
			nfl.use('event-custom', function (Y) {
				var publisher = new Y.EventTarget();
				Object.extend(document, {
					_fire: Element.Methods.fire.methodize(),
					fire: function (eventName, memo) {
						var evt = document._fire(eventName, memo);
						// if Prototype hasn't halted the event, don't fire it to YUI
						if (!evt.stopped) {
							// publish the event globally
							if (! publisher.getEvent(eventName)) {
								publisher.publish(eventName, {
									broadcast: 2,
									emitFacade: true
								});
							}
							evt.stopped = !publisher.fire(eventName, { memo: memo });
						}
						return evt; // to match document.fire's current signature
					}
				});
			});
		}

		Element.addMethods({
			getOuterHTML: function (element) {
				if (element.outerHTML) {
					return element.outerHTML;
				}
				var parent = element.parentNode;
				var el = document.createElement(parent.tagName);
				el.appendChild(element);
				var shtml = el.innerHTML;
				parent.appendChild(element);
				return shtml;
			},
			templatize: (function(){
				var FIND = /#%7B([^%]+)%7D/g, REPLACE = "#{$1}", ERROR = 'Could not templatize element ', EMPTY = "",
				    DATA_RE = / data\-(href|src|action|style)="([^"]*)"/g, DATA_REPLACE = ' $1="$2"';
				return function( _ref, _hide ) {
					var el, t, html;
					el = $(_ref);
					if (! el) { throw( ERROR + _ref ); }
					html = el.innerHTML.replace( FIND, REPLACE ).replace(DATA_RE, DATA_REPLACE);
					t = new Template( html );
					if ( false !== _hide ) {
						el.update( EMPTY );
						el.hide();
					}
					return t;
				};
			})(),
			text: function(el) {
				return el.innerText || el.textContent;
			}
		});
		Object.extend(Number.prototype, {
			commaify: (function() {
				var FIND    = /(\d)(\d{3}(?:,\d{3})*(?:\.\d+)?)$/,
				    REPLACE = "$1,$2";

				return function() {
					var workingString, selfAsString = this.toString();

					while (workingString !== selfAsString) {
						workingString = selfAsString;
						selfAsString  = selfAsString.replace(FIND, REPLACE);
					}
					return selfAsString;
				};
			}()),
			pluralEnding: function() { return (this - 1 === 0) ? '' : 's'; } // this === 1 -> false
		});
		Math.randomByTime = function () {
			var time, d;
			d = new Date();
			d.setSeconds(Math.floor(d.getUTCSeconds() / 10) * 10);
			d.setMilliseconds(0);
			time = d.getTime();
			return time;
		};
		/**
		 * Prototype 1.6 includes a toJSON method on Array
		 * that breaks native JSON stringification. This
		 * will be removed in Prototype 1.7, so we shouldn't
		 * be using it anyway.
		 */
		if (typeof Array.prototype.toJSON === 'function') {
			delete Array.prototype.toJSON;
		}
		String.prototype.truncateAtLastWord = function (intLength) {
			try {
				var tStr = this.truncate(intLength);
				if (tStr.endsWith('...')) {
					return this.truncate(((tStr.lastIndexOf(' ')+1)+3));
				}
				else {
					return this;
				}
			}
			catch (e) {
				nfl.log(e.message);
			}
		};
		Object.extend(Prototype.Browser,{Version: (navigator.userAgent.toLowerCase().match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1], Chrome: navigator.userAgent.toLowerCase().match(/chrome/), IPhone: navigator.userAgent.toLowerCase().indexOf('iphone;') > -1, PalmPre: navigator.userAgent.toLowerCase().indexOf('webos/') > -1, Android: navigator.userAgent.toLowerCase().indexOf('android') > -1 });
		Function.prototype.defaults = function (origArgs) {
			for (var i = 0, j = 1; j < arguments.length; i++, j++) {
				if (typeof origArgs[i] == 'undefined') {
					origArgs[i] = arguments[j];
				}
			}
		};
		Object.extend(document, {
			cookies: function(){
				return {
					getValue: function(offset){
						var endstr = document.cookie.indexOf (";", offset);
						if (endstr == -1) {
							endstr = document.cookie.length;
						}
						return unescape(document.cookie.substring(offset, endstr));
					},
					get: function(name) {
						var arg = name + "=";
						var alen = arg.length;
						var clen = document.cookie.length;
						var i = 0;
						while (i < clen) {
							var j = i + alen;
							if (document.cookie.substring(i, j) == arg) {
								return document.cookies.getValue(j);
							}
							i = document.cookie.indexOf(" ", i) + 1;
							if (i === 0) {
								break;
							}
						}
						return "";
					},
					set: function (name, value, expires, path, domain, secure, raw) {
						document.cookie = name + "=" + (raw?value:escape(value)) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
					},
					remove: function (name,path,domain) {
						if (document.cookies.get(name)) {
							document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
						}
					},
					getExipiry: function(days, hours, minutes) {
						var expDate = new Date();
						if (typeof days == "number" && typeof hours == "number" && typeof hours == "number") {
							expDate.setDate(expDate.getDate() + parseInt(days, 10));
							expDate.setHours(expDate.getHours() + parseInt(hours, 10));
							expDate.setMinutes(expDate.getMinutes( ) + parseInt(minutes, 10));
							return expDate.toGMTString();
						}
					}
				};
			}(),
			insertAfter: function (new_node, existing_node) {
				try {
					if (existing_node.next()) {
						existing_node.parentNode.insertBefore(new_node,existing_node.next());
					}
					else {
						existing_node.parentNode.appendChild(new_node);
					}
				}
				catch (err) {
					console.log("insertAfter Error: "+ err.message);
				}
			},
			include: function (path) {
				try{
					var curScriptsRoot="";
					var curScriptName=path;
					curScriptName='imported-js-'+ curScriptName.substring(curScriptName.lastIndexOf('/')+1,curScriptName.lastIndexOf('.js')).replace('.','-');
					if (path.indexOf('http://') === -1) {
						var curScripts = document.getElementsByTagName("script");
						for (var s=1;s<curScripts.length;s++) {
							try {
								if(curScripts[s].src !== ''){
									var curScriptsRootTemp = (curScripts[s].src);
									if (curScriptsRootTemp.indexOf("/scripts")){
										curScriptsRoot = curScriptsRootTemp;
										curScriptsRoot = curScriptsRoot.substring(0,curScriptsRoot.indexOf("/scripts"));
										break;
									}
								}
							}
							catch (e) { console.error('document.include error',e);}
						}
					}
					var headEle	= document.getElementsByTagName("head")[0];
					var scriptEle = document.createElement('script');
					scriptEle.id = curScriptName;
					scriptEle.type = 'text/javascript';
					scriptEle.src = (curScriptsRoot + path);
					headEle.appendChild(scriptEle);
				}catch(e){ console.error('document.include error',e); }
			}
		});
		/*
		 * Creates a cross-browser "window:hashchange" event using the document object,
		 * listens for native support for the hashchange event and uses that. Otherwise,
		 * it checks for hash change at a standard interval.
		 *
		 * The `memo` property of the event is the results of calling
		 * window.location.hashparams.get()
		 *
		 * usage: document.observe('window:hashchange',func);
		 */
		(function() {
			var hashChecker;
			function fireHashChangeEvent(event) {
				var hashHash = window.location.hashparams.get();
				document.fire('window:hashchange', hashHash ? hashHash.toObject() : {});
			}
			function checkHashChange(event) {
				try {
					Event.stopObserving(window, 'hashchange', checkHashChange);
					Event.observe(window, 'hashchange', fireHashChangeEvent);
					clearInterval(hashChecker);
					fireHashChangeEvent(event);
				} catch(e) {console.error(e);}
			}
			function hasHashChanged() {
				if(window.__hash == location.hash){ return; }
				window.__hash = location.hash;
				fireHashChangeEvent();
			}
			Event.observe(window, 'hashchange', checkHashChange);
			try {
				window.__hash = location.hash;
				hashChecker = setInterval(hasHashChanged, 100);
			} catch(e) {console.error(e);}
		})();
		window.location.hashparams = function(){
			return {
				getStringFromHash: function(oHash){
					var retStr, hashObj = $H(oHash);
					retStr	= (Object.toJSON(hashObj).replace(/("| )/gi,'').replace(/,/gi,'/'));
					retStr	= retStr.substring(1,retStr.length - 1);
					return retStr;
				},
				getHashFromString: function(stringObj){
					if (stringObj.strip() === ''){
						return null;
					}
					var hashParams	= stringObj.split('/');
					var actParams	= new Hash();
					var paramSet;
					for(var ap=0; ap < hashParams.length; ap++){
						if(hashParams[ap].indexOf(':') > -1){
							paramSet	= hashParams[ap].split(':');
							actParams.set(paramSet[0],paramSet[1]);
						}else{
							actParams.set(hashParams[ap],hashParams[ap]);
						}
					}
					return actParams;
				},
				get: function(){ return window.location.hashparams.getHashFromString(location.hash.replace('#',''));},
				set: function(hashParams,replace){
					var hash	= ("#"+ (window.location.hashparams.getStringFromHash(hashParams)));
					if(typeof replace === 'boolean'){
						if(replace === true){
							var href = window.location.href;
							if(href.indexOf('#') > -1){
								href = href.substring(0,href.indexOf('#'));
							}
							window.location.replace(href+hash);
							return true;
						}
					}
					location.hash = hash;
				},
				remove: function(){
					var h	= this.get();
					if(h){
						for(var hi=0; hi < arguments.length ;hi++){
							if(typeof (h.get(arguments[hi])) !== 'undefined'){ h.unset(arguments[hi]); }
						}
					}
					this.set(h,true);
				}
			};
		}();
		document.observe("dom:ready",function(){
			if(!document.ready){ document.ready = true; document.fire("dom:beforeloaded");}
			if(!document.loaded){ document.loaded = true; document.fire("dom:loaded");}
		});
		if(typeof nfl === 'undefined'){ nfl = {}; }
		(function (_nfl) {

			/**
			 * Creates new namespaces under the nfl namespace
			 *
			 * @param {String}
			 *            The name of the new namespace
			 */
			_nfl.namespace=function(){ var a=arguments,o=null,i,j,d;for(i=0;i<a.length;++i){d=a[i].split(".");o=nfl;for(j=(d[0]=="nfl")?1:0;j<d.length;++j){o[d[j]]=o[d[j]]||{};o=o[d[j]];}} return o;};
			_nfl.namespace("ui","util","global","data","analytics");
			_nfl.global.debugenabled	= true;
			_nfl.global.SEARCH_ADS	= true;

			window.nfl = _nfl;

		}(window.nfl || {}));
		/**
		 * Writes a message to the console (if available) and prevents programs
		 * from throwing errors on browsers missing a console.
		 *
		 * @param {String}
		 *            message The message to write
		 */
		(function () {
			var f = Prototype.emptyFunction, needsConsole = Object.isUndefined(window.console);

			if (needsConsole && (document.cookies.get('debug') == 'true')) {
				document.include('http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js');
			} else if (needsConsole) {
				window.console = { log: f, debug: f, info: f, warn: f, error: f, assert: f, dir: f, dirxml: f, group: f, groupEnd: f, time: f, timeEnd: f, count: f, trace: f, profile: f, profileEnd: f };
				nfl.log = f;
			}
			nfl.log = function(s,r){
				try {
					console.log.apply(console, arguments);
				}
				catch (e){
					try{
						if (typeof r !== 'undefined') {
							console.log(s,r,e);
						}
						else{
							console.log(s,e);
						}
					}
					catch (e2){console.error(e2);}
				}
			};
		}());
		/**
		 * Loads in the environmental variables
		 */
		if(typeof nfl.constants !== 'undefined'){
			Object.extend(nfl.global,nfl.constants);
		}
		//add in deprecations
		Object.extend(nfl.global, {
			imagepath: nfl.global.IMAGE_PATH,
			scriptpath: nfl.global.SCRIPT_PATH,
			flashpath: nfl.global.FLASH_PATH,
			ecmimagepath: nfl.global.ECM_IMAGE_PATH,
			searchdomain: nfl.global.SEARCH_DOMAIN
		});

		(function () {
			/**
			 * Initialize nfl.util.cookies namespace note: these functions have been moved
			 * to document.cookies. these references are just pointers now. (a.w.)
			 */
			nfl.namespace("util.cookies");
			var cookiePointers = {
				getCookieVal: document.cookies.getValue,
				getExpDate:   document.cookies.getExipiry,
				getCookie:    document.cookies.get,
				setCookie:    document.cookies.set,
				deleteCookie: document.cookies.remove
			};
			Object.extend(nfl.util.cookies, cookiePointers);
			Object.extend(window, cookiePointers);
		}());

		/**
		 * Adds a module dependency to fix YUI/Prototype problems
		 */
		(function (nfl, Y, YUI_config, NFL_config) {
			// don't destroy exisiting constants
			if (! nfl.constants) {
				nfl.constants = nfl.global;
			}
		}(window.nfl || {}, window.Y || YUI(), window.YUI_config || {}, window.NFL_config || {}));

		// TODO: Remove this once everything is on the prototype-compat module
		if (typeof YUI !== 'undefined') { 
			Array.prototype._reduce = Array.prototype.reduce;
			Object.extend(Array.prototype, {
				reduce : function(f,i){
				    if(arguments.length > 0){
				        //use native arguments, pass to replicator
				        var r = i;
				        for(var it=0,al=this.length; it < al; it++){
				            r = f(r, this[it], it, this); //previousValue, currentValue, index, array
				        }
				        return r;
				    }else{
				        return this._reduce();
				    }
				}
			});
		}

		(function () {
			nfl.namespace('nfl.events');
			Object.extend(nfl.events, {
				/**
				 * Enables Flash to fire prototype custom events.
				 */
				fire: function( _type, _memo, _dispatcher ) {
					Element.fire($(_dispatcher) || document, _type, _memo );
				},
				available: function() { return true; },
				/**
				 * Constant for monitoring the hash change
				 */
				WindowEvent : { HASH_CHANGE: "window:hashchange" }
			});
		}());
		(function () {
			/**
			 * functions and properties for manipulating ads
			 *
			 * @author arianna.winters
			 * @namespace nfl
			 * @requires nfl
			 */
			nfl.namespace("nfl.ads");
			Object.extend(nfl.ads, {
				collection:       [],
				visibleAds:       0,
				hasRotating:      false,
				rotationInterval: 30,
				internal:         window.n_internal_ads || false
			});

			/**
			 * ad object
			 *
			 * @author arianna.winters
			 * @namespace nfl.ads
			 * @class nfl.ads.Ad
			 * @requires nfl.ads
			 */
			nfl.ads.Ad	= Class.create({
				initialize: function(div, params, options) {
					this.pathOnly = (options.pathOnly)?true:false;
					this.params	= params;
					this.options = (typeof options === 'undefined')?{}:options;
					this.tile	= (typeof options.tile === 'undefined')? (nfl.ads.collection.length + 1):options.tile;
					this.rotate	= (typeof options.rotating === 'undefined')? false:options.rotating;
					this.onload	= (options.onload)?' onload="'+options.onload+'"':'';
					this.url	= (typeof this.options.url !== 'undefined')?this.options.url:this.getUrl();
					this.options.write	= (typeof this.options.write === 'undefined')?true:this.options.write;
					this.oid	= div;
					if (this.tile === 1 && this.params.indexOf('dcopt=ist') <= 0){
						//if(typeof this.options.slot !== 'undefined'){
						//	if(this.options.slot !== 'inpage' && this.options.slot !== 'videogallery') {
						//		params += ";dcopt=ist";
						//	}
						//}else{
							this.params += ";dcopt=ist";
						//}
					}
					//console.info('Ad #'+this.tile+' params:',this.params);
					
					if(!this.pathOnly){
						this.adClassInt	= (nfl.ads.visibleAds + 1);
						var el;
						/* if(!div.id){ div, this.tile } - removed what's this supposed to do?*/
						el			= $(div);
						this.id		= ("ad" + this.adClassInt +'-iframe');
						if (el) {
							el.addClassName('ad'+this.adClassInt);
							this.id	= (el.id + '-iframe');
							if (this.options.write) {
								this.write();
							}
						}
						nfl.ads.add(this);
						el = null;
					}else{
						this.adClassInt	= false;
						this.id		= false;
						nfl.ads.add(this);
						return (this.params.replace('#{tile}',this.tile) +(this.params.indexOf(';ord=') < 0 ? ';ord=' + adRandom + '?' : ''));
					}
				},

				getInternal: function(){
					if(typeof nfl.ads.internal !== 'undefined'){
						for(var adi=0,adl=nfl.ads.internal.length; adi < adl; adi++){
							var matchesAll	= (nfl.ads.internal[adi].length > 0)?true:false;
							for(var adifl=0; adifl < nfl.ads.internal[adi].length; adifl++){
								var match	= nfl.ads.internal[adi][adifl];
								// console.log('getInternal doing a crit match on '+
								// match.id+' '+match.type+' for '+match.match);
								if(match.type == 'global'){
									// console.log(window.location.domain +'!=='+
									// match.match +'?'+(window.location.domain !==
									// match.match));
									if(window.location.domain !== match.match){ matchesAll = false; break; }
								}
								if(match.type == 'url'){
									// console.log(window.location.pathname +'!=='+
									// match.match +'?'+(window.location.pathname !==
									// match.match));
									if(window.location.pathname !== match.match){ matchesAll = false; break; }
								}
								if(match.type == 'section'){
									// console.log(window.location.pathname +'.indexOf('+
									// match.match +') !==
									// 0?'+(window.location.pathname.indexOf(match.match)
									// !== 0));
									if(window.location.pathname.indexOf(match.match) !== 0){ matchesAll = false; break; }
								}
								if(match.type == 'slot'){
									// console.log(this.options.slot +'!=='+ match.match
									// +'?'+(this.options.slot !== match.match));
									if(this.options.slot !== match.match){ matchesAll = false; break; }
								}
							}
							if(matchesAll){
								/* this guy matches the subset criteria, replace him */
								return ('http://www.nfl.com/widgets/ads-served-by-nfl/' + this.options.width + 'x' + this.options.height + '?template=basic-html-structure&confirm=true');
								// break;
							}
						}
					}
					return false;
				},
				getUrl: function(){
					var mInt	= this.getInternal();
					if (mInt) {
						/* do something funny */
						this.url		= mInt;
						this.getInternal	= function(){
							return mInt;
						};
					}else{
						if(this.tile == 1 && this.options.slot != 'inpage' && this.options.slot != 'videogallery'&& this.params.indexOf('dcopt=ist') <= 0) {
							this.params += ";dcopt=ist";
						}
						this.url		= 'http://ad.doubleclick.net/adi/'+ this.params.replace('#{tile}',this.tile) +';ord=' + adRandom + '?';
					}
					return this.url;
				},
				update: function() {
					// nfl.log("reload #"+ this.adClassInt);
					this.write();
				},
				write: function(){
					var self = this, container = $(this.oid);
					container.update(this.getIframeHTML((Prototype.Browser.Gecko && (Prototype.Browser.Version).indexOf('1.9.2') === 0)? false : true));
					if(Prototype.Browser.Gecko && (Prototype.Browser.Version).indexOf('1.9.2') === 0){
						setTimeout(function () {
							container.down('iframe').setAttribute('src', self.getUrl());
						}, 50);
					}
					
					this.setParentSize(); // we do this just in case
				},
				getIframeHTML: function(src){
					return (!this.options.transparent)? '<iframe '+ ((typeof src === 'undefined' || src === true)? 'src="'+ this.url +'" ':'')+'id="' + this.id + '" name="' + this.id + '" width="' + this.options.width + '" height="' + this.options.height + '" frameborder="0" scrolling="no"'+ this.onload +'></iframe>':'<iframe '+ ((typeof src === 'undefined' || src === true)? 'src="'+ this.url +'" ':'')+'id="' + this.id + '" name="' + this.id + '" width="' + this.options.width + '" height="' + this.options.height + '" allowTransparency="true" frameborder="0" scrolling="no"'+ this.onload +'></iframe>';
				},
				setParentSize: function(){
					var _p		= $(this.oid);
					var _dims	= {width:parseInt(_p.getStyle('width'), 10),height:parseInt(_p.getStyle('height'), 10)};
					if(this.options.width !== _dims.width && this.options.width > 0){
						_p.setStyle({'width':(this.options.width+'px')});
					}
					if(this.options.height !== _dims.height && _dims.height > 0){
						_p.setStyle({'height':(this.options.height+'px')});
					}
				}
			});
			// factory method to create ads in concert with YUI.
			nfl.ads.createAd = function (div, params, options) {
				if(typeof options !== 'undefined'){
					if(options.pathOnly){
						var _xAd	= new nfl.ads.Ad(div, params, options);
						var _r		= (_xAd.params.replace('#{tile}',_xAd.tile) +';ord=' + adRandom + '?')
						return _r;
					}
				}
				return new nfl.ads.Ad(div, params, options);
			};
			nfl.ads.rotation	= new (Class.create({
				initialize:function(){
					this.elapsor	= null;
					this.rotator	= null;
					this.interval	= 30; /* we assign a default of 30 just in case */
					this.useElapsed = false;
				},
				rotate: function(){
					// console.info('nfl.ads.rotate');
					var __log	= '';
					nfl.ads.random(); // first update the adRandom var
					nfl.ads.collection.each(function (Ad) {
						if (Ad.rotate) {
							Ad.update(Ad);
							__log += '#'+Ad.adClassInt+' "'+ Ad.id+'" rotated.\n';
							/* this is a rotating ad, rotate it */
						} else {
							__log +='#'+Ad.adClassInt+' "'+ Ad.id+'" not rotated.\n';
						}
					});
					console.log('nfl.ads.rotate ('+ this.interval +' secs)\n'+ __log);
					this.elapsed = 0;
					/*
					 * start elapsor when useElapsed changed to true without a rotator
					 * restart
					 */
					if(this.useElapsed && !this.elapsor) {
						this.elapsor = new PeriodicalExecuter(this.countElapsed, 1);
					}
				},
				start: function(){
					/* make sure this thing is stopped first */
					if(this.rotator !== null){ this.stop(); }
					if(this.useElapsed){
						var __elapsed	= (typeof this.elapsed !== 'undefined')?this.elapsed:0;
						if(__elapsed > 0 && nfl.ads.rotationInterval > __elapsed){
							/* start from last spot */
							var sp	= (nfl.ads.rotationInterval - __elapsed);
							setTimeout(function(){ this.elapsed = 0; this.start(); }.bind(this),sp);
							return;
						}
						/* start elapsed counter */
						this.elapsor	= new PeriodicalExecuter(this.countElapsed.bind(this), 1);
					}
					/* start rotator */
					this.rotator = new PeriodicalExecuter(this.rotate.bind(this), this.interval);
				},
				stop: function(){
					if(this.rotator !== null){this.rotator.stop(); this.rotator = null; }
					if(this.useElapsed && this.elapsor !== null){this.elapsor.stop(); this.elapsor = null;}
					this.elapsed = 0;
				},
				pause: function(){
					/* leave elapsed */
					if(this.rotator !== null){this.rotator.stop(); this.rotator = null; }
					if(this.useElapsed && this.elapsor !== null){this.elapsor.stop(); this.elapsor = null;}
				},
				countElapsed: function(){
					this.elapsed++;
					if(this.elapsed === this.interval){this.elapsed = 0;}
				}
			}))();

			nfl.ads.add	= function(Ad){
				var adIndex	= nfl.ads.collection.length;
				nfl.ads.collection.each(function(Adi,ind){
					if(Adi.id == Ad.id && Ad.id !== false){adIndex = ind; throw $break;}
				}.bind(this));

				if(!Ad.pathOnly){
					/*
					if(Ad.rotate == true){
						nfl.log("ad #"+ Ad.adClassInt +" is a rotating ad");
					}else{
						nfl.log("ad #"+ Ad.adClassInt +" is not a rotating ad");
					}
					*/
					if(Ad.rotate === true && nfl.ads.hasRotating === false){
						/* has not had any previous rotating ads */
						nfl.ads.hasRotating	= true;
						if (document.loaded){
							nfl.ads.rotation.start();
						}
						else{
							document.observe("dom:loaded", function () {
								nfl.ads.rotation.start();
							});
						}
					}
					if(adIndex === nfl.ads.collection.length){ nfl.ads.visibleAds++; }
				}
				nfl.ads.collection[adIndex] = Ad;
			};
			nfl.ads.replace = function(Ad){
				var adIndex	= -1;
				nfl.ads.collection.each(function(Adi,ind){
					if(Adi.id == Ad.id){adIndex = ind; throw $break;}
				}.bind(this));
				if(adIndex > -1){
					nfl.ads.collection[adIndex] = Ad;
				}
			};
			nfl.ads.getById = function(id){
				var retAd	= null;
				nfl.ads.collection.each(function(Adi,ind){
					// console.log('nfl.ads.getById: checking '+ Adi.oid +' = '+id);
					if(Adi.oid == id){retAd = Adi; throw $break;}
				}.bind(this));
				return retAd;
			};
			nfl.ads.tilesOnPage = function(){ 
				return nfl.ads.collection.length; 
			};
			/**
			 * Generates new random number for use in creating sets of ads.
			 *
			 * @return {Integer}
			 */
			nfl.ads.random	= function(){ adRandom	= (Math.random() * 1000); return adRandom; };
			nfl.ads.random();
			

			/**
			 * Resizable Ads - port of YUI class
			 */
			(function (ads) {
				var IFRAME_URL = nfl.global.SITE_URL + "/widgets/global/resizable-ads";

				ads.resizable = {};

				ads.ResizableAd = Class.create({
					initialize: function (config) {
						var srcNode = $$(config.srcNode).first();

						this.tile    = config.tile ? config.tile : nfl.ads.collection.size() + 1;
						this.srcNode = srcNode;
						this.id      = srcNode.identify();
						this.adURL   = new Template(config.adURL).evaluate(this) + adRandom;
						this.rotate  = false;
						this.width   = config.width || 728;
						this.height  = config.height || 90;

						// register yourself as globally available
						ads.resizable = {};
						ads.resizable[this.id] = this;

						// gogogo
						srcNode.update('<iframe src="' + this._getIFrameURL() + '" frameborder="0" scrolling="no" width="' + this.width + '" height="' + this.height + '"></iframe>');
						nfl.ads.collection.push(this);
					},
					_getIFrameURL: function () {
						return IFRAME_URL + '?' + Object.toQueryString({
							template: 'basic-html',
							confirm: 'true',
							parentNode: this.id,
							adURL: this.adURL
						});
					},
					setIFrameSize: function (width, height) {
						console.log('setIFrameSize(' + width + ', ' + height + ')');
						var frame = this.srcNode.down('iframe');

						frame.width  = width;
						frame.height = height;
					}
				});

				ads.createResizableAd = function (config) {
					return new ads.ResizableAd(config);
				};

			}(nfl.ads));
		}());
		(function () {
			nfl.namespace('nfl.util');
			Object.extend(nfl.util, {
				/**
				 * Open a new pop up window.
				 *
				 * @param {string}
				 *            url the url of the window.
				 * @param {string}
				 *            panelName the name of the window.
				 * @param [{object}]
				 *            an object containing key-value pairs of window attributes to
				 *            overide the defaults
				 */
				openPopWindow: function(url, name){
					var win_args = '', win_options = {width:800,height:600,toolbar:0,scrollbar:'auto'};
					if(typeof arguments[2] == 'object'){
						for(var argName in arguments[2]) {
							win_options[argName] = arguments[2][argName];
						}
						for(var argName in win_options) {
							win_args += (argName+"="+win_options[argName]+",");
						}
						win_args = win_args.substring(0,(win_args.length - 1));
					}
					if(typeof arguments[2] == 'number' && typeof arguments[3] == 'number') {
						win_args = 'width='+ arguments[2] +',height='+ arguments[3] +',toolbar=0,scrollbar=auto';
					}
					if(typeof arguments[2] == 'string'){ win_args = arguments[2];}
					var win	= window.open(url,name,win_args); win.focus();
				},
				/**
				 * Sends a Micro Level call to Omniture to track links. Originally created for
				 * use by the Scorestrip.
				 *
				 * @param {string}
				 *            linkName: the name of the link to track via Omniture.
				 * @param {string}
				 *            propValue: the value of prop35. this can be different form
				 *            linkName.
				 */
				omnitureLinkTracking: function(linkName, propValue){
					var s_analytics = s_gi(s_account);
					s_analytics.linkTrackVars = "prop35";
					s_analytics.prop35 = propValue;
					s_analytics.tl(true,'o',linkName);
				},
				/**
				 * Sends a Page Level call to Omniture to track dynamic page calls on things like tabs etc. 
				 *
				 * @param {string}
				 *            pageName: the name of the page to track via Omniture.
				 * @param {string}
				 *            heirName: the heirarchy path to track via omniture. this is usually the same as 
				 *            pageName with pipe characters instead of colons after the first separator.
				 * @param {string}
				 *            chName: channel value to pass via omniture call.
				 */
				omniturePageTracking: function(pageName, heirName, chName) {
					var s_analytics 	= s_gi(s_account);
					s_analytics.linkTrackEvents = 'event1';
					s_analytics.linkTrackVar	="events,pageName,hier1,prop5,eVar2,eVar3,eVar4";

					s_analytics.pageName	= pageName;
					s_analytics.hier1 		= heirName;
					s_analytics.channel		= chName;
					s_analytics.prop5 		= heirName;
					s_analytics.eVar2		= pageName;
					s_analytics.eVar3		= chName;
					s_analytics.eVar4 		= heirName;
					s_analytics.prop35		= '';
					s_analytics.prop6		= '';

					s_analytics.events		= 'event1';
					s_analytics.t();
				}
			});
			window.$openWindow = nfl.util.openPopWindow; // shorthand pointer
		}());
		(function () {
			/**
			 * Image Preloading functions.
			 */
			var pointers = {
				notFoundImg: null,
				checks:      {
					generic: function(image) {
						image.src = pointers.notFoundImg.src; // TODO: This won't resolve to anything
					}
				},
				loadImages: function(){
					var imagesToPreload = arguments, preloadedImages = [], i, l;
					for (i = 0, l = imagesToPreload.length; i < l; i++) {
						preloadedImages[i]     = document.createElement('img');
						preloadedImages[i].src = imagesToPreload[i];
					}
					return preloadedImages;
				},
				loadImages2: function(imagesToPreload) {
					var preloadedImages = [], i, l;
					for (i = 0, l = imagesToPreload.length; i < l; i++) {
						preloadedImages[i] = new Image();
						preloadedImages[i].src = imagesToPreload[i];
					}
					return preloadedImages;
				},
				loadImages3: function(imagesToPreload) {
					var preloadedImages = [], i, l, c;
					for (i = 0, l = imagesToPreload.length; i < l; i++) {
						c = i + 1;
						$('sr_image' + c).src = imagesToPreload[i];
					}
					return preloadedImages;
				}
			};
			nfl.namespace("nfl.util.images.preloader");
			Object.extend(nfl.util.images.preloader, pointers);
			Object.extend(window, {
				preloadImages:  pointers.loadImages,
				preloadImages2: pointers.loadImages2,
				preloadImages3: pointers.loadImages3
			});
		}());
		/**
		 * This has been moved to YUI
		 */
		nfl.global.Scorestrip = Class.create({
			initialize: function(divID, options) {
				nfl.use("scorestrip", function (Y) {
					nfl.ss = new Y.ScoreStrip({
						render: "#" + divID
					});
				});
			}
		});
		/**
		 * Provides constants for observing and firing authentication events
		 * Authentication events should be fired with a "component"
		 *
		 * @namespace nfl.events
		 * @class AuthenticationEvent
		 */
		nfl.events.AuthenticationEvent = function () {
			var AE, prefix;
			
			function logger(event) { console.log('AuthenticationEvent: ' + event.eventName, event.memo); }
			
			prefix = 'nfl:authentication:';
			AE = { SIGN_IN: prefix + 'signin', SIGN_OUT: prefix + 'signout', AUTH_FAILURE: prefix + 'authfailure' };
			// monitor events
			if (window.console) {
				for (var i in AE) {
					if (AE.hasOwnProperty(i)) {
						document.observe(AE[i], logger);
					}
				}
			}
			return AE;
		}();
		/**
		 * The Authentication class provides static methods to get/set/clear cookies
		 * associated with a user. Fires an AuthenticationEvent when either set or clear
		 * is called. e.g.:
		 *
		 * document.observe(nfl.events.AuthenticationEvent.SIGN_IN, doSomething);
		 *
		 * In order to be logged in, you must have all three NFL cookie: userId, at &
		 * ptnr.
		 *
		 * @namespace nfl.global
		 * @class Authentication
		 */
		nfl.global.FantasyServiceCalled = false;
		nfl.global.Authentication = function () {
			var AuthenticationEvent = nfl.events.AuthenticationEvent,
			    Cookies			= { USER: 'userId', SITELIFE: 'at', PARTNER: 'ptnr', FANTASY: 'fan', PARTNER2: 'partner' },
			    COMPONENT		= 'AuthenticationEvent',
			    DOMAIN			= document.domain,
			    PATH			= '/',
			    COOKIE_SIGN_IN	= 'CookieSignIn',
			    SIGN_IN_APP     = '/fans/login',
			    nflCookie       = document.cookies.get(Cookies.USER).toQueryParams(),
			    pluckCookie     = document.cookies.get(Cookies.SITELIFE).toQueryParams(),
			    partnerCookie   = document.cookies.get(Cookies.PARTNER).toQueryParams(),
			    fanCookie		= (document.cookies.get(Cookies.FANTASY) !== '')? document.cookies.get(Cookies.FANTASY).toQueryParams() : null,
			    partnerCookie2 = document.cookies.get(Cookies.PARTNER2).substring(1,document.cookies.get(Cookies.PARTNER2).length -1).toQueryParams(),
			    fanData, team, username, fantasy;


			// Returns bool if the cookie's user matches the supplied value
			function isUser(_cookie) {
				return _cookie && _cookie.u && decodeURIComponent(partnerCookie.u) === username /* && decodeURIComponent(partnerCookie2.u) === username */;
			}

			// Returns bool if user is authenticated or not
			function is_authenticated() {
				return !! username;
			}

			// Listener for a SIGN_OUT event
			function onSignOut(e) {
				username = team = null;
				/* delete cookies for site */
				document.cookies.remove(Cookies.USER, PATH, DOMAIN);
				document.cookies.remove(Cookies.SITELIFE, PATH, DOMAIN);
				document.cookies.remove(Cookies.PARTNER, PATH, DOMAIN);
				document.cookies.remove(Cookies.FANTASY, PATH, DOMAIN);
				document.cookies.remove(Cookies.PARTNER2, PATH, DOMAIN);
			}

			function onSignIn(e) {
				if ( e.memo.component === COOKIE_SIGN_IN ) { return; }
				username = e.memo.username;
				team     = e.memo.team;
			}
			function getFantasyDataFromService(){
				//console.info('getFantasyDataFromService called.',fanData);
				var uri		= (nfl.global.FANTASY_API +'/internal/user/leagues?format=json');
				uri	= (uri+ '&callback=onFantasyServiceDataReturned&random='+Math.randomByTime());
				window.onFantasyServiceDataReturned	= onFantasyServiceDataReturned;
				if(nfl.global.FantasyServiceCalled === false){
					// has not been requested prior
					nfl.global.FantasyServiceCalled	= true;
					document.include(uri);
				}else{
					document.fire('nfl:fantasy:user:data:retrieved',fanData);
					document.fire('nfl:fantasy:league:data:retrieved',fanData);
				}
			}
			function onFantasyServiceDataReturned(json){
				//console.log('onFantasyServiceDataReturned',json);
				if(json){
					var _t	= {};
					if(json.user){
						if(typeof json.user.id	!== 'undefined'){ if(json.user.id !== ''){ _t.user = json.user.id;}}
					}
					if(json.leagues || json.autopicks){
						_t.leagues	= [];
						if(json.leagues){
							for(var ind=0; ind < json.leagues.length; ind++){
								var lo	= json.leagues[ind];
								var l	= {
									'leagueId'  : lo.id,
									'leagueName': lo.name,
									'leagueType':'normal',
									'teamId'    : lo.team.id,
									'teamName'  : lo.team.name,
									'draftDate' : lo.draftDate,
									'draftTime' : lo.draftTime,
									'draftType' : lo.draftType,
									'leagueLink':'<a href="'+nfl.global.FANTASY_DOMAIN+'/league/'+ lo.id +'">'+ lo.name +'</a>',
									'teamLink':'<a href="'+nfl.global.FANTASY_DOMAIN+'/league/'+ lo.id +'/team/'+ lo.team.id +'">'+ lo.team.name +'</a>'
								};
								_t.leagues[_t.leagues.length]	= l;
							}
						}
						if(json.autopicks){
							for(var ind=0; ind < json.autopicks.length; ind++){
								var to	= json.autopicks[ind];
								var t	= {
										'leagueId'  : null,
										'leagueName': null,
										'leagueType':'autopick',
										'teamId'    : to.id,
										'teamName'  : to.name,
										'draftDate' : null,
										'draftTime' : null,
										'draftType' : null,
										'leagueLink':'Autopick Team',
										'teamLink':'<a href="'+nfl.global.FANTASY_DOMAIN+'/autopick/'+ to.id +'">'+ to.name +'</a>'
								};
								_t.leagues[_t.leagues.length]	= t;
							}
						}
						fantasy	= _t;
					}
				}
				fanData	= fantasy;
				document.fire('nfl:fantasy:user:data:retrieved',fantasy);
				document.fire('nfl:fantasy:league:data:retrieved',fantasy);
			}
			function getFantasyData(){
				if ( !is_authenticated() ) { return; }//if the user is not logged in then no reason to fetch fantasy data
				//nfl.log('getFantasyData called. fanCookie = ' + fanCookie);
				var fanData		= false;
				if(fanCookie !== null){
					var fantasyCookieData		= fanCookie;
					//console.log('fantasyCookieTeams',fantasyCookieData);
					fanData			= {'leagues':[],'user':null};
					if(fantasyCookieData.fu && fantasyCookieData.fu !== ''){
						fanData.user	= fantasyCookieData.fu;
					}
					if(fantasyCookieData.l){
						// create clean data 
						var tmp			= fantasyCookieData.l.split('^');
						var ind			= 0;
						for(var cv=0; cv < tmp.length; cv++){
							var vals		= tmp[cv].split(','); //returns something like "1:NFL Managed 1,9:ODoyle Rules"
							fanData.leagues[fanData.leagues.length] = {
									'leagueId':(vals[0].split(':')[0]),
									'leagueName': decodeURI(vals[0].split(':')[1]).replace(/\+/g,' '),
									'leagueType':'normal',
									'teamId': (vals[1].split(':')[0]),
									'teamName': decodeURI(vals[1].split(':')[1]).replace(/\+/g,' '),
									'draftDate':null,
									'draftTime':null,
									'draftType':null,
									'leagueLink':'<a href="'+nfl.global.FANTASY_DOMAIN+'/league/'+ (vals[0].split(':')[0]) +'">'+ decodeURI(vals[0].split(':')[1]).replace(/\+/g,' ') +'</a>',
									'teamLink':'<a href="'+nfl.global.FANTASY_DOMAIN+'/league/'+ (vals[0].split(':')[0]) +'/team/'+ (vals[1].split(':')[0]) +'">'+ decodeURI(vals[1].split(':')[1]).replace(/\+/g,' ') +'</a>'
							};
						}
					}
					if(fantasyCookieData.a){
						var tmp			= fantasyCookieData.a.split('^');
						var ind			= 0;
						for(var cv=0; cv < tmp.length; cv++){
							var vals		= tmp[cv].split(':');
							fanData.leagues[fanData.leagues.length] = {
									'leagueId':null,
									'leagueName': null,
									'leagueType':'autopick',
									'teamId': vals[0],
									'teamName': decodeURI(vals[1].replace(/\+/g,' ')),
									'draftDate':null,
									'draftTime':null,
									'draftType':null,
									'leagueLink':'Autopick Team',
									'teamLink':'<a href="'+nfl.global.FANTASY_DOMAIN+'/autopick/'+vals[0]+'">'+decodeURI(vals[1].replace(/\+/g,' ')) +'</a>'
							};
						}
					}
					fantasy	= fanData;
					if(fantasyCookieData.u !== null && fantasyCookieData.u !== '' && fantasyCookieData.u !== username){
						/* !!! fantasy user does not match current user !!! */
						nfl.log('fantasy user does not match current user');
						document.cookies.remove('fan');
						fanData	= null;
					}else{
						//nfl.log('firing "nfl:fantasy:user:data:retrieved"',fantasy);
						document.fire('nfl:fantasy:user:data:retrieved',fantasy);
						return;
					}
				}
				if(!fanCookie || fanData === null){
					nfl.log('!fanCookie || fanData === null');
					getFantasyDataFromService();
					return;
				}
			}

			if (nflCookie.u) {
				team			= decodeURIComponent(nflCookie.t);
				username		= decodeURIComponent(nflCookie.u);
			}
			// if these values don't match, don't consider us logged out
			if ( ! ( isUser(partnerCookie) && isUser(pluckCookie) ) ) {
				onSignOut();
			}
			
			// Listens for dom:loaded event
			function initialize (e) {
				if (is_authenticated()) {
					// If we're referred from login, fire log the event
					if (document.referrer.indexOf(nfl.global.ID_MANAGER + SIGN_IN_APP) === 0) {
						s_analytics.events = "event11";
					}
					document.fire(AuthenticationEvent.SIGN_IN, { component: COOKIE_SIGN_IN, username: username, team: team });
				}
			}

			function mergeWithUserCookie(obj) {
				var userSessionDate, nflCookie = document.cookies.get("userId").toQueryParams(),
					serialize = function(obj) {
						var str = []; for(var p in obj){str.push(p + "=" + obj[p]);} return str.join("&");
					};
				
				$H(obj).each(function (pair) {
					nflCookie[pair.key] = pair.value;
				});
				
				if (nflCookie.p === 'true')  {
					userSessionDate = new Date(nflCookie.d * 1);
					userSessionDate.setUTCFullYear(userSessionDate.getUTCFullYear() + 1);
				}
				
				document.cookies.set("userId", serialize(nflCookie), userSessionDate, "/", ".nfl.com", null, false);
			}

			document.observe('dom:loaded', initialize);
			document.observe(AuthenticationEvent.SIGN_OUT, onSignOut);
			document.observe(AuthenticationEvent.SIGN_IN, onSignIn);

			/* Login session reset... */
			(function () {
				var GlobalEnv = (Object.isUndefined(window.YUI) || Object.isUndefined(YUI.namespace)) ? {} : YUI.namespace("Env.NFLUser"),
					userSessionResetMouseHandler,
					userSessionResetKeyHandler,
					userSessionReset;

				if (nflCookie && !GlobalEnv.trackingLastAction) {
					GlobalEnv.trackingLastAction = true;

					userSessionReset = function (e) {				
						// Detatch events manually just in case				
						Event.stopObserving(userSessionResetMouseHandler, 'mousedown');
						Event.stopObserving(userSessionResetKeyHandler, 'keydown');
						
						mergeWithUserCookie({
							la: new Date().getTime()
						});
						setTimeout(function(){
							userSessionResetMouseHandler = document.observe('mousedown', userSessionReset);
							userSessionResetKeyHandler = document.observe('keydown', userSessionReset);
						}, 10000);
					};
					userSessionResetMouseHandler = document.observe('mousedown', userSessionReset);
					userSessionResetKeyHandler = document.observe('keydown', userSessionReset);
				}
				
			}());

			return {
				signOut: function() { document.fire(AuthenticationEvent.SIGN_OUT, { component: COMPONENT });},
				isAuthenticated: function() { return is_authenticated();},
				getUser: function() {
					return is_authenticated() ? {
						username: username,
						team: team
					} : null;
				},
				getFantasyData: function(){ return getFantasyData(); },
				getFantasyDataFromService: function(){ return getFantasyDataFromService();},
				getProviders: function () {
					var providers = nfl.constants.GIGYA_CONF.enabledProviders.split(",").inject(new Hash(), function (init, value) {
							init.set(value, false);
							return init;
						});

					if (is_authenticated() && nflCookie.sps) {
						console.log(nflCookie);
						nflCookie.sps.split(",").each(function (value) {
							providers.set(value, true);
						});
					}
					return providers;
				},
				setProviders: function (providers) {
					mergeWithUserCookie({
						sps: providers.inject([], function (init, pair) {
							if (pair.value) {
								init.push(pair.key);
							}
							return init;
						}).join(",")
					});
				}
			};
		}();

		/**
		 * 
		 */
		nfl.namespace('nfl.global.Fantasy');
		nfl.global.Fantasy.STATES	= {
			LOGGED_OUT:'LOGGED_OUT',
			LOGGED_IN:'LOGGED_IN',
			NO_TEAMS:'NO_TEAMS',
			CLOSED:'CLOSED'
		};
		nfl.global.Fantasy.MyTeamsHeader = function(config){
			var S	= nfl.global.Fantasy.STATES,
			container = null,
			state = S.LOGGED_OUT,
			json = {},
			fancookie = null,
			user = null,
			template = null,
			limit = 3;

			var STATE_CLASSES	= {
				'LOGGED_OUT': 'signed-out',
				'LOGGED_IN':  'signed-in-teams',
				'NO_TEAMS':   'signed-in-no-teams',
				'CLOSED':     'signed-in-closed'
			};
			var STATE_NODES		= {
				'LOGGED_OUT': '.nv-fantasy-signed-out',
				'LOGGED_IN':  '.nv-fantasy-signed-in-teams',
				'NO_TEAMS':   '.nv-fantasy-signed-in-no-teams',
				'CLOSED':     '.nv-fantasy-signed-in-closed'
			};
			var onFantasyUserData = function(event){
				console.log('Fantasy.MyTeamsHeader->onFantasyUserData',event);
				try{
					/* process json into templatable frag */
					var _data = event.memo;

					if(_data){
						var tJSON     = json;
						tJSON.leagues = {total:0,user:_data.user};
						if(_data.leagues){
							if(_data.leagues.length > 0){
								for(var l=0; l < _data.leagues.length && l <= limit; l++){
									tJSON.leagues[('league'+(l+1))] = _data.leagues[l];
									tJSON.leagues[('league'+(l+1))].index = (l+1);
								}
							}
							tJSON.leagues.total = (_data.leagues.length);
						}
						json	= tJSON;
					}
					/* set state information */
					//console.info('json.leagues.total ='+json.leagues.total,json);
					if(json.leagues){
						if(json.leagues.total <= 0){ state	= S.NO_TEAMS; }
					}else{ state	= S.NO_TEAMS; }
					if(!json.user || json.user === null){ state = S.LOGGED_OUT; }
				}catch(e){ console.error(e.message, e); }
				/* now write out results */
				write(STATE_NODES[state]);
			};
			document.observe('nfl:fantasy:user:data:retrieved',onFantasyUserData);

			var write = function(selector){
				if(!container){ container = $(container); }
				if(!container){ return false; }
				var upEle	= container.down(selector);
				if(template === null){ template = upEle.templatize(); upEle.show(); }
				for(var key in STATE_CLASSES){
					if(key !== state){ container.removeClassName(STATE_CLASSES[key]); }
				}
				container.addClassName(STATE_CLASSES[state]);
				//console.log('FantasyMyTeams->write STATE_CLASSES['+ state+'] = '+STATE_CLASSES[state],json);
				//console.log('FantasyMyTeams->write replace upEle content with ',template.evaluate(json));
				upEle.update(template.evaluate(json));
				if(json.leagues){
					if(json.leagues.total < limit){
						/* remove extras */
						upEle.select('.team-node').each(function(ele,ind){
							if((ind +1) > json.leagues.total){ ele.remove(); }
						}.bind(this));
						upEle.select('.foot').each(function(ele,ind){ ele.remove(); });
					}
				}
			};

			var initialize	= function(config){
				user		= nfl.global.Authentication.getUser();
				container	= $(config.container);
				//console.log('FantasyMyTeams->initialize',user);
				if(user !== null){
					var _tJSON	= json; 
					_tJSON.user = user; //appending user json to internal json

					state	= S.LOGGED_IN;
					json	= _tJSON; 

					var ujson	= nfl.global.Authentication.getFantasyData();
				}
				container.addClassName(STATE_CLASSES[state]);
			};
			initialize(config);

			return {
				write: function(selector){
					/* upate dom elements with merged template */
					write(selector);
					//Y.NFL.Template.setContent(selector, this.get('json'), Y.NFL.Template.childParser);
				}
			};
		};

		/**
		 * The CenterPiece module inserts a Flash centerpiece of various sizes into the
		 * document.
		 *
		 * @namespace nfl.global
		 * @class CenterPiece
		 */
		nfl.global.CenterPiece = Class.create({
			/**
			 * Constructor for the CenterPiece class.
			 *
			 * @constructor
			 * @param {String}
			 *            type The type of CenterPiece. Accepted vaults are "normal",
			 *            "wide" and "extra-wide". the window object. The listener can
			 *            override this.
			 * @param {String}
			 *            flashURL path to the Flash file for the centerpiece.
			 * @param {String}
			 *            subjectType The subjecType of the page calling the Centerpiece
			 *            (normal only).
			 * @param {String}
			 *            modifiedDate The date the centerpiece content was modified
			 *            (normal only).
			 * @param {Object}
			 *            options An associated array used to override any defaults in
			 *            the CenterPiece.
			 */
			initialize: function(divID, type, flashURL, subjectType, modifiedDate, options) {
				var div;
				div = $(divID);
				div.addClassName("cp-" + this.type);
				var o = $H({
					width: ((type == "extra_wide") ? "965" : (type == "wide") ? "660" : "408"),
					height: "325",
					version: "8.0",
					background: "#FFFFFF",
					params: { wmode: (this.type == "normal") ? 'opaque' : 'transparent' },
					flashVars: $H({ IMAGEPATH: nfl.global.imagepath }),
					playerVolume: 50,
					pauseSeconds: 10
				});
				if (type == "normal") {
					var tmpO	= o.get('flashVars');
					tmpO.set("playerXmlUrl","/widget/centerpiece?subjectType=" + encodeURIComponent(subjectType));
					tmpO.set('modifiedDate',modifiedDate);
					tmpO.set("playerVolume",o.get('playerVolume'));
					tmpO.set("pauseSeconds",o.get('pauseSeconds'));
					o.set('flashVars',tmpO);
				}
				this.flash = new nfl.media.Flash(flashURL, div, o.merge($H(options || {})));
			},
			getFlash: function() { return this.flash; }
		});
		nfl.namespace("nfl.media");
		nfl.media.Flash = Class.create({
			initialize: function(url, el, options) {
				var so, id, o, fID;
				// nfl.log("nfl.media.Flash.initialize: 1");
				id = (typeof el == 'string') ? el : el.id;
				fID = id.replace(/-/g, "") + "Flash";
				o = $H({ id: fID, width: "550", height: "400", version: "8", background: "#FFFFFF" }).merge($H(options)); /*
																															 * checked
																															 * against
																															 * prototype
																															 * 1.6.0.2
																															 */
				// nfl.log("nfl.media.Flash.initialize: 2");
				this.fid = o.get('id');
				if ($(this.fid)) { throw("Cannot embed Flash movie: Element with the id \"" + this.fid + "\" already exists."); }
				var optParams	= new Hash();
				var optVars		= new Hash();
				// nfl.log("nfl.media.Flash.initialize: 3");
				// nfl.log("typeof options = "+ (typeof options));
				if((typeof options == 'object') && options.get){
					if(typeof options.get('params') == 'object'){
						optParams	= $H(options.get('params'));
						optVars		= $H(options.get('flashVars'));
					}else{
						try{
							optParams = $H(options.params);
						}catch(e){}
					}
				}
				// nfl.log("nfl.media.Flash.initialize: 4");
				o.set('params',$H({ allowScriptAccess: "always", wmode: "opaque" }).merge(optParams)); /*
																										 * checked
																										 * against
																										 * prototype
																										 * 1.6.0.2
																										 */
				o.set('flashVars', optVars);
				so = new SWFObject(url, this.fid, o.get('width') + "", o.get('height') + "", o.get('version') + "", o.get('background'));
				o.get('params').each(function(pair) { so.addParam(pair.key, pair.value); });
				o.get('flashVars').each(function(pair) { so.addVariable(pair.key, encodeURIComponent(pair.value)); });
				// nfl.log("nfl.media.Flash.initialize: 5");
				so.write(id);
				so = null;
				// nfl.log("nfl.media.Flash.initialize: 6");
			},
			getMovie : function(){
				return (navigator.appName.indexOf("Microsoft") != -1)?
					function() { return window[this.fid]; } :
					function() { return document[this.fid]; };
			}(),
			exec: function(s) { this.getMovie()[s]();}
		});

		/**
		 * Audio Panel/Window
		 */
		nfl.namespace('nfl.media.audio');
		nfl.media.audio.player = function(contentId){
			nfl.util.openPopWindow("/audioplayer?id=" + contentId, 'audioPlayer', {width:760,height:410,toolbar:0,scrollbar:'auto'});
		};

		/* event logging */
		(function () {
			function logEvent(event) {
				nfl.log('{' + event.eventName + '}');
			}

			document.
				observe('dom:loaded', logEvent).
				observe('dom:beforeloaded', logEvent).
				observe('dom:ready', logEvent).
				observe('window:hashchange', logEvent);
		}());
		(function IEDoesNotSupportABBRUntilThis() { document.createElement('abbr');})();
		// no more IE6!!!
		nfl.namespace("nfl.bandages");
		nfl.bandages.IE6HeaderFixes = Class.create({ initialize: function (options) {} });
		nfl.bandages.IE6FooterFixes = function() {};

		nfl.namespace('widgets');
		nfl.events.VideoPlayerEvent = {
			INITIALIZED:       'videoplayer:initialized',
			AVAILABLE:         'videoplayer:readyToLoad',
			READY_TO_PLAY:     'videoplayer:waitingToPlay',
			UNAVAILABLE:       'videoplayer:unavailable',
			AD_START:          'videoplayer:adPlaying',
			AD_COMPLETE:       'videoplayer:adComplete',
			AD_LOADED:         'videoplayer:adLoaded',
			PRE_ROLL_START:    'mediaplayer:preRollStart',
			PRE_ROLL_COMPLETE: 'mediaplayer:preRollComplete',
			PLAY:              'videoplayer:play',
			PAUSE:             'videoplayer:pause',
			POST_ROLL_START:   'mediaplayer:postRollStart',
			PLAYBACK_COMPLETE: 'flash:complete',
			RESTART:           'videoplayer:restart',
			ADD_TO_FAVORITES:  'mediaplayer:addToFavorites',
			PLAYING_IN_HQ:     'videoplayer:playingInHQ',
			PLAYING_IN_SQ:     'videoplayer:playingInSQ',
			JSON_LOADED:       'videoplayer:json:loaded',
			LBALXML_LOADED:    'videoplayer:loadbalancerxml:loaded',
			HTML5DATALOADED:   'videoplayer:htmlfivedata:loaded'
		};
		/**
		 * The VideoPlayer class allows embedding of the NFL video player.
		 *
		 * @namespace nfl.widgets
		 * @class VideoPlayer
		 */
		nfl.widgets.VideoPlayer = (function(){

			function getInstallURL (code) {
				return nfl.global.SITE_URL + '/widgets/videos/downloader?template=basic-html&confirm=true' + (code ? '&icampaign=' + code : '');
			}

			var OPTIONAL_ARGUMENTS   = $w('contentId companionSize related playerName adSetting adRatio dartURL autoplay channelId'),
			    ALT_CONTENT_TEMPLATE = new Template(
			        '<div id="#{id}" style="visibility:hidden">' +
			                '<a href="http://get.adobe.com/flashplayer/" target="_blank">' +
			                        '<img style="width:#{w}px;height:#{h}px" src="' +
			                        nfl.global.imagepath +
			                        '/img/video/flash-required-#{origW}x#{origH}.png" alt="Flash is required to watch videos on NFL.com. Please click here to install Flash on your computer." />' +
			                '</a>' +
			        '</div>'),
			    AKAMAI_ATTRIBUTION   = ('<a style="display:none;" href="' + getInstallURL('VG_Player_Link_HQ_DL') + '" class="unlock replaced">Unlock HQ Video <span></span></a>' +
									    '<span style="display:none;" class="attribution replaced">HQ video delivered by Akamai <span></span></span>'),
			    EFFECT_QUEUE         = 'akamaiAttribution',
			    MINIMUM_VERSION		 = "10.0.0",
				akamaiInitialized    = false,
			    VideoPlayerEvent     = nfl.events.VideoPlayerEvent,
			    VideoPlayer          = null,
			    HTML5VideoPlayer     = null,
			    instances            = [],
			    DEBUGGING			 = (window.location.hash !== '' && (window.location.hash).indexOf('debug=true') > -1)? true : false,
			    FLASH_VERSION        = Object.isUndefined(window.deconcept)? {'major':0,'minor':0,'rev':0} : deconcept.SWFObjectUtil.getPlayerVersion();  FLASH_VERSION.major = (window.location.hash !== '' && (window.location.hash).indexOf('fmt=HTML5') > -1)? 0 : FLASH_VERSION.major;
			    //FLASH_VERSION        =  {'major':0,'minor':0,'rev':0};

			function isArticlePlayer(){
				try{
					var path	= window.location.pathname + "";
					var articleStoryPaths = new RegExp(/\/.*\/story\//g);
					console.info('isArticlePlayer',path.match(articleStoryPaths));
					if(path.match(articleStoryPaths) !== null){ return true; }
					return false;
				}catch(e){ console.error('isArticlePlayer',e);}
			}

			function getSizeOptions( size ) {
				switch( size ) {
					case 'large':    return (isArticlePlayer())? { w: '640', h: '360', f: 'inline-video-player' } : { w: '615', h: '346', f: 'inline-video-player' };
					case 'article':    return { w: '640', h: '360', f: 'inline-video-player' };
					case 'off-site': return { w: '384', h: '216', f: 'player'};
					case 'detail':   return { w: '768', h: '432', f: 'video-detail-player' };
					case 'big-plays': return {w: '588',h:'326', f: 'inline-video-player'};
					default:         return { w: '384', h: '216', f: 'inline-video-player' };
				}
			}

			function cleanUpEffect(effect) {
				effect.element.effect = null;
				effect.element.setStyle({ display: effect.options.to === 0 ? 'none' : 'block' });
			}

			function toggleNotice(toToggle, show) {
				// cancel existing animations
				if (toToggle.effect) {
					toToggle.effect.cancel();
				}
				// do it old school if there's no scriptaculous
				if (Object.isUndefined(window.Effect)) {
					toToggle[show ? 'show' : 'hide']();
					return true;
				}
				// animate
				toToggle.effect = new Effect[show ? 'Appear' : 'Fade'](toToggle, {
					afterFinish: cleanUpEffect,
					queue: { scope: EFFECT_QUEUE, position: 'end' }
				});
			}

			function showUnlockMessaging(evt) {
				var el          = evt.element(),
				    parent      = el.up(),
				    attribution = parent.down('.attribution'),
				    unlock      = parent.down('.unlock');

				toggleNotice(attribution, false);
				toggleNotice(unlock, evt.memo.isHQAvailable && ! evt.memo.netSessionAvailable);
			}

			function showAkamaiAttribution(evt) {
				var el          = evt.element(),
				    parent      = el.up(),
				    attribution = parent.down('.attribution'),
				    unlock      = parent.down('.unlock');

					toggleNotice(unlock, false);
					toggleNotice(attribution, true);
			}

			function proxyOnDocument(_e) {
				document.fire(_e, _e.memo);
			}

			function addProxyListener(_pair) {
				this.observe(_pair.value, proxyOnDocument);
			}

			function removeProxyListener(_pair) {
				this.stopObserving(_pair.value, proxyOnDocument);
			}

			function addOptionalArguments(arg) {
				if (this.config.hasOwnProperty(arg)) {
					this.so.addVariable(arg, this.config[arg]);
				}
			}

			function alertNetSessionIsInstalling(player) {
				try {
					player.instance().checkForNetSessionInstall();
				}
				catch (e) {}
			}

			VideoPlayer = Class.create({
				initialize: function( config ) {
					this.config = config;
					this.written = false;
					try{ this.write(); }catch(e){ console.error('error writing out video player',e);}
					if (FLASH_VERSION.major === 0 || (window.location.hash !== '' && (window.location.hash).indexOf('HTML5=true') > -1)) {
						this.loadHTML5VideoForNonFlash();
					}
					// do this only the first time a view player instance is created.
					if (!akamaiInitialized) {
						akamaiInitialized = true;
						VideoPlayer.initializeAkamaiListeners();
					}
					instances.push(this);
				},
				loadHTML5VideoForNonFlash: function () {
					// set up transports
					if(DEBUGGING){ alert('loadHTML5VideoForNonFlash..'); }
					try{
						this.config.transplants	= {
							'AKAMAI_ATTRIBUTION':AKAMAI_ATTRIBUTION,
							'ALT_CONTENT_TEMPLATE':ALT_CONTENT_TEMPLATE,
							'showAkamaiAttribution':showAkamaiAttribution,
							'getSizeOptions':getSizeOptions
						};
						
						// load html 5 video player 
						if(!$('imported-js-nfl-widgets-html5video')){
							if(DEBUGGING){ alert('loading in html5 video lib'); };
							// wait for loaded event 
							document.observe('lib:loaded:html5video', function(){ HTML5VideoPlayer = new nfl.widgets.HTML5VideoPlayer(this.config); }.bind(this));
							//document.include('/scripts/lib/nfl.widgets.html5video.js');  // no idea why this wasnt working on the ipad.. should look into that
							if(!document.loaded){
								document.write('<script type="text/javascript" src="' + SCRIPT_PATH + '/scripts/lib/nfl.widgets.html5video.js' + '" id="imported-js-nfl-widgets-html5video"></script' + '>');
							}
						}else{
							HTML5VideoPlayer = new nfl.widgets.HTML5VideoPlayer(this.config);
						}
					}catch(e){ if(DEBUGGING){ console.error('error loading html5 player',e); } }
				},
				write: function () {
					var so, id, divid, swfid, container;

					id = this.config.uniqid || 'nflvideo-' + this.config.contentId;
					if ( /^\d/.test(id) ) {
						id = 'v' + id;
					}

					divid = id + '-video';
					this.swfid = swfid = id.replace(/-/g, '') + 'swf';
					this.geometry	= getSizeOptions( this.config.size );
					this.geometry.origW = this.geometry.w;
					this.geometry.origH = this.geometry.h;
					if ( this.config.width ) {
						this.geometry.w = this.config.width;
					}
					if ( this.config.height ) {
						this.geometry.h = this.config.height;
					}
					Element.setStyle(this.config.uniqid, { width: this.geometry.w + 'px', height: this.geometry.h + 'px' });
					var o = this.geometry;
					o.id = divid;
					o.bgcolor = (typeof this.config.bgcolor !== 'undefined')?this.config.bgcolor:'#000000';
					so = new SWFObject(
						nfl.constants.FLASH_PATH + "/flash/video/" + o.f + ".swf",
						this.swfid, this.geometry.w, this.geometry.h, ""+MINIMUM_VERSION+"", o.bgcolor, true
					);

					so.useExpressInstall(nfl.constants.FLASH_PATH + "/flash/expressinstall.swf");
					so.addParam('allowScriptAccess', 'always');
					so.addParam('allowFullScreen', 'true');
					so.addParam('wmode', (typeof this.config.wMode !== 'undefined')?this.config.wMode:'opaque');
					so.addVariable('uniqid', this.swfid);
					this.so = so;
					OPTIONAL_ARGUMENTS.each(addOptionalArguments, this);

					if ( this.config.containerId && (container = $( this.config.containerId )) ) {
						divid = container.identify();
					}
					else if (this.config.write === false) {
		                return;
					}
		            else {
		            	document.write( ALT_CONTENT_TEMPLATE.evaluate( o ) );
		            }

		            setTimeout((function() {
		            	var div = $(divid), swf;
		            	so.write(divid);
		 				swf = $(swfid);
		 				this.config.container	= div;
		 				this.config.containerId	= divid
		            	this.written = true;

						this.akamaiClickHandler = function (event) {
							var m = event.findElement('a').href.match(/[&\?]icampaign=([a-zA-Z0-9\-_]+)/),
								code = m ? m[1] : '';

							swf.pauseVideo();
							event.stop();
							nfl.widgets.VideoPlayer.installNetSession(code);
						};

		            	div.
		            		insert({ top: AKAMAI_ATTRIBUTION }).
		            		setStyle({ visibility: "visible" }).
							down('a.unlock').
								observe('click', this.akamaiClickHandler);
		            	if(!swf){ return }
		            	swf.
							observe(VideoPlayerEvent.PLAYING_IN_HQ, showAkamaiAttribution).
							observe(VideoPlayerEvent.PLAYING_IN_SQ, showUnlockMessaging);
		            }.bind(this)), 50);
				},
				instance: function() {
					return $( this.swfid );
				},
				proxyEvents: function() {
					$H(nfl.events.VideoPlayerEvent).each(addProxyListener, this.instance());
				},
				stopProxyingEvents: function() {
					$H(nfl.events.VideoPlayerEvent).each(removeProxyListener, this.instance());
				},
				destroy: function () {
					var div = $(this.divid),
						identifier = (typeof this.config.containerId !== 'undefined') ? this.config.containerId : this.config.uniqid;

					this.instance().
						stopObserving(VideoPlayerEvent.PLAYING_IN_HQ, showAkamaiAttribution).
						stopObserving(VideoPlayerEvent.PLAYING_IN_SQ, showUnlockMessaging);
					instances.splice(instances.indexOf(this), 1);
					div.down('a.unlock').stopObserving('click', this.akamaiClickHandler);
					div.update('');
					this.so = null;
					this.akamaiClickHandler = null;

					if (nfl.widgets.VideoPlayers[identifier]) {
						delete nfl.widgets.VideoPlayers[identifier]; 
					}
				}
			});

			VideoPlayer.isNetSessionInstalled = function() {
				if (Object.isUndefined(window.DLMHelper)) {
					throw new Error('nfl.widgets.VideoPlayer.isNetSessionInstalled() called without including dlm.js');
				}
				return window.DLMHelper.installed;
			};
			VideoPlayer.installNetSession = function(code) {
				window.nfl.use('netsession-installer', function (Y) {
					Y.NetSessionInstaller.installNetSession(code);
				});
			};
			VideoPlayer.initializeAkamaiListeners = function () {
				// listen for alert that NetSession is installing
				window.nfl.use('event', function (Y) {
					Y.Global.on('nfl:akamaiclientinstalled', function (event) {
						instances.each(alertNetSessionIsInstalling);
					});	
				});
			};
			return VideoPlayer;
		}());
		nfl.widgets.VideoPlayers = {};
		nfl.createVideoPlayer = function (config) {
			nfl.widgets.VideoPlayers[((typeof config.containerId !== 'undefined') ? config.containerId : config.uniqid)] = new nfl.widgets.VideoPlayer(config);
		};

		/*
		 * @author arianna.winters @class nfl.widgets.Carousel @param {String} |
		 * {Object} parent container element of ul element
		 */
		nfl.widgets.Carousel = Class.create({
			initialize: function(container,options){
				this.container	= $(container);
				console.log('initializing '+container);
				this.list		= this.container.select('.list-items').first();
				this.options	= (typeof options !== 'undefined')?options:{debug:false};
				this.rows		= (typeof this.options.rows !== 'undefined')? this.options.rows:1;
				this.evtprefix	= (typeof this.options.evtprefix !== 'undefined')?this.options.evtprefix:'nfl';
				this.totalPages	= -1;
				this.portwidth	= 0;
				this.totalWidth = 0;
				this.relativePaging = false;
				this.options.itempadding = (typeof this.options.itempadding !== 'undefined')? this.options.itempadding:-1;
				this.options.debug = (typeof this.options.debug !== 'undefined')?this.options.debug:false;
				this.options.slide = (typeof this.options.slide !== 'undefined')?this.options.slide:true;

				this.console	= (this.options.debug)?console:{log:function(){},info:function(){},warn:function(){}};

				this.boundHandlers	= {};
				this.boundHandlers.onScroll = this.onScroll.bindAsEventListener(this);
				this.boundHandlers.onPageChange = this.onPageChange.bindAsEventListener(this);

				/* set list width to children total width */
				var tChildSel	= (this.list.select('.list-page').length > 0)?'.list-page':'li';
				// this.console.log('child selector: '+tChildSel+', there are
				// '+this.list.select(tChildSel).length+' of these elements');
				var tChildren	= this.list.select(tChildSel);
				tChildren.each(function(ele){
					this.totalWidth = this.totalWidth+(this.getItemTotalWidth(ele));
				}.bind(this));
				if(this.rows > 1){
					this.totalWidth	= (this.getItemTotalWidth(this.list.select('li').first()) * (Math.ceil(this.list.select('li').length / this.rows)));
				}

				this.list.setStyle({width:(this.totalWidth)+'px'});
				this.console.log('set list style to '+this.list.getStyle('width'));
				this.scrollMultiplyer = 1;
				this.originalLeftMargin	= (parseInt(this.list.getStyle('margin-left').replace('px',''), 10));
				// console.log('initializing '+container+' ending.');
				document.observe(this.evtprefix+':carousel:scroll',this.boundHandlers.onScroll);
				document.observe(this.evtprefix+':carousel:pagechange',this.boundHandlers.onPageChange);
				document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage()});
			},
			getItemTotalWidth: function(ele){
				var retWidth	= 0;
				if(ele){
					retWidth 	= ele.getWidth();
					var margins	= {left:(parseInt(ele.getStyle('margin-left'), 10)),right:(parseInt(ele.getStyle('margin-right'), 10))};

					if(margins.left > 0){retWidth = retWidth+margins.left;}
					if(margins.right > 0){retWidth = retWidth+margins.right;}
				}
				return retWidth;
			},
			onPageChange: function(event){
				if(this.container.identify() == event.memo.id){
					this.console.info('nfl.carousel.onPageChange: '+event.memo.id+' {'+this.evtprefix+':carousel:pagechange'+'}');
					var currentPageEle	= this.container.select('.carousel-controls-page').first();
					var totalPagesEle	= this.container.select('.carousel-controls-totalpages').first();
					this.portwidth 	= this.container.getWidth()+ Math.abs(this.originalLeftMargin);
					// this.console.info('nfl.photos.carousel.onPageChange: '+
					// this.totalWidth +' / '+ portwidth +' = '+
					// (Math.floor(this.totalWidth / portwidth)));
					// this.console.info('nfl.photos.carousel.onPageChange: '+
					// this.container.identify() +' total pages = '+
					// (Math.floor(this.totalWidth / portwidth)) +', current page = '+
					// this.getCurrentPage());

					if(totalPagesEle){totalPagesEle.update(this.getTotalPages());}
					if(currentPageEle){currentPageEle.update(((typeof event.memo.page !== 'undefined')?(event.memo.page):this.getCurrentPage())+'');}
				}
			},
			getTotalPages: function(){
				if(this.totalPages === -1){
					if(!isNaN(Math.ceil(this.totalWidth / this.portwidth))){
						this.totalPages	= Math.ceil(this.totalWidth / this.portwidth);
						// this.console.info('nfl.photos.carousel.getTotalPages: is
						// ie?'+ Prototype.Browser.IE +',
						// version='+Prototype.Browser.Version);
					}
					if(this.totalPages < 1){
						this.totalPages	= 1;
					}
				}
				return this.totalPages;
			},
			getCurrentPage: function(flr){
				var itemcontainer	= this.list;
				var portwidth 		= this.container.getWidth();
				var floor			= (typeof flr === 'undefined')?false:flr;
				// console.log('getCurrentPage: '+portwidth);
				// console.log('getCurrentPage:
				// '+(parseInt(itemcontainer.getStyle('margin-left')) / portwidth));
				var retval			= (floor)?(Math.floor(Math.abs(parseInt(itemcontainer.getStyle('margin-left'), 10)) / portwidth)+1):Math.ceil(Math.abs(parseInt(itemcontainer.getStyle('margin-left'), 10)) / portwidth)+1;
				// console.log('getCurrentPage: '+retval);
				return retval;
			},
			getPageByOffset: function(left){
				try{
					var itemcontainer	= $(this.containerId);
					var portwidth 		= itemcontainer.up().getWidth();
					var mleft			= (typeof left == 'undefined')? parseInt(itemcontainer.getStyle('margin-left'), 10):left;
					return Math.ceil(Math.abs(mleft) / portwidth);
				}catch(e){ console.warn('nfl.photogallery.thumbnails.getPage: error',e); }
				try{
					// return Math.floor(this.__currentItem.index /
					// this.numberOfThumbsPerScrollPanel)
				}catch(e2){}

				return 0;
			},
			canScrollLeft: function(){
				if(this.getCurrentPage() > 1){ return true; }
				return false;
			},
			scrollLeft: function(){
				document.fire(this.evtprefix+':carousel:scroll',{'id':this.container.identify(),'direction':'left'});
			},
			canScrollRight: function(){
				if(this.getCurrentPage() < this.getTotalPages()){ return true; }
				return false;
			},
			scrollRight: function(event){
				document.fire(this.evtprefix+':carousel:scroll',{'id':this.container.identify(),'direction':'right'});
			},
			scrollToPageByIndex: function(index){
				// first get item
				var __items	= this.list.select('li');
				if(__items.length > 0 && (index - 1) < __items.length){
					var __item		= __items[(index - 1)];
					var __iOffset	= __item.viewportOffset()[0];
					var __cOffset	= this.list.viewportOffset()[0];
					var __left		= (__cOffset < 0)?((__iOffset < 0)?(Math.abs(__cOffset) - Math.abs(__iOffset)):(Math.abs(__cOffset) + __iOffset)):(__iOffset - __cOffset);
					var __page		= Math.floor(Math.abs(__left) / this.portwidth);
					if(__left < this.portwidth){
						__page		= 0;
					}
					var __nLeft		= (__page * this.portwidth);
					this.list.morph('margin-left: -' + __nLeft + 'px;',{afterFinish: function(){document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage()});}.bind(this), duration: 0.8, fps: 30});

					return;
				}
				console.log('scrollToPageByIndex: out of bounds '+index+'x'+__items.length);
			},
			scrollToIndex: function(index){
				var __items	= this.list.select('li');
				if(__items.length > 0 && (index - 1) < __items.length){
					this.relativePaging = true;
					var __item		= __items[(index - 1)];
					var __iOffset	= __item.viewportOffset()[0];
					var __cOffset	= this.list.viewportOffset()[0];
					var __left		= (__cOffset < 0)?((__iOffset < 0)?(Math.abs(__cOffset) - Math.abs(__iOffset)):(Math.abs(__cOffset) + __iOffset)):(__iOffset - __cOffset);
					this.list.morph('margin-left: -' + __left + 'px;',{afterFinish: function(){document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage(true)});}.bind(this), duration: 0.8, fps: 30});

					return;
				}
			},
			scrollToPage: function(page){
				if(page > 0 && page < this.getTotalPages()){
					var __left	= (page > 1)?(0 - (this.portwidth * (page - 1))):0;
					if(this.options.slide){
						this.list.morph('margin-left:' + __left + 'px;',{afterFinish: function(){document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage(true)});}.bind(this), duration: 0.8, fps: 30});
					}else{
						this.list.setStyle({'marginLeft': __left + 'px'});
						document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage()});
					}
				}
			},
			onScroll: function(event){
				this.console.info("nfl.carousel.onScroll");
				if(this.container.identify() == event.memo.id){
					var amountToScrollMultiplyer	= this.scrollMultiplyer;
					var direction 					= event.memo.direction;
					var itemcontainer				= this.list;
					// portwidth = this.container.getWidth()+
					// Math.abs(this.originalLeftMargin);
					var portwidth 					= parseInt(this.container.getStyle('width'), 10)+ Math.abs(this.originalLeftMargin);
					var newCoord					= 0;

					if(event.memo.multiplyer){ amountToScrollMultiplyer	= event.memo.multiplyer;}
					/*
					 * try{ var itemLeft =
					 * parseInt(itemcontainer.getStyle('margin-left')); }catch(e){
					 * itemcontainer.setStyle({'margin-left':'0px'}); var itemLeft =
					 * parseInt(itemcontainer.getStyle('margin-left')); }
					 */
					var cpage	= this.getCurrentPage();
					if(this.relativePaging){
						var cLeft	= parseInt(this.list.getStyle('margin-left'), 10);
						switch(direction){
							case 'left':
								newCoord 	= ((0 - (Math.abs(cLeft) - portwidth)) < 0)?(0 - (Math.abs(cLeft) - portwidth)):((cLeft < 0)?0:(0-((this.getTotalPages()-1) * portwidth)));
								if(newCoord === 0){ this.relativePaging = false; }
								break;
							case 'right':
								newCoord 	= ((0 - (Math.abs(cLeft) + portwidth)) > (0-(parseInt(this.list.getStyle('width'), 10) - portwidth)))?(0 - (Math.abs(cLeft) + portwidth)):(((0-(parseInt(this.list.getStyle('width'), 10) - portwidth)) > (0-((this.getTotalPages()-1) * portwidth)) )?(0-(parseInt(this.list.getStyle('width'), 10) - portwidth)):0);
								if(newCoord === 0){ this.relativePaging = false; }
								break;
							default:
								break;
						}
					}else{
						switch(direction){
							case 'left':
								// newCoord = (itemLeft ==
								// (0+this.originalLeftMargin))?(0 - (portwidth *
								// Math.floor((this.totalWidth -
								// Math.abs(this.originalLeftMargin)) /
								// portwidth))):(Math.abs(itemLeft) - portwidth);
								newCoord 	= (cpage == 1)?(0-((this.getTotalPages()-1) * portwidth)):(0-((cpage-2)*portwidth));
								break;
							case 'right':
								newCoord 	= (cpage == this.getTotalPages())? 0:(0-((cpage)*portwidth));
								// newCoord = ((Math.abs(itemLeft) + portwidth) <=
								// this.totalWidth)?(0 - (Math.abs(itemLeft) +
								// portwidth)):(0 + this.originalLeftMargin);
								break;
							default:
								break;
						}
					}
					// now perform scroll operation based on value outputs from switch
					// statement above
					if(Math.abs(newCoord) % portwidth == (0+this.originalLeftMargin) || this.relativePaging){
						// newLeft = (itemLeft + amountToScroll);
						this.console.log("{nfl.carousel.onScroll: newCoord = "+ newCoord +"}");
						if(this.options.slide){
							itemcontainer.morph('margin-left: ' + newCoord + 'px;',{afterFinish: function(){document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage()});}.bind(this), duration: 0.8, fps: 30});
						}else{
							itemcontainer.setStyle({'marginLeft':newCoord + 'px'});
							document.fire(this.evtprefix+':carousel:pagechange',{id:this.container.identify(),page:this.getCurrentPage()});
						}
					}else{
						this.console.warn('nfl.carousel.onScroll: item is in play.');
						// nfl.log("{nfl.carousel.onScroll: item is in play: "+ itemLeft
						// +" % "+ portwidth +" == "+ (itemLeft % portwidth ==
						// (0+this.originalLeftMargin)) +"}");
					}
				}
			},
			destroy:function(){
				// document.stopObserving(this.evtprefix+':carousel:scroll',
				// this.boundHandlers.onScroll);
				// document.stopObserving(this.evtprefix+':carousel:pagechange',
				// this.boundHandlers.onPageChange);
				document.stopObserving(this.evtprefix+':carousel:scroll');
				console.info('nfl.carousel.destroy: destroyed');
			}
		});

		nfl.widgets.DynamicTitles = (function(){
			var __titleIds	= [];
			var addTitle	= function(id,opts){
				opts		= (typeof opts !== 'undefined')? opts : {};
				__titleIds[__titleIds.length] = {'id':id,'opts':opts};
				//console.log('nfl.widgets.DynamicTitles.addTitle('+id+','+opts+')',__titleIds);
			};
			var onLoaded	= function(event){
				/* for each item in collection, replace with swf */
				__titleIds.each(function(__title){
					/* get element */
					try{
					var __ele	= $(__title.id);
					var __txt	= __ele.innerHTML;
					var __dims	= __ele.getDimensions();
					var __o		= {h:__dims.height,w:__dims.width,fp:((typeof __title.opts.asset !== 'undefined')? __title.opts.asset : (nfl.global.flashpath + "/flash/utils/ezSlabBold.swf"))};
					__o			= Object.extend(__o, __title.opts);
					//console.log('nfl.widgets.DynamicTitles.onLoaded: ',__ele,__txt,__o);
					var __so	= new SWFObject(__o.fp, __title.id+'-swf', __o.w, __o.h, "9.0.115", "#FFFFFF", true);
					__so.addParam('allowScriptAccess', 'always');
					__so.addParam('allowFullScreen', 'false');
					__so.addParam('salign', 'lt');
					__so.addParam('align', 'left');
					__so.addParam('wmode', 'transparent');
					__so.addVariable('txt', __txt);

					__so.write(__title.id);
					}catch(e){ console.warn('nfl.widgets.DynamicTitles.onLoaded',e); }
				});
			};
			document.observe('dom:loaded',onLoaded);

			return {
				add: function(id,opts){
					addTitle(id,opts);
				}
			};
		})();

		nfl.global.InitializeSearch = (function () {
			var label, input, notBlank;

			notBlank = /\S/;

			function onInputFocus ( _evt ) {
				label.hide();
			}
			function onInputBlur ( _evt ) {
				if ( notBlank.test( input.value ) ) { return; }
				input.value = '';
				label.show();
			}
			function testInputBlankness() { 
				if ( $F(input).blank() ) {
					onInputBlur();
				}
				else {
					onInputFocus();
				}
			}
			return function( _config ) {
				input = $(_config.input);
				label = $(_config.label);
				if ( ! ( input && label )  ) { return; }

				input.observe('focus', onInputFocus ); 
				input.observe('blur', onInputBlur );
				testInputBlankness();
				// IE7 populates this value between DOM and window load 
				Event.observe(window, 'load', testInputBlankness);
			};
		})();
		nfl.global.prestitial			 = (function(){
			var __BODYELE			= 'com-nfl';
			var __CONTENTWRAPPER	= 'com-nfl-doc';
			var __PREHDELE			= 'com-nfl-prestitial-header';
			var __TLIMIT			= 30000;
			var __CTIME				= 0;
			var __POLLINGRATE		= 1000;


			var __adIdLookup		= {
					'ebReportingFlash':'eyeDiv',
					'eyeDiv':'eyeDiv',
					'random':function(){ if(document.loaded){
						/* get last divs id */
						var __bodychildren	= $('com-nfl').select('div:last-child');
						if(__bodychildren.length > 0){
							//console.log('bchildren: '+__bodychildren.length,__bodychildren[(__bodychildren.length - 2)])
							var __dchild = __bodychildren[(__bodychildren.length - 2)];
							if(__dchild.tagName.toLowerCase() == 'div'){
								if((__dchild.id).indexOf('DIV_') > -1){
									return __dchild.id;
								}
							}
						}
						/* assume it failed other checks */
						return 'thisisnotthedroidyouwant';
					} return 'peanutbutternjellies'; }
			};

			return {
				initialize: function(){
					if(document.loaded){
						try{$(__CONTENTWRAPPER).setStyle({'height':(document.viewport.getHeight()+'px')});}catch(e){}
						try{
							nfl.global.prestitial.poll();
							nfl.global.prestitial.background.poll();
						}catch(e2){ console.warn('presitial error: ',e2); }
						return;
					}
					document.observe('prestitial:ready',function(){
						try{$(__CONTENTWRAPPER).setStyle({'height':(document.viewport.getHeight()+'px')});}catch(e){}
						try{
							nfl.global.prestitial.poll();
							nfl.global.prestitial.background.poll();
						}catch(e3){ console.warn('presitial error: ',e3); }
					});	
				},
				poll: function(){
					/* check to see if ad is still present */
					//console.log('nfl.global.prestitial.poll: window.n_prestitialAdId = '+ window.n_prestitialAdId +'\n\r $(__BODYELE).hasClassName(\'prestitial-active\') = '+ $(__BODYELE).hasClassName('prestitial-active') +'\n\r$(__BODYELE).hasClassName(\'prestitial\') = '+ $(__BODYELE).hasClassName('prestitial'));
					if(typeof window.n_prestitialAdId === 'undefined'){ return false; }
					if(!($(__BODYELE).hasClassName('prestitial-active')) && !($(__BODYELE).hasClassName('prestitial'))){ return false; /* there's no prestitial, do alittle dance */ }
					if(this.isDummy()){return false;}
					if($(this.getAdId())){
						/* code for checking whether or not the ad has finished displaying goes here */
						if(this.getAdId() == 'eyeDiv'){
							var eyefs		= this.getEyeFlash();
							if(eyefs){
								if(eyefs.style.top == '0px'){
									eyefs.style.top = ($(__PREHDELE).getHeight()+'px');
								}
								var stylesum	= parseInt(eyefs.style.width, 10)+parseInt(eyefs.style.height, 10);
								if(stylesum <= 0){
									this.remove();
								}
							}	
						}else{
							var __adiv	= $(this.getAdId());
							if(__adiv.getStyle('visibility') == 'hidden'){
								this.remove();
							}
						}
					}
					/* rinse and repeat */
					setTimeout(function () { nfl.global.prestitial.poll(); },__POLLINGRATE);
				},
				remove: function(){
					$(__BODYELE).removeClassName('prestitial-active');
					$(__BODYELE).removeClassName('prestitial');

					try{ document.getElementsByTagName('html')[0].style.overflow = 'scroll'; }catch(e){}
					console.log('removed prestitial-active/prestitial class.');
				},
				close: function(){
					try{
						this.remove();
						try{ $(__CONTENTWRAPPER).setStyle({'height':'auto'}); }catch(e){}

						if($(this.getAdId())){
							$(this.getAdId()).remove();
							console.log('removed '+this.getAdId()+' element.');
						}
					}catch(e2){}
				},
				getAdIdLookup: function(){
					return __adIdLookup;
				},
				getAdId: function(){
					var __adId	= __adIdLookup[window.n_prestitialAdId];
					if(window.n_prestitialAdId == 'random'){
						__adId = __adIdLookup[window.n_prestitialAdId]();
					}
					//console.log('getAdId: '+__adId,__adIdLookup);
					return __adId;
				},
				isDummy: function(){
					if($(window.n_prestitialAdId) || typeof __adIdLookup[window.n_prestitialAdId] !== 'undefined'){
						//console.log('isDummy: ad id');
						if($(this.getAdId())){
							//console.log('isDummy: ad container'+$(__adIdLookup[window.n_prestitialAdId]).innerHTML);
							if($(this.getAdId()).innerHTML === ''){ alert('nfl.global.prestitial.isDummy: 4'); return true; }
							if($(this.getAdId()).tagName.toLowerCase() == 'img'){return true;}
							//console.log('isDummy: ad container content:'+$(__adIdLookup[window.n_prestitialAdId]).innerHTML);
							return false;
						}
					}
					return false;
				},
				getEyeFlash: function(){
					if($(this.getAdId())){
						var __adDiv		= $(this.getAdId());
						var __adObjects	= __adDiv.select('object');
						return __adObjects[1];
					}
					return false;
				},
				background: {
					poll: function(){
						__CTIME				= __CTIME+__POLLINGRATE;
						//console.log('background.poll: document loaded = '+document.loaded+' nfl.global.prestitial.getAdId() = '+ nfl.global.prestitial.getAdId());
						if(typeof window.n_prestitialAdId === 'undefined'){ return false; }
						if($(nfl.global.prestitial.getAdId()) || __CTIME > __TLIMIT){
							if(__CTIME > __TLIMIT){ console.log('nfl.global.prestitial.background.poll: removing due to time limit expiration'); }
							if(document.getElementsByTagName('html')[0].style.overflow != 'hidden'){
								document.getElementsByTagName('html')[0].style.overflow = 'hidden';
								return;
							}
							this.remove();
						}else{
							setTimeout(function () { nfl.global.prestitial.background.poll(); },__POLLINGRATE);
						}
					}, 
					remove: function(){
						$(__BODYELE).removeClassName('prestitial');
						try{ document.getElementsByTagName('html')[0].style.overflow = 'hidden'; }catch(e){} /* faceplant, I'm actually mimicking their junk so that at least its consistent */
						if($(nfl.global.prestitial.getAdId()) && !nfl.global.prestitial.isDummy()){ $(__BODYELE).addClassName('prestitial-active'); }
						if(!nfl.global.prestitial.isDummy()){
							try{ 
								$(__CONTENTWRAPPER).setStyle({'height':'auto'}); 
							}catch(e2){}
						}else{
							/* remove overflow = hidden that some bad ad programmer monkeys put in *faceplant* */
							try{ document.getElementsByTagName('html')[0].style.overflow = 'scroll'; }catch(e3){}
						}
						console.log('removed prestitial class.');
					}
				}
			};
		})();

		nfl.global.Navigation = (function () {
			var ID = {
					CONTAINER: 'alt-nv-main',
					SCORESTRIP: 'hd-scorestrip'
				},
				ATTR = { ORIGINAL_HEIGHT: 'data-oheight' },
				CSS = {
					CONTENT: 'div.channel-content',
					GROUP: 'li.alt-nv-group',
					SHADOW: 'shadow',
					PREPARED: 'prepared'
				},
				CLOSE_HEIGHT = { height: '0px' },
				DURATION = 0.5,
			    sexy = false,
			    ss,
			    timeout,
			    mousedOver,
			    TO_DURATION = 750;

			function prepareChannel ( _el ) {
				var group, iframe, newStyle, oHeight, div;

				newStyle  = { display: 'none' };

				group    = _el.up( 'li' );
				group.channels = _el;

				oHeight = _el.offsetHeight - parseFloat( _el.getStyle('paddingBottom') ) - parseFloat( _el.getStyle('paddingTop') );
				_el.setAttribute( ATTR.ORIGINAL_HEIGHT, oHeight + 'px' );
				_el.addClassName( CSS.PREPARED );

				// Fixes select see-through in IE6
				if ( Prototype.Browser.IE ) {
					iframe    = document.createElement( 'iframe' );
					iframe.id = "DivShim";
					iframe.setAttribute("scrolling","no");
					iframe.setAttribute("frameborder","0");
					_el.insertBefore( iframe, _el.firstChild );
				}

				div = document.createElement('div');
				div.className = CSS.SHADOW;
				_el.appendChild( div );

				if ( sexy ) {
					newStyle.backgroundPosition = '0 ' + oHeight + 'px';
					newStyle.height = '0px';
				}
				_el.setStyle( newStyle );
			}

			function beforeOpenStart(_effect) {
				_effect.element.show().setStyle({ zIndex: 1000 });
			}
			function afterOpenFinish(_effect) {
				_effect.element.setStyle({ zIndex: 1000 }).transitionEffect = null;
			}
			function afterCloseFinish(_effect) {
				_effect.element.hide().transitionEffect = null;
			}

			function toggleChannels( _channels, _open) {
				// if we're sexy, do a slide
				if ( sexy ) {
					// cancel any current effects on this element
					if ( _channels.transitionEffect ) {
						_channels.transitionEffect.cancel();
					}
					// create an effect with different options based on whether or not we're opening
					_channels.transitionEffect = new Effect.Morph( _channels, _open ?
						{ style: { height: _channels.getAttribute( ATTR.ORIGINAL_HEIGHT ) }, duration: DURATION,
						  beforeStart: beforeOpenStart, afterFinish: afterOpenFinish } :
						{ style: CLOSE_HEIGHT, duration: DURATION, afterFinish: afterCloseFinish }
					);
					return;
				}
				// otherwise just show or hide based on the direction
				_channels[ _open ? 'show' : 'hide' ]();
			}

			function onMouseOver ( _e ) {
				var group, from, channels;
				_e.stop();

				// figure out your context
				group    = _e.findElement( CSS.GROUP );
				if ( ! group ) { return; }
				channels = group.channels;
				from     = $( _e.relatedTarget || _e.fromElement );

				// if you're not over the correct element, exit
				if ( (! channels) || (! from) || ( from && from.descendantOf && from.descendantOf( group ) ) ) { return; }

				// if we come from the scorestrip, hold off on sliding out
				if ( ss && ( ss === from || ( from.descendantOf && from.descendantOf(ss) )) ) {
					mousedOver = true;
					// if we're locked, cancel the old timeout
					if ( channels.timeout ) { clearTimeout(channels.timeout); }
					// set a timeout to slide the current channel out after a decent wait
					channels.timeout = setTimeout(function() {
						// clear the lock
						channels.timeout = null;
						// if we're still moused over, exit
						if ( ! mousedOver ) { return; }
						// toggle the channels open
						toggleChannels( channels, true );
					}, TO_DURATION);
					return;
				}
				// otherwise toggle the channels open
				toggleChannels( channels, true );
			}
			function onMouseOut ( _e ) {
				var group, to, channels;

				// stop the event
				_e.stop();

				// figure out your context
				group    = _e.findElement( CSS.GROUP );
				if ( ! group ) { return; }
				channels = group.channels;
				to       = $( _e.relatedTarget || _e.toElement );

				// if you're not over the correct element, exit
				if ( (! channels) || ( to  && ( to === group || ( to.descendantOf && to.descendantOf( group ) ) ) ) ) { return; }

				// set a flag alerting that we've moused out, in case someone is waiting
				mousedOver = false;

				// if we're locked, don't slide out
				if (channels.timeout) { return;}

				// toggle the channels open
				toggleChannels( channels, false );
			}

			function removeReferences(group) {
				if ( ! group.channels ) { return; }
				delete group.channels.transitionEffect;
				delete group.channels.timeout;
				delete group.channels;
			}

			function cleanUp(e) {
				$(ID.CONTAINER).
					stopObserving('mouseover', onMouseOver).
					stopObserving('mouseout', onMouseOut);
				try {
					$$(CSS.GROUP).each(removeReferences);
				} catch (e2) {}
				ss = null;
			}

			return {
				initialize: function() {
					var el = $(ID.CONTAINER);
					if ( ! el ) { return; }

					// If we have scriptaculous, go the extra mile
					if ( typeof Effect !== "undefined" ) { sexy = true; }

					el.
						observe('mouseover', onMouseOver ).
						observe('mouseout', onMouseOut ).
						select( CSS.CONTENT ).
							each( prepareChannel );
					Event.observe(window, 'unload', cleanUp);
					document.observe('dom:loaded', function() { ss = $(ID.SCORESTRIP); });
				},
				setAnimation: function( _value ) {
					if ( sexy === _value ) { return; }
					sexy = _value;
					$$('#' + ID.CONTAINER + ' ' + CSS.CONTENT).each(
						_value ? function( _el ) {
							_el.setStyle({ backgroundPosition: '0 ' + _el.getAttribute( ATTR.ORIGINAL_HEIGHT ) + 'px', height: '0px', paddingBottom: null });
							_el.addClassName( CSS.PREPARED );
						} : function( _el ) {
							_el.setStyle({ backgroundPosition: 'left top', height: 'auto', paddingBottom: '0px' });
							_el.removeClassName( CSS.PREPARED );
						});
				}
			};
		})();
		nfl.global.MicroNav = (function () {

			function getWidth(li) {
			    return li.offsetWidth;
			}

			function onMouseOver(event) {
				var from = $(event.relatedTarget || event.fromElement);
				if (from && from.descendantOf(this)) {
					return;
				}
				this.addClassName('hovered');
			}

			function onMouseOut(event) {
				var to = event.relatedTarget || event.toElement;
				if (to && to.descendantOf(this)) {
					return;
				}
				this.removeClassName('hovered');
			}

			function prepareSubNav(list) {
		        var lis     = list.childElements(),
					parent  = list.up(),
					width   = lis.max(getWidth);

				list.
					setStyle({ width: width + 'px' });
				parent.
					observe('mouseover', onMouseOver.bindAsEventListener(parent)).
			        observe('mouseout', onMouseOut.bindAsEventListener(parent)).
					addClassName('ready');
		    }

			return {
				initialize: function (selector) {
					$$(selector + '>ul>li>ul').each(prepareSubNav);
				}
			};
		}());
		nfl.global.embedScoreStrip = function (config) {
			if(typeof config.srcNode === 'string'){ config.srcNode = document.getElementById(config.srcNode); }
			config.srcNode.innerHTML	= '<iframe src="'+nfl.global.SITE_URL+'/partner/scorestrip" frameborder="0" scrolling="no" style="width:100%;height:100%"></iframe>';
		};
	}
	
	if (window.YUI && window.nfl && nfl.constants && typeof nfl.constants.SCRIPT_PATH !== "undefined") {
		setup();
	}
	else {
		if (!window.dependencyQueue) {
			window.dependencyQueue = [];
		}
		window.dependencyQueue.push(setup);
		document.write('<script type="text/javascript" src="' + SCRIPT_PATH + '/scripts/global/dependencies.js' + '"></script' + '>');
	}
}());

