/* BEGIN: window after load script  */
var alreadyrunflag = 0 //flag to indicate whether target function has already been run
if (document.addEventListener) {
    document.addEventListener("DOMContentLoaded", function() {
        alreadyrunflag = 1;
        fsAWLLaunchFunctions();
    }, false);
} else if (window.addEventListener) { //DOM method for binding an event
    window.addEventListener("load", fsAWLLaunchFunctions, false);
} else if (window.attachEvent) { //IE exclusive method for binding an event
    window.attachEvent("onload", fsAWLLaunchFunctions);
} else if (document.getElementById) { //support older modern browsers
    window.onload = fsAWLLaunchFunctions();
}
/* END: window after load script  */




/* BEGIN: [Load Functions After Window Load] 
 ** will launch function(s) after the window has loaded.
 ** call as a string:  fsAWLLoadFunction({func:'rackEm("global-nav")'});
 */
var fsAWLFunctions = new Array(); // setup the initial array
var fsAWLCount = 0; // setup a general counter
function fsAWLLoadFunction(options) { // load the functions
    var options = options || {}; // options setup
    var func = options.func || "";	 // get the function to be called
    fsAWLFunctions[fsAWLCount] = func; // add the function to the array
    fsAWLCount++; // increase the counter
}
function fsAWLLaunchFunctions() { // launch the functions
    for (i = 0; i < fsAWLFunctions.length; i++) { // loop through the functions
        setTimeout("eval(" + fsAWLFunctions[i] + "); ", 50);// launch the functions
    }
}
/* END: [Load Functions After Window Load] */


/* BEGIN: [CHECK EVENT STATUS] 
 ** will return the TRUE event on the selected element and not anything inside of it due to event bubbling.
 ** call fsCheckEvent and it will return the correct element you designated for your event
 ** example: alertElement.onmouseout = function(){
 var element = fsCheckEvent(this);
 if(element){
 element.className = element.className.replace("on", "");
 }
 }
 */
function fsCheckEventObject(e, p) {
    if (!e) var e = window.event;
    e.cancelBubble = true;
    if (e.stopPropagation) e.stopPropagation();
    if (e.target) eobj = e.target;
    else if (e.srcElement) eobj = e.srcElement;
    if (eobj.nodeType == 3) eobj = eobj.parentNode;
    var eobj = (e.relatedTarget) ? e.relatedTarget : (e.type == 'mouseout') ? e.toElement : e.fromElement;
    if (!eobj || eobj == p) return false;
    while (eobj.parentNode) {
        if (eobj == p) return false;
        eobj = eobj.parentNode;
    }
    return true;
}


/* SET THE MOUSE OUT EVENT */
function fsCheckEvent(obj, func) {
    var e = window.event || arguments.callee.caller.arguments[0];
    if (fsCheckEventObject(e, obj)) {
        return obj;
    }
}


/* END: [CHECK EVENT STATUS] */




// 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;

//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);
    }
}

// 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;
}


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 = fsReqDomain + '/fe/images/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 User Info Script] */
function fsUserInfo() {
    try {
        var userSignInOut = document.getElementById('sign-in-out'); // get a handle to sign in / out link
        if (user.USER_ID != '' && user.USER_ID != 0) { // check if the user is logged in...
            var userLink = document.getElementById("fs-header-user-name"); // get a handle to the user link
            userLink.innerHTML = user.USER_FIRST_NAME; // set the users name


            userSignInOut.innerHTML = "SIGN OUT"; // Set sign out text
            userSignInOut.href = fsReqDomain + "/logout"; // set sign out url
            userSignInOut.title = "Sign out"; // set sign out title on link

            var userDropDown = document.getElementById('user-dropdown'); // get a handle to the user drop down section
            var userDropDownLinks = userDropDown.getElementsByTagName('a'); // gather all the links

            var profileLink = "http://community.foxsports.com/" + user.SCREEN_NAME + "?pref_tab=my_site";
            var hubLink = "http://community.foxsports.com/" + user.SCREEN_NAME + "/admin/edit_profile.one?pref_tab=my_hub";
            var favTeamsLink = "http://community.foxsports.com/" + user.SCREEN_NAME + "/blog/wizard.one?step=wizard%2FFavorite_Teams ";
            var favPlayersLink = "http://community.foxsports.com/" + user.SCREEN_NAME + "/blog/wizard.one?step=wizard%2FFavorite_Players ";
            var inboxLink = "http://community.foxsports.com/" + user.SCREEN_NAME + "/mail";

            for (i = 0; i < userDropDownLinks.length; i++) { // loop throught the links
                switch (userDropDownLinks[i].className) { /// check the class names
                    case "my-profile": // if it's the profile link
                        userDropDownLinks[i].href = profileLink; // set link location
                        break;
                    case "edit-profile": // if it's the edit profile link
                        userDropDownLinks[i].href = hubLink; // set link location
                        break;
                    case "favorite-teams": // if it's teh favorite-teams link
                        userDropDownLinks[i].href = favTeamsLink; // set link location
                        break;
                    case "favorite-players": // if it's the favorite players link
                        userDropDownLinks[i].href = favPlayersLink; // set link location
                        break;

                }
            }

            /* For Global Community Links */
            var navLinks = document.getElementById("nav-community");
            var userLink = navLinks.getElementsByTagName("a");

            for (i = 0; i < userLink.length; i++) {
                switch (userLink[i].innerHTML) {
                    case "Profile":
                        userLink[i].href = profileLink; // set link location
                        break;
                    case "Inbox":
                        userLink[i].href = inboxLink; // set link location
                        break;
                    case "Hub":
                        userLink[i].href = hubLink; // set link location
                        break;
                }
            }
        } else {

            if (userSignInOut) {
                userSignInOut.href = fsReqDomain + "/login?cfu=" + window.location; // set sign out url
            }
        }
    } catch(e) {/*ignore*/}

}
/* END: [Global User Info Script] */


