/**
 * @author Arianna Winters <arianna.winters@nfl.com>
 * @copyright 2007 NFL
 * @package nfl
 * @version 1.1
 * @requires prototype
 */

/**
 * @author Ryan Johnson <ryan@livepipe.net>
 * @copyright 2007 LivePipe LLC
 * @package Object.Event
 * @license MIT
 * @url http://livepipe.net/projects/object_event/
 * @version 1.0.0
 */
if(typeof Object.Event=="undefined"){
   /**
    * Object.Event is an class that allows any object to support
    * custom events.
    @extends Object
    */
	Object.Event = {
	   /**
	    * Object.Event.extend is a method that extends the object
	    * passed in as an arguement with all it's own methods.
	    * @param {Object} object Object to be extended
	    */
		extend: function(object){
			object._objectEventSetup = function(event_name){
				this._observers = this._observers || {};
				this._observers[event_name] = this._observers[event_name] || [];
			};
			object.observe = function(event_name,observer){
				if(typeof(event_name) == 'string' && typeof(observer) != 'undefined'){
					this._objectEventSetup(event_name);
					if(!this._observers[event_name].include(observer))
						this._observers[event_name].push(observer);
				}else
					for(var e in event_name)
						this.observe(e,event_name[e]);
			};
			object.stopObserving = function(event_name,observer){
				this._objectEventSetup(event_name);
				this._observers[event_name] = this._observers[event_name].without(observer);
			};
			object.notify = function(event_name){
				this._objectEventSetup(event_name);
				var collected_return_values = [];
				var args = $A(arguments).slice(1);
				try{
					for(var i = 0; i < this._observers[event_name].length; ++i)
						collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
				}catch(e){
					if(e == $break)
						return false;
					else
						throw e;
				}
				return collected_return_values;
			};
			if(object.prototype){
				object.prototype._objectEventSetup	= object._objectEventSetup;
				object.prototype.observe			= object.observe;
				object.prototype.stopObserving		= object.stopObserving;
				object.prototype.notify				= function(event_name){
					if(object.notify){
					   
						var args = $A(arguments).slice(1);
						args.unshift(this);
						args.unshift(event_name);
						object.notify.apply(object,args);
					}
					this._objectEventSetup(event_name);
					var args = $A(arguments).slice(1);
					var collected_return_values = [];
					try{
						if(this.options && this.options[event_name] && typeof(this.options[event_name]) == 'function')
							collected_return_values.push(this.options[event_name].apply(this,args) || null);
						for(var i = 0; i < this._observers[event_name].length; ++i)
							collected_return_values.push(this._observers[event_name][i].apply(this._observers[event_name][i],args) || null);
					}catch(e){
						if(e == $break){
							return false;
						}else{ throw e; }
					}
					return collected_return_values;
				};
			}
		}
	}
}
Function.prototype.defaults = function(origArgs/*, defaults*/) {
	for (var i = 0, j = 1; j < arguments.length; i++, j++) {
		if (typeof origArgs[i] == 'undefined')
			origArgs[i] = arguments[j];
	}
}

