/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();




/*
 * This is a temporary file used until Longana 1.0 code is stable enough to retrofit old link.js
 */

Ext.ns("NHL");
/*
 * Global Link3 Singleton.  This singleton contains global link3 parameters and functions.
 */
NHL.Link3 = function(){
	
	return	{
		/*
		 * Get upload fields from a specific domino form.  This can be used to dynamically build Ext forms
		 * with upload fields that correspond to upload fields on the notes form.
		 * 
		 *	url 		: path to the notes form
		 *	callback	: the function to call after we've received the names of the fields
		 *	scope		: the scope to execute the callback in (usually "this")
		 */
		getUploadFields	: function(url, callback, scope) {
			Ext.Ajax.request({
				url		: url,
				success	: function(r) {
					var inputs = r.responseText.match(/<input type="file" name="(%%File\.[^"]+)/g);
					names = [];
					Ext.each(inputs, function(input) {
						names.push(input.replace(/<input type="file" name="/g, ""));
					});
					if (callback) {
						callback.apply(scope || window, names);
					}
				}
			});
		},
		
		
		/*
		 * Delete any attachment from any domino document
		 * 
		 * 	db			: path to the notes database containing the attachment
		 * 	unid		: the unid of the document containing the attachment
		 *	file		: the filename of the attachment to delete
		 *	callback	: the function to call after the attachment has been deleted
		 *	scope		: the scope to execute the callback in (usually "this")
		 */
		deleteAttachment : function(db, unid, file, callback, scope) {
			Ext.Ajax.request({
				url		: "/link3/link3.nsf/agtDeleteAttachment?OpenAgent",
				params	: {
					unid	: unid,
					db		: db,
					file	: file
				},
				success	: function(r) {
					if (callback) {
						callback.apply(scope || window, [r.responseText]);
					}
				}
			});
		},
		
		
		
		/*
		 * Prints any html content using a standard NHL Link format
		 * 
		 * 	title	: The title of the page
		 * 	content	: The html content to print.  Usually the innerHTML of a specific element
		 */
		print: function(title, content){
			this.printTitle = title;
			this.printContent = content;
			window.open("/link3/link3.nsf/pagePrintController", "PrintController", "height=100, width=100, resizable=no,scrollbars=no,status=no");
		},
		
		
		
		/*
		 * Converts individual column entries (already formatted as JSON) to a JSON array.
		 * 
		 * 	columnData	: The data from a db lookup containing concatenated json data
		 *		in the format {key:value}{key:value}{key:value}.  This function converts
		 *		that data into a usable array in the format [{key:value},{key:value},{key:value}]
		 */
		dbColumnToJSON	: function(columnData) {
			return Ext.decode("[" + columnData.responseText.replace(/\}\{/g, "},{") + "]");
		},
		
		
		
		/*
		 * Converts a JSON string to a JSON object while properly removing carriage returns and other invalid whitespace
		 * 
		 *	jsonString	: The string to convert to the JSON object
		 */
		decode	: function(jsonString) {
			return Ext.decode(jsonString.replace(/([\x00-\x1f])/g, " "));
		},
		
		
		/*
		 * Use some ext magic to clone objects.
		 */
		clone	: function(o) {
			return Ext.decode(Ext.encode(o));
		},
		
		
		/*
		 * Create the module manager object to hold defaults.  Also create a modules object
		 * that is used to idenfity modules that have already been loaded
		 */
		ModuleManager	: {
			basePath	: "/link3/",
			modules		: {}
		},
		
		
		/*
		 * This function loads any modules that NHL.Link3 needs at a specific time.
		 * Modules can be loaded on demand for use in the callback function.  You do not need
		 * a callback function if your module is being loaded for later use
		 */
		needs 			: function(modules, callback, scope) {
			Ext.getBody().mask("Loading...", "x-mask-loading");
			
			/*
			 * Needed to remove items from an array
			 */
			var remove = function(array, from, to) {
				var rest = array.slice((to || from) + 1 || array.length);
				array.length = from < 0 ? array.length + from : from;
				return array.push.apply(array, rest);
			};
			
			
			/*
			 *	Get the next module we need to load
			 */
			var getNext = function() {
				var module = modules[0];
				
				if (NHL.Link3.ModuleManager.alwaysReload || !NHL.Link3.ModuleManager.modules[module]) {
					/*
					 *	If the module has not yet been loaded, load it here, eval the the response
					 * and add it to the module object.  Finally, finish processing the module
					 */
					Ext.Ajax.request({
						url			: (module[0]=='/'? '' : NHL.Link3.ModuleManager.basePath) + module + ".js",
						scope		: this,
						callback	: function(opts, success, resp) {
							eval(resp.responseText);
							NHL.Link3.ModuleManager.modules[module] = true;
							processModule(scope);
						}
					});	
				} else {
					/*
					 * If we already have the module loaded, no need to do anything with it
					 * just finish processing.
					 */
					processModule(scope);
				}
			};
		
		
			/*
			 * After the module has been loaded, we need to move on to the next one.  If there
			 * are no modules left, execute the callback function
			 */
			var processModule = function() {
				remove(modules, 0);
				if (modules.length > 0) {
					getNext();
				} else {
					if (callback) {
						Ext.getBody().unmask();
						callback.apply(scope || window);
					}
				}
			};
		
			/*
			 *	Go get our first module
			 */
			getNext();
		},

		
		
		
		/*
		 * Sign Out Of NHL Link
		 */
		signOut		: function() {
			Ext.getBody().mask("Signing Out", "x-mask-loading")
			
			/*
			 * If we're coming from the access box, just sign out of that box
			 */
			if (window.DSHost && DSHost.match(/access/)) {
				document.location.href = "https://access.nhl.com/dana-na/auth/logout.cgi";
			} else {
				Ext.Ajax.request({
					url		: "/names.nsf?Logout",
					success	: function() {
						NHL.Link3.eraseCookie("nhl_grp_key", true);
						NHL.Link3.eraseCookie("port_auth_key", true);
						NHL.Link3.eraseCookie("link_session", true);
						NHL.Link3.eraseCookie("link_home", true);
						document.location.href = "/link3/authentication.nsf?Open&dologout=true";
					}
				});
			}
		},
		
		
		/*
		 * We should have a default ajax timeout that we can modify globally
		 */
		defaultAjaxTimeout : 30000,
		
		
		/*
		 * Load a user's profile
		 */
		loadProfile		: function(userName) {
			NHL.Link3.ModuleManager.basePath = "/working/bobringer/link3/";
			
			NHL.Link3.needs(["modules/users/profile"], function() {
				L3.UserProfile.open(userName);
			}, this);
		},
			
			
		
		
		/*
		 * Shortcuts to common icon paths
		 */
		silk		: "/link3/resources/icons/silk/",
		fugue		: "/link3/resources/icons/fugue/",
		fugue2		: "/link3/resources/icons/fugue2/",
		teams16		: "/link3/resources/logos/16/",
		teams38		: "/link3/resources/logos/38/",
		teams72		: "/link3/resources/logos/72/",
		
		
		/*
		 * YouTube API Key used to embed YouTube content using the API
		 */
		youTubeKey	: "AI39si4OxwQTEJfbKpq8UiE3GQ5qoWxGGr0HziDX2ICoU2HUqhx77-197oefFjnF5r0eoF-3Pj0qqIx4p80XBH_lZUX91a1czA",
		
		
		/*
		 * Set Cookies (Deprecated -- use Longana.setCookie instead)
		 */
		setCookie	: function(name,value,days,domain) {
			var d = "";
			if (domain) {
				if (document.location.host.match(/nhl.com/)) {
					d = "; domain=.nhl.com";
				} else {
					d = "; domain=.nhl.net";
				}
			}
			if (days) {
				var date = new Date();
				date.setTime(date.getTime()+(days*24*60*60*1000));
				var expires = date.toGMTString();
				document.cookie = name + "=" + value + "; expires=" + expires + "; path=/" + d;
			} else {
				document.cookie = name + "=" + value + "; path=/" + d;
			}
		},


		/*
		 * Get Cookies (Deprecated -- use Longana.getCookie instead)
		 */
		getCookie	: function(name) {
			var nameEQ = name + "=";
			var ca = document.cookie.split(';');
			for(var i=0;i < ca.length;i++) {
				var c = ca[i];
				while (c.charAt(0) == ' ') {
					c = c.substring(1, c.length);
				}
				if (c.indexOf(nameEQ) === 0) {
					return c.substring(nameEQ.length, c.length);
				}
			}
			return null;
		},


		/*
		 * Erase Cookies (Deprecated -- use Longana.deleteCookie instead)
		 */
		eraseCookie	: function(name, domain) {
			NHL.Link3.setCookie(name,"",-1, domain);
		},
		

		/*
		 * Returns the height of the current viewport minus any header elements.
		 */		
		getViewableHeight : function(isViewport) {
			var totalHeight = Ext.lib.Dom.getViewHeight(false) - 120;
		
			/*
			 * Remove height of flash team picker for page style apps
			 */
			if (!isViewport) {
				totalHeight -= 40;
			}

			/*
			 * Return -20 to compensate for any additional padding
			 */
			return totalHeight - 20;
		},
		
		
		
		/*
		 * Open window and provide alternative link when opening popups failes
		 */
		openWin	: function(url) {
			var w = window.open(url);
			if (!w) {
				var h = "<span style='font-weight:bold; font-family:Arial; font-size:13px'>Your browser has blocked your popup.<br /><br /><a target='_blank' " +
					"href='" + url + "'>Click Here To View The Document That Was Blocked</a></span><br /><br /><br />To prevent this message in the future, please " +
					"disable your browser's popup blocker for all nhl.com sites.";
				
				Ext.MessageBox.show({
					title	: "Popup Blocked",
					msg		: h,
					icon	: Ext.MessageBox.WARNING,
					buttons	: Ext.MessageBox.OK
				})
			}
		},
		
		
		
		growl	: function(conf) {
			Ext.applyIf(conf, {
				style		: "normal",
				duration	: 5
			})
			
			Growl[conf.style](conf)
		}
	};
}();
L3 = NHL.Link3;