/* BEGIN: [Global Navigation Script] */
try { document.execCommand('BackgroundImageCache', false, true); } catch(e) {/*ignore*/} // for IE6 flicker 
function rackEm(me) {

    try {
        var navSec = document.getElementById(me); // get the nav
        var navUls = navSec.getElementsByTagName("ul"); // grab all of the list items
        var navActive;
        for (i = 0; i < navUls.length; i++) { // cycle throught the list items
            var node = navUls[i]; // setup the node handler

            if (node.parentNode.nodeName == "LI") { // check to see if the parent of the current ul is a list time

                if (node.parentNode.className == "active") { // check for any active state
                    navSec.className = navSec.className + " active"; // reset the class for the global nav..
                }

                node.parentNode.onmouseover = function() { // set the onmouseover for the list item
                    var element = fsCheckEvent(this); // check the even bubble and get the correct element

                    if (element) { // if the element is not "undefined", do the following script to that element on mouse out

                        var anch = element.getElementsByTagName('a');	// get all anchors in the list item
                        var ul = element.getElementsByTagName('ul'); // get all ULs in the list time
                        var li = ul[0].getElementsByTagName('li'); // get the LIs in the ULs in the list item

                        anch[0].className = anch[0].className.replace('openNavParent', ''); // remove the open state from the anchor if it's already open
                        anch[0].className = anch[0].className + ' openNavParent'; // reset the anchor class name
                        ul[0].className = 'openNav'; // reset the ULs class to "open"

                        if (document.all) { // check for internet exporer
                            if (element.className != "active") {
                                ul[0].style.marginLeft = '-' + (Math.round(ul[0].parentNode.offsetWidth)) + 'px'; // set the positioning of the drop down
                            }
                        } else { // all other browser
                            ul[0].style.marginLeft = '-' + (Math.round(ul[0].parentNode.offsetWidth / ul[0].length)) + 'px'; //  set the positioning of the drop down
                        }

                    }
                };
                node.parentNode.onmouseout = function() { // set the mouseout for the list itme

                    var element = fsCheckEvent(this); // check the even bubble and get the correct element

                    if (element) { // if the element is not "undefined", do the following script to that element on mouse out

                        var anch = element.getElementsByTagName('a');	// get all internal anchors
                        var ul = element.getElementsByTagName('ul');	// get all interna ULs
                        anch[0].className = anch[0].className.replace('openNavParent', ''); // remove the open state from the anchors
                        ul[0].className = ''; // remove the class name from the internal ULs

                        var li = ul[0].getElementsByTagName('li'); // get internal list items from the internal ULs

                        if (anch[0].className == 'openNavParent') {
                            anch[0].className = '';
                        }
                    }
                };
            }
        }
    } catch(e) {/*alert('nav error: '+e.message);*/}
}
/* END: [Global Navigation Script] */


// Global Drop Down Script //
function fsDropDown(me, options) {
    var options = options || {};
    var toShow = options.toShow;
    var clicked = options.clicked || false;
    try {
        toShow = document.getElementById(toShow);

        if (clicked == false) {
            me.onmouseover = function() {
                toShow.className = toShow.className + " on";
            }
            me.onmouseout = function() {
                toShow.className = toShow.className.replace(" on", "");
            }
            toShow.onmouseout = function() {
                var element = fsCheckEvent(this);
                if (element) {
                    element.className = element.className.replace("on", "");
                }
            }


        } else {

            if (toShow.className != "on") { // see if the class name is already on
                toShow.className = "on"; // if not, turn it on
            } else { // if it is
                toShow.className = ""; // turn it off.
            }
            toShow.onmouseout = function() {
                var element = fsCheckEvent(this);
                if (element) {
                    element.className = element.className.replace("on", "");
                }
            }


        }
    } catch(e) {/* ignore */}

}


function findAge(yr, mon, day, unit, decimal, round) {
    //Sample usage
    //findAge (year, month, day, unit, decimals, rounding)
    //Unit can be "years", "months", or "days"
    //Decimals specifies demical places to round to (ie: 2)
    //Rounding can be "roundup" or "rounddown"
    //findAge(1997, 11, 24, "years", 0, "rounddown")

    var one_day = 1000 * 60 * 60 * 24;
    var one_month = 1000 * 60 * 60 * 24 * 30;
    var one_year = 1000 * 60 * 60 * 24 * 30 * 12;
    today = new Date();
    var pastdate = new Date(yr, mon - 1, day);
    var countunit = unit;
    var decimals = decimal;
    var rounding = round;
    finalunit = (countunit == "days") ? one_day : (countunit == "months") ? one_month : one_year;
    decimals = (decimals <= 0) ? 1 : decimals * 10;
    if (unit != "years") {
        if (rounding == "rounddown")
            return(Math.floor((today.getTime() - pastdate.getTime()) / (finalunit) * decimals) / decimals + " " + countunit);
        else
            return(Math.ceil((today.getTime() - pastdate.getTime()) / (finalunit) * decimals) / decimals + " " + countunit);
    }
    else {
        yearspast = today.getFullYear() - yr - 1;
        tail = (today.getMonth() > mon - 1 || today.getMonth() == mon - 1 && today.getDate() >= day) ? 1 : 0;
        pastdate.setFullYear(today.getFullYear());
        pastdate2 = new Date(today.getFullYear() - 1, mon - 1, day);
        //tail = (tail==1)? tail+Math.floor((today.getTime()-pastdate.getTime())/(finalunit)*decimals)/decimals : Math.floor((today.getTime()-pastdate2.getTime())/(finalunit)*decimals)/decimals;
        return(yearspast + tail);
    }
}

