var ff_nfl = new Array(
['http://www.sportsline.com/nfl/','NFL Home'],
['http://www.nfl.com/','NFL.com','_blank'],
['http://www.nfl.com/scores.shtml','Scoreboard','_blank'],
['http://www.nfl.com/standings/','Standings','_blank'],
['http://www.nfl.com/schedules/','Schedules','_blank'],
['http://www.nfl.com/stats/','Stats','_blank'],
['/nfl/teams','Teams'],
['/nfl/players','Players'],
['/nfl/transactions/','Transactions'],
['/nfl/injuries','Injuries'],
["rule"],
['http://www.sportsline.com/redir?url=3620','Tickets','_blank']
);

var ff_nba = new Array(
['/nba/','NBA Home'],
['/nba/scoreboard','Scoreboard'],
['/nba/standings','Standings'],
['/nba/schedules','Schedules'],
['/nba/stats','Stats'],
['/nba/teams','Teams'],
['/nba/players','Players'],
['/nba/transactions','Transactions'],
['/nba/injuries','Injuries'],
["rule"],
['http://www.sportsline.com/redir?url=3623','Tickets','_blank']
);
		
var ff_mlb = new Array(
['/mlb','MLB Home'],
['/mlb/scoreboard','Scoreboard'],
['/mlb/standings','Standings'],
['/mlb/schedules','Schedules'],
['/mlb/stats','Stats'],
['/mlb/teams','Teams'],
['/mlb/players','Players'],
['/mlb/transactions','Transactions'],
['/mlb/injuries','Injuries'],
["rule"],
['http://www.sportsline.com/redir?url=3624','Tickets','_blank']
);

var ff_nhl = new Array(
['/nhl/','NHL Home'],
['/nhl/scoreboard','Scoreboard'],
['/nhl/standings','Standings'],
['/nhl/schedules','Schedules'],
['/nhl/stats','Stats'],
['/nhl/teams','Teams'],
['/nhl/players','Players'],
['/nhl/transactions','Transactions'],
['/nhl/injuries','Injuries'],
["rule"],
['http://www.sportsline.com/redir?url=3626','Tickets','_blank']
);

var ff_cfo = new Array(
['/collegefootball','NCAAF Home'],
['/collegefootball/scoreboard','Scoreboard'],
['/collegefootball/standings','Standings'],
['/collegefootball/schedules','Schedules'],
['/collegefootball/stats','Stats'],
['/collegefootball/polls','Polls'],
['/collegefootball/teams','Teams'],
['/collegefootball/players','Players'],
["rule"],
['http://www.sportsline.com/redir?url=3627','Tickets','_blank']
);

var ff_cba = new Array(
['/collegebasketball','NCAAB Home'],
['/collegebasketball/scoreboard','Scoreboard'],
['/collegebasketball/mayhem/brackets','Brackets'],
['/collegebasketball/mayhem/regions/midwest','Regions'],
['/collegebasketball/standings','Standings'],
['/collegebasketball/schedules','Schedules'],
['/collegebasketball/stats','Stats'],
['/collegebasketball/teams','Teams'],
['/collegebasketball/players','Players'],
['/ncaawbasketball','Wmn\'s Hoops'],
["rule"],
['http://www.sportsline.com/redir?url=3628','Tickets','_blank']
);

var ff_gol = new Array(
['http://www.pgatour.com/','PGATOUR.COM'],
['http://www.pgatour.com/scoring/','Leaderboards'],
['http://www.golfweb.com/tournaments/usopen','U.S. Open'],
['http://www.pgatour.com/tournaments/','Schedules'],
['http://www.pgatour.com/stats/','Stats'],
['http://www.pgatour.com/players/','Players'],
['http://www.pgatour.com/courseguide','Course Guide'],
['http://www.pgatour.com/gearguide','Gear Guide'],
['http://www.pgatour.com/travel','Golf Packages']
);

var ff_aut = new Array(
['/autoracing/','Racing Home'],
['/autoracing/results','Results'],
['/autoracing/standings','Standings'],
['/autoracing/schedules','Schedules'],
['/autoracing/teams','Teams'],
['/autoracing/drivers','Drivers'],
['/autoracing/tracks','Tracks'],
["rule"],
['http://www.sportsline.com/redir?url=3630','Tickets','_blank']
);

