// Do not edit this script unless you contact Media Applications

// ------------------------
// Browser / OS Detection 
// ------------------------
var IE = (document.all) ? 1 : 0;
var DOM = (document.getElementById) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var MAC = ((navigator.appVersion.indexOf("PPC") >0) || (navigator.appVersion.indexOf("Mac") >0)) ? 1 : 0;

var ua = navigator.userAgent;
var OPERA = (ua.indexOf("Opera") > 0) ? 1 : 0;
var SAF = (navigator.appVersion.indexOf("Safari") >0) ? 1 : 0;
var iPhone = (ua.indexOf("iPhone") > 0) ? 1 : 0;

if (ua.indexOf("AOL") > 0) {
	var s_prop9="AOL"; // for Omniture
	var dclk_seg="aol"; // for Doubleclick
    }

function getEl(el) {
    return document.all ? document.all[el] : document.getElementById(el);
    }

function getElementsByClassName(cl,el) {
    var retnode = [];
    var myclass = new RegExp('\\b'+cl+'\\b');
    var elem = (el) ? el.getElementsByTagName('*') : document.getElementsByTagName('*');
    for (var i = 0; i < elem.length; i++) {
        var classes = elem[i].className;
        if (myclass.test(classes)) retnode.push(elem[i]);
        }
    return retnode;
    }

// ---------------------------------
// clipping functions for Mr. Pukey
// and other dynamically positioned
// icons
// ---------------------------------

function clipObj(who) {
    if (IE) {
        var clipper = document.all[who];
    }
    else if (DOM) {
        var clipper=document.getElementById(who);
    }
    clipper.style.clip = 'rect(0px 19px 32px 0px)';
    timer = setTimeout("unclipObj('"+who+"')", 2500);
}

function unclipObj(who) {
    if (IE) {
        var clipper = document.all[who];
    }
    else if (DOM) {
        var clipper=document.getElementById(who);
    }
    clipper.style.clip = 'rect(0px 64px 32px 0px)';
}


// --------------------------
// Cookie releated functions
// --------------------------

function setCookie (name, value, expires) {
	if (!expires) expires = new Date();
	document.cookie = name + "=" + value + "; expires=" + expires.toGMTString() +";domain=.cbssports.com; path=/";
}

function readCookie(name) {
    if(document.cookie == '') {
	return false;
    } else {
	var firstChar, lastChar;
	var theBigCookie = document.cookie;
	name = name + '=';
	firstChar = theBigCookie.indexOf(name);
	if (firstChar != -1) {
	    firstChar += name.length;
	    lastChar = theBigCookie.indexOf(';', firstChar);
	    if(lastChar == -1) lastChar = theBigCookie.length;
	    return unescape(theBigCookie.substring(firstChar, lastChar));
	} else {return false;}
    }
}

function killCookie(name, path, domain) {
  var theValue = readCookie(name);
  if(theValue) {
      document.cookie = name + '=' + theValue + '; expires=Fri, 13-Apr-1970 00:00:00 GMT' + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:''); // set an already-expired cookie
  }
}

function getValue(cookieName,name) {
	cookieValue=readCookie(cookieName)
	findString=name;
	if (cookieValue) {
		namePos=cookieValue.indexOf(findString,0);
		if (namePos==-1) {return false;}
		valueStart=(cookieValue.indexOf('&',namePos+1)+1);
		valueEnd=cookieValue.indexOf('&',valueStart+1);
		if (valueEnd==-1)  valueEnd=cookieValue.length;
		valueIs=cookieValue.substring(valueStart,valueEnd)
		if (namePos!=null) {return valueIs;}
	}
	else {return false;}
}

function mTrack(mTrackName,mTrackMax,cName,cExpires) {

    if (arguments.length == 2) {var cName='mediaTrack';}
    var newExp = (cExpires) ? ';expires='+cExpires : '';

    var showAd=true;
    if (!readCookie(cName)) {
        newCook=mTrackName +'|' +1;
        document.cookie=(cName +'='  + newCook +";domain=.cbssports.com;path=/" +newExp);
    	}
    else if (readCookie(cName)) {
        oldCook = readCookie(cName);
        var thisAH = oldCook.indexOf(mTrackName);
        if (thisAH==-1) {
            newCook=oldCook +'|' +mTrackName +'|' +1;
            document.cookie=(cName +'=' + newCook +";domain=.cbssports.com;path=/" +newExp);
            }
        else {
            var splitCook = oldCook.split('|');
            var cookPlus; var plusOne;
            for (i=0; i < splitCook.length; i+=2 ) {
                plusOne = i+1;
                if (splitCook[i]==mTrackName) {
                    cookPlus = parseInt(splitCook[plusOne])+1;
                    splitCook[plusOne]=cookPlus;
                    if (cookPlus > mTrackMax) showAd = false;
                    }
                }
            newCook="";
            for (var j=0; j < splitCook.length-1; j+=2) {
                newCook += splitCook[j] + '|' +splitCook[j+1];
                if (j+2 < splitCook.length) {newCook += '|';}
                }
            document.cookie=(cName +'=' + newCook +";domain=.cbssports.com;path=/" +newExp );
            }
        }
    return showAd;
    }

// --------------------------
// window opening functions -
// --------------------------
function openScroll(url,name,width,height) {
    popupWin = window.open(url, name, 'menubar=0,toolbar=0,location=0,directories=0,status=0,scrollbars=1,resizable=0,width=' +width +',height=' +height +',left=50,top=50');
}

function openPopup(url,name,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');
}