function returnAge() {
    var age = -1;
    if (user.MONTH_CODE == "0" || user.MONTH_CODE == "" || user.DATE_CODE == "0" || user.DATE_CODE == "" || user.BIRTH_YEAR == "0" || user.BIRTH_YEAR == "")
    {
    }
    else
    {
        var bdayMonth = user.MONTH_CODE;
        var bdayDate = user.DATE_CODE;
        var bdayYear = user.BIRTH_YEAR;
        age = findAge(bdayYear, bdayMonth, bdayDate, "years", 0, "rounddown");
    }

    if (age > 12 && age < 18) {
        (age = 1);
    }
    if (age > 17 && age < 25) {
        (age = 2);
    }
    if (age > 24 && age < 35) {
        (age = 3);
    }
    if (age > 34 && age < 45) {
        (age = 4);
    }
    if (age > 44 && age < 55) {
        (age = 5);
    }
    if (age > 54 && age < 65) {
        (age = 6);
    }
    if (age > 64) {
        (age = 7);
    }
    return age;
}


/*
 * cfuLocation - supposively a deprecated var
 */
var cfuLocation = "<%=domain%>";


/* BEGIN: [Global MSN Scripts] 
 ** globalVariables: cfuLocation, passportLoginUrl */

function generateLoginUrl() {
    //var path = location.pathname; // get the location path
    var href = location.href; // get full url
    var query = location.search; // get the query string
    if (query == '') { // if there is no query string
        href = href + "?need=prefs"; // write in one
    } else { // if there is a query string
        href = href + "&need=prefs"; // append the need query
    }
    if (window.location.href.indexOf('blogs') != -1) { // if the user in is in blogs
        var cfu = escape(cfuLocation + "/pp/response?blogs=true&cfu=" + href); // write out the proper query string
    } else { // if the user is not in blogs
        var cfu = escape(cfuLocation + "/pp/response?cfu=" + href); // write out the proper query string
    }
    var doubleEscapeCfu = escape(cfu); // ensure all is escaped properly
    var queryParams = "&seclog=10&wa=wsignin1.0&wreply=" + cfu + "&cb=" + escape("&wa=wsignin1.0&wreply=") + doubleEscapeCfu; // write out the full query string
    return passportLoginUrl + queryParams; // return the full url and proper query string
}

function getSignInStatus(me) {
    var signInLink = document.getElementById(me); // get a handle to the signin link

    if (signInLink) { // make sure the link exists
        if (typeof(euid) == "undefined" || euid == null || euid == '') { // if the user isn't signed in...
            signInLink.href = generateLoginUrl(); // get/set the link url
            signInLink.innerHTML = "Sign in"; // update the link text
            signInLink.title = "Sign into MSN"; // update the link title

        } else { // if the user IS signed in...
            signInLink.href = cfuLocation + "/logout"; // set the signout url
            signInLink.innerHTML = "Sign out"; // update the link text
            signInLink.title = "Sign out of MSN"; // update the link title
        }
    }
}


// Site Search for BING
function launchSiteSearch() {

    Msn.SiteSearch.bind("#search", { searchParam: "sp_q",
        searchParams: "",
        searchUrl: "http://msn.foxsports.com/search",
        siteSearchOn: "true",
        helpertext: "Search FOX Sports",
        onepxgif: "http://blstc.msn.com/br/gbl/css/10/decoration/t.gif",
        // BEGIN Search Fox Video Code. Add Video Search Parameters
        videoParam: "q",
        videoParams: "",
        videoUrl: "http://multimedia.foxsports.com/search"
        // End Search Fox Video Code. Add Video Search Parameters
    }
            );
}

/* END: [Global MSN Scripts] */




/* BEGIN: [Global Check cookie for login status] */

function checkCookie(cookieName, length) {
    var allcookies = document.cookie;
    var cookiePos = allcookies.indexOf(cookieName + "=");
    if (cookiePos != -1) {
        var start = cookiePos + length;
        var end = allcookies.indexOf(";", start);
        if (end == -1)
            end = allcookies.length;
        var value = allcookies.substring(start, end);
        value = unescape(value);
        return value;
    }
    return "";
}

/* END: [Global Check cookie for login status] */




/* BEGIN: [Global Advertisement Launching]
 ** Example on calling this function:
 ** loadAds(); or fsLoadAds({adID: "45x60", solo: true});
 ** Using options, call what you want to change only.  Inside the function, defaults are set and explained.
 */