var ff_ten = new Array(
['/tennis','Tennis Home'],
['/tennis/scoreboard','Scoreboard'],
['/tennis/rankings','Rankings'],
['/tennis/schedules','Schedules'],
['/tennis/players','Players'],
["rule"],
['http://www.sportsline.com/redir?url=3631','Tickets','_blank']
);

var ff_horse = new Array(
['/horseracing','Horses Home'],
['http://horseracing.sportsline.com/cbsSportsLineLive.htm','Live Racing'],
['http://horseracing.sportsline.com/roadToTheDerby/','Triple Crown'],
["rule"],
['http://www.sportsline.com/redir?url=4258','Tickets','_blank']
);

var news_nfl = news_nba = news_mlb = news_nhl = news_cfo = news_cba = news_gol = news_aut = news_horse = news_ten = [];

var news_nfl = new Array (
["/nfl/story/8478315","Judge: Chiefs give Cunningham the goods"],
["/nfl/story/8480777","Winslow, Browns await MRI results"],
["/nfl/story/8481147","Romo: I stayed ahead of drug policy"],
["/nfl/story/8480049","Restless S Darius back with Jags"],
["/nfl/story/8480559","Day off for Vikes\' \'Whiz Kid\' Smith"],
["/nfl/story/8480749","Taylor absent as Redskins practice"],
["/nfl/story/8480449","He\'s back: Archuleta healthy, relieved"]
);
var news_nba = new Array (
["/nba/gamecenter/recap/NBA_20050517_IND@DET ","Pistons on verge of return trip to East finals "],
["/nba/story/8481059 ","Pistons poised to put Pacers out of their misery "],
["/nba/story/8478116","Fast-learning \'General\' motors Mavs through playoffs  "],
["/nba/story/8480009","Labor meeting \'fails to materialize\'"],
["/nba/story/8480481","Wizards\' Dixon goes before Congress"],
["/nba/story/8480285","Resting Heat ready for Shaq\'s return"],
["/nba/story/8480653","Phoenix\'s Colangelo top executive"]
);
var news_mlb = new Array (
["/mlb/gamecenter/recap/MLB_20050517_FLA@LA ","Willis fails in bid for eighth win, loses to Dodgers"],
["/mlb/story/8481530 ","It\'ll take more than one loss to derail Dontrelle-mania "],
["/mlb/gamecenter/recap/MLB_20050517_MIL@WAS","Obermueller\'s first win since September one to remember"],
["/mlb/story/8480093","Power Rankings: Cardinals rewarding flock\'s faith"],
["/mlb/gamecenter/recap/MLB_20050517_STL@PHI","Hot Abreu goes yard again for Phils"],
["/mlb/gamecenter/recap/MLB_20050517_NYY@SEA","Giambi lifts Yankees to 10th in a row"],
["/mlb/gamecenter/recap/MLB_20050517_CHC@PIT","Cubs\' Lee ends Mesa\'s save streak"]
);
var news_nhl = new Array (
["/nhl/story/8475239","Rucinsky sparks Czechs over Canada for world title"],
["/nhl/story/8470023","NHLPA cancels membership meeting"],
["/nhl/story/8467022","League, players close finance talks"]
);
var news_cfo = new Array (
["/collegefootball/story/8466856","Notebook: At Arizona St., focus is on moving forward"],
["/collegefootball/story/8480593","Ohio State clear of Clarett saga?"],
["/collegefootball/story/8480088","Oklahoma State dismisses three"],
["/collegefootball/story/8478494","Bowden: DeBerry in religious battle"],
["/collegefootball/story/8478163","Temple football to play in the MAC"],
["/nba/story/8469415","Texas A&M recruit looking into NBA"],
["/general/story/8470552","Fresno St. lures AD away from Ohio"]
);
var news_cba = new Array (
["/collegebasketball/story/8477986","Ten for Tuesday: Package deals for the ages"],
["/collegebasketball/story/8477414","VCU transforms fears into nation-wide faction"],
["/collegebasketball/story/8480931","Blue Devils top Preseason NIT field "],
["/collegebasketball/story/8480089","Wade to head west for Washington"],
["/collegebasketball/story/8480538","Cyclones\' Morgan out of hospital"],
["/collegebasketball/story/8480571","Charleston So. names new coach"],
["/collegebasketball/story/8478179","Huggins will remain at Cincinnati"]
);
var news_gol = new Array (
["http://www.pgatour.com/story/8475436","Purdy surges to first TOUR win at EDS Byron Nelson"],
["http://www.pgatour.com/story/8477763","British Open to be Nicklaus\' final event"],
["http://www.pgatour.com/story/8474949","Bjorn wins British Masters in playoff"],
["http://www.pgatour.com/story/8477110","Thorpe wins in Monday playoff"],
["http://www.pgatour.com/story/8468671","Asian Tour to expand season"],
["http://www.pgatour.com/story/8480735","Consistency is the key to Woods\' putting routine"],
["http://www.pgatour.com/story/8480190","Sorenstam eyes Grand Slam"]
);
var news_aut = new Array (
["/autoracing/story/8480543","Feud of the Week: Jamie McMurray vs. Kyle Busch"],
["/autoracing/story/8480442","Rice not cleared to race in Indy 500"],
["/autoracing/story/8478036","Smoother track fueling Indy speeds"],
["/autoracing/story/8478715","Luyendyk Jr. secures qualifying ride"],
["/autoracing/story/8478059","Jarrett\'s crew chief resigns"],
["/autoracing/story/8474962","Kanaan wins Indy pole; Patrick 4th"],
["/autoracing/story/8477856","Wheeler: Gordon\'s the best bet"]
);
var news_ten = new Array (
["/tennis/story/8474474","Federer cruises in Hamburg title"],
["/tennis/story/8480232","Davydenko, Mantilla win in Austria"],
["/tennis/story/8480328","Frazier KOs defending champ Schaul"],
["/tennis/story/8480320","Venus strolls to Istanbul quarterfinals"],
["/tennis/story/8480272","Chile, Argentina win in Team Cup"],
["/tennis/story/8477656","U.S. Open to use blue courts"],
["/tennis/story/8474544","Mauresmo rallies to win Italian title"]
);
var news_horse = new Array (
["/horseracing/story/8480342","Giacomo still has much to prove"],
["/horseracing/story/8480349","Zito now Preakness triple threat"],
["/horseracing/story/8477820","Preakness just a Band-Aid for Pimlico"],
["/horseracing/story/8477791","Afleet Alex in working Pimlico vacation"],
["/horseracing/story/8476277","Lil\' Sister Swiss wins Nursery Stakes"],
["/horseracing/story/8475259","Veteran trainer in fresh spotlight"],
["/horseracing/story/8475284","Golden Commander takes Kingston"]
);