function SW(url, name, type) {//translate legacy popup function to new openPopup
	var swArray = new Array([],[508,494],[494,331],[550,400],[523,360],[532,412],[610,550],[494,550]);
	for (var i=0; i < swArray.length; i++) {
  		var swWidth = swArray[type][0];
		var swHeight = swArray[type][1];
	}
  openPopup(url,name,swWidth,swHeight);
}

// --------------------
// position detection -
// --------------------
function psuedoGetElementById(elm,d){
    var p,i,x; if(!d) d=document; if((p=elm.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; elm=elm.substring(0,p);
        }
    if(!(x=d[elm])&&d.all) x=d.all[elm]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][elm];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=document.getElementById(elm,d.layers[i].document);
    return x;
	}

function getCoordinates(obj) {
    var point = { x: 0, y: 0 };
    while(obj) {
        point.x += obj.offsetLeft;
        point.y += obj.offsetTop;
        obj = obj.offsetParent;
        }
    return point;
    }

function whereami(anchorid) {
    var locarr = new Array();
    if(DOM) {
        var myanchor = document.getElementById(anchorid);
        var coordinates = getCoordinates(myanchor)
        if (myanchor){
            locarr[0] = coordinates.x;
            locarr[1] = coordinates.y;
            }
    }
    else {
	    var myanchor = psuedoGetElementById(anchorid);
        var coordinates = getCoordinates(myanchor)
        if(myanchor.offsetLeft&&myanchor.offsetTop){
            locarr[0] = coordinates.x;
            locarr[1] = coordinates.y;
        }
    }
	return locarr;
}

// ------------------------------------------
// 2-tier fast fact drop-down scripts (oly) -
// ------------------------------------------

function OverLayer() {
    clearTimeout(timer);
    isOver = true;
}

function OutLayer() {
    clearTimeout(timer);
    isOver = false;
    timer = setTimeout("HideAllLayers()",100);
}


function ShowLayerFF(showEl,event) {
    if (showEl == "gnddhome") return;
    clearTimeout(CBSi.gn.timer);
    CBSi.gn.hide();

    if(DOM) {var whichEl = document.getElementById(showEl);}
    else {var whichEl = psuedoGetElementById(anchorid);}

    whichAnchor = showEl + "A";

    var coor= new Array();
    corr = whereami(whichAnchor);
    cmLeft = corr[0];
    cmTop = corr[1];

	if (whichEl.style) {
		if(MAC && IE){
		cmLeft = whichEl.offsetLeft;
		cmTop = 4;
		}
		if (showEl != 'gnddmore' && showEl != 'gnddfantasy' && showEl != 'gnddcycling') {
			if((cmLeft+whichEl.clientWidth)>770){
			cmLeft=(770-whichEl.clientWidth);
			}
		}
		whichEl.style.left = cmLeft;
		whichEl.style.top = cmTop + 18;
		whichEl.style.visibility = "visible";
	}
	else {
		whichEl.visibility = "visible";
		whichEl.top = cmTop + 18;
                if (showEl != 'gnddmore' && showEl != 'gnddfantasy' && showEl != 'gnddcycling') {
			    if((cmLeft+whichEl.width)>770){
				cmLeft=(770-whichEl.width);
				}
                }
		whichEl.left = cmLeft;
	}
	cmTop = 0; cmLeft = 0;
}


// ----------------------------------------------
// used on scoreboard calendars in options nav  -
// ----------------------------------------------

var gnActive = 'gnddhomeA';
var gnHomeLink = '';
var isOver=false;
var timer=null;
var cmTop=cmLeft=0;

function ShowLayer(showEl,event) {
	globalNavRightEdge = whereami('rightGlobalNav');
	globalNavRightEdge = globalNavRightEdge[0];

	clearTimeout(timer);
	HideAllLayers();
	var whichEl = document.getElementById(showEl);
	whichAnchor = showEl + "A";

    gnActive = showEl + "A";
    gnLink = document.getElementById(gnActive);
    
	whichAnchorDim = whereami(whichAnchor);
	cmLeft = whichAnchorDim[0]-10;

	if( arguments[2] ){
		globalNavBottomEdge = whereami(arguments[2]);
		cmTop = globalNavBottomEdge[1];
	}else{
		cmTop = whichAnchorDim[1] + 20;
	}

	whichEl.style.visibility = "visible";
	whichEl.style.top = cmTop;

	whichEl.style.left = cmLeft;
}

function HideAllLayers() {
	var divTemp = document.getElementsByTagName('div');
	for (i = 0; i < divTemp.length; i++) { 
		var divString = new String(divTemp[i].id);
		if (divString.indexOf('gndd') != -1) {
            divTemp[i].style.visibility = "hidden";
        }
    }
}

// --------------------------------------------------------------------------
// AJAX and other scripts for the tab-sets on home page, arenas, and other  -
// --------------------------------------------------------------------------

function getHTTPObject() {
	var xmlhttp;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		 try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		 } catch (E) {
				xmlhttp = false;
		 }
	}

	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}

	return xmlhttp;
}

<!-- scripts-tab -->
function tabSetParent(){
    this.newSet = function( name ){
        eval( 'this.' + name + '= new tabSetObj("'+ name +'");' );
    }
}