/*
 *  NHL Link3 Session Singleton to get information about the current user
 */
NHL.Link3.Session = function(){
	var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
	function decode64(input) {
	   var output = "";
	   var chr1, chr2, chr3;
	   var enc1, enc2, enc3, enc4;
	   var i = 0;
	
	   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
	   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
	
	   do {
	      enc1 = keyStr.indexOf(input.charAt(i++));
	      enc2 = keyStr.indexOf(input.charAt(i++));
	      enc3 = keyStr.indexOf(input.charAt(i++));
	      enc4 = keyStr.indexOf(input.charAt(i++));
	
	      chr1 = (enc1 << 2) | (enc2 >> 4);
	      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
	      chr3 = ((enc3 & 3) << 6) | enc4;
	
	      output = output + String.fromCharCode(chr1);
	
	      if (enc3 != 64) {
	         output = output + String.fromCharCode(chr2);
	      }
	      if (enc4 != 64) {
	         output = output + String.fromCharCode(chr3);
	      }
	   } while (i < input.length);
	
	   return output;
	}
	
	
	var adGroups = [];
	var domGroups = [];
	var type = "";
	var clientLocation = "";
	var userOffice = "";

	if (Session.userSession) {
        var sobj = Ext.decode(decode64(Session.userSession));
        if (sobj.ad) {
            adGroups = sobj.ad.split("|");
        }
        if (sobj.dom) {
            domGroups = sobj.dom.replace(/Link_/g, "").split("|");
        }
		
		type = sobj.type;
		clientLocation = unescape(sobj.clientLocation);
		userOffice = sobj.officeLocation;
	}
	
	return {
		decode64	: decode64,
		
		hasAD : function() {
			var ret = false;
		    for (var i = 0; i < arguments.length; i++) {
				if (adGroups.indexOf(arguments[i]) > -1) {
					ret = true;
				}
    		}
			return ret;
		},
		
		hasDom : function() {
			var ret = false;
		    for (var i = 0; i < arguments.length; i++) {
				if (domGroups.indexOf(arguments[i]) > -1) {
					ret = true;
				}
    		}

			return ret;
		},
		
		
		getUserType : function() {
			return type;
		},
		
		getClientLocation : function() {
			return clientLocation;
		},
		
		getUserOffice : function() {
			return (userOffice.match(/New York/ig)) ? "New York" : userOffice;
		},
		
		isSecureLocation : function() {
			return (clientLocation !== "Internet");
		}
	};
}();