var fsLoadAdsHold = false; // if this is set to "true", then the fsLoadAds function will not complete it's initial run and wait for a second call.
function fsLoadAds(options) {

    try {
        var options = options || {}; // options setup.
        //this is an ad(s) added manually to the page
        //and being called separately from the CMS ads
        if (fsLoadAdsHold != true) {   //	if a hold hasn't been placed on the launching of advertisements

            //these are the ad modules added into a CMS page.
            //the ads information is populated in an array that is being called on page load
            if (ads && ads != null && ads.length > 0) { // if ads exist...
                for (var j = 0; j < ads.length; j++) { // loop through the ads
                    var ad = ads[j];
                    var id = ad[0];// get the id of each ad div
                    var size = ad[1].split("x");// get the size of each ad
                    var dapCall = ad[2] + ad[3];  //"&PG=SPTFB1&AP=1390"
                    var el = document.getElementById(id);

                    if (el && el != null) {
                        el.className = 'ad' + ad[1] + 'box';
                        dapMgr.enableACB(id, false); // enable advertisement
                        if (ad[1] == "980x50") { // check for ad rendering for 980x50 banner ad
                            dapMgr.renderAd(id, dapCall, size[0], size[1], '1'); // render advertisement
                        } else {
                            dapMgr.renderAd(id, dapCall, size[0], size[1]); // render advertisement
                        }
                    } else {
                        if (ad[1] == "120x30_sportsbar") {
                            dapMgr.enableACB('ad' + ad[1], false); // enable advertisement
                            dapMgr.renderAd('ad' + ad[1], dapCall, size[0], size[1]); // render advertisement
                        } else { // where the adbox is the ID
                            dapMgr.enableACB('ad' + ad[1] + 'box', false); // enable advertisement
                            dapMgr.renderAd('ad' + ad[1] + 'box', dapCall, size[0], size[1]); // render advertisement
                        }
                    }
                }

            }
        } else {
            fsLoadAdsHold = false; // remove the hold for this function... open for second call
        }
    } catch(e) {/* ignore */}
}
/* 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.name || "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 || ''; // top position from the browser.  Default is 25px.
    var wLeft = options.left || ''; // 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) {

    try {

        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();
        }
    } catch(e) { /* ignore */ }
}
/* 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: [Global Scorestrip] */
var fsIE = document.all ? true : false;
var mouseDown = false;
var tempX = 0;
var tempY = 0;

function fsScoreStrip(me, options) {

    var options = options || {}; // setup the flash options
    var page = document.body; // get a handle to the page body
    var info = options.info || ''; // get the data for the list
    var daList = document.getElementById('fsSSList'); // get a handle to the list container
    var setListItemClass = true;

    if (me == "ini") { // check for initiate flag for score strip

        if (typeof(user) != "undefined") { // get a handle to the user object
            sportsBarUser = '';
            for (name in user) { // get the variable information inside the object
                sportsBarUser += "&" + name.toLowerCase() + "=" + user[name]; // set the variable name and data as a query string for flash.
            }
        }

        var scoreStripHolder = document.createElement("div"); // create the scorestrip holder
        scoreStripHolder.id = "scoreStripHolder"; // set it's ID

        var scoreStrip = document.createElement("div"); // set the scorescript div
        scoreStrip.id = "scoreStrip"; // set the scorescript ID

        var scoreStripAd = document.createElement("div"); // create the scorestrip advertisment section
        scoreStripAd.id = "ad120x30_sportsbar"; // set the adbox

        page.appendChild(scoreStripHolder); // put the holder on the page
        scoreStripHolder.appendChild(scoreStrip); // put the scorestrip in the div
        scoreStripHolder.appendChild(scoreStripAd); // put the scorestrip advertisement in the div

        launchMyFlash({ // launch the flash file
            contUrl: fsReqDomain + '/mnt/fscom/NASCAR/Toolbar.swf', // fsReqDomain is for partners
            locId:"scoreStrip",
            width:"100%",
            height:36,
            flashVars: "gamesUrl=9240_49&domain=" + fsReqDomain + "&currentSport=" + fsCurrentSport + sportsBarUser
        });

    } else {

        if (daList) { // see if the list container actually exists
            daList.innerHTML = ""; // remove all list items
            var lists = daList; // create the initial list for popup
        } else { // if not...
            var lists = document.createElement("ul"); // create the initial list for popup
            lists.id = "fsSSList"; // set it's ID
        }

        for (i = 0; i < info[1].length; i++) { // loop through the array
            listItem = document.createElement("li"); // create the list item
            listAnchor = document.createElement("a"); // create the anchor
            listAnchor.title = info[1][i][0]; // set the title of the anchor

            if (info[0] == "alert") { // check for an alert call
                listAnchor.href = info[1][i][1]; // set the url
                listAnchor.innerHTML = "<strong>" + info[1][i][2] + ", <span>" + info[1][i][3] + "<\/span><\/strong><br \/>" + info[1][i][0]; // write out alert info
            } else if (info[0] == "edit") { // check for edit calls
                listAnchor.title = info[1][i][0]; // set the title
                listAnchor.href = info[1][i][1]; // set the url
                listAnchor.innerHTML = info[1][i][0]; // set the text/html inside the anchor

            } else { // for all other calls
                listAnchor.href = "javascript:changeScoreStrip('" + info[1][i][0] + "', '" + info[1][i][1] + "');"; // set the url
                listAnchor.innerHTML = info[1][i][0]; // set the text/html inside the anchor
            }

            if (info[0] == info[1][i][0]) { // check for the current sport
                listAnchor.className = "on"; // highlight that anchor
                setListItemClass = false;

            }

            if (typeof(info[1][i][1]) == "object") { // check for sub-menu (array object)
                var subLists = document.createElement("ul"); // create the initial list for popup
                subLists.id = "fsSSsubList"; // set it's ID

                for (s = 0; s < info[1][i][1].length; s++) {
                    subListItem = document.createElement("li"); // create the list item
                    subListAnchor = document.createElement("a"); // create the anchor

                    subListAnchor.title = info[1][i][1][s][0]; // set the title of the anchor
                    subListAnchor.href = "javascript:changeScoreStrip('" + info[1][i][1][s][0] + "', '" + info[1][i][1][s][1] + "');"; // set the url
                    subListAnchor.innerHTML = info[1][i][1][s][0]; // set the text/html inside the anchor

                    subListItem.appendChild(subListAnchor);
                    subLists.appendChild(subListItem);
                }
                listItem.appendChild(subLists); // add to listItem
                listItem.onmouseover = function() {this.className = "on"};
                listItem.onmouseout = function() {this.className = ""};
            }


            listItem.appendChild(listAnchor); // put the anchor in the list item
            lists.appendChild(listItem); // put the list item inside the UL

        }

        page.appendChild(lists); // add the UL list to the page.

        if (setListItemClass == false) {
            lists.className = "on"; // turn the element on
        } else {
            document.getElementById("fsSSList").className = "fsSS" + info[0] + " on"; // to be passed into the function by the flash for positioning.
        }

        lists.onmouseout = function() { // set the mouse out event handler
            var element = fsCheckEvent(this); // check the even bubble and get the correct element
            if (element) { // if the element is not "undefined", do the following script to that element on mouse out
                element.className = element.className.replace("on", ""); // do the event
            }
        }
    }


    /* for flash dragging */
    if (!fsIE) document.captureEvents(Event.MOUSEMOVE)

    if (fsIE) {
        document.body.onmousedown = function() {
            mouseDown = true;
        }
        document.body.onmouseup = function() {
            mouseDown = false;
        }

    } else {
        document.onmousedown = setMouseDown;
        document.onmouseup = setMouseDown;
    }
    document.onmousemove = getMouseXY;

}
function fsGetUserData() {
    return user;
}