function tabSetObj( name ){

    if(IE && MAC){return;}

    this.name = name;
    this.tabDecoration   = function(){return ''}
    this.addId        = function(){return ''}
    this.addMouseOver = function(){return ''}
    this.addMouseOut  = function(){return ''}

    this.arrayPush = function( array, value ){
        array[array.length] = value;
        return;
    }

    // addTab to TabSet
    this.addTab = function( label, url, row, def ){
        if( row == null ) row = 0;
        this.row = new Array();

        if( def ) this.defaultRow = row;

        if( this.label ){
            if( this.label[row] )
            {
                this.arrayPush( this.label[row], label )
                this.arrayPush( this.url[row], url );
            }else{
                this.label[row] = Array( label );
                this.url[row] = Array( url );
            }
        }else{
            this.label = new Array();
            this.label[row] = Array( label );
            this.url = new Array();
            this.url[row] = Array( url );
        }
        this.row[row] = true;
        if( def ) this.defaultCell = this.label[row].length - 1;

    }

     this.getClassName = function(){
        return (( this.defaultRow == row ) && ( this.defaultCell == cell )) ? this.classOn : this.classOff ;
    }

    this.drawTabSet = function( dRow, dCell ){
        if( dRow != null ) this.defaultRow = dRow;
        if( dCell != null ) this.defaultCell = dCell;

        var tabSetHtml = '';
        // For Each Row
        for( row=this.row.length-1; row>=0; row-- ){
            rowHtml = '';
            label = this.label[row]
            rowHtml+= '<div class="tabContainer">';
		rowHtml+= '<ul class="tabSet">';

			    // For each Tab in a Specified row
		for( cell=0; cell < label.length; cell++ ){
		    className = this.getClassName(cell);
		    mouseOver = this.addMouseOver(cell,className);
		    mouseOut = this.addMouseOut(cell,className);
		    addId = this.addId(cell);
		    rowHtml += '<li class="'+ className +'-container">';
		    rowHtml += '<a href="javascript:void(0);"';
		    rowHtml += ' onclick="javascript:tabSet.' + this.name + ".click(" + row + "," + cell + ')"';
		    rowHtml += ' class="'+ className +'"';
		    rowHtml += addId + mouseOver + mouseOut;
		    rowHtml += '>';
		    rowHtml += label[cell];
		    rowHtml += '</a>';
		    //rowHtml += this.tabDecoration();
		    /*if (cell != label.length-1) {
			rowHtml += '<span class="tabPipe">|</span>';
		    } else {
			rowHtml += '';
		    }
		    rowHtml += '<div class="tabDownArrowContainer">';
		    rowHtml += '<span class="tabDownArrow"></span>';
		    rowHtml += '</div>';*/
		    rowHtml += '</li>';
		}
		rowHtml+= '</ul>';
		rowHtml+= '<ul class="tabDecoration">';

			    // For each Tab in a Specified row
		for( cell=0; cell < label.length; cell++ ){
		    className = this.getClassName(cell);
		    mouseOver = this.addMouseOver(cell,className);
		    mouseOut = this.addMouseOut(cell,className);
		    addId = this.addId(cell);
		    rowHtml += '<li class="'+ className +'-container">';
		    rowHtml += '<a href="javascript:void(0);"';
		    rowHtml += ' onclick="javascript:tabSet.' + this.name + ".click(" + row + "," + cell + ')"';
		    rowHtml += ' class="'+ className +'"';
		    rowHtml += addId + mouseOver + mouseOut;
		    rowHtml += '>';
		    rowHtml += label[cell];
		    rowHtml += '</a>';
		    rowHtml += '</li>';
		}
		rowHtml+= '</ul>';
	    rowHtml+= '</div>';
            if( this.defaultRow == row ){
                bottomRow = rowHtml;
            }else{
                tabSetHtml += rowHtml;
            }

        }
        document.getElementById(this.tabDivName).innerHTML = tabSetHtml + bottomRow;
    }

    this.renderTabs = function( dRow, dCell ){

		this.tabDivName = 'tabSet-tab-'+ this.name;
        var div = '<div id="'+ this.tabDivName +'">.</div>';
        document.write( div );

        this.drawTabSet();

    }

    this.click = function( row, cell ){
		this.changeContents( this.url[row][cell] );
        this.drawTabSet( row, cell );
    }

    this.changeContents= function( url ){
        http = getHTTPObject();
        http.open( "GET", url, true);
        http.onreadystatechange = this.onreadystatechange;
        tabSet.tabDestination = this.name;
        http.send(null);
    }

    this.onreadystatechange = function(){
        var loading = '<h3 id="ajaxLoading">Loading...</h3>';
	if (http.readyState == 4) {
            eval( "document.getElementById('tabSet_" + tabSet.tabDestination + "_div').innerHTML = http.responseText;" );
        } else {
	    eval( "document.getElementById('tabSet_" + tabSet.tabDestination + "_div').innerHTML = loading;" );
	}
    }

}
var tabSet = new tabSetParent();

// ----------------------
// Mouse-over Tool-tips -
// ----------------------

function tooltipOn(message,shift,e) {
	// Get position
	var posX = 0, posY = 0;
	if (!e) var e = window.event;
    posX = e.clientX;
	posY = e.clientY;

    // if called from the child, then pass second argument

    // Get scrolling offset
    var scrollX = 0, scrollY = 0;
    if (self.pageYOffset) // all except Explorer
    {
    	scrollX = self.pageXOffset;
    	scrollY = self.pageYOffset;
    }
    else if (document.documentElement && document.documentElement.scrollTop)
    	// Explorer 6 Strict
    {
    	scrollX = document.documentElement.scrollLeft;
    	scrollY = document.documentElement.scrollTop;
    }
    else if (document.body) // all other Explorers
    {
    	scrollX = document.body.scrollLeft;
    	scrollY = document.body.scrollTop;
    }

	if(MAC && IE){
		return; // Do nothing - IE Mac can't handle style.width properly
	}
    else {
        document.getElementById('tooltip').innerHTML = message;
        // get shifts for when called from child
        var shiftX = (shift && shift != 0) ? sekritLeft - scrollX : 0;
        var shiftY = (shift && shift != 0) ? sekritTop - scrollY : 0;
        // else pos
        document.getElementById('tooltip').style.left = scrollX + posX + 10 + shiftY;
        document.getElementById('tooltip').style.top = scrollY + posY + 10 + shiftX;
        document.getElementById('tooltip').style.visibility = 'visible';
        //alert('POS: '+posX+','+posY+' SHIFT: '+shiftX+','+shiftY+' SCROLL: '+scrollX+','+scrollY+' END: '+document.getElementById('tooltip').style.left+','+document.getElementById('tooltip').style.top);
    }
	return;
}

