// DCLK variables, required for every page
var axel = Math.random() + "";
var ord = axel * 1000000000000000000;

// Broswer detection - these must be consistent on every page.  make sure the old script file has the same variables.
var NS4 = (document.layers) ? 1 : 0;
var IE4 = ((document.all) && (!document.getElementById)) ? 1 : 0;
var IE5 = ((document.all) && (!document.fireEvent) && (!window.opera)) ? 1 : 0;
var DOM = (document.getElementById) ? 1 : 0;  // ns6+ and ie5+ and mozilla
var NS6 = ((!document.all) && (document.getElementById)) ? 1 : 0;  // ns6+ and mozilla, not ie6
var IE = (navigator.appName == "Microsoft Internet Explorer") ? 1 : 0;
var PC = (navigator.platform == "Win32") ? 1 : 0;
var MAC = ((navigator.appVersion.indexOf("PPC") >0) || (navigator.appVersion.indexOf("Mac") >0)) ? 1 : 0;

// fantasy football
var ff = new Object();

//Layer switch functions using the display property
function layerSwitchDisplay(theDivs, divId) {
// Layer switching functions
  for (var i = 0; i < theDivs.length; i++) {
    if (theDivs[i] == divId) {
      showLayerDisplay(theDivs[i]);
    }
    else {
      hideLayerDisplay(theDivs[i]);
    }
  }
}
function hideLayerDisplay(whichEl) {
  document.getElementById(whichEl).style.display = "none";
}
function showLayerDisplay(whichEl) {
  document.getElementById(whichEl).style.display = "";
}

function ToggleStyleDisplay(elId, state) {
    if (typeof(elId) != "object") {
        var el = document.getElementById(elId);
    }
    else {
        var el = elId;
    }

    if (!el) {
        return;
    }
    var displayValue = el.style.display;

    if (arguments.length > 1) {
        if (state) {
            displayValue = 'none';
        }
        else {
            displayValue = 'block';
        }
    }
    var block = 'block';
    if (NS6) {
        if (el.tagName == 'TR') block = 'table-row';
        if (el.tagName == 'TABLE') block = 'table';
        if (el.tagName == 'TD' || el.tagName == 'TH') block = 'table-cell';
    }
    if ((displayValue == '') || (displayValue == 'none')) {
        el.style.display = block;
    }
    else {
        el.style.display = 'none';
    }
}


function userState(type) {
  if (arguments.length == 0) {
    if (typeof(user) != 'object') return false;
    if (typeof(user.USER_ID) != 'string') return false;
    if (user.USER_ID == 0) return false;
    return true;
  }
  else {
    if (userState()) {
      if (type == 'players') {
        if (typeof(userPlayers) != 'object') return false;
        if (typeof(userPlayers.length) != 'number') return false;
        if (userPlayers.length == 0) return false;
        return true;
      }
      else if (type == 'teams') {
        if (typeof(userTeams) != 'object') return false;
        if (typeof(userTeams.length) != 'number') return false;
        if (userTeams.length == 0) return false;
        return true;
      }
    }
    else {
      return false;
    }
  }
}

function findX(el) {
  var x = 0;
  var obj = document.getElementById(el);
  while (obj.offsetParent) {
  x += obj.offsetLeft;
  obj = obj.offsetParent;
  }
  return x;
}
function findY(el) {
  var y = 0;
  var obj = document.getElementById(el);
  while (obj.offsetParent) {
  y += obj.offsetTop;
  obj = obj.offsetParent;
  }
  return y;
}

function Redirect(url) {
location.replace(url);
}

/*
  This will turn on the debugInfo area at the bottom of the page then append the message passed in.  The function will work if the
	user is on dev or passes in a key value pair in the querystring where the key is debug with any value.
*/
function DebugInfo(message) {
    try {
        var args = GetArgs();
        if (typeof(args.debug) != "undefined" || location.hostname.indexOf("dmz.foxsports.com") != -1 || location.hostname.indexOf("dtn.foxsports.com") != -1) {
            document.getElementById("debugHeader").style.display = "block";
            var obj = document.getElementById("debugInfo");
            obj.style.display = "block";
            obj.innerHTML = "<li>" + message + obj.innerHTML;
        }
    }
    catch(e) {
    }
}

// used on story pages
var months = new Array ("Jan.", "Feb.", "Mar.", "Apr.", "May.", "Jun.", "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec");
function formatDate(seconds) {
  var d = new Date(seconds * 1000);
  var y = d.getYear();
  var h = d.getHours();
  var m = d.getMinutes();
  var p;

  if (h >= 12) {
    p = "p.m.";
  } else {
    p = "a.m.";
  }
  if (h > 12) {
    h -=12;
  } else if (!h) {
    h = 12;
  }
  if (m < 10) {
    m = "0" + m;
  }
  if (y < 1000) {
    y += 1900;
  }
  return months[d.getMonth()] + " " + d.getDate() + ", " + y +
    " " + h + ":" + m + " " + p;
}

// Image swapping function
function imageSwap(imageName, imageSource) {
  // Don't do anything if images aren't supported in DOM
  if (document.images) {
    // Change the source of the image
    // Both of these are passed in the function arguments
    imageName.src = imageSource;
  }
}

function validate5DigitZIP(f) {
	var temp = '';
	var valid = "0123456789";
	var formZIP = f.zipcode.value;
	if (formZIP.length != 5) {
		alert("Please enter a 5 digit zip code.  Thank you.");
		return false;
	}
	for (var i=0; i < formZIP.length; i++) {
		temp = "" + formZIP.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") {
			alert("Your zip code must be five numerals.  Please try again.");
			return false;
		}
	}
	return true;
}

//Generic Window Opener function
function openWin(winURL, winName, winWidth, winHeight) {
  var winTop = 25;
  var winLeft = 25;
  if (screen.availWidth <= 800) {
    var winLeft = screen.availWidth - winWidth;
  }
  if (arguments.length == 2) {  //open generic window
    var theWin = window.open(winURL, winName);
  }
  else { // open standard pop-up window with tool bars disabled
    var theWin = window.open(winURL, winName, "width=" + winWidth + ",height=" + winHeight + ",top=" + winTop + ",left=" + winLeft + ",screenY=" + winTop + ",screenY=" + winLeft + ",toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=1,scrollbars=no");
  }
}

//Browser Bookmarking function
function addBookmark(){
  var bookmarkurl = document.URL;
  var bookmarktitle = document.title;
  if(window.sidebar){ // Firefox
    window.sidebar.addPanel(bookmarktitle, bookmarkurl,'');
  } else if(window.opera){ //Opera
    var a = document.createElement("A");
    a.rel = "sidebar";
    a.target = "_search";
    a.title = title;
    a.href = url;
    a.click();
  } else if(document.all){ //IE
    window.external.AddFavorite(bookmarkurl, bookmarktitle);
  }
}