/*
 * 
 */
(function(){
	if (!Array.prototype.unique) {
		Array.prototype.unique = function( b ) {
			var a = [], i, l = this.length;
	 		for( i=0; i<l; i++ ) {
	  			if( a.indexOf( this[i], 0, b ) < 0 ) { a.push( this[i] ); }
	 		}
	 		return a;
		};
	}
	
	
	/*
	 * Truncates a number at a specified precision
	 */
	if (!Number.prototype.truncate) {
 		Number.prototype.truncate = function(n) {
			return Math.round(this * Math.pow(10, n)) / Math.pow(10, n);	
		};
	}
	
	
	/*
	 * Returns a new date object. The date object will contain the date of the day of the week passed in as a parameter. For example:
	 * date.getDateOfWeek(0) returns nearest Sunday looking into the past. if current date falls on a Sunday, date.getDateOfWeek(0) returns current date.
	 * date.getDateOfWeek(1) returns Monday of current week.
	 * date.getDateOfWeek(7) returns nearest Sunday looking into the future.
	 */
	if (!Date.prototype.getDateOfWeek) {
		Date.prototype.getDateOfWeek = function (day_of_week) {
			var d = new Date(this);
			d.setDate(d.getDate()-d.getDay()+day_of_week);
			return d;
		};	
	}
})();