function tooltipOff() {
	if (IE || DOM) {document.getElementById('tooltip').style.visibility="hidden";}
    else return;
    }

// ----------------------
// Bookmark Pages
// ----------------------
function bookmarkThisPage(hrefObject, bookmarkLabel){
    hrefObject.href=document.location.href;   // Some browsers do a "bookmark link" feature, so the href must have the location to bookmark -- this makes sure it does
    if(window.sidebar && window.sidebar.addPanel){
        // Add to Mozilla's sidebar/ bookmarks
        window.sidebar.addPanel( bookmarkLabel, document.location.href, '' );
    }
    else if(window.external && (navigator.platform == 'Win32' ||(window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1))){
        // Add to IE's favorites
        window.external.AddFavorite(document.location.href, bookmarkLabel);
    }
    else if(window.opera && window.print)
    {
        // Opera
        return true;
    }
    else if(document.layers){
        // Fall back into an alert box if it seems Crtl+D is the bookmarking shortcut (Netscape)
        window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
    }
    else{
        // Fall back into another alert box.
        window.alert('Please use your browser\'s bookmarking facility to create a bookmark');
    }
    return false;
}

function externalWrite( string ) {
    document.write( string );
}

//---------------------
// Show Hide Element
//---------------------

function toggleHideShow(el) {
    var targetEl = document.getElementById(el);
    targetEl.style.display = (targetEl.style.display == 'none' || targetEl.style.display == '' ? 'block' : 'none');
}

//---------------------
// Begin flashObj
//---------------------