var more = new Array (
["/arenafootball","Arena Football"],
["/boxing","Boxing"],
["/olympics","Olympic Sports"],
["/soccer","Soccer"],
["/cycling","Tour de France"],
["/wireless","Wireless"],
["/wnba","WNBA"],
["/ncaawbasketball","Women\'s NCAA Hoops"],
["/info/siteindex","Site Index"]
);

var tt = new Array(
['','',''],
['NFL ','nfl','nfl'],
['NBA ','nba','nba'],
['MLB ','mlb','mlb'],
['NHL ','nhl','nhl'],
['NCAA Football ','cfo','collegefootball'],
['NCAA Hoops ','cba','collegebasketball'],
['Golf ','gol','pgatour'],
['Auto Racing ','aut','autoracing'],
['Tennis ','ten','tennis'],
['Horse Racing ','horse','horseracing'],
['More Sports ','more','more']
);

var dd_ns4 = (document.layers) ? 1 : 0;
var dd_ie4 = (document.all) ? 1 : 0;
var dd_dom = ((document.getElementById) && (!dd_ie4)) ? 1 : 0; // ns6
var isOver = false;
var timer = null;
var cmTop = 0;
var cmLeft = 0;

// dd_ns4 redraw on resize
if (dd_ns4) {
        origWidth = innerWidth;
        origHeight = innerHeight;
}

function reDo() {
        if (innerWidth != origWidth || innerHeight != origHeight) {location.reload();}
}

if (dd_ns4) onresize = reDo;
if (dd_dom) onload = InitObj;

document.write("<div id=\"gnddhome\"></div>");
	