//Flash Detection
if (typeof(requiredVersion)=="undefined") {
  var requiredVersion = 6;
}
var flash5Installed = false;
var flash6Installed = false;
var actualVersion = 0;
var useFlash = false;
if(IE && PC){
  document.writeln('<SCR' + 'IPT LANGUAGE=VBScript\>');
  document.writeln('on error resume next');
  document.writeln('flash6Installed  = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))');
  document.writeln('If (flash6Installed) then');
  document.writeln('  flash5Installed  = True');
  document.writeln('Else');
  document.writeln('  flash5Installed  = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))');
  document.writeln('End If');
  document.writeln('</SCR' + 'IPT\>');
}
function detectFlash() {
  if (navigator.plugins) {
    if (navigator.plugins["Shockwave Flash"]) {
      var flashDescription = navigator.plugins["Shockwave Flash"].description;
      var flashDescriptionShort = flashDescription.slice(0,flashDescription.indexOf("."));
      var flashDescriptionVersion = flashDescriptionShort.slice(flashDescriptionShort.lastIndexOf(" ")+1, flashDescriptionShort.length);
      var actualVersion = parseInt(flashDescriptionVersion);
    }
  }
  //alert("version detected: " + actualVersion);
  if (flash5Installed) {
    var actualVersion = 5;
  }
  if (flash6Installed) {
    var actualVersion = 6;
  }
  if (actualVersion >= requiredVersion) {
    useFlash = true;
    var url = document.URL;
    if (url.indexOf("flash=0") != -1) useFlash = false; //debug code so user can add flash=0 to url string and see what the site looks like w/o flash
  }
}
detectFlash();

// Stuff for Plugin Detection
    // this is where we write out the VBScript for MSIE Windows
    var WM_startTagFix = '</';
    var msie_windows = 0;
    if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)){
        msie_windows = 1;
        document.writeln('<script language="VBscript">');
        document.writeln('\'This will scan for plugins for all versions of Internet Explorer that have a VBscript engine version 2 or greater.');
        document.writeln('\'This includes all versions of IE4 and beyond and some versions of IE 3.');
        document.writeln('Dim WM_detect_through_vb');
        document.writeln('WM_detect_through_vb = 0');
        document.writeln('If ScriptEngineMajorVersion >= 2 then');
        document.writeln('  WM_detect_through_vb = 1');
        document.writeln('End If');
        document.writeln('Function WM_activeXDetect(activeXname)');
        document.writeln('  on error resume next');
        document.writeln('  If ScriptEngineMajorVersion >= 2 then');
        document.writeln('     WM_activeXDetect = False');
        document.writeln('     WM_activeXDetect = IsObject(CreateObject(activeXname))');
        document.writeln('     If (err) then');
        document.writeln('        WM_activeXDetect = False');
        document.writeln('     End If');
        document.writeln('   Else');
        document.writeln('     WM_activeXDetect = False');
        document.writeln('   End If');
        document.writeln('End Function');
        document.writeln(WM_startTagFix+'script>');
    }

function WM_pluginDetect(plugindescription, pluginxtension, pluginmime, activeXname){
        //This script block will test all user agents that have a real plug-in array
        //(i.e. Netscape) and set the variables, otherwise it directs the routine
        // to WM_activeXDetect to detect the activeX control.
        // First define some variables
        var i,plugin_undetectable=0,detected=0, daPlugin=new Object();
        // Then we check to see if it's an MSIE browser that you can actually
        // check for the plugin in question.
        if (msie_windows && WM_detect_through_vb){
            plugin_undetectable = 0;
        } else {
            plugin_undetectable = 1;
        }
        // If it has a real plugins or mimetypes array, we look there for the plugin first
        if(navigator.plugins) {
            numPlugins = navigator.plugins.length;
            if (numPlugins > 1) {
                if (navigator.mimeTypes && navigator.mimeTypes[pluginmime] && navigator.mimeTypes[pluginmime].enabledPlugin && (navigator.mimeTypes[pluginmime].suffixes.indexOf(pluginxtension) != -1)) { // seems like we have it, let's just make sure and check the version (if specified)
                    if ((navigator.appName == 'Netscape') && (navigator.appVersion.indexOf('4.0') != -1)) { // stupid, stupid Netscape can't handle the references to navigator.plugins by number, sooo...
                        for(i in navigator.plugins) {
                            if ((navigator.plugins[i].description.indexOf(plugindescription) != -1) || (i.indexOf(plugindescription) != -1)) { // some versions of quicktime have no description. feh!
                                detected=1;
                                break;
                            }
                        }
                    } else {
                        for (i = 0; i < numPlugins; i++) {
                            daPlugin = navigator.plugins[i];
                            if ((daPlugin.description.indexOf(plugindescription) != -1) || (daPlugin.name.indexOf(plugindescription) != -1)) {
                                detected=1;
                                break;
                            }
                        }
                    }
                    // Mac weirdness
                    if (navigator.mimeTypes[pluginmime] == null) {
                        detected = 0;
                    }
                }
                return detected;
            } else if((msie_windows == 1) && !plugin_undetectable){
                return WM_activeXDetect(activeXname);
            } else {
                return 0;
            }
        } else {
            return 0;
        }
    }


//NFL PRO BOWL
function openBallot(url,width,height) {
 popupWin = window.open(url, name, "menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,width=" +width +",height=" +height +",left=50,top=50");
}

// MLB.com gameday04
// new window launch
// usage: <a href="[url]" onclick="popWin(this,'[window_name]','[width]','[height]' {,'_optional_options'}); return false;" ... >
var _pw_l,_pw_t,_pw_z;
function popWin(url,n,w,h,o) {
  if (w>screen.availWidth-12) w=screen.availWidth-12;
  if (h>screen.availHeight-48) h=screen.availHeight-48;
  _pw_l=(screen.availWidth-w-12)/2;
  _pw_t=(screen.availHeight-h-48)/2;
  _pw_z=window.open(url,n,'width='+w+',height='+h+',left='+_pw_l+',top='+_pw_t+','+o);
}
function launchGameday(params) {
  var gamedayURL = 'http://mlb.mlb.com/mlb/gameday/gd2004.html?' + params;
  popWin(gamedayURL,'GamedayWin','770','600','location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=yes');
}

// retrieve arguments from url query string
function GetArgs() {
	var args = new Object();
	var query = location.search.substring(1);
	var pairs = query.split("&");
	for (var i = 0; i < pairs.length; i++) {
		var pos = pairs[i].indexOf('=');
		if (pos == -1) continue;
		var argname = pairs[i].substring(0,pos);
		var value = pairs[i].substring(pos+1);
		args[argname] = unescape(value);
	}
	return args;
}

// possible function if we center pages
function PositionElementsOnResize() {
	if (document.getElementById('ad300x250')) {
    var ad300x250 = document.getElementById('ad300x250');
    ad300x250.style.top = findY('ad300x250box');
    ad300x250.style.left = findX('ad300x250box');
	}
	if (document.getElementById('ad160x600')) {
    var ad160x600 = document.getElementById('ad160x600');
    ad160x600.style.top = findY('ad160x600box');
    ad160x600.style.left = findX('ad160x600box');
	}
}
window.onresize = PositionElementsOnResize;

// Called by the Point Roll AD Iframe to hide the AD.
function hidePointRoll() {
  //try {
		var adDiv = document.getElementById('advertLabel728x90');
		adDiv.style.display = "none";
                //parent.dap_Resize(document.body.id,1,1);
		//var iframes = adDiv.getElementsByTagName("IFRAME");
		//adDiv.removeChild(iframes[0]);
		//window.top.focus();
	//}
	//catch(e) {
//	}
}