var flashObj 							= new Object();

	flashObj.settings					= new Object();
	flashObj.settings.objectAttributes	= ['id','width','height','style'];
	flashObj.template					= new Object();
	flashObj.template.takeover			= { width:985, height:300, loop:'false', menu:'false', quality:'autohigh', scale:'exactfit', wmode:'opaque', id:'expandingAd' };
	flashObj.template.takeover100		= { width:985, height:100, loop:'false', menu:'false', quality:'autohigh', scale:'exactfit', wmode:'opaque', id:'expandingAd' };
	flashObj.template.basic				= { width:32, height:32, menu:'false', quality:'autohigh', wmode:'opaque' };
	flashObj.template.printable			= { width:650, height:875, loop:'false', menu:'false', quality:'autohigh', scale:'exactfit', wmode:'opaque', id:'bracket' };
	flashObj.template.viewable			= { width:875, height:650, loop:'false', menu:'false', quality:'autohigh', scale:'exactfit', wmode:'opaque', id:'bracket' };


	flashObj.display = function( swfPath, swfVersion, swfOptions, imgPath, imgObj ){
		// This is the primary function in this Object Class
		//
		// Functions
		//  1. IF swfOptions._debug is true, <textarea> tags are added before and after Output for debugging purposes.
		//  2. Attaches Template to current Operation (If Applicable)
		//	3. Decides whether FLASH or IMG will be written based on user's Supported Flash/Fash Version
		//	4. doc.writes or returns HTML depending on swfOptions._return (true/false)
		var html = '';
		if( !imgObj ) imgObj = {};

		// If _debug true, Open Textarea Tag
		if( swfOptions['_debug'] ) html += '<textarea style="width:985px; height:300px" wrap="off">';

		// Import Template
		var template = ( typeof(this.template[swfOptions._template]) == 'object' )
					? this.template[swfOptions._template]
					: this.template.basic;

		// Generate HTML or IMG
		//html += ( this.getVersion() >= swfVersion )
		if( this.isSupported( swfVersion ) ){
			// Flash/FlashVersion Supported, Processes for Flash Object/Embed Output
			html += this.outputFlash( swfPath, swfVersion, swfOptions, template );
		}else{
			if( !imgObj.height ) imgObj.height = ( !swfOptions ) ? template.height : swfOptions.height;
			if( !imgObj.width  ) imgObj.width  = ( !swfOptions ) ? template.width  : swfOptions.width ;
			html += this.outputImg( imgPath, imgObj, template );
		}

		// If _debug true, Close Textarea Tag
		if( swfOptions['_debug'] ) html += '</textarea>';

		if( swfOptions['_return'] ){
			// Returns HTML
			return html;
		}else{
			document.write(html);		// Writes HTML to DOM
			return ( this.isSupported( swfVersion ) ) ? 'flash' : 'image';	// Returns Flash/Image depending on what was written
		}
	}

	flashObj.outputFlash = function( swfPath, swfVersion, swfOptions, template ){
		var oAttributes = new Object(); // Object Tag Attributes
		var oParameters = new Object(); // Object Tag Parameters
		var eAttributes = new Object(); // Embed  Tag Attributes

		// -Over-write Template with User Specified Information
		// -For Each Property User provided in swfOptions
		//  Write Option to Template.
		for( var key in swfOptions ) if( key.substr(0,1) != '_' ) template[key] = swfOptions[key];

		// Static Non Changing Flash classid & codebase
		oAttributes['classid'] = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
		oAttributes['codebase'] = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ this.objectVersionString(swfVersion);

		// Set Object Movie Parameter
		oParameters['movie'] = swfPath;

		// Set Embed Standard/Src Attributes
		eAttributes['type'] = 'application/x-shockwave-flash';
		eAttributes['pluginspage'] = 'http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash';
		eAttributes['src'] = swfPath;

		// Build Object/Embed Attributes based on non flash Attributes such as ID, STYLE
		//  Users flashObj.settings.objectAttributes for list of Object Attributes
		for( var index=0; index<this.settings.objectAttributes.length; index++ ){
			var templateKey = this.settings.objectAttributes[index];
			if( typeof template[templateKey] != 'undefined' ){
				oAttributes[templateKey] = template[templateKey];
				eAttributes[templateKey] = template[templateKey];
				delete template[templateKey];
			}
		}

		// Build Parameters and Embed
		for( var key in template ){
			oParameters[key] = template[key];
			eAttributes[key] = template[key];
		}

		// Build HTML
		var html  = '';
			// Object
			html += '<OBJECT';		// Open Object Tag
			for( var key in oAttributes ) html += '\n ' + key + '="' + oAttributes[key] + '"';	// Build Object Attributes
			html += '>';			// Close the Start Object Tag
			// Parameters
			for( var key in oParameters ) html += '\n  <PARAM NAME="' + key + '" VALUE="' + oParameters[key] + '" />';	// Build Ojbect Parameters
			// Embed
			html += '\n<EMBED';		// Open Embed Tag
			for( var key in eAttributes ) html += '\n ' + key + '="' + eAttributes[key] + '"';	// Build Embed Attributes
			html += ' />';			// Close Embed Tag
			html += '\n</OBJECT>';	// Close Object Tag
		return html;
	}

	flashObj.isSupported = function( swfVersion ){
		// Checks if Necessary Flash Version is Supported by browser.
		return(   this.juxtVersion( this.getVersionString() )   >=   this.juxtVersion( swfVersion )   );
		// this.juxtVersion
		// Converts Flash Version Information whether it be (Integer, String, or Array) into a Comparable string of numbers.
	}

	flashObj.juxtVersion = function( version ){
		// Converts Flash Version Information whether it be (Integer, String, or Array) into a Comparable string of numbers.
		var vString = '';	// Return Variable

		if( typeof(version) == 'string' || typeof(version) == 'number' ){
			version = parseInt(version);
			// Convert String/Number into 3 character string. Padded by zeros
			if( version < 10 ) vString += '00'+ version;
			if( version >= 10 && version < 100 ) vString += '0'+ version;
			if( version >= 100 ) vString += version;
			vString += '000000000';
		}else if( typeof(version) == 'object' ){
			for( i=0; i<=3; i++ ){
				if( typeof(version[i]) == 'undefined' || version[i] == 0 ){
					vString += '000';
				}else{
					if( version[i] < 10 ) vString += '00'+ version[i];
					if( version[i] >= 10 && version[i] < 100 ) vString += '0'+ version[i];
					if( version[i] >= 100 ) vString += version[i];
				}
			}
		}
		return vString;
	}

	flashObj.objectVersionString = function( version ){
		// Converts juxtVersion String of 12 characters into an Array Object.
		var version = this.juxtVersion(version);
		var objVersion = new Array();
		var segmentCount = 0;
		var group = '';
		for( var i=0; i<version.length; i++ ){
			segmentCount ++;
			group += ( parseInt(version.substr(i,1)) )
				   ? (version.substr(i,1)+'')
				   : '';
			if( segmentCount == 3 ){
				if( !group ) group = 0;
				segmentCount = 0;
				objVersion.push( group );
				group = '';
			}
		}
		return objVersion;
	}

	flashObj.outputImg = function( imgPath, imgObj, template ){
		// If no imgPath Provided
		if( ! imgPath ) return '';

		var oImg = new Object();		// Holds Image Tag Attributes
		var oAnchor = new Object();		// Holds Anchor Tat Attributes
		var anchorFlag = false;			// Boolean: IF Any Anchor Tag Attributes Exits (true)

		oImg['src'] = imgPath;
		oImg['height'] = template.height;
		oImg['width'] = template.width;
		oImg['border'] = 0;

		// Overwrite/Build Image and Anchor Tags
		for( var key in imgObj ){
			if( key.substr(0,1) == '_' ){
				oAnchor[key.substr(1)] = imgObj[key];
				anchorFlag = true;
			}else{
				oImg[key] = imgObj[key];
			}
		}

		// Build HTML
		var html = '';

			if( anchorFlag ){
				html += '<a';		// Open Achor Tag
				for( var key in oAnchor ) html += '\n ' + key + '="' + oAnchor[key] + '"';	// Build Anchor Attributes
				html += '>';		// Close the Start Object Tag
			}

			html += '<img';		// Open Achor Tag
			for( var key in oImg ) html += '\n ' + key + '="' + oImg[key] + '"';	// Build Anchor Attributes
			html += '/>';		// Close the Start Object Tag

			if( anchorFlag ) html += '</a>';	// Close Achor Tag

		return html;
	}

	flashObj.detectFlash = function(){
		this.detectedFlag = true;
		if(navigator.plugins && navigator.mimeTypes.length){
			// Non IE
			var x = navigator.plugins["Shockwave Flash"];
			if(x && x.description){
				//PlayerVersion = new com.deconcept.PlayerVersion();
				this.versionString = x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")
				this.version = this.versionString[0];
			}
		}else{
			// IE
			try{
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				for(var i=3; axo!=null; i++){
					axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
					if (i==6){
						axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47
					}
				}
			}catch(e){}

			if (axo != null) {
				this.version = axo.GetVariable("$version").split(" ")[1].split(',')[0];
				//this.versionString = axo.GetVariable("$version").split(" ")[1];
				this.versionString = axo.GetVariable("$version").split(' ')[1].split(',');
			}
		}
		return;
	}

	flashObj.getVersion = function(){
		if( ! this.detectedFlag ) this.detectFlash();
		return this.version;
	}

	flashObj.getVersionString = function(){
		if( ! this.detectedFlag ) this.detectFlash();
		return this.versionString;
	}