//build sport dropdowns
for ( i = 1 ; i < tt.length-1 ; i++ ) {
	var ff = eval("ff_" + tt[i][1]);
	var news = eval("news_" + tt[i][1]);
	var divNum = "gndd" + tt[i][2];
	var strDiv = "<div class=\"cm\" id=\"" + divNum + "\" onMouseOver=\"OverLayer();\" onMouseOut=\"OutLayer('"+ divNum + "');\">";

	if (ff.length==0)  { // news only
		var strDiv = "<div class=\"cmNOff\" id=\"" + divNum + "\" onMouseOver=\"OverLayer();\" onMouseOut=\"OutLayer('"+ divNum + "');\">";
		strDiv = strDiv + "<table cellspacing=1 cellpadding=1 width=300 border=0><tr valign=top>";
		}
	else if (news.length==0){ // ff only
		var strDiv = "<div class=\"cmNOnews\" id=\"" + divNum + "\" onMouseOver=\"OverLayer();\" onMouseOut=\"OutLayer('gnddcycling');\">";
		strDiv = strDiv + "<table cellspacing=0 cellpadding=1 border=0 width=100><tr valign=top><td nowrap class=cmLff>";
		}
	else { // both
		var strDiv = "<div class=\"cm\" id=\"" + divNum + "\" onMouseOver=\"OverLayer();\" onMouseOut=\"OutLayer('"+ divNum + "');\">";
		strDiv = strDiv + "<table cellspacing=1 cellpadding=1 width=400 border=0><tr valign=top><td class=cmLff width=100>";
		}

	for ( j = 0 ; j < ff.length ; j++ ) {

   		var linkString = new String(ff[j][0]);

		if (ff[j][0]=="rule") {
            strDiv = strDiv +'<table width="100%" cellspacing=0 cellpadding=0 border=0><tr><td height=6><spacer type=block width=1 height=1></td></tr><tr><td height=1 bgcolor="#A8A8A8"><spacer type=block width=1 height=1></td></tr><tr><td height=1 bgcolor="#C5C5C3"><spacer type=block width=1 height=1></td></tr><tr><td height=6><spacer type=block width=1 height=1></td></tr></table>';
            continue;
            }
        if (linkString.indexOf('http:') == -1) ff[j][0] = "http://www.sportsline.com" + ff[j][0];

        var linkTarget="";
        if (ff[j][2]) linkTarget=(" target=\'" +ff[j][2] +"\'");

        if (ff[j][1]=="Tickets") {
            strDiv = strDiv + "<center><a class='black' href='" + ff[j][0] + "'" +linkTarget +">" + ff[j][1] + "</a></center><table width='100%' cellspacing=0 cellpadding=0 border=0><tr><td height=4><spacer type=block width=1 height=1></td></tr></table>";


            }
        else {
            strDiv = strDiv + "&nbsp\;&#183\;&nbsp\;<a class='black' href='" + ff[j][0] + "'" +linkTarget +">" + ff[j][1] + "</a><br>";
            }
        }

	if (news.length!=0){
		strDiv = strDiv + "</td><td class=cmL width=300 nowrap><div class='cmH'>&nbsp\;" + tt[i][0] + "News</div>";
		for ( j = 0 ; j < news.length ; j++ ) {
			var linkString = new String(news[j][0]);
			if (linkString.indexOf('http:') == -1) news[j][0] = "http://www.sportsline.com" + news[j][0];		
			if (j < 7) strDiv = strDiv + "&nbsp\;<b>&#183\;</b>&nbsp\;<a href='" + news[j][0] + "'>" + news[j][1] + "</a><br>";
		}
	}
	
	strDiv = strDiv + "</td></tr></table></div>\n";
	document.write(strDiv);
    }

//build more dropdown - 120
var strMore = "<div class=\"cmMore\" id=\"gnddmore\" onMouseOver=\"OverLayer();\" onMouseOut=\"OutLayer('gnddmore');\">";
strMore = strMore + "<table cellspacing=1 cellpadding=3 border=0 width=145><tr valign=top><td nowrap class=cmLff>";
for ( j = 0 ; j < more.length ; j++ ) {
	if ( j == more.length-1 ) strMore = strMore + "<br>";
	var linkString = new String(more[j][0]);
	if (linkString.indexOf('http:') == -1) more[j][0] = "http://www.sportsline.com" + more[j][0];	
	strMore = strMore + "<b>&#183\;</b>&nbsp\;<a href='" + more[j][0] + "'>" + more[j][1] + "</a><br>";
}
strMore = strMore + "<br></td></tr></table></div>\n";
document.write(strMore);