// function used to display fantasy information
// this function will take the teamId and return the team name either linked or not linked.
function ff_dt(teamId, type) {
	try {
		// need to find the correct league for the team id passed in.
		for (var i = 0; i < teamsInfo.length; i++) {
			 if (teamsInfo[i][0] == teamId) var teamName = teamsInfo[i][1];
		}
		if (arguments.length == 1) {
			var link = '<a href="http://msnfantasy.foxsports.com/nfl/commish/team/home?teamId=' + teamId + '">' + teamName + '</a>';
			return link;
		}
		if (arguments.length == 2 && arguments[1] == 0) {
			return teamName;
		}
	}
  catch(e) {
	  //do nothing
	}
}
function ff_dw_dt(teamId, type) {
	try {
		var teamName = teamsInfo[0][1];
		if (arguments.length == 1) {
			var link = '<a href="http://msnfantasy.foxsports.com/nfl/commish/team/home?teamId=' + teamId + '">' + teamName + '</a>';
			document.write(link);
			return;
		}
		if (arguments.length == 2 && arguments[1] == 0) {
			document.write(teamName);
			return;
		}
	}
  catch(e) {
	  //do nothing
	}
}

function ff_dg(leagueId, type) {
	try {
		for (var i = 0; i < teamsInfo.length; i++) {
			 if (teamsInfo[i][4] == leagueId) var leagueName = teamsInfo[i][5];
		}
		if (arguments.length == 1) {
			var link = '<a href="http://msnfantasy.foxsports.com/nfl/commish/league/home?leagueId=' + leagueId + '">' + leagueName + '</a>';
			return link;
		}
		if (arguments.length == 2 && arguments[1] == 0) {
			return leagueName;
		}
	}
  catch(e) {
	  //do nothing
	}
}

function ff_dw_dg(leagueId, type) {
	try {
		var leagueName = teamsInfo[0][5];
		if (arguments.length == 1) {
			var link = '<a href="http://msnfantasy.foxsports.com/nfl/commish/league/home?leagueId=' + leagueId + '">' + leagueName + '</a>';
			document.write(link);
			return;
		}
		if (arguments.length == 2 && arguments[1] == 0) {
			document.write(leagueName);
			return;
		}
	}
  catch(e) {
	  //do nothing
	}
}

function openRadioWindow() {
  var radioWindow = window.open("/radio/radioPlayer", "subwindow", "height=100,width=299");
}

/* BEGIN: [Tab Switch Function] */
function tabSwitch(me){
	me.className = me.className.replace("_off","_on"); // set the tab to "On"
	for(i=0; i<me.parentNode.childNodes.length; i++){  // cycle through the tags in the containing node of this anchor
		if(me.parentNode.childNodes[i].title != me.title){ // look for everthing that isn't the anchor you just changed

			if(me.parentNode.childNodes[i].className == me.className){ // find the class name that matches the current class name
				me.parentNode.childNodes[i].className = me.parentNode.childNodes[i].className.replace("_on","_off"); // Turn them all "Off"
			}

			if(me.parentNode.childNodes[i].title == me.title+"_Data"){  // find the associated "Data" with the user picked (related by titles)
				me.parentNode.childNodes[i].style.display = "block"; // display the data
			}else if(me.parentNode.childNodes[i].title){ // find all of the other "Data" related to tabs

				if(me.parentNode.childNodes[i].title.search("_Data") != -1){ // filter out the one that matches the one the user picked
					me.parentNode.childNodes[i].style.display = "none"; // "hide" the other related data
				}
			}
		}
	}
}
/* END: [Tab Switch Function] */


/* BEGIN: [ Add This defaults} */
addthis_logo = 'http://msn.foxsports.com/fe/img/add_this_header.jpg';
addthis_brand = 'Fox Sports';
addthis_options = 'digg,myspace,live,ballhype,yardbarker,favorites,delicious,google,facebook,reddit,newsvine,more';
/* END: [ Add This defaults} */



/* BEGIN: [Global Navigation Script] */
try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {/*ignore*/} // for IE6 flicker issues
function rackEm(me){
	try{
	var navSec = document.getElementById(me); // get the nav
	var navUls = navSec.getElementsByTagName("ul"); // grab all of the list items
	for(i=0; i<navUls.length; i++){ // cycle throught the list items
		var node = navUls[i];
		node.id=i; // set the id for the ul list items
		node.parentNode.onmouseover=function(){
			this.className = this.className +' openNavParent';
			this.childNodes[2].className = "openNav openNavImg";
		};
		node.parentNode.onmouseout=function(){
			this.className = this.className.replace(' openNavParent','');
			this.childNodes[2].className = "";
			if(this.className == "openNavParent"){
				this.className ='';
			}
		};

		if(node.parentNode.nodeName == "LI"){
			node.parentNode.childNodes[0].className=node.parentNode.childNodes[0].className +=" openNavImg";
		}else{
			if(document.all){
				node.style.marginLeft = "-"+(Math.round(node.parentNode.offsetWidth))+"px";
			}else{
				node.style.marginLeft = "-"+(Math.round(node.parentNode.offsetWidth/navUls.length-10))+"px";
			}
		}
	}
	}catch(e){alert("nav error: "+e.message);}
}
/* END: [Global Navigation Script] */


/* BEGIN: [Global Advertisement Launching]
	** Example on calling this function:
	** loadAds(); or loadAds({adID: "45x60", solo: true});
	** Using options, call what you want to change only.  Inside the function, defaults are set and explained.
*/
function loadAds(options){
	var options = options || {}; // options setup.
	var adID = options.adID || ""; // specifically called ads
	var fsAds = "160x600,300x250,728x90,120x30"; // standard ad calls
	var solo = options.solo || false;  // solo toggle.  Don't call standard ads
	
	if(solo == true){  // if only the specific ads
		var ads = adID.split(","); // load up the specific ads
	}else{
		var ads = adID.concat(adID.split(","),fsAds.split(",")).split(","); // load up ALL ads including specifics
	}
	
	if(ads){ // if ads exist...
		for(var i=0; i<ads.length; i++){ // loop through the ads
			size = ads[i].split("x"); // get the size of each ad
			dapMgr.enableACB('ad'+ads[i]+'box',false); // enable advertisement
			dapMgr.renderAd('ad'+ads[i]+'box', eval("adCode"+ads[i]), size[0], size[1]); // render advertisement		
		}
	}		
}
/* END: [Global  Advertisement Launching] */