// END flashObj



// BEGIN show_hide_covered
document.hidetags = new Array("select","textarea");

function getAbsolutePos(el){
var r = { x: el.offsetLeft, y: el.offsetTop };
	if (el.offsetParent) {
		var tmp = getAbsolutePos(el.offsetParent);
		r.x += tmp.x;
		r.y += tmp.y;
	}
return r;
};

function hideShowCovered(el){
//	var document.hidetags = new Array("applet", "iframe", "select");
var p = getAbsolutePos(el);
var coor = new Array(new Array(p.x,(el.offsetWidth + p.x),p.y,(el.offsetHeight + p.y)),0);
var k=document.hidetags.length;
while(k){
var ar = document.getElementsByTagName(document.hidetags[--k]);
var cc = null;
var i = ar.length;
	while(i){
		cc = ar[--i];
		p = getAbsolutePos(cc);
		coor[1] = new Array(p.x,(cc.offsetWidth + p.x),p.y,(cc.offsetHeight + p.y));
		cc.style.visibility=(el.style.visibility=="hidden"||(cc.style.visibility=="hidden" && (coor[1][0] > coor[0][1]) || (coor[1][1]< coor[0][0]) || (coor[1][2] > coor[0][3]) || (coor[1][3]< coor[0][2])))?"visible":"hidden"
	}
}
};

function hideShowCoveredBehavior(){
var ar = document.getElementsByTagName("div");
var cc = null;
var i = ar.length;
while(i){
cc = ar[--i];
	if(cc.id.indexOf("gndd")!=-1){
	cc.onpropertychange= function(){hideShowCovered(this)};
	cc.onlosecapture= function(){hideShowCovered(this)};
	}
}
};
// END show_hide_covered

// Functions for the 'Share' button - transferred from media/buttons.html
function shareLinks(){};
shareLinks.prototype.allowClose = false;
shareLinks.prototype.showButtons = function(id) {
    shareLinks.prototype.thisMccid = id;
    if (shareLinks.prototype.lastMccid) {
        document.getElementById('shareBoxi'+shareLinks.prototype.lastMccid).style.visibility="hidden";
    }
    this.allowClose=false;
    document.getElementById('shareBoxi'+shareLinks.prototype.thisMccid).style.visibility="visible";
    shareLinks.prototype.lastMccid = id;
}
shareLinks.prototype.shareOff = function() {
    if (this.allowClose==true) {
        document.getElementById('shareBoxi'+shareLinks.prototype.thisMccid).style.visibility="hidden";
    }
}
shareLinks.prototype.hideButtons = function() {
	this.allowClose=true;
	setTimeout("shareLinks.prototype.shareOff()",1000);
	}

//---------------------
// Login Box
//---------------------
var loginHttp = new getHTTPObject();
var g_xurl;
var login = function(xurl,mpid,vendor,id,password) {
    g_xurl = xurl;
    var url = encodeURI('/ajax_login');
    var uri = encodeURI('xurl='+xurl+'&mpid='+mpid+'&vendor='+vendor+'&id='+id+'&password='+password+'&r='+Math.random());
    loginHttp.open('POST',url,true);
    loginHttp.onreadystatechange = this.handleLogin;
    loginHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    loginHttp.send(uri);
}

var handleLogin = function(){
    if (loginHttp.readyState == 4 && loginHttp.status == 200) {
	var data = loginHttp.responseText;
	data = data.replace(/<!--.*-->/g,'');
	data = data.replace(/^\s+|\s+$/g,'');
	if (data == '1') {
	    document.getElementById('loginForm').innerHTML = "<p id='loginStandby'>Please Stand By...</p>";
	    setTimeout("window.location.replace(g_xurl)", 1);
	} else {
	    document.getElementById('loginError').innerHTML = data;
	}
    }
}