function fsSportsMenu(me) {
    me = document.getElementById(me);
    me.className = me.className.replace(' on', ''); // remove the preset class
}

function changeScoreStrip(league, url) {
    document.getElementById('scoreStrip-flash').changeScoreStrip(url, league);
}

function launchRadio() {
    openNewWin('', {url: fsReqDomain + "/radio/radioPlayer", name: "fs_radio_player", width: "310", height: "120", resizable: "no"});
}

function showSportsMenu(data) { // data from flash
    var data = data[0]; // grab the array from flash
    if (data == "ini") { // check for initial call
        var type = "ini"; // set the call type
    } else {
        var type = '';	// set it to null
    }
    fsScoreStrip(type, {info: data }); // call the score strip
}

/* for dragging the tool bar */
function setMouseDown(event) {
    mouseDown = (event.type == "mousedown" ? true : false);
}

function getMouseDown() {
    if (!mouseDown) {
        window.document.SWF_OBJECT.focus();
    }
    return mouseDown;
}

function getMouseX() {
    return tempX;
}

function getMouseY() {
    return tempY;
}

function getMouseXY(e) {
    if (fsIE) { // grab the x-y pos.s if browser is fsIE
        tempX = event.clfsIEntX + document.body.scrollLeft;
        tempY = event.clfsIEntY + document.body.scrollTop;
    } else {  // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }

    if (tempX < 0) {tempX = 0;}
    if (tempY < 0) {tempY = 0;}
    return true;
}

/* END: [Global Scorestrip] */

/* 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: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 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 verifyNoFunc = 'No';//show the 'no' button
var verifyYesFunc = "false";//show the 'yes' button
var alertType = "";//what type of alert???
var alertHeaderText = "";//what text to put on top of the alert's header image

/* END:general community alert variables */

/* 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 (!takeOver) { // if the takeover div doesn't already exist, create another one
        var pageBody = document.getElementsByTagName("body")[0]; // get a handle to the page body
        takeOverDiv = document.createElement('div');  // create the take over div
        takeOverDiv.style.position = 'absolute'; // set the posotion of the div to absolute
        takeOverDiv.style.top = '0px';  // set the top position
        takeOverDiv.style.left = '0px'; // set the left position
        takeOverDiv.style.overflow = 'hidden'; // set the overflow (no scroll bars)
        takeOverDiv.style.display = 'none'; // set the inital display settings (start out hidden)
        takeOverDiv.id = 'fsTakeOver'; // set the DIVs Id
        pageBody.appendChild(takeOverDiv);  // Add it to the web page
        takeOver = document.getElementById('fsTakeOver');  // Get the object.
    }
    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] */
//sets the yes function for the popup
function setVerifyYesFunc() {
    if (typeof(user) != "undefined" && user != null && typeof(user.VERIFIED) != "undefined" && (user.VERIFIED == '' || user.VERIFIED == '0')) {
        verifyYesFunc = 'takeToVerify(' + user.USER_ID + ",'" + window.location.pathname + window.location.search + "')";
    }
}

//gets the scroll position
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 ];
}