/* BEGIN: [Global Open Window Script]
	** Example on calling this function:
	** openNewWin(this, {url:"http://foxsports.com", scrollbars: "yes", name: "my_window"});
	** Using options, call what you want to change only.  Inside the function, defaults are set and explained.
*/
function openNewWin(me, options){
	var options = options || {}; // options setup.
	var wUrl = options.url || null; // url for pop-up.  Default is null.
	var wName = options.windowName || "FS_Window"; // name for pop-up.  Default is "FS_Window".
	var wWidth = options.width || 800; // width of pop-up. Default is 800px;
	var wHeight = options.height || 600; // height of popup.  Default is 600px.
	var wTop = options.top || 25; // top position from the browser.  Default is 25px.
	var wLeft = options.left || 25; // left position form the browser. Default is 25px.
	var wToolbar = options.toolbar || "no"; // Whether or not to display the browser toolbar. Default is "no".
	var wLocation = options.location || "no"; // Whether or not to display the address field. Default is "no".
	var wDirectories = options.directories || "no"; // Whether or not to add directory buttons. Default is "no"
	var wStatus = options.status || "no"; // Whether or not to add a status bar. Default is "no".
	var wMenubar = options.menubar || "no"; // Whether or not to display the menu bar. Default is "no".
	var wResizable = options.resizable || "yes"; // Whether or not the window is resizable. Default is "yes".
	var wScrollbars = options.scrollbars || "no"; // Whether or not to display scroll bars. Default is "no".
	var wFullscreen = options.fullscreen || "no"; // Whether or not to display the browser in full-screen mode. Default is "no". A window in full-screen mode must also be in theater mode.
	var wChannelmode = options.channelmode || "no"; // Whether or not to display the window in theater mode. Default is "no".

	window.open(wUrl,wName,"width="+wWidth+",height="+wHeight+",top="+wTop+",left="+wLeft+",toolbar="+wToolbar+",location="+wLocation+",directories"+wDirectories+",status="+wStatus+",menubar="+wMenubar+",resizable="+wResizable+",scrollbars="+wScrollbars+",fullscreen="+wFullscreen+",channelmode="+wChannelmode);
}
/* END: [Global Open Window Script] */


/* BEGIN: [Global FLASH LAUNCHING SCRIPT]
	** Example on calling this function:
	** launchMyFlash({contUrl:'/id/8532673', locId:"leader-board", width:638, height:560, wMode: "opaque", flashVars: "addam=really cool"});
	** Using options, call what you want to change only.  Inside the function, defaults are set and explained.
*/
function launchMyFlash(options){
	var options = options || {}; // setup the flash options
	var flashVars = options.flashVars || ''; // get the flash variables
	var iBFlash = options.locId || ''; // get the location ID of the containing element of the flash
	var flashId = options.flashId || iBFlash+"-flash"; // get the ID of the Flash object
	var contentUrl = options.contUrl || ''; // get the location of the flash movie
	var fHeight = options.height || 250; // get the height
	var fWidth = options.width || 320; // get the width
	var fWmode = options.wMode || "transparent"; // get the wMode
	var fBGColor = options.bgColor || ''; // get the background color
	var fScale = options.scale || ''; // get the scale parameter
	var fsAlign = options.sAlign || ''; // get salign paramater
	var fVersion = options.version || ''; // get the flash version
	var fFinish = options.finishFunction; // finish function
	
	
	var iBFlashHolder = document.getElementById(iBFlash); // get a handle to the containing element
	
	if(iBFlashHolder){ // if the element exists
		
		var daFlash =  new FSFlashTag(contentUrl,fWidth,fHeight); // create the flash object		
		if(flashVars){ // if flash vars
			daFlash.setFlashvars(flashVars); // set the flash variables
		}
		if(flashId){ // if flash Id
			daFlash.setId(flashId); // set the flash Id
		}
		if(fWmode){ // if wMode
			daFlash.setWmode(fWmode); // set the wMode
			daFlash.setWmodeFF(fWmode); // set the wMode
		}
		if(fBGColor){ // if bgColor
			daFlash.setBgcolor(fBGColor); // set the background color	
		}
		if(fScale){ // if scale
			daFlash.setScale(fScale); // set the Scale
		}
		if(fsAlign){ // if fsAlign
			daFlash.setSalign(fsAlign); // set the salign	
		}
		if(fVersion){ // if fVersion
			daFlash.setVersion(fVersion); // set the version	
		}		
		iBFlashHolder.innerHTML = daFlash; // launch/display the flash
	}
	
	if(fFinish){
		fFinish();
	}	
}
/* END: [Global FLASH LAUNCHING SCRIPT] */



/* BEGIN: [Global Flash Reziser Script]
	** Example on calling this function:
	** sizeMyFlash({height: "200px", width: "300px", flashId:"leader-board-flash"});
	** Using options, call what you want to change only.  Inside the function, defaults are set and explained.
*/
function sizeMyFlash(options){
	var options = options || {}; // setup the options
	var fHeight = options.height || ''; // capture the height
	var fWidth = options.width || ''; // capture the width
	var fId = options.flashId || ''; // capture the flash ID
	
	if(fId){ // make sure theres a flash ID passed
		var theFlash = document.getElementById(fId); // get a handle to the flash object
		
		if(theFlash){ // make sure the object capture was successful
			if(fHeight){ // make sure there's a height set
				theFlash.style.height = fHeight; // set the new height
			}
			if(fWidth){ // make sure there's a width set
				theFlash.style.width = fWidth; // set the new width
			}
		}
	}
}
/* END: [Global Flash Reziser Script] */




/* BEGIN: [Number Randomizer v1]
	** Example on calling this function:
	** randomizeMe(this, {maxNumber: 10, exempt: [5, 6,7,8]});
	** The Randomizer randomly generate a number from 0 to the "maximumNumber" you pass it.
	** If it comes across any exempt numbers, it will start the script over until it finds one that doesn't match the exempt.
*/
function randomizeMe(me, options){
	var options = options || {}; // setup the options
	var imExempt = options.exempt || null; // capture the exempt numbers
	var maxNum = options.maxNumber || 0; // capture the maximum number to randomize
	var rand_no = Math.floor(Math.random()*maxNum); // run the random numbers

	if(imExempt != null){ // check to see if there are any exempt numbers
		imExempt = imExempt.toString(); // turn the exemptions into a string
		for(i=0; i<maxNum; i++){ // loop throught the set number
			if(imExempt.search(rand_no) != -1){ // check for exempt numbers
				return randomizeMe(me, {exempt: imExempt, maxNumber: maxNum}); // start over

			}
		}
	}

	return rand_no;// return the new random number
}
/* END: [Number Randomizer] */

/* BEGIN: [Odd/Even states]
	** Example on calling this function:
	** evenOdd("round_table", {even: "on", rollOverClass: "over"});
	** This will grab the table you set, cylce through it, set the even class (on) and set a rollover state for the table rows
*/
function evenOdd(me, options){
	var options = options || {}; // options setup.
	var roc = options.RollOverClass || null;
	var ec = options.Even || "on";
	var oc = options.odd || "off";
	var table = document.getElementById(me); // get the table
	if(table.nodeName == "TABLE"){ // make sure a table is being passed
		var tBody = table.getElementsByTagName('tbody')[0];	// capture the table body
		var tableRows = tBody.getElementsByTagName("TR"); // capture all of the table rows in the table
		var trs = 0; // set the secondary holder
		for(var i=0; i<tableRows.length; i++){ // loop through all of the rows
			/* odd / even selection */
			if(trs==1){ // check for even rows
				tableRows[i].className = ec; // set the class name to on
				trs = 0; // reset the trs to the odd state so next one is skipped
			}else{
				tableRows[i].className = oc; // set the class name to on
				trs=1;	// set the next one to even if an odd one is found
			}

			/* roll over class change */
			if(roc){ // check to see if a roll over class has been set
				tableRows[i].onmouseover=function(){ // set the onmouse over event
					this.className = this.className +' '+roc;	// add the class to the TR
				};
				tableRows[i].onmouseout=function(){ // set the onmouse out event
					this.className = this.className.replace(' '+roc,''); // remove the preset class
					if(this.className == roc){ // remove the class set
						this.className =''; // remove the class set
					}
				};
			}
		}
	}
}
/* BEGIN: [Odd/Even states] */