function InitObj() {
	for (i = 1; i < tt.length; i++) { 
		whichEl = "gndd" + tt[i][2];
		if (dd_dom) {
			whichEl = document.getElementById(whichEl);
		}
		else {	
			whichEl = (dd_ns4) ? document.layers[whichEl] : document.all[whichEl].style;
		} 
		whichEl.onmouseover = OverLayer;
		whichEl.onmouseout = OutLayer;
	}

	//fantasy dropdown code
	var fantasy_el = "gnddfantasy";
	if (dd_dom) {
		fantasy_el = document.getElementById(fantasy_el);
	}
	else {	
	
	
		fantasy_el = (dd_ns4) ? document.layers[fantasy_el] : document.all[fantasy_el].style;
	} 
	fantasy_el.onmouseover = OverLayer;
	fantasy_el.onmouseout = OutLayer;

}
InitObj();

function ShowLayer(showEl,event) {
	if (showEl == "gnddhome") return;
	clearTimeout(timer);
	HideAllLayers();
	if (dd_dom) {
		var whichEl = document.getElementById(showEl);
	}
	else {	
		var whichEl = (dd_ns4) ? document.layers[showEl] : document.all[showEl].style;
	}
	whichAnchor = showEl + "A";

	if (dd_ie4) {
		if (document.all[whichAnchor]){ 
			cmTop = findy(document.all[whichAnchor]) + 20;
			cmLeft = findx(document.all[whichAnchor]) - 20;
		}
	}
	if (dd_ns4) {
		if (document.anchors[whichAnchor]) {
			cmTop = document.anchors[whichAnchor].y + 20;
			cmLeft = document.anchors[whichAnchor].x - 20;
		}
	}
	if (dd_dom){
		if (document.anchors[whichAnchor]){
			var myObject = document.anchors[whichAnchor];
			while (myObject.offsetParent) {
				cmTop  = cmTop  + myObject.offsetTop;
				cmLeft = cmLeft + myObject.offsetLeft;
				myObject = myObject.offsetParent
			}
		}
	}
	if(showEl == 'gnddcbs') {
		cmTop  -= 25;
		cmLeft += 25;
		if (dd_dom) {
			cmTop  = -20;
			cmLeft -= 20;
		}
	}
	if (dd_dom) {
		whichEl.style.visibility = "visible";
		whichEl.style.top = cmTop + 20;
		if (showEl != 'gnddmore' && showEl != 'gnddfantasy' && showEl != 'gnddcycling' && showEl != 'gnddcbs') {
			if (cmLeft > 370) cmLeft = 370;
			}
		else if (showEl=='gnddfantasy') cmLeft=425;
		whichEl.style.left = cmLeft;
		}
	else {	
		whichEl.visibility = "visible";
		whichEl.top = cmTop;
		if (showEl != 'gnddmore' && showEl != 'gnddfantasy' && showEl != 'gnddcycling' && showEl != 'gnddcbs') {
			if (cmLeft > 370) cmLeft = 370;
			}
		else if (showEl=='gnddfantasy') cmLeft=425;
		whichEl.left = cmLeft;
		} 	
	cmTop = 0; cmLeft = 0;
	}

function findy(item) {
	if (item.offsetParent) {return item.offsetTop + findy(item.offsetParent);}
	else {return item.offsetTop;}
}

function findx(item) {
	if (item.offsetParent) {return item.offsetLeft + findx(item.offsetParent);}
	else {return item.offsetLeft;}
}

function HideAllLayers() {
	if (dd_dom) {
		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";
		}
	}	
	if (dd_ie4) {
		var divTemp = document.all.tags("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";
		}
	}
	if (dd_ns4) {
		for (i = 0; i < document.layers.length; i++) { 
			var divString = new String(document.layers[i].name);
			if (divString.indexOf('gndd') != -1) document.layers[i].visibility = "hidden";
		}
	}
}

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

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