function regAlert(show, options) {
    var options = options || {}; // options setup
    var regAlertId = options.alertId || "fsAlert";
    var regYesFunc = options.yesFunc || verifyYesFunc;
    var regNoFunc = options.noFunc;
    var pageType = options.type || alertType;
    var headerText = options.headerText || alertHeaderText;
    var bodyText = options.notification || regNotification;
    var headerTitle = options.title || regHeader;
    if (headerText == '' || typeof(headerText) == "undefined")headerText = "FOXSports.com Alert";
    var closelVal = "Close";
    var closelClass = "button-table";
    var closelSize = "70px";

    if (!document.getElementById(regAlertId)) {
        var regPageBody = document.getElementsByTagName("body")[0]; // get a handle to the page body
        var alertDiv = document.createElement('div');  // create the take over div
        alertDiv.id = regAlertId;
        //alertDiv.style.position = "absolute";
        //alertDiv.style.zIndex = 999;
        regPageBody.appendChild(alertDiv);  // Add it to the web page
        alertDiv.style.display = "none";
    }
    var theAlert = document.getElementById(regAlertId);  // Get the object.
    theAlert.style.display = "block";

    var regAlertHtml = "<div class='header'>";
    regAlertHtml += "<h1>" + headerTitle + "<\/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/images/overlayHeader.png" width="668" height="85" id="headerImage">';
    regAlertHtml += '<tr><td title="' + headerText + '">' + headerText + '</td></tr></table>';
    regAlertHtml += "<div class='information'>";
    regAlertHtml += bodyText;//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=' + user.USER_ID + "&cfu=" + window.location.pathname + window.location.search;//cfu;
        regAlertHtml += '<input name="yesBtn" type="button" onmousedown="takeOverAlert(false, {alertId: \'' + regAlertId + '\' });' + regYesFunc + ';" 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="' + 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>";
    takeOver(true); // launch the takeover
    theAlert.innerHTML = regAlertHtml;
    // var position = getScrollXY();
    window.scrollTo(0, 260);//(position[1] - 185)
}

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 (!el) {
            var regPageBody = document.getElementsByTagName("body")[0]; // get a handle to the page body
            var alertDiv = document.createElement('div');  // create the take over div
            alertDiv.id = regAlertId;
            //alertDiv.style.position = "absolute";
            //alertDiv.style.zIndex = 999;
            regPageBody.appendChild(alertDiv);  // Add it to the web page
            alertDiv.style.display = "none";
        }
        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").childNodes;
        }
        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) {
            for (i = 0; i < divs3.length; i++) {
                var thisHtml = "<table width='100%' cellspacing='0' cellpadding='8' border='0'><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[i].innerHTML = thisHtml;
            }
        }
    }
}

function takeToVerify(userId, cfu) {
    var pingAJAX;
    var regNotification = 'A verification message has been sent to your email address.  Please check you inbox and follow the instructions in the email.';
    // Posting the user's choice
    var req = null;
    var url = "/emailVerification?userId=" + userId + "&cfu=" + cfu;
    var stateChange = function() {
        if (pingAJAX.readyState == 4) {
            if (pingAJAX.status == 200) {
                //takeOverAlert(true, {callFunction:'regAlert',notification:regNotification, yesFunc:"false", noFunc:"false"});
                regAlert(true, {notification:regNotification,title:'FoxSports.com', headerText: 'FOXSports.com Alert', yesFunc:"false", noFunc:"false"});
            } else if (pingAJAX.status == 304) {    //there was no change to the data
                //do nothing
            }
            else {//something went wrong and the data was not posted.
                //alert("error:" + pingAJAX.status+"- "+ responseText);
            }
        }
    }
    if (document.implementation && document.implementation.createDocument) { //firefox, chrome, safari
        pingAJAX = new XMLHttpRequest();
    } else if (window.ActiveXObject && /Win/.test(navigator.userAgent)) {//ie
        pingAJAX = new ActiveXObject('MSXML2.XMLHTTP.3.0');
    }
    pingAJAX.onreadystatechange = stateChange;
    pingAJAX.open("GET", url, true);
    pingAJAX.send(null);
    //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') {
        window.location = "#top"
        takeOverAlert(true, {callFunction: 'regAlert'});
    } else {
        winopen(url, 'popwin', 400, 340);
    }
}

function talkbackVerifyEmail() {
    takeToVerify(user.USER_ID, window.location.pathname + window.location.search);
}

/* 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
 */