/* BEGIN: [Take over Div]
	** Example on calling this function:
	** takeOver(true, {'zindex':'50', 'bgcolor':'#0000FF', 'opacity':'70'});
	** Pass true to gray out screen, false to ungray...
	** This will grab the table you set, cylce through it, set the even class (on) and set a rollover state for the table rows
*/

function takeOver(vis, options) {
	var options = options || {}; // options setup
	var zindex = options.zindex || 990;  // set the zidex... "should be enough to cover the page
	var opacity = options.opacity || 70; // set the default opacity
	var opaque = (opacity / 100); // set the default opacity... (for IE)
	var bgcolor = options.bgcolor || '#000000'; // set the default background color
	var toHide = options.hide || null; // get the elements to hide
	var takeOver=document.getElementById('fsTakeOver');  // get a handle to the takeover div
	var pageWidth = 1600, pageHeight = 1200;

	if (vis) { // check to see if a gray out should take place

		/* Calculate the page width and height */
		
		if( typeof( window.innerWidth ) == 'number' ) {
			 //Non-IE
			//pageWidth = window.innerWidth+window.pageXOffset+"px";	
			pageWidth = "100%";  // set the page width
			pageHeight = document.documentElement.scrollHeight+"px"; // set the page height
		  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
		    pageWidth = document.documentElement.clientWidth+document.documentElement.scrollWidth+"px";
		    pageHeight = document.documentElement.clientHeight+document.documentElement.scrollHeight+"px";
		    
		  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			pageWidth = document.body.clientWidth+document.body.scrollLeft+"px";
			pageHeight = document.body.clientHeight+document.body.scrollTop+"px";
		  }
				

		/* Set the shader to cover the entire page and make it visible. */
		takeOver.style.opacity=opaque;  // set the opacity of the take over div
		takeOver.style.MozOpacity=opaque;  // set the mozilla opacity
		takeOver.style.filter='alpha(opacity='+opacity+')';  // set the IE filter opacity
		takeOver.style.zIndex=zindex; // set the zIndex
		takeOver.style.backgroundColor=bgcolor;  // set the background color
		takeOver.style.width= pageWidth; // set the width of the div
		takeOver.style.height= pageHeight; // set the height of the div
		takeOver.style.display='block';  // show the take over div
		resizeTimer=setTimeout(resizeHandler,10); // set a controller for the resizer
	}else{ // if the gray out should be turned off
		takeOver.style.display='none';  // hide the take over div
		
	}
}
var resizeTimer;
function resizeHandler(){ // handler
	var sTakeOver=document.getElementById('fsTakeOver');  // Get the object.
	if(sTakeOver){
		if(sTakeOver.style.display == "block"){
			window.onresize = function() { // on resize
				if(takeOverOn == true){ // check to see if the takeover is turned on
					takeOver(true); // if so, reset it when the window is done being resized
				}
				window.onresize = function() {;};// set a new function inside of it
				clearTimeout(resizeTimer); // clear the controller when it's done
				resizeTimer=setTimeout(resizeHandler,1); // reset the controller
			}
		}
	}
}

/* END: [Take over Div] */
function regAlert(show, options){
	var options = options || {}; // options setup
	var regAlertId = options.alertId || "fsAlert";	
	var regYesFunc = options.yesFunc;
	var regNoFunc = options.noFunc;	
	var pageType =  options.type || alertType;
	var headerText = options.headerText || alertHeaderText;
    if(headerText == '')headerText = "FOXSports.com Alert";	
    var closelVal = "Close";
	var closelClass = "button-table";
	var closelSize = "70px";
	
		var theAlert = document.getElementById(regAlertId);  // Get the object.
	theAlert.style.display="block";
	
	var regAlertHtml = "<div class='header'>";
		regAlertHtml += "<h1>"+regHeader+"</h1>";
		regAlertHtml += "<a href='#' onclick='takeOverAlert(false, {alertId: \""+regAlertId+"\" })'>X</a>";
		regAlertHtml += "</div>";
		regAlertHtml += "<div class='notification'>";
		regAlertHtml += '<table cellpadding="0" cellspacing="0" border="0" background="/fe/img/overlayHeader.png" width="668" height="85" id="headerImage">';
		regAlertHtml += '<tr><td title="'+headerText+'">'+headerText+'</td></tr></table>';
		regAlertHtml += "<div class='information'>";
		regAlertHtml +=  regNotification;
		regAlertHtml += "<br/><br/><br/>";
		
		regAlertHtml += "<table cellpadding='3' cellspacing='0' border='0' align='center'>";
		regAlertHtml += "<tr>";
		
		if(regYesFunc != 'undefined' && regYesFunc != null && regYesFunc != "false"){// && regYesFunc != 'undefined'){
	      regAlertHtml += "<td>";	
		  regAlertHtml += '<div class="button-table" style="width:70px;"><div class="inputContainer">';	
		  var yesUrl = '/emailVerification?userId=' + uid + "&cfu="+window.location.pathname + window.location.search;//cfu;
		  regAlertHtml += '<input name="yesBtn" type="button" onmousedown="takeOverAlert(false, {alertId: \''+regAlertId+'\' });'+regYesFunc+";window.location.href='"+yesUrl+'\'" value="Yes"/>';
	      regAlertHtml += '</div></div>';
	      regAlertHtml += "</td>";
		}
		if(regNoFunc != 'undefined' && regNoFunc != null && regNoFunc != "false"){// && regNoFunc != 'undefined'){
			if(regNoFunc == "No"){
				var newFunc = '';	
			}else{
				var newFunc = regNoFunc;	
			}
			regAlertHtml += "<td>";
	  	    regAlertHtml += '<div class="button-table" style="width:70px;"><div class="inputContainer">';	
	  	    regAlertHtml += '<input name="noBtn" type="button" onmousedown="takeOverAlert(false, {alertId: \''+regAlertId+'\' });'+newFunc+'" value="No"/>';
	  	    regAlertHtml += '</div></div>';
	  	    regAlertHtml += "</td>";
		}				
        
        if(regYesFunc == 'undefined' || regNoFunc == 'undefined' || regYesFunc == null || regNoFunc == null || regYesFunc == 'false' || regNoFunc == 'false'){// || regYesFunc == 'undefined' || regNoFunc == 'undefined') {
        	if(pageType != "" && pageType == "community"){	
             //get the screenname for the profile url	
             var urlParameters = location.search.substring(1).split("&");//get all paramters from url
             var screenName="";
             //traverse through the url parameters and get the screename value
             for(var l=0;l< urlParameters.length; l++){
               var pair = urlParameters[l].split("=");
               if(pair[0] == "screenname")screenName=pair[1];
             }		
        	regAlertHtml += "<td>";
    		regAlertHtml += '<div class="button-table2" style="width:120px;"><div class="inputContainer">';
    		//var profileUrl = 'http://community.foxsports.com/profiles/profile.aspx';    		
    		var profileUrl = 'http://community.foxsports.com/'+screenName;
    		regAlertHtml += '<input name="profileBtn" type="button" onclick="window.location.href=\''+profileUrl+'\'" value="Set Up Profile"/>';
            regAlertHtml += '</div></div>';
            regAlertHtml += "</td>";
            closelVal = "Skip & Return to site";
            closelClass = "button-table2";
        	closelSize = "150px";
            }   
        	regAlertHtml += "<td>";
			//regAlertHtml += '<div class="button-table2" style="width:150px;"><div class="inputContainer">';
			regAlertHtml += '<div class="'+closelClass+'" style="width:'+closelSize+';"><div class="inputContainer">';
			regAlertHtml += '<input name="closeBtn" type="button" onmousedown="takeOverAlert(false,{})" value="'+closelVal+'"/>';
	        regAlertHtml += '</div></div>';
	        regAlertHtml += "</td>";  
		}
        
        regAlertHtml += "</tr></table>";
        regAlertHtml += "</div>";
        regAlertHtml += "<br/><br/>";
		regAlertHtml += "</div>";
		theAlert.innerHTML = regAlertHtml;
		document.location = "#fsAlert";
}
function getScrollXY() {
	  var scrOfX = 0, scrOfY = 0;
	  if( typeof( window.pageYOffset ) == 'number' ) {
	    //Netscape compliant
	    scrOfY = window.pageYOffset;
	    scrOfX = window.pageXOffset;
	  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
	    //DOM compliant
	    scrOfY = document.body.scrollTop;
	    scrOfX = document.body.scrollLeft;
	  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
	    //IE6 standards compliant mode
	    scrOfY = document.documentElement.scrollTop;
	    scrOfX = document.documentElement.scrollLeft;
	  }	  
	  return [ scrOfX, scrOfY ];
}
//general community alert variables
//var regAlertMessage = ""; // registration alert message set this variable for message
var takeOverOn; // take over on state holder
var alertIdOn; // alert ID on state holder
//var regClass; // special class for registration information
var regHeader; // header text
var regNotification; // notification text
var regAlertId; // alert ID holder
//var verifyYesFunc;//show the 'yes' button
//var verifyNoFunc;//show the 'no' button
var regAlertMessage = 'In order to participate in FOXSports.com community applications (Post comments, messages and create blogs) you will first need to verify your email (<a href="/register">edit</a>).<br\/> Would you like to verify now?'; 
var verifyYesFunc = 'takeToVerify('+user.USER_ID+",'"+window.location.pathname + window.location.search+"')";
var verifyNoFunc = 'No';
var alertType = "";//what type of alert???
var alertHeaderText = "";//what text to put on top of the alert's header image