//---------------------
// Quicklinks
//---------------------
var CBSi_quicklinks = {
    action:'stop',
    authorid:0,
    containerId:'ql_content',
    delay:50,
    hiding:null,
    increment:11,
    maxCount:50,
    position:0,
    quicklinks:[],
    timeout:null,
    title:document.title,
    unit:'px',
    server:'',
//    reRendered:0,
    showHide: function (what) {
        if (CBSi_quicklinks.populated == null) {
            CBSi_quicklinks.injectJS("/data/community/quicklinks/"+CBSi_quicklinks.authorid);
            CBSi_quicklinks.populate();
        }
        var ql_content = document.getElementById(CBSi_quicklinks.containerId);

        if (what){
            if (what == 'hide_delay'){
                CBSi_quicklinks.hiding = setTimeout('CBSi_quicklinks.showHide("hide")',500);
            }
            ql_content.style.display = (what == 'hide')? 'none':'block';
        }
        else {
            ql_content.style.display = (ql_content.style.display == 'block')? 'none':'block';
        }
    },
    populated:null,
    success: function(j) {
        var json = eval('('+unescape(j)+')');
        if (json.quicklinks){
            CBSi_quicklinks.quicklinks = json.quicklinks;
            CBSi_quicklinks.populate();
        }
    },
    populate: function() {
        var myUl = document.getElementById("ql_list");
        myUl.innerHTML = '';
        CBSi_quicklinks.populated=0;
        for (i=CBSi_quicklinks.quicklinks.length-1;i>=0;i--){
            var newLi = document.createElement('li');
            newLi.innerHTML =
                '<div><a class="link" href="'+decodeURIComponent(CBSi_quicklinks.quicklinks[i][1])+'">'+
                '<b>&middot;</b> '+decodeURIComponent(CBSi_quicklinks.quicklinks[i][0])+' </a>'+
                '<a class="remove" href="#" onClick="CBSi_quicklinks.remove('+i+');return false;">Remove</a></div>';
            myUl.appendChild(newLi);
            CBSi_quicklinks.populated++;
        }
        CBSi_quicklinks.setPageCount(CBSi_quicklinks.populated);
    },
    setPageCount: function (count) {
        var ql_count = document.getElementById("ql_count");
        ql_count.innerHTML = count+' pages';
    },
    add: function() {
        var docURL = encodeURIComponent(document.URL);

        if (CBSi_quicklinks.populated >= CBSi_quicklinks.maxCount) {
            alert('Sorry, a maximum of '+CBSi_quicklinks.maxCount+' Quicklinks are allowed');
            return false;
        }
        else {
            for (i=CBSi_quicklinks.quicklinks.length-1;i>=0;i--){
               if (CBSi_quicklinks.quicklinks[i][1] == document.URL) {
                    alert('This page is already in your Quicklinks, titled "'+
                        decodeURIComponent(CBSi_quicklinks.quicklinks[i][0])+'" ('+(i+1)+' from the bottom)');
                    return false;
                }
            }
            CBSi_quicklinks.title = encodeURIComponent(CBSi_quicklinks.title);
            CBSi_quicklinks.injectJS("/data/community/quicklinks/"+CBSi_quicklinks.authorid+"?action=add&label="+CBSi_quicklinks.title+"\&url="+docURL);
        }
    },
    remove: function(i) {
        CBSi_quicklinks.injectJS("/data/community/quicklinks/"+CBSi_quicklinks.authorid+"?action=remove&mccid="+CBSi_quicklinks.quicklinks[i][2]);
        var removed = CBSi_quicklinks.quicklinks.splice(i,1);
    },
    scroll: function (direction) {
        if (CBSi_quicklinks.timeout) clearTimeout(CBSi_quicklinks.timeout);
        if (direction) CBSi_quicklinks.action = direction;
        var ql_ul = document.getElementById("ql_list");
        var changed = 0;
        if (CBSi_quicklinks.action == 'up')
        {
            if (CBSi_quicklinks.position > -1*ql_ul.offsetHeight+50){
                CBSi_quicklinks.position -= CBSi_quicklinks.increment;
                changed = 1;
            }
        }
        else if (CBSi_quicklinks.action == 'down'){
            if (CBSi_quicklinks.position < 0){
                CBSi_quicklinks.position += CBSi_quicklinks.increment;
                changed = 1;
            }
        }
        if (changed) {
            ql_ul.style.top = CBSi_quicklinks.position + CBSi_quicklinks.unit;
            CBSi_quicklinks.timeout = setTimeout('CBSi_quicklinks.scroll()',CBSi_quicklinks.delay);
        }
    },
    script: null,
    injectJS: function(url) {   // quick lean transport method
        var head = document.getElementsByTagName("head")[0];
        if (CBSi_quicklinks.script) head.removeChild(CBSi_quicklinks.script);
        CBSi_quicklinks.script = document.createElement('script');
        CBSi_quicklinks.script.id = 'injectJS';
        CBSi_quicklinks.script.type = 'text/javascript';
        CBSi_quicklinks.script.src = CBSi_quicklinks.server+url;
        head.appendChild(CBSi_quicklinks.script);
    }
};