var fsAnalyticsDescription; // page description information
var fsAnalyticsHold; // if this is set to "true", then the fsAnalytics function will not complete it's initial run and wait for a second call.
function fsAnalytics(me, options) {
    var options = options || {}; // options setup
    var fsType = options.type || ''; // get the type of call
    var fsDescription = options.description || fsAnalyticsDescription; // get the description of call
    var fsAds = options.ads || false; // to send a request to
    var realTime = options.realTime || true; // get flag for realtime processing
    var pageView = options.pageView || false; // get pageview request
    var trackingPath = options.tPath || ''; // get the tracking path
    var fsEventName = options.eventName || fsType; // get the even type to pass to reporting. Default is the type of call.
    if (trackingPath != '') {
        trackingPath = encodeURIComponent(trackingPath);
    }

    /* Count Page as a "Page View" or not */
    if (pageView == true) { // see if pageview is set
        pageView = 1; // set the flag to be tracked as a new page view
    } else { // if not
        pageView = 0; // set the flag NOT to be tracked as a page view
    }

    if (fsAnalyticsHold != true) { //	if a hold hasn't been placed on the launching of analytics
        /* Request Type Launch */
        switch (fsType) { // check the type of call

            case "link": // if it's a link
                ntptEventTag("lc=" + trackingPath + "&ev=" + fsEventName + "&" + fsDescription + "&pv=" + pageView); // send tracking for the link with a description
                break;
            case "keepAlive": // time spend tracking in intervals set on the page...
                ntptEventTag("lc=" + trackingPath + "&ev=" + fsEventName + "&evdetail=" + fsDescription + "&pv=" + pageView); // send tracking for the link with a description
                break;
            case "media":
                /* must use the "this" (captured in the "me" variable) call on the onclick for the link */
                /* fsDescription will show up as the query modification they will see in the reporting engine */
                ntpLinkTag(me, [fsDescription]); // captures the url for the link tag
                break;
            case "external":
                /* must use the "this" (captured in the "me" variable) call on the onclick for the link */
                /* fsDescription will show up as the query modification they will see in the reporting engine */
                ntpLinkTag(me, [fsDescription]); // captures the url for the link tag
                break;
            case "form":
                /* must use the "document.formName" or "this" (captured in the "me" variable) call on the onclick for the link */
                /* fsDescription will show up as the query modification they will see in the reporting engine */
                ntptSubmitTag(me, [fsDescription]); // modifies the working query string for the reporting
                break;
            case "ini": // for initial page load
                var head = document.getElementsByTagName('head').item(0); // get the header tag
                var script = document.createElement('script'); // create a script tag
                script.src = fsReqDomain + "/fe/js/ntpagetag.js"; // set the script source
                script.type = "text/javascript"; // set the type
                script.defer = true; // set the defer
                head.appendChild(script); // place the script on the page
                NTPT_PGEXTRA = fsDescription + "&qc=1"; // set the NetInsite query
                break;
        }
    } else {
        fsAnalyticsHold = false; // remove the hold... open for second call
    }
}

/* 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:


        //user.USER_ID = 3372001;
        Spry.$$(".paginator").setAttribute("spry:detailregion", "fsCommentsPagination"); // setup the comment pagination region
        if (typeof(user) == "undefined" || user.USER_ID == "0" || user.USER_ID == "") {
            //if (user.USER_ID == "0" || user.USER_ID == ""){ // check for user id
            Spry.$$(".add-comment-link").setAttribute("href", passportLoginURL); // pass in the passportLogin
            Spry.$$(".add-comment-link").setAttribute("title", "Log in to add a comment"); // add the correct title to the anchor
            Spry.$$(".add-comment-link").setAttribute("spry:content", "Log in to add a comment"); // add the correct content to the anchor
            document.getElementById("add_comments_link").innerHTML = "LOG IN TO ADD A COMMENT"; // add the correct content to the anchor
            document.getElementById("add_comments1_link").innerHTML = "LOG IN TO ADD A COMMENT"; // add the correct content to the anchor
        } else {
            if (typeof(user.ONESITE_GOOD_STANDING) != "undefined" && (user.ONESITE_GOOD_STANDING == null || user.ONESITE_GOOD_STANDING == "false")) {
                var message = "This account does not have access to post comments.";
                Spry.$$(".add-comment-link").setAttribute("href", "javascript:regAlert(true, {notification:'" + message + "',title:'FoxSports.com',  headerText: 'FOXSports.com Alert', yesFunc:'false', noFunc:'false'});"); // set the verify onclick
            } else {
                if (typeof(user.VERIFIED) != "undefined" && (user.VERIFIED == '' || user.VERIFIED == '0')) { // if the user is unverified, setup alert
                    Spry.$$(".add-comment-link").setAttribute("href", "javascript:pgVerifyEmail();"); // set the verify onclick
                } else {
                    Spry.$$(".add-comment-link").setAttribute("href", "javascript:fsAddComments();");	// set the fsAddComments
                }
            }
            /*else { // if they are verified, allow to add comments
             Spry.$$(".add-comment-link").setAttribute("href", "javascript:fsAddComments(this);");	// set the fsAddComments
             }*/
            //Spry.$$(".add-comment-link").setAttribute("onclick", "fsAddComments();");	// set the fsAddComments
            Spry.$$(".add-comment-link").setAttribute("title", "Add a Comment"); // set the new title
            document.getElementById("add_comments_link").innerHTML = "ADD A COMMENT"; // set the new innerHTML
            document.getElementById("add_comments1_link").innerHTML = "ADD A COMMENT"; // set the new innerHTML

        }


        Spry.$$(".current_page").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // make sure there are comments
        Spry.$$(".current_page").setAttribute("spry:content", "{fsCommentsPagination::currentPage}"); // if so, show the page numbering
        Spry.$$(".total_pages").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // make sure there are comments
        Spry.$$(".total_pages").setAttribute("spry:content", " of {fsCommentsPagination::pageCount}"); // if so, show the page numbering

        Spry.$$(".comment_link_next").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // check for page comments
        Spry.$$(".comment_link_next").setAttribute("onclick", "fsPageComments(this, '{fsCommentsPagination::nextPage}'), fsAnalytics(this, {type: 'link', description: 'Comments - Next Page'})"); // if so, setup next page
        Spry.$$(".comment_link_prev").setAttribute("spry:if", "{fsCommentsPagination::pageCount}"); // check for page comments
        Spry.$$(".comment_link_prev").setAttribute("onclick", "fsPageComments(this, '{fsCommentsPagination::previousPage}'),fsAnalytics(this, {type: 'link', description: 'Comments - Previous Page'})"); // 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:nth-last-child(0) .info:nth-last-child(0)").addClassName("lastInfo");

        Spry.$$(".body").setAttribute("spry:content", '{fsComments::body}'); // attach the body of the comments


        Spry.$$(".comm-user").setAttribute("alt", '{fsComments::userName}'); // ste the user alt tag
        Spry.$$(".avatar").setAttribute("title", '{fsComments::userName}'); // set the title of the user link
        Spry.$$(".userName").setAttribute("spry:content", '{fsComments::userName}'); // attatch the user name
        Spry.$$(".userName").setAttribute("title", '{fsComments::userName}'); // set the title
        //Spry.$$(".date").setAttribute("spry:content", '{fsComments::postDate}'); // attach the post date of the comment
        //Spry.$$(".time").setAttribute("spry:content", '{fsComments::postDate}'); // attach the post date of the comment
        Spry.$$(".avatar").setAttribute("href", 'http://community.foxsports.com/{fsComments::userName}');// setup the users profile link
        Spry.$$(".userName").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
        var currentRow = fsComments.getCurrentRow();

        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 (i == rows.length - 1) {
                var info = document.getElementById("info_" + rid); // get the info div
                info.style.border = "none";
                info.setAttribute("style", "border:none;");
            }
        }


    }});


}