function takeOverAlert(show, options){
	var options = options || {}; // options setup
	//var alertId = options.alertId || null; // Custom alert div
	var newFunc = options.callFunction|| null; // Override function
	//regClass = options.regClass || 'green'; // special class for registration information
	regHeader = options.header || 'FoxSports.com'; // header text
	regNotification = options.notification || regAlertMessage;	 // alert MEssage
	regYesFunc = options.yesFunc || verifyYesFunc; // yes function
	regNoFunc = options.noFunc || verifyNoFunc; // no function
	regAlertId = options.alertId || "fsAlert"; // alert box IDs//regAlertId
	var el = document.getElementById(regAlertId);
	var regForm = document.forms['RegistrationForm'];
	//regAlert(); // setup the alert divs
	var pageType = options.type || alertType;
	var headerText = options.headerText || alertHeaderText;
	if(headerText == "")headerText = "FOXSports.com Alert";
		
	if(show){ // check to see if the alert should show		
		takeOver(true); // launch the takeover
		
		if(newFunc){ // check for specific function
			newFunc = newFunc+"("+show+", {alertId:'"+regAlertId+"', "+'yesFunc:"'+regYesFunc+'", '+"noFunc:'"+regNoFunc+"', type:'"+pageType+"', headerText:'"+headerText+"'});"; // launch whatever function the user passed and pass the alert ID.
			eval(newFunc);	//call function
		}
		el = document.getElementById(regAlertId);		
		if(el){ // if an ID has been set
			var position = getScrollXY();
			window.scrollTo(0,(position[1]-185));
			el.style.display = "block"; // show it		 			
		}
		if(regForm){ // check for the registration form
			regForm.style.visibility = "hidden"; // hide it
		}
		takeOverOn = true; // turn the toggle on
		alertIdOn = regAlertId; // set the alert id globally
	}else{ // turn off alert
		takeOver(false); // remove takeover
		if(el){ // check for an ID
			el.style.display = "none"; // hide the alert
		}
		if(regForm){ // check for the registration form
			regForm.style.visibility = "visible"; // show it
		}
		takeOverOn = false; // turn toggle off
	}

}

function newAddComment(contentId,forum) {
  if (typeof(user.USER_ID) == 'undefined' || user.USER_ID == '0') {
  } else {
    var forumKey;
    if (!forum) {
      forumKey = "StoryComments";
    } else {
      forumKey = forum;
    }
    var ttlEl = document.getElementById("mem-cmnts-ttl");
    var divs;
    if (ttlEl) {
      divs = document.getElementById("mem-cmnts-ttl").childNodes; // get the container
    }
    var ftrEl = document.getElementById("mem-cmnts-ftr");
    var divs2;
    if (ftrEl) {
      divs2 = document.getElementById("mem-cmnts-ftr").childNodes; // get the container
    }
    var noneEl = document.getElementById("mem-cmnts-none");
    var divs3;
    if (noneEl) {
      var divs3 = document.getElementById("mem-cmnts-none");
    }
    var html="<a href='javascript:verifyComment(" +  contentId + ",\"" + forumKey + "\")'>add a comment</a>";
    if (divs) {
      for(i=0; i<divs.length; i++){
        if(divs[i].className == "add"){
          divs[i].innerHTML = "+ " + html;
       }
      }
    }
    if (divs2) {
      for(i=0; i<divs2.length; i++){
        if(divs2[i].className == "add"){
          divs2[i].innerHTML = "+ " + html;
        }
      }
    }
    if (divs3) {
      
        var thisHtml = "<table><tr><td><a href='javascript:verifyComment(" + contentId +",\"" +forumKey+ "\");'><img width='132' height='29' border='0' alt='' src='http://community.foxsports.com/FoxSports/images/btn_post_cmnt.gif'\/></a></td><td><a href='javascript:verifyComment(" + contentId +",\""+forumKey+ "\");'>Be the first to share your thoughts about this story with other Fox Sports members.</a></td></tr></table>";
        
     
	  divs3.innerHTML = thisHtml;
	 
    }
  }
}

function takeToVerify(userId, cfu) {
  window.location = "/emailVerification?userId=" + userId + "&cfu=" + cfu;
}