//---------------------
// MCC Favorites
//---------------------
function memberShareLinks(){}memberShareLinks.allowClose=false;memberShareLinks.showButtons=function(b,a){this.allowClose=false;var d=document.getElementById("favMemberBoxi");var c=b;d.style.visibility="visible";YAHOO.util.Dom.setXY(d,b);hoverPopup.displayKnob(a)};memberShareLinks.shareOff=function(){if(this.allowClose==true){document.getElementById("favMemberBoxi").style.visibility="hidden";hoverPopup.displayKnob("none")}};memberShareLinks.hideButtons=function(){this.allowClose=true;setTimeout("memberShareLinks.shareOff()",2000)};memberShareLinks.showActive=function(){this.allowClose=false};var hoverPopup={getCoords:function(d,b,f,a){var c=YAHOO.util.Dom.getXY(a);c[0]-=48;c[1]+=31;return c},displayKnob:function(a){if(a=="right"){document.getElementById("knobright").style.visibility="visible"}else{if(a=="left"){document.getElementById("knobleft").style.visibility="visible"}else{if(a=="top"){document.getElementById("knobtop").style.visibility="visible"}else{if(a=="bottom"){document.getElementById("knobbottom").style.visibility="visible"}else{if(a=="none"){document.getElementById("knobright").style.visibility="hidden";document.getElementById("knobleft").style.visibility="hidden";document.getElementById("knobtop").style.visibility="hidden";document.getElementById("knobbottom").style.visibility="hidden"}}}}}}};function delay(a){setTimeout('afterFiveSeconds("'+a+'")',200)}function delayOnlineMemberRender(b){var a=b;if(document.getElementById("top-favs")!=null){CBSi_processOnlineMembers(a)}}function afterFiveSeconds(json){var profileObject=eval("("+unescape(json)+")");if(document.getElementById("top-favs")!=null){CBSi_processOnlineMembers(profileObject)}if(document.getElementById("top-favs-teams")!=null){CBSi_processTeams(profileObject)}}function CBSi_renderMember(a){delay(a)}function CBSi_processFavTeams(json){var profileObject=eval("("+unescape(json)+")");if(document.getElementById("top-favs-teams")!=null){CBSi_processTeams(profileObject)}}function CBSi_processContent(a){document.getElementById("userContent").innerHTML=document.getElementById(a).innerHTML}function CBSi_processOnlineMembers(d){var g=-3;var h=7;var a=10;var j="http://images.cbssports.com/images/mcc/anonymous.gif";var f=new Array();if(d.MCC.profileType=="MCC"){f.push("<p id='membersLinks'><a href='/mcc/authors/author'>Your Favorite Members</a> | <a href='/mcc/'>View All</a></p>")}else{f.push("<p><a href='/mcc/'>Top Members Online</a></p>")}f.push("<ul class='bg2' id='membersList'>");var b=0;if(d.MCC.favs.author.length>h){b=h}else{b=d.MCC.favs.author.length}for(var e=0;e<b;e++){if(e!=h-1){f.push("<li>")}else{f.push("<li class='mccLstMember'>")}f.push("<div id='favMemberBoxiContainer"+e+"' onMouseOver='CBSi_processContent(\"content_"+d.MCC.favs.author[e]["author-id"]+'"); memberShareLinks.showButtons(hoverPopup.getCoords(event,"top", '+g*a+', "favMemberBoxiContainer'+e+"\"), \"top\");' onMouseOut='memberShareLinks.hideButtons();'>");f.push("<a href='http://www.cbssports.com/mcc/authors/author/"+d.MCC.favs.author[e]["author-id"]+"' >");f.push("<span>");f.push("<img border='0' width='25' height='22' src='"+d.MCC.favs.author[e]["logo-small"]+"' />");f.push("</span>");f.push("</a>");f.push(drawMember(d.MCC.favs.author[e]));f.push("</div>");f.push("</li>");g++}for(var e=b;e<h;e++){if(e!=h-1){f.push("<li>")}else{f.push("<li class='mccLstMember'>")}f.push("<span>");f.push("<img width='25' height='22' src='"+j+"' alt='member'/>");f.push("</span>");f.push("</li>")}f.push("</ul>");f.push("<p id='membersOnline'>Total Members Online: "+d.MCC.MemberCount+"</p>");try{document.getElementById("top-favs").innerHTML=f.join("")}catch(c){}}function drawMember(c){var b=new Array();b.push("<div id='content_"+c["author-id"]+"' style='display:none; width: 0px; height: 0px;'>");b.push("<table><tr><td valign='center'>");for(var a=0;a<c.badges.badge.length;a++){b.push("<img border='0' width='20' height='20' src='"+c.badges.badge[a].logo+"' />")}b.push("<a href='http://www.cbssports.com/mcc/authors/author/"+c["author-id"]+"' >");b.push("&nbsp;"+c["screen-name"]);b.push("</a>");b.push("<br/>");b.push("<b>Last Post: </b><a href='/mcc/messages/message/"+c.last_post.mccid+"'>"+c.last_post.prettyTime+"</a>");b.push("</td></tr>");b.push("</table></div>");return b.join("")}function CBSi_processTeams(i){try{if(CBSi_MEDIA_SERVER_HOME==undefined){CBSi_MEDIA_SERVER_HOME="http://www.cbssports.com"}}catch(g){CBSi_MEDIA_SERVER_HOME="http://www.cbssports.com"}var h=-3;var j=7;var a=10;var k="<img height=15 width=15 align=absmiddle border=0  src='http://images.cbssports.com/images/mcc/team_bg.gif'/>";var c=new Array();var f=new Array();var d=new Array();f.push();c=(i.TEAMS.NFL.icon=="")?["/customize?default_tab=NFL",k]:["/nfl/teams/page/"+i.TEAMS.NFL.abrrev,i.TEAMS.NFL.icon];if(i.TEAMS.NFL.icon!=""){f.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}else{d.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}c=(i.TEAMS.MLB.icon=="")?["/customize?default_tab=MLB",k]:["/mlb/teams/page/"+i.TEAMS.MLB.abrrev,i.TEAMS.MLB.icon];if(i.TEAMS.MLB.icon!=""){f.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}else{d.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}c=(i.TEAMS.NBA.icon=="")?["/customize?default_tab=NBA",k]:["/nba/teams/page/"+i.TEAMS.NBA.abrrev,i.TEAMS.NBA.icon];if(i.TEAMS.NBA.icon!=""){f.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}else{d.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}c=(i.TEAMS.NCAAF.icon=="")?["/customize?default_tab=NCAAF",k]:["/collegefootball/teams/page/"+i.TEAMS.NCAAF.abrrev,i.TEAMS.NCAAF.icon];if(i.TEAMS.NCAAF.icon!=""){f.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}else{d.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}c=(i.TEAMS.NCAAB.icon=="")?["/customize?default_tab=NCAAB",k]:["/collegebasketball/teams/page/"+i.TEAMS.NCAAB.abrrev,i.TEAMS.NCAAB.icon];if(i.TEAMS.NCAAB.icon!=""){f.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}else{d.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}c=(i.TEAMS.NHL.icon=="")?["/customize?default_tab=NHL",k]:["/nhl/teams/page/"+i.TEAMS.NHL.abrrev,i.TEAMS.NHL.icon];if(i.TEAMS.NHL.icon!=""){f.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}else{d.push("<li><a href='"+CBSi_MEDIA_SERVER_HOME+c[0]+"'>"+c[1]+"</a></li>")}try{document.getElementById("top-favs-teams").innerHTML="<ul id='teamsList'>"+f.join("")+d.join("")+"</ul>"}catch(b){}};