var slide_effect;

function fsAddComments() {    // Add Comments Expander
    if (typeof(slide_effect) == "undefined") {
        slide_effect = new Spry.Effect.Slide("add_comments", {duration:300, from:"0%", to:"100%", toggle:true}); // do the spry slide out effect
    }
    slide_effect.start();

}

function fsPageComments(me, showPage) { // Page through comments
    if (user.USER_ID == "0" || user.USER_ID == "") { // check for user id (check to see if they are logged in)
        fsCommentsMain.setURL(fsXMLComments + '?commentsContentId=' + fsCTKey + '&forumKey=' + fsCFKey + '&page_no=' + showPage); // get cached url
    } else {
        fsCommentsMain.setURL(fsXMLComments + '?commentsContentId=' + 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() { // Post a comment
    var commDiv = document.getElementById("add_comments");
    var textarea = commDiv.getElementsByTagName("textarea")[0];
    var newComment = escape(textarea.value); // get the comments

    var userId = user.USER_ID; // get the users ID
    fsAnalytics(this, {type: 'link', description: 'Comments - Post Comment'});
    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

            var commDiv = document.getElementById("add_comments");
            commDiv.getElementsByTagName("textarea")[0].value = '';	// clear the value of the comment field
            slide_effect.start();

            //Spry.Effect.DoSlide("add_comments", {duration:300, from:"100%", to:"0%", 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] */

/* BEGIN: Validating textarea characters length */

function validateTextLength(el, maxLength, message) {
	var areaLength = el.value.length;	
	if (maxLength < parseInt(areaLength)) {
		alert(message);
		el.value = el.value.substring(0, maxLength);
		return false;
	}
	return true;
}

function validateTextArea(el) {		
	return validateTextLength(el, 800, "You have exceeded the number of text characters allowed.");
}

/* END: Validating textarea characters length */


/* BEGIN: [URL Hash String]
 ** Example on calling this function:
 ** var cmsID = fsUrl("cms");
 ** This will set the assigned variables to the corresponding url variable.
 ** This will also capture everything beyond the hash mark as well ( # ) for ajax applications.
 */

function fsUrl(key)
{
    var value = null;
    if (hashStringArr[key])
    {
        value = hashStringArr[key];
    }
    return value;
}

hashStringArr = new Array();

function fsUrl_Parse()

{

    var query = window.location.hash.substring(1);
    var pairs = query.split("&");
    var mainQuery = window.location.search.substring(1);
    var mainQueryPairs = mainQuery.split("&");


    /* from ? */
    for (var i = 0; i < mainQueryPairs.length; i++)
    {
        var mPos = mainQueryPairs[i].indexOf("=");
        if (mPos >= 0) {
            var argname = mainQueryPairs[i].substring(0, mPos);
            var value = mainQueryPairs[i].substring(mPos + 1);
            hashStringArr[argname] = value;
        }
    }

    /* from # */
    for (var i = 0; i < pairs.length; i++)
    {
        var pos = pairs[i].indexOf('=');
        if (pos >= 0)
        {
            var argname = pairs[i].substring(0, pos);
            var value = pairs[i].substring(pos + 1);
            hashStringArr[argname] = value;
        }
    }
}

fsUrl_Parse(); // Start the query string gathering

/* END: [URL Hash String] */

/* FoxSports Global Launch Functions */
fsAWLLoadFunction({func:'setVerifyYesFunc()'});//set the verify yes function
fsAWLLoadFunction({func:'fsAnalytics(this, {type: "ini"})'}); // launch Foxsports Analytics
fsAWLLoadFunction({func:'fsFoxSportsGeneral()'}); // launch foxsports general scripts
fsAWLLoadFunction({func:'rackEm("global-nav", {trackLinks: true, description: "fsnav"})'}); // launch global nav1
fsAWLLoadFunction({func:'rackEm("global-nav-expanded", {trackLinks: true, description: "fsnav"})'}); // launch global nav2
fsAWLLoadFunction({func:'rackEm("msn-menu-items")'}); // load msn nav after window launches
fsAWLLoadFunction({func:'launchMyFlash({contUrl:"' + fsReqDomain + '/fe/flash/fs-header_clock.swf", locId:"ad120x30box", width:116, height:24})'}); // launch clock
fsAWLLoadFunction({func:"launchSiteSearch()"}); // load MSN Bing Search
fsAWLLoadFunction({func:'fsScoreStrip("ini")'}); // launch the scorestrip
fsAWLLoadFunction({func:'fsLoadAds()'}); // load the ads