document.insertAfter=function(new_node, existing_node){
	/**
	 * if the existing node has a following sibling, insert the current
	 * node before it. otherwise appending it to the parent node
	 * will correctly place it just after the 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){
		nfl.log("insertAfter Error: "+ err.message);
	//	alert("insertAfter Error: "+ err.message);
	}
}

if(typeof nfl=="undefined"){ var nfl={}; } 
if(typeof nfl.created=="undefined"){ nfl.created=false; }
if(!nfl.created){
	/**
	 * 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");

	/**
	 * Defines the type of event model to use
	 * This automatically sets itself to the style used
	 * by the prototype library if it's available, otherwise
	 * it uses livepipes custom object.extend methodology.
	 */
	//nfl.global.eventModel			= document.observe ? "prototype":"livepipe";  
	nfl.global.eventModel			= "livepipe";
	// ---------------------------- WARNING ----------------------------
	// the property above is to allow us to do early compat testing. eventually 
	// moving to the prototype 1.6 release once proper time for testing 
	// has taken place. if you enable prototype 1.6 also enable the 1.8 release 
	// of scriptaculous.

	/** 
	 * create simple 'nfl.events' object for global events 
	 * or if eventModel == 'prototype' use prototype custom events
	 * attached to the document object.
	 */
	if(nfl.global.eventModel != "prototype"){ 
		nfl.events = Class.create(); nfl.events = {}; Object.Event.extend(nfl.events) ;
	}else{
		nfl.namespace('nfl.events');
		nfl.events.observe	= function(evtName,func){ document.observe(evtName, func); nfl.log('document.observe: \''+ evtName +'\''); };
		nfl.events.notify	= function(evtName,evtArgs){ document.fire(evtName); nfl.log('{document.'+ evtName +'}'); };
	}

	/**
	 * Loads in the enviromental variables defined in the commons_js
	 */
	nfl.global.imagepath			= n_imagepath;
	nfl.global.scriptpath			= n_scriptpath;
	nfl.global.flashpath			= n_flashpath;
	nfl.global.debugenabled			= (new String(location.hostname).indexOf('localhoost')) > -1? true : false;
	nfl.global.ENV					= n_environment;
	/**
	 * Holds information about the users browser
	 * @returns {Object}  
	 */
	nfl.util.Browser				= { IE: !!(window.attachEvent && !window.opera), Opera: !!window.opera, WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1}
	/**
	 * holds information about the clients user agent
	 * @returns {String}  
	 */
	nfl.util.Agent					= navigator.userAgent.toLowerCase();
	/**
	 * holds information about the clients Platform
	 * @returns {Object}  
	 */
	nfl.util.Platform				= { Apple: nfl.util.Agent.indexOf("mac")!=-1, Win: nfl.util.Agent.indexOf("win")!=-1}
	/**
	 */
	nfl.util.Server					= {Protocol: window.location.protocol, Host: window.location.hostname, Port: window.location.port, Path: window.location.pathname}
	/**
	 * Writes a message to the console(if available)
	 * @param {String} message The message to write
	 */
	nfl.log							= function(message,type){ 
		if(!nfl.util.Browser.Opera && !nfl.util.Browser.IE){ 
			try{ if(nfl.global.debugenabled){ console.log(message); }}catch(err){ }
		}else{ 
			if(nfl.util.Browser.IE && $('nfl-debug-console-logger')){ 
				try{
					$('nfl-debug-console-logger').options[$('nfl-debug-console-logger').options.length] = new Option(message,'');
					$('nfl-debug-console-logger').options[($('nfl-debug-console-logger').options.length - 1)].className = type;
					$('nfl-debug-console-logger').options[($('nfl-debug-console-logger').options.length - 1)].focus();
				}catch(err){}}
		}}; nfl.log("loading nfl.js..");
	/**
	 * Checks a string against null, and if
	 * the string is null returns an empty string. Otherwise
	 * returns the string 
	 * @param {String} str The string to compare
	 * @returns {String}
	 */
	nfl.util.isNull					= function(str){ return (str === null) ? '' : str;}

	/**
	 * Initialize nfl.util.cookies namespace 
	 * Functions in this namespace are for cookie manipulation.
	 */
	nfl.namespace("util.cookies");
	nfl.util.cookies.getExpDate		= function(days, hours, minutes) {var expDate = new Date( ); if(typeof days == "number" && typeof hours == "number" && typeof hours == "number") {expDate.setDate(expDate.getDate( ) + parseInt(days));expDate.setHours(expDate.getHours( ) + parseInt(hours));expDate.setMinutes(expDate.getMinutes( ) + parseInt(minutes));return expDate.toGMTString( );}}
	nfl.util.cookies.getCookieVal	= function(offset){ var endstr = document.cookie.indexOf (";", offset); if (endstr == -1){endstr = document.cookie.length;}; return unescape(document.cookie.substring(offset, endstr));}
	nfl.util.cookies.getCookie		= 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 nfl.util.cookies.getCookieVal(j); }; i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return "";}
	nfl.util.cookies.setCookie		= function(name, value, expires, path, domain, secure) { document.cookie = name + "=" + escape (value) + ((expires) ? "; expires=" + expires : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");}
	nfl.util.cookies.deleteCookie	= function(name,path,domain) { if (nfl.util.cookies.getCookie(name)) { document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";}}
	var getExpDate					= nfl.util.cookies.getExpDate;
	var getCookieVal				= nfl.util.cookies.getCookieVal;
	var getCookie					= nfl.util.cookies.getCookie;
	var setCookie					= nfl.util.cookies.setCookie;
	var deleteCookie				= nfl.util.cookies.deleteCookie;

	function enabledebug(){
		$import("/scripts/lib/nfl.debugger.js");
	}
	if(nfl.util.cookies.getCookie('devdbg') == 'true' && !nfl.global.debugenabled){ 
		nfl.global.debugenabled	= true; 
		nfl.log("loading nfl.js..");
		nfl.events.observe('libNflLoaded', enabledebug);
		nfl.events.observe('contentloaded',function(){
			nfl.global.debugconsole	= new nfl.debug.console();
		});
	}

	/**
	 * Initialize nfl.ads namespace 
	 */	
	nfl.namespace("nfl.ads");
	/**
	 * Holds internal references to all ads on a page 
	 */
	nfl.ads.collection				= {}
	/**
	 * Generates new random number 
	 * for use in creating sets of ads.
	 * @return {Integer}
	 */
	nfl.ads.random					= function(){ adRandom	= (Math.random() * 1000); return adRandom; };
	nfl.namespace("nfl.ads.rotating");
	/**
	 * Initializes rotating ads
	 */
	nfl.ads.rotating.initialize		= function(){ /* initialize iframe adproxies, attach onload events to nfl.ads.rotating.onload */ };
	/**
	 * Retrieves all ad proxy objects that 
	 * are defined by a classname of 'adproxy'
	 * and reloads them.
	 */
	nfl.ads.rotating.load			= function(){ nfl.ads.random(); var adproxies = document.getElementsByClassName('adproxy'); for(ap=0; ap < adproxies.length; ap++){ adproxies[ap].src	= adproxies[ap].src; }};
	/**
	 * Transports the resulting content of 
	 * an ad proxy iframe to a dom element.
	 * Fires on load of an ad proxy iframe.
	 * @param {String} srcId The ID AND Name of the source ad proxy iframe
	 * @param {String} targetId The ID of the element in which to load the ad proxy iframe result
	 */
	nfl.ads.rotating.onload			= function(srcId,targetId){
		nfl.log('nfl.ads.rotating.onload: loading in content for \''+ (targetId.substr(0,targetId.indexOf('-'))) +'\'');
		var domObject 				= (document.all)? window.frames[srcId].document : $(srcId).contentDocument; 
		var containerObject			= domObject.getElementById(targetId.substr(0,targetId.indexOf('-')));
		try{ 
			
			containerObject.removeChild(containerObject.getElementsByTagName("script")[0]); 
			containerObject.removeChild(containerObject.getElementsByTagName("script")[0]); 
			nfl.log('nfl.ads.rotating.onload: stripped proxy element of script content'); 
		}catch(e){
			nfl.log('nfl.ads.rotating.onload: could not locate script element in proxy element');
		}
		$(targetId).update(containerObject.innerHTML); 
	};
	
	nfl.namespace("nfl.ads.deferred");
	/**
	 * Initializes static ads
	 * static ads feature deferred loading
	 */
	nfl.ads.deferred.initialize		= function(){ 

		if(!document.all){
			//document.observe("contentLoaded", nfl.ads.static.load);
			var adcontainers = document.getElementsByClassName('adcontainer'); for(ac=0; ac < adcontainers.length; ac++){ document.write(('\n\r<div id="nfl-ads-wrapper-'+ (adcontainers[ac].id) +'" class="nfl-ads-scriptwrapper">\n\r'+'<script language="javascript" src="'+ nfl.ads.collection[adcontainers[ac].id].src +'" type="text/javascript"><\/script>'+'\n\r</div>\n\r')); }
			Event.observe(window,"load", nfl.ads.deferred.load);
		}
	};
	
	/**
	 * Retrieves all wrapped ad elements
	 * transports the contents to the appropriate target 
	 * elements.
	 */
	nfl.ads.deferred.load				= function(){ 
		adwrappers = document.getElementsByClassName('nfl-ads-scriptwrapper');
		for(aw=0; aw < adwrappers.length; aw++){ 
			//nfl.log('nfl.ads.static.load: loading\n\r'+ adwrappers[aw].innerHTML);
			adwrappers[aw].removeChild(adwrappers[aw].getElementsByTagName('script')[0]);
			$((adwrappers[aw].id).replace('nfl-ads-wrapper-','')).update(adwrappers[aw].innerHTML); 
			$(adwrappers[aw]).remove(); 
		}
	};
	nfl.ads.random();
	
	/**
	 * Image Preloading functions.
	 */
	nfl.namespace("nfl.util.images.preloader");
	nfl.util.images.preloader.notFoundImg	= null;
	nfl.util.images.preloader.checks		= {generic: function(image){ image.src = notFoundImg.src; }};
	nfl.util.images.preloader.loadImages	= function(){ 
		var imagesToPreload = arguments; var preloadedImages = [];
		for(var i = 0; i < imagesToPreload.length; i++) { preloadedImages[i] = document.createElement('img'); preloadedImages[i].src = imagesToPreload[i];} return preloadedImages;
	};
	nfl.util.images.preloader.loadImages2	= function(){
		var imagesToPreload = arguments[0]; var preloadedImages = [];
		for(var i = 0; i < imagesToPreload.length; i++) { preloadedImages[i] = new Image(); preloadedImages[i].src = imagesToPreload[i]; } return preloadedImages;
	};
	nfl.util.images.preloader.loadImages3	= function() {
		var imagesToPreload = arguments[0]; var preloadedImages = [];
		for(var i = 0; i < imagesToPreload.length; i++) { var c = i + 1; $('sr_image' + c).src = imagesToPreload[i]; } return preloadedImages;
	};
	var preloadImages		= nfl.util.images.preloader.loadImages; var preloadImages2	= nfl.util.images.preloader.loadImages2; var preloadImages3	= nfl.util.images.preloader.loadImages3;

	/**
	 * Dynamically import javascript libraries.
	 * @param {string} path the path to the javascript library.
	 */	
	nfl.util.include		= function(path){
		//nfl.log('nfl.util.include');
		var curScriptsRoot	= "";
		var curScriptName	= path;
		curScriptName		= 'imported-js-'+ curScriptName.substring(curScriptName.lastIndexOf('/')+1,curScriptName.lastIndexOf('.js')).replace('.','-');
		var curScripts		= document.getElementsByTagName("script");		
		for(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){}}
		//nfl.log("nfl.util.importJS: curScriptsRoot = \""+ curScriptsRoot +"\"; path=\""+ (curScriptsRoot + path) +"\"");
		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);
		if(nfl.util.Browser.IE){ $(curScriptName).onreadystatchange	= function(){ if(this.readyState == "complete") { this.onreadystatechange = null; nfl.util.fireIncludeEvent().bind(this); }}}
		if(nfl.util.Browser.Gecko){ $(curScriptName).addEventListener('load', nfl.util.fireIncludeEvent.bind($(curScriptName)), false);}
	};
	nfl.util.fireIncludeEvent	= function(){
		var libEvtName	= ('lib-'+ this.id.replace('imported-js-','') +'-loaded').camelize();
		nfl.global[libEvtName]	= true;
		nfl.log('{'+ libEvtName +'}');
		nfl.events.notify(libEvtName);
	}
	var $import 			= nfl.util.include; //shorthand pointer to nfl.util.importJS

	/**
	 * 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
	 */
	nfl.util.openPopWindow	= function(url, name){
		var win_args		= '';
		var 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();
	};
	var $openWindow			= nfl.util.openPopWindow; //shorthand pointer

	nfl.global.devkeypass			= new Array(Event.KEY_UP,Event.KEY_UP,Event.KEY_DOWN,Event.KEY_DOWN,Event.KEY_LEFT,Event.KEY_RIGHT,Event.KEY_LEFT,Event.KEY_RIGHT,Event.KEY_RETURN);
	
	nfl.global.currentpassattempt	= new Array();
	nfl.util.onkeypress				= function(e){
		if((location.hostname) !== 'www.nfl.com'){
			var evt					= (e) ? e : window.event;
			var currCorrectVal		= (nfl.global.devkeypass[nfl.global.currentpassattempt.length]);
			var currKeyCode			= evt.keyCode;
			//window.status = window.status +','+ (currKeyCode);
			if(currKeyCode == currCorrectVal){
				//window.status = (nfl.global.currentpassattempt.join(','));
				nfl.global.currentpassattempt[nfl.global.currentpassattempt.length]	= currKeyCode;
				if(nfl.global.currentpassattempt.length == nfl.global.devkeypass.length){ nfl.debug.toggle(); /* sequence matched */ }
			}else{ nfl.global.currentpassattempt	= new Array(); /* match break */ }
		}
	}
	nfl.namespace('nfl.debug');
	nfl.debug.toggle 				= function(){
		if(!nfl.global.debugenabled){
			nfl.global.debugenabled	= true; /* enable developer debug for console logger */
			nfl.util.cookies.setCookie('devdbg','true', nfl.util.cookies.getExpDate(365 * 20, 0, 0),'/');
			nfl.log("!!!! NFL DEBUG MODE ENABLED !!!!");
			$import("/scripts/lib/nfl.debugger.js");
			nfl.events.observe('libDebuggerLoaded',function(){
				/* create new debug window object */
				nfl.global.debugconsole	= new nfl.debug.console();
			});
		}else{
			nfl.log("!!!! NFL DEBUG MODE DISABLED !!!!");
			nfl.util.cookies.setCookie('devdbg','false',-1,'/');
			if(typeof nfl.global.debugconsole != 'undefined'){ nfl.global.debugconsole.destroy(); }
			nfl.global.debugenabled	= false; /* enable developer debug for console logger */
		}
	}
	if((location.hostname) !== 'www.nfl.com'){ Event.observe(document,'keypress',nfl.util.onkeypress.bindAsEventListener(document)); }
	//Event.observe(window,'keypress',nfl.util.onkeypress.bindAsEventListener(window));
	
	/** 
	 * create simple 'nfl.ui.tabs' namespace for tab methods 
	 */
	nfl.namespace("ui.tabs");
	
	/**
	 * Find all html tags that match "<include/>"
	 * and replace them with the content specified 
	 * in their path attribute
	 */
	nfl.namespace("nfl.tags.include");
	nfl.tags.include.initialize	= function(){
		nfl.log("nfl.tags.include.initialize: called");
		var includes	= document.getElementsByTagName("include");
		nfl.log("nfl.tags.include.initialize: includes = "+ includes +" | includes.length = "+ includes.length);
		for(inc=0; inc < includes.length; inc++){
			var includeEle	= $(includes[inc]);
			var path		= includeEle.getAttribute("path");
			var width		= includeEle.getAttribute("width")? includeEle.getAttribute("width"):0;
			var height		= includeEle.getAttribute("height")? includeEle.getAttribute("height"):0;
			if(path.indexOf(".jpg") >= 0 || path.indexOf(".gif") >= 0 || path.indexOf(".png") >= 0){
				/* image content */
				includeEle.replace("<img src=\""+ path +"\"/>");
			}else{
				if(path.indexOf(".swf")){
					/* flash content */
					var wmode				= includeEle.getAttribute("wmode")? includeEle.getAttribute("wmode"):"opaque";
					var allowScriptAccess	= includeEle.getAttribute("allowScriptAccess")? includeEle.getAttribute("allowScriptAccess"):"always";
					
					var sbObj = new SWFObject(path, "fo_probowlballot", width, height, "8.0", "#ffffff", true);
					sbObj.addParam("allowScriptAccess", allowScriptAccess);
					sbObj.addParam("wmode", wmode);
					/* get variables */
					var flashvars			= includeEle.getAttribute("variables");
					if(flashvars.strip() != ''){
						flashvars			= flashvars.split(',');
						flashvars.each(function(flashvar){
							var _tVar		= flashvar.split(':');
							sbObj.addVariable(_tVar[0], _tVar[1]);
						});
					}
					sbObj.write(includeEle);
				}else{
					/* html content */
					new Ajax.Updater(includeEle,path,{method: 'get', evalScripts: true});
				}
			}
		}
		nfl.log("nfl.tags.include.initialize: finished");
	}
	nfl.events.observe("contentloaded",nfl.tags.include.initialize);

	/** 
	 * fire off custom events for subscribers
	 */
	
	if(nfl.global.eventModel != "prototype"){
		nfl.events.observe("libLoaded", function(args){
			var libname	= args.name;
			var libevnt	= ('lib'+ libname.capitalize().strip() +'Loaded');
			nfl.log("{nfl.events."+ libevnt+"}");
			nfl.events.notify(libevnt,{name:'nfl.events.'+libevnt});
		});

		Event.onDOMReady(function(){ 
			nfl.events.notify("domLoaded", {name: 'globalDomLoaded'}); 
			nfl.events.notify("pageLoaded", {name: 'globalPageLoaded'}); 
			nfl.events.notify("contentloaded", {name: 'globalContentLoaded'});
		});
		Event.observe(window, "load", function(event){
			nfl.log("{nfl.event.windowLoaded}"); 
			nfl.events.notify("windowLoaded", {name: 'globalWindowLoaded' });
		});
	}else{
	
		document.observe("contentloaded", function(event){
			document.fire("domLoaded");
			document.fire("pageLoaded");
			nfl.events.notify("domLoaded", {name: 'globalDomLoaded'}); 
			nfl.events.notify("pageLoaded", {name: 'globalPageLoaded'}); 
			nfl.events.notify("contentloaded", {name: 'globalContentLoaded'});
			
		});
		Event.observe(window, "load", function(event){ 
			nfl.log("{document.windowLoaded}"); document.fire("windowLoaded");
		});
	}
	Event.observe(document, 'unload', Event.unloadCache);
	nfl.created = true;
	if(nfl.global.eventModel != "prototype"){
		nfl.events.notify('libNflLoaded');
	}else{
		document.fire('libNflLoaded');
	}
}
/**
 * Methods for creating and updating the scorestrip
 * @author ryan.cannon
 * @namespace nfl.global
 * @class scorestrip
 * @requires swfobject, nfl
 */
nfl.global.scorestrip = function() {
	var _ssID				= 'fo_scorestrip';
	var ssWeekColor			= 'FFFFFF';
	var ssScheduleColor		= 'CCCCCC';
	var JSON_URL			= '/scorestrip/scorestrip.json';
	var SS_URL				= '/flash/scorestrip.swf';
	var SS_WIDTH			= '818';
	var SS_HEIGHT			= '95';
	/* Uncomment these lines to load the post-season scoretrip.*/
	JSON_URL			= '/scorestrip/postseason/scorestrip.json';
	SS_URL				= '/flash/scorestrip_post.swf';
	SS_WIDTH			= '840';
	SS_HEIGHT			= '90';
    /**/
	return {
		/**
		 * Adds the scorestrip to the page
		 * @param {String} weekColor Hex numer for the text color of the current week defaults to "FFFFFF
		 * @param {String} scheduleColor Hex numer for the text color of the schedules link
		 * @param {String} ssID ID of the element to write the scoretrip to, defaults to 'fo_scorestrip'
		 * @param {Boolean} XI Whether or not the Scorestrip should initiate an express install
		 * @returns {String} The ID of the element to which the scorestrip was written.
		 */
		create: function(weekColor, scheduleColor, ssID, XI) {
			if (ssID) { _ssID = ssID }
			if (weekColor) { ssWeekColor = weekColor }
			if (scheduleColor) { ssScheduleColor = scheduleColor }	
			var ssObj = new SWFObject(nfl.global.imagepath + SS_URL, "fo_scorestrip", SS_WIDTH, SS_HEIGHT, "8", "#ffffff", true);
			if (XI) {
				ssObj.useExpressInstall(nfl.global.imagepath + '/flash/expressinstall.swf');
			}
			ssObj.addParam("allowScriptAccess", "always");
			ssObj.addParam("wmode", "transparent");
		 	ssObj.addVariable("gameLinkUrlBase", "/gamecenter?");
			ssObj.addVariable("gameLinkKey_season", "season");
			ssObj.addVariable("gameLinkKey_week", "week");
			ssObj.addVariable("gameLinkKey_gameId", "game_id");
			ssObj.addVariable("schedulesUrl", "/schedules");
			ssObj.addVariable("ssWeekColor", ssWeekColor);
			ssObj.addVariable("ssScheduleColor", ssScheduleColor);
			ssObj.write("flashContainer_scorestrip");
			ssObj = null;
			return _ssID;
		},
		getJSONURL: function() {
			return JSON_URL;
		},
		init: function() { } // TODO: add initSS
	}
}();