/*
 * Team Icon Drop Down
 */
L3.TeamCombo = function(config) {
	Ext.applyIf(config, {
		store	: new Ext.data.SimpleStore({
			fields	: ['teamCode', 'teamName', 'teamLogo'],
			data	: [
				['anaheim', 	"Anaheim Ducks", 		"team-anaheim"],
				['atlanta', 	"Atlanta Thrashers", 	"team-atlanta"],
				['boston', 		"Boston Bruins", 		"team-boston"],
				['buffalo', 	"Buffalo Sabres", 		"team-buffalo"],
				['calgary', 	"Calgary Flames",	 	"team-calgary"],
				['carolina',	"Carolina Hurricanes",	"team-carolina"],
				['chicago', 	"Chicago Blackhawks",	"team-chicago"],
				['colorado', 	"Colorado Avalanche", 	"team-colorado"],
				['columbus',	"Columbus Blue Jackets","team-columbus"],
				['dallas',	 	"Dallas Stars", 		"team-dallas"],
				['detroit', 	"Detroit Red Wings", 	"team-detroit"],
				['edmonton',	"Edmonton Oilers", 		"team-edmonton"],		
				['florida', 	"Florida Panthers", 	"team-florida"],
				['losangeles', 	"Los Angeles Kings", 	"team-losangeles"],
				['minnesota',	"Minnesota Wild", 		"team-minnesota"],
				['montreal', 	"Montreal Canadiens", 	"team-montreal"],
				['nashville', 	"Nashville Predators",	"team-nashville"],
				['newjersey',	"New Jersey Devils",	"team-newjersey"],
				['nyislanders',	"New York Islanders",	"team-nyislanders"],
				['nyrangers', 	"New York Rangers", 	"team-nyrangers"],
				['ottawa',		"Ottawa Senators",		"team-ottawa"],
				['philadelphia',"Philadelphia Flyers",	"team-philadelphia"],
				['phoenix', 	"Phoenix Coyotes", 		"team-phoenix"],
				['pittsburgh',	"Pittsburgh Penguins", 	"team-pittsburgh"],	
				['sanjose', 	"San Jose Sharks", 		"team-sanjose"],
				['stlouis', 	"St. Louis Blues", 		"team-stlouis"],
				['tampabay',	"Tampa Bay Lightning",	"team-tampabay"],
				['toronto', 	"Toronto Maple Leafs",	"team-toronto"],
				['vancouver', 	"Vancouver Canucks", 	"team-vancouver"],
				['washington',	"Washington Capitals",	"team-washington"]
			]
		}),
		valueField		: 'teamCode',
		displayField	: 'teamName',
		iconClsField	: 'teamLogo',
		width			: 170,
		triggerAction	: 'all',
		editable		: false,
		mode			: 'local'
	});
	
	L3.TeamCombo.superclass.constructor.call(this, config);
};
Ext.extend(L3.TeamCombo, Ext.form.ComboBox, {
    initComponent:function() {
        Ext.apply(this, {
            tpl:  '<tpl for=".">'
                + '<div class="x-combo-list-item team-combo-item '
                + '{' + this.iconClsField + '}">'
                + '{' + this.displayField + '}'
                + '</div></tpl>'
        });
 
        L3.TeamCombo.superclass.initComponent.call(this);
 
    },
 
    onRender:function(ct, position) {
        L3.TeamCombo.superclass.onRender.call(this, ct, position);
 
        this.wrap.applyStyles({position:'relative'});
        this.el.addClass('team-combo-input');
 
        this.icon = Ext.DomHelper.append(this.el.up('div.x-form-field-wrap'), {
            tag: 'div', style:'position:absolute', cls:'team-combo-icon team-nhl'
        });
    },
	
    setIconCls:function() {
		if (this.getValue() === "") {
			this.icon.className = 'team-combo-icon team-nhl';
			return;
		}

        var rec = this.store.query(this.valueField, this.getValue()).itemAt(0);
        if(rec) {
            this.icon.className = 'team-combo-icon ' + rec.get(this.iconClsField);
        }
    }, 
 
    setValue: function(value) {
      	L3.TeamCombo.superclass.setValue.call(this, value);
        this.setIconCls();
    }
});
 