function newCreateBlog() {
  var els = document.getElementById("blog-comm-r").childNodes; // get the container
  var url='javascript:verifyBlog()';
  var html='<a href="' + url + '"><img width="258" vspace="7" height="40" border="0" alt="Start a Blog" src="http://community.foxsports.com/FoxSports/images/blogs/soccer/btn_startablog_b.gif"/> </a>'
  for(i=0; i<els.length; i++) {
     if(divs[i].className == "c") {
      divs[i].innerHTML = html;
     }
  }
}

function pgVerifyEmail() {     
  takeOverAlert(true, {callFunction: 'regAlert'});
}

function verifyBlog() {
  var url = window.location.hostname + "/blogs/Create.aspx";
  if (user.VERIFIED == '' || user.VERIFIED == '0') {
    takeOverAlert(true, {callFunction: 'regAlert'});
  } else {
    window.location = url;
  }
}

function checkVerified(funcToCall) {
  if (window.location.hostname == 'http://community.staging.foxsports.com' || window.location.hostname == 'http://community.foxsports.com') {
    if (typeof(user.USER_ID) == 'undefined') {
    } else {
      var regAlertMessage = 'In order to participate in FOXSports.com community applications (Post comments, messages and create blogs) you will first need to verify your email (<a href="http://msn.foxsports.com/register">edit</a>).<br/> Would you like to verify now?';
      var verifyYesFunc = 'takeToVerify("' + user.USER_ID + '","' + escape(window.location.href) + '");';
      var verifyNoFunc = 'No';
    }
    eval(funcToCall);
  }
}

function verifyComment(contentId,forum) {
  var forumKey;
  if (!forum) {
    forumKey = "StoryComments";
  } else {
    forumKey = forum;
  }
  var url = "http://community.foxsports.com/boards/AddComment.aspx?forum_key=" + forumKey + "&topic_key=" + contentId + "&ret=" + escape(window.location.href);
  if (user.VERIFIED == '' || user.VERIFIED == '0') {   
    takeOverAlert(true, {callFunction: 'regAlert'});
	window.scrollTo(0,0);
  } else {
    winopen(url, 'popwin', 400, 340);
  }
}

function talkbackVerifyEmail() {
  takeToVerify(user.USER_ID,window.location.pathname + window.location.search);
}

// ---------------------------------------------------------//
// CP FLASH TAKE OVER //
// ---------------------------------------------------------//
/* BEGIN: [CP FLASH TAKE OVER] */
function hideItemsAboveCPWide()
{
  //document.write('<style>DIV.hdr{visibility:hidden;} #cpGrayBar1{visibility:hidden;} #cpGrayBar2{visibility:hidden;}</style>');
	document.getElementById("cpGrayBar1").style.display = "none";
	document.getElementById("cpGrayBar2").style.display = "none";
	document.getElementById("cpLayoutDiv").style.display = "none";
	document.getElementById("cpFullLayoutDiv").style.display = "block";	
}

function CPWideAnimationDone()
{
  //document.write('<style>#cpExtended{visibility:hidden;}DIV.hdr{visibility:visible;}</style>');
	document.getElementById("cpExtended").style.display = "none";
    document.getElementById("mainCPDiv").style.display = "block";
	document.getElementById("cpLayoutDiv").style.display = "block";
	document.getElementById("cpFullLayoutDiv").style.display = "none";
}

function closeCPNarrow()
{
  //document.write('<style>#cpGrayBar1{visibility:visible;} #cpGrayBar2{visibility:visible;}</style>');
	document.getElementById("cpGrayBar1").style.display = "block";
	document.getElementById("cpGrayBar2").style.display = "block";
	document.getElementById("cpNarrow").style.display="none";
}

function shrinkCP()
{
	document.getElementById("cpExtended").style.width="428px";
	document.getElementById("FlashcpWide").style.width="428px";
    document.getElementById("cpHeadlines").style.display = "block";
}
/* END: [CP FLASH TAKE OVER] */



/* BEGIN: [GLOBAL ANALYTICS TRACKING]
	** Example on calling this function:
	** fsAnalytics(this, {type: "link", description: "fantasy pickem popup - 324314324"});
	** This example will send an event call to our analytics provider so they can track this link with a description in side of the page
*/
function fsAnalytics(me, options){
	var options = options || {}; // options setup
	var fsType = options.type || ''; // get the type of call
	var fsDescription = options.description || ''; // get the description of call
	var fsAds = options.ads || false; // to send a request to 
	
	switch(fsType){ // check the type of call
		case "link": // if it's a link
			ntptEventTag("lc="+encodeURIComponent(document.location)+"ev="+fsDescription); // send tracking for the link with a description
		break;
		case "keepAlive": // time spend tracking in intervals set on the page...
			ntptEventTag("ev=keep alive&evdetail="+fsDescription); // send tracking for the link with a description
		break;
	}
	
}

/* END: [GLOBAL ANALYTICS TRACKING] */



// ---------------------------------------------------------//
// COMMENTS //
// ---------------------------------------------------------//
/* BEGIN: [Comments] */
var fsXMLComments = "/widget/comments";
var fsCommentsMain = '';
var fsCommentsPagination = '';
var fsComments = '';
var fsCFKey=''; // comment forum key
var fsCTKey=''; // comment topic key
var fsCommentsTotalLink = ''; // holder for comments link
function startComments(fKey, tKey){
	fsCFKey=fKey; // set the global forum key
	fsCTKey=tKey; // set the global topic key
	
	if(document.getElementById('number_of_comments')){
		fsCommentsTotalLink = document.getElementById('number_of_comments'); // get handle to comments link
	}
	
	fsCommentsMain = new Spry.Data.XMLDataSet('', 'root/topic', {useCache:false});
	fsCommentsPagination = new Spry.Data.XMLDataSet('', 'root/pagination', {useCache:false});
	fsComments = new Spry.Data.NestedXMLDataSet(fsCommentsMain, "posts/post", {useCache:false}); // Get the XML Data
	
	fsComments.setColumnType('body','html'); // show the html in the comment
	
	Spry.Utils.addLoadListener(function(){ // Attach a spry listener... when the data ready, do the following:
										
		Spry.$$(".commentNavigation").setAttribute("spry:detailregion", "fsCommentsPagination"); // setup the comment pagination region
		
		if (uid == "0" || uid == ""){ // check for user id
			Spry.$$(".add-comm").setAttribute("href", passportLoginURL); // pass in the passportLogin
			Spry.$$(".add-comm").setAttribute("title", "Log in to add a comment"); // add the correct title to the anchor
			Spry.$$(".add-comm").setAttribute("spry:content", "Log in to add a comment"); // add the correct content to the anchor
		}else{
			if (user.VERIFIED == '' || user.VERIFIED == '0') { // if the user is unverified, setup alert						
				Spry.$$(".add-comm").setAttribute("href", "javascript:pgVerifyEmail();"); // set the verify onclick
				
			} else { // if they are verified, allow to add comments
				Spry.$$(".add-comm").setAttribute("href", "javascript:fsAddComments(this);");	// set the fsAddComments			
			}
			Spry.$$(".add-comm").setAttribute("title", "Add a Comment"); // set the new title
			Spry.$$(".add-comm").setAttribute("spry:content", "Add a Comment"); // set the new innerHTML
		}			
		
		Spry.$$(".comment_counter").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // make sure there are comments
		Spry.$$(".comment_counter").setAttribute("spry:content", "Page {fsCommentsPagination::currentPage} of {fsCommentsPagination::pageCount}"); // if so, show the page numbering 
		Spry.$$(".member_comment_next").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // check for page comments
		Spry.$$(".member_comment_next").setAttribute("onclick", "fsPageComments(this, '{fsCommentsPagination::nextPage}')"); // if so, setup next page
		Spry.$$(".member_comment_prev").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // check for page comments
		Spry.$$(".member_comment_prev").setAttribute("onclick", "fsPageComments(this, '{fsCommentsPagination::previousPage}')"); // if so, setup next page
		
		Spry.$$("#comment_content").setAttribute("spry:region", "fsComments"); // setup the comments region
		Spry.$$("#commNotification").setAttribute("spry:if", '{fsComments::ds_UnfilteredRowCount} == 0');// show notification if no comments are available
		Spry.$$(".namedAncor").setAttribute("name", '{fsComments::postId}');// setup the anchor
		
		Spry.$$(".comment").setAttribute("spry:repeat", "fsComments"); // repeat the spry children
		Spry.$$(".comment").setAttribute("spry:if", "{fsComments::postId}"); // check for a post ID
		Spry.$$(".comment").setAttribute("spry:even", "on"); // if so, then setup the "odd/even" states
		
		Spry.$$(".copy").setAttribute("spry:content", '{fsComments::body}'); // attach the body of the comments
		
		
		Spry.$$(".comm-user").setAttribute("alt", '{fsComments::userName}'); // ste the user alt tag
		Spry.$$(".comm-user-link").setAttribute("title", '{fsComments::userName}'); // set the title of the user link
		Spry.$$(".user-name").setAttribute("spry:content", '{fsComments::userName}'); // attatch the user name
		Spry.$$(".user-name").setAttribute("title", '{fsComments::userName}'); // set the title
		Spry.$$(".post-date").setAttribute("spry:content", '{fsComments::postDate}'); // attach the post date of the comment
	
		Spry.$$(".comm-user-link").setAttribute("href", 'http://community.foxsports.com/{fsComments::userName}');// setup the users profile link
		Spry.$$(".user-name").setAttribute("href", 'http://community.foxsports.com/{fsComments::userName}');// setup the users profile link
		
		Spry.$$(".report-abuse").setAttribute("onclick", 'fsReportComments("{fsCommentsMain::topicID}", "{fsComments::postId}")'); // setup the report abuse link
		Spry.Data.initRegions(); // initialize the the regions
		fsPageComments('', 1); // kick off the comments		
	});
	
	if(fsCommentsTotalLink){ // check to see if there's a comment bubble
		fsCommentsPagination.addObserver({ onPostLoad: function() { // launch this when the data is confirmed loaded
			fsCommentsTotalLink.innerHTML = fsCommentsPagination.getCurrentRow()['itemsCount'] + " comments"; // update the comments bubble
			}
		});	
	}
	
	// Comments Thumbnail Replacement //
	Spry.Data.Region.addObserver("comment_content", { onPostUpdate: function(){ // set observer for when the thumbnail achors get loaded
		var rows = fsComments.getData(); // get the thumbnails
	
		for (var i = 0; i < rows.length; i++){ // loop through the thumbnails
			var row = rows[i]; // get the rows
			var rid= row.ds_RowID; // get the individual rowId
			var o = document.getElementById("fs-user_" + rid); // get the first thumbnail in the set
	
			if (o) // checks to see if the thumbnail image actually exists in the markup
				o.src = row.avatarURLSmall; // if so, then set the image source
			
		}
		
		if(rows.length == 0){
			Spry.$$(".add-comm").addClassName("add-commHide");
			
		}else{
			Spry.$$(".add-comm").removeClassName("add-commHide"); 
		}
	
	}});
	
	
}





function fsAddComments(me){	// Add Comments Expander
try{
	Spry.Effect.DoSlide('add-comments', {duration:300, from:"0px", to:"100%", toggle:true}); // do the spry slide out effect
}catch(e){alert("add comments error: "+e.message)}
	
}

function fsPageComments(me, showPage){ // Page through comments
	
	if (uid == "0" || uid == ""){ // check for user id (check to see if they are logged in)	
		fsCommentsMain.setURL(fsXMLComments+'?contentId='+fsCTKey+'&forumKey=' + fsCFKey + '&page_no='+showPage); // get cached url
	}else{
		fsCommentsMain.setURL(fsXMLComments+'?contentId='+fsCTKey+'&forumKey=' + fsCFKey + '&page_no='+showPage+'&ran='+Math.round((Math.random() * 10000) + 1)); // break cache		
	}
	
	fsCommentsMain.loadData(); // load in the new comments  
	
	fsCommentsMain.addObserver({ onPostLoad: function() { // launch this when the data is confirmed loaded
	fsCommentsMain.removeObserver(this); // remove this observer

		var sigh = fsCommentsMain.getDocument(); // get the original DOM XML document
		fsCommentsPagination.setDataFromDoc(sigh); // load the data.
		
		}
	});
		 
}

function fsPostComments(me){ // Post a comment
	
	var newComment = escape(document.forms['comm'].comment2add.value); // get the comments
	var userId = uid; // get the users ID
	
	var req = Spry.Utils.loadURL("POST", "/widget/addComments", true, fsRunComments, {postData:"userId="+userId+"&forumKey="+fsCFKey+"&topicKey="+fsCTKey+"&comment="+newComment, headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8" } }); // send the comments (loadComments) is going to run when we get a response back
	
	
} 

function fsReportComments(tid, pid){ // Report a comment
	//var url = "http://community.foxsports.com/boards/report.aspx?topic_id=" + tid.toString() + "&post_id=" + pid.toString();	
	//var reportIt = window.open(url, 'popwin', "width=500, height = 400 ,menubar=no,status=no,location=no,toolbar=no,scrollbars=no");
	var url = "/widget/contentCheck/userInput?topic_id=" + tid.toString() + "&post_id=" + pid.toString();	
	var reportIt = window.open(url, 'popwin', "width=680, height=582 ,menubar=no,status=no,location=no,toolbar=no,scrollbars=no,resizable=no");
	
	reportIt.focus();
}

function fsRunComments(req){	// Reload comments AFTER a new one has posted
	if(req){ // check if this is a response call
		var text = req.xhRequest.responseText; // get the response text
		if(text){ // if there is text
			document.comm.comment2add.value = '';	// clear the value of the comment field		
			Spry.Effect.DoSlide('add-comments', {duration:300, from:"0px", to:"100%", toggle:true, finish: function(){
																													
					var freshData = Spry.Utils.stringToXMLDoc(text); // turn the results into XML DOM
					fsCommentsMain.setDataFromDoc(freshData); // load the data.																								
																													
				}
			}); // to close up the comments		
		}
	}	
}
/* END: [Comments] */