Ext.reg('teamcombo', L3.TeamCombo);










/*
 * Prevent start date/end date fields from having dates reversed
 */
Ext.apply(Ext.form.VTypes, {
	emailMask: /[@\.a-z0-9!#$%&'*+\/=?^_`{\|}~-]/i,

  email: function (v) {
  	// correct email validation regex per specs below, see also http://tools.ietf.org/html/rfc2822#section-3.4.1
	var email = /^\s*([a-z0-9!#$%&'*+\/=?^_`{\|}~-]+)(\.[a-z0-9!#$%&'*+\/=?^_`{\|}~-]+)*@([a-z0-9!#$%&'*+\/=?^_`{\|}~-]+)(\.[a-z0-9!#$%&'*+\/=?^_`{\|}~-]+)*\.([a-z]){2,4}\s*$/i;

/*
addr-spec       =       local-part "@" domain

local-part      =       dot-atom / quoted-string / obs-local-part

domain          =       dot-atom / domain-literal / obs-domain

domain-literal  =       [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS]

dcontent        =       dtext / quoted-pair

dtext           =       NO-WS-CTL /     ; Non white space controls

                        %d33-90 /       ; The rest of the US-ASCII
                        %d94-126        ;  characters not including "[",
                                        ;  "]", or "\"
obs-local-part  =       word *("." word)
quoted-string   =       [CFWS]
                        DQUOTE *([FWS] qcontent) [FWS] DQUOTE
                        [CFWS]

atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

atom            =       [CFWS] 1*atext [CFWS]

dot-atom        =       [CFWS] dot-atom-text [CFWS]

dot-atom-text   =       1*atext *("." 1*atext)

FWS             =       ([*WSP CRLF] 1*WSP) /   ; Folding white space
                        obs-FWS

CFWS            =       *([FWS] comment) (([FWS] comment) / FWS)

*/

	return email.test(v);
  },
  datefieldrange: function(val, field) {
    var date = field.parseDate(val);
    
    // We need to force the picker to update values to recaluate the disabled dates display
    var dispUpd = function(picker) {
      var ad = picker.activeDate;
      picker.activeDate = null;
      picker.update(ad);
    };
    
    if (field.startDateField) {
      var sd = Ext.getCmp(field.startDateField);
      sd.maxValue = date;
      if (sd.menu && sd.menu.picker) {
        sd.menu.picker.maxDate = date;
        dispUpd(sd.menu.picker);
      };
    } else if (field.endDateField) {
      var ed = Ext.getCmp(field.endDateField);
      ed.minValue = date;
      if (ed.menu && ed.menu.picker) {
        ed.menu.picker.minDate = date;
        dispUpd(ed.menu.picker);
      };
    };
    /* Always return true since we're only using this vtype
     * to set the min/max allowed values (these are tested
     * for after the vtype test)
     */
    return true;
  }
});




/*
 * Create new functions to hide both a form field AND it's label
 */
Ext.override(Ext.form.Field, { 
    showContainer: function() { 
        this.enable(); 
        this.show(); 
        this.getEl().up('.x-form-item').setDisplayed(true); // show entire container and children (including label if applicable) 
    }, 
     
    hideContainer: function() { 
        this.disable(); // for validation 
        this.hide(); 
        this.getEl().up('.x-form-item').setDisplayed(false); // hide container and children (including label if applicable) 
    }, 
     
    setContainerVisible: function(visible) { 
        if (visible) { 
            this.showContainer(); 
        } else { 
            this.hideContainer(); 
        } 
        return this; 
    },
	
	
	/*
	 * Added by Rouslan to set/unset an existing field as readonly
	 */
	setReadOnly : function(ro) {
		this.getEl().dom.readOnly = ro;
		if (ro) {
			this.getEl().addClass('x-form-readonly');
		} else {
			this.getEl().removeClass('x-form-readonly');
		}

		if (this instanceof Ext.form.TriggerField) {
			this.setDisabled(ro);
			if (this instanceof Ext.form.ComboBox) {
				this.setEditable(!ro);
				if (ro) {
					this.expand_original = this.expand;
					this.expand = Ext.emptyFn;
				} else {
					this.expand = this.expand_original;
				}
			}
		}
	}
});




Ext.namespace('Link.Plugins');
Link.Plugins.StaticScrollLock = function(config) {
    Ext.apply(this, config);
};
Ext.extend(Link.Plugins.StaticScrollLock, Ext.util.Observable, {
    init	:function(pan) {
		this.pan = pan;
		pan.on("render", function() {
			
			(function() {
				this.scrollMode = "absolute";
				this.scrollHomePos = {left:pan.getEl().getX(0),top:pan.getEl().getY(), width:pan.getSize().width};
	
				Ext.EventManager.on(window, 'scroll', function(){
					this.setPosition();
					
				}, this);

				Ext.EventManager.on(window, 'resize', function(){
					this.scrollHomePos.left = pan.getEl().getX(0)
					this.setPosition();
				}, this);
				
				this.setPosition();		
			}).defer(1000, this);
		}, this)
    },
	
	
	setPosition	: function() {
		
		var top = Ext.getDoc().getScroll().top;
		if (top > this.scrollHomePos.top) {
			var owner = this.pan.ownerCt;
			
			owner.setHeight((top - this.scrollHomePos.top) + ((this.pan.getInnerHeight() - 0) + 15));

			if (!Ext.isIE) {
				if (this.scrollMode == "absolute") {
					this.scrollMode = "fixed";
					this.pan.getEl().dom.style.position = "fixed";
					this.pan.getEl().dom.style.left = (this.scrollHomePos.left) + "px";
					this.pan.getEl().dom.style.top = 0;
					this.pan.getEl().dom.style.paddingTop = "6px";						
					this.pan.getEl().setWidth(this.scrollHomePos.width);
				}
			} else {
				this.pan.getEl().setLocation(this.scrollHomePos.left, ((top - 0) + 6));
			}

		} else {

			if (!Ext.isIE) {
				if (this.scrollMode == "fixed") {
					this.scrollMode = "absolute";
					this.pan.getEl().dom.style.position = "relative";
					this.pan.getEl().dom.style.left = "0px";
					this.pan.getEl().dom.style.top = "0px";
					this.pan.getEl().dom.style.paddingTop = "0px";			
				}
			} else {
				this.pan.getEl().setLocation(this.scrollHomePos.left, this.scrollHomePos.top);					
			}

		}			
	}
});