// menu
if(typeof(part) == "undefined" || part == null || part == "") { part = "http://music.yahoo.com"; }
if(typeof(section) == "undefined" || section == null || section == "") { section = "homeMenu"; }
if(typeof(rdDomain) == "undefined" || rdDomain == null || rdDomain == "") { rdDomain = "http://us.rd.yahoo.com"; }
if(typeof(srv) == "undefined" || srv == null || srv == "") { srv = "http://music.yahoo.com"; }
if(typeof(img_path) == "undefined" || img_path == null || img_path == "") { img_path = "http://us.music1.yimg.com/music.yahoo.com/common/resources/skins/us/"; }
if(typeof(sta) == "undefined" || sta == null || sta == "") { sta = "0"; }
if(typeof(guest) == "undefined" || guest == null || sta == "") { guest = "1"; }
if(typeof(sid) == "undefined" || sid == null || sid == "") { sid = "0"; }
if(typeof(showMenuAndSearch) == "undefined" || showMenuAndSearch == null || showMenuAndSearch == "") { showMenuAndSearch = "1"; }

if (sta == 1) {
	var lc_arr = new Array(
		152,
		'',
		new Array(srv + '/launchcast/stations/default.asp', 'radio station guide','-1'),
		new Array(srv + '/launchcast/play/default.asp', 'play my station','-1'),
		new Array(srv + '/launchcast/station.asp?edit=1', 'edit my station','-1'),
		new Array(srv + '/launchcast/subscription/default.asp', 'LAUNCHcast plus','-1'),
		new Array('http://help.yahoo.com/l/us/yahoo/music/', 'LAUNCHcast help','-1')
	);
} else {
	var lc_arr = new Array(
		152,
		'',
		new Array(srv + '/launchcast/stations/default.asp', 'radio station guide','-1'),
		new Array(srv + '/launchcast/setup.asp', 'customize my station','-1'),
		new Array(srv + '/launchcast/subscription/default.asp', 'LAUNCHcast plus','-1'),
		new Array('http://help.yahoo.com/l/us/yahoo/music/', 'LAUNCHcast help','-1')
	);
}
if (guest == 1) {
	var mv_arr = new Array(
		129,
		'',
		new Array(srv + '/musicvideos/lists/top.asp', 'top 100','-1'),
		new Array(srv + '/premieres', 'video premieres','-1'),
		new Array(srv + '/musicvideos/lists/new.asp', 'new videos','-1'),
		new Array(srv + '/musicvideos/default.asp', 'videos by genre','-1'),
		new Array('http://help.yahoo.com/l/us/yahoo/music/videos/', 'music videos help','-1'),
		new Array(srv + '/promo-39320433', 'Stop! Watch','-1')
	);
} else {
	var mv_arr = new Array(
		129,
		'',
		new Array(srv + '/video/?sx=p/m.xml', 'play my station','-1'),
		new Array(srv + '/musicvideos/myvideos.asp', 'my videos','-1'),
		new Array(srv + '/musicvideos/lists/top.asp', 'top 100','-1'),
		new Array(srv + '/premieres', 'video premieres','-1'),
		new Array(srv + '/musicvideos/lists/new.asp', 'new videos','-1'),
		new Array(srv + '/musicvideos/default.asp', 'videos by genre','-1'),
		new Array('http://help.yahoo.com/l/us/yahoo/music/videos/', 'music videos help','-1'),
		new Array(srv + '/promo-39320433', 'Stop! Watch','-1')
	);
}



var menu_arr = new Array (
	new Array(
		'but_LAUNCHcastRadio-up.gif',
		'but_LAUNCHcastRadio-over.gif',
		'lcMenu',
		lc_arr,
		-1,
		''
	),
	new Array(
		'but_musicVideos-up.gif',
		'but_musicVideos-over.gif',
		'mvMenu',
		mv_arr,
		-1,
		''

	),
	new Array(
		'but_downloads-up.gif',
		'but_downloads-over.gif',
		'audioMenu',
		new Array(
			250,
			'',
			new Array(rdDomain + '/launch/hmpgnav/subnav/ymu/evt=32740/*' + srv + '/unlimited/', 'Y! Music Unlimited', '-1'),
			new Array(rdDomain + '/launch/hmpgnav/subnav/yme/evt=32739/*' + srv + '/musicengine/', 'Free Player', '-1')
		),
		-1,
		''
	),
	new Array(
		'but_artists-up.gif',
		'but_artists-over.gif',
		'readMenu',
		new Array(
			148,
			'',
			new Array(srv + '/lyrics', 'Lyrics','-1'),
			new Array(srv + '/promo-40241836-homepage', 'Get Your Freak On','-1'),
			new Array(srv + '/promo-18684304--smash', 'smash','-1'),
			new Array('http://mf.music.yahoo.com/launch/photos.html', 'photos','-1'),
			new Array(srv + '/read/default.asp', 'news/reviews/interviews','-1'),
			new Array(srv + '/promo-29644410', 'who\'s next?','-1'),
			new Array(srv + '/promo-31904706', 'Live Sets','-1'),
			new Array(rdDomain + '/launch/nav/ComboOptIn/Newsletters/evt=34477/*' + srv + '/musicengine/optin/', 'newsletters','-1'),
			new Array(srv + '/promos/thenandnow/', 'Then &amp; Now','-1')
		),
		-1,
		''
	)
);

/*

			new Array('http://mobile.yahoo.com/ringtones', 'ringtones', '-1'), // remove per h bug 850793

			new Array(srv + '/live/default.asp', 'live @ Yahoo! Music','-1'),

			new Array(srv + '/promos/top10downloads/', 'Top 10 Downloads', '-1'),
			new Array(rdDomain + '/launch/hmpgnav/subnav/*http://music.yahoo.com/jessicaforyou/', 'MP3 Downloads', '-1'),
			new Array(rdDomain + '/launch/hmpgnav/subnav/*http://music.yahoo.com/jessicaforyou/', 'Jessica Simpson Personalized MP3', '-1')
			//new Array(srv + '/musicengine/downloads/', 'Song Downloads', '-1'),
			//new Array(srv + '/unlimited/', 'Yahoo! Music Unlimited', '-1')
*/
function ln(url) {
	if (url != '') {
		if (url.indexOf(srv) == -1 && url.indexOf('mf.music') == -1 && url.indexOf('help.yahoo') == -1) {
			window.open(url);
		} else {
			document.location = url;
		}
	}
}

// header

for (i=0;i<menu_arr.length;i++) {
	eval('var ' + menu_arr[i][2] + 'off = new Image();');
	eval('var ' + menu_arr[i][2] + 'on = new Image();');
	eval(menu_arr[i][2] + 'off.src = "' + img_path + menu_arr[i][0] + '";');
	eval(menu_arr[i][2] + 'on.src = "' + img_path + menu_arr[i][1] + '";');
}

var off_timer;

function ol(lyr, idx, parent) {
	clearTimeout(off_timer);

	lyr.style.backgroundColor='#6B6BB7';
	lyr.style.color='#FFFFFF';
	if (idx > -1) {
		cls(idx,menu_arr[idx][4]);
		if (menu_arr[idx][5] == '') {
			menu_arr[idx][5] = lyr;
		}
		var img = eval('document.top_' + idx);
		var img_src = eval(menu_arr[idx][2] + 'on.src');
		if (img.src != img_src) {
			img.src = img_src;
		}
		eval('document.getElementById("sub_' + idx + '").style.visibility = "visible"');
	} else {
		cls(parent,menu_arr[parent][4]);
	}
}

function cl(lyr, idx) {
	if (idx == -1) {
		lyr.style.backgroundColor='#E1E1FF';
		lyr.style.color='#000000';
	}
	off_timer = setTimeout("cls(-1,-1)",500);
}

function cls(o1, o2) {
	for (i=0;i<menu_arr.length;i++) {
		if (i != o1 && i != o2) {
			if (menu_arr[i][5] != '') {
				if (menu_arr[i][4] == -1) {
					if (menu_arr[i][2] != section) {
						menu_arr[i][5].style.backgroundColor = '#000000';
					}
				} else {	
					menu_arr[i][5].style.backgroundColor = '#E1E1FF';
					menu_arr[i][5].style.color='#000000';
				}
			}
			if (menu_arr[i][2] != section) {
				var img = eval('document.top_' + i);
				var img_src = eval(menu_arr[i][2] + 'off.src');
				if (img.src != img_src) {
					img.src = img_src;
				}
			}
			eval('document.getElementById("sub_' + i + '").style.visibility = "hidden"');
		}
	}
}

function menu() {		
	for(j=0;j<menu_arr.length;j++) {

		document.write('<div id="sub_' + j + '" style="z-index: 1000">');
		// ------ Currently not used -------
		if(menu_arr[j][3][1] != '') { document.write('<table cellpadding="0" cellspacing="0" border="0"><tr><td height="' + menu_arr[j][3][1] + '" colspan="1"><spacer type="block" height="' + menu_arr[j][3][1] + '"></td></tr></table>'); }
		// ------ End of Currently not used -------
		document.write('<div id="menu_container">');
		for(i=2;i<menu_arr[j][3].length;i++) {
			document.write('<div class="menu_item" onClick="ln(\'' +  menu_arr[j][3][i][0] + '\');" onMouseover="ol(this,' + menu_arr[j][3][i][2] + ',' + j + ');" onMouseout="cl(this,' + menu_arr[j][3][i][2] + ');">');
			// ------ Currently not used -------
			if (menu_arr[j][3][i][2] != '-1') {	document.write('<table cellpadding="0" cellspacing="0" border="0" height="10" align="right"><tr><td valign="bottom"><img name="top_' + menu_arr[j][3][i][2] + '" src="' + img_path + 'arrow_subNav-up.gif"/></td></tr></table>'); }
			// ------ End of Currently not used -------
			document.write(menu_arr[j][3][i][1] + '</div>');
		}
		document.write('</div></div>');
	}
}

// The search box and menu
function searchAndMenu() {
	if(typeof(showMenuAndSearch) == "undefined" || showMenuAndSearch == "") { showMenuAndSearch = "1"; }
	if(showMenuAndSearch == "1") {
		document.write("<div id=\"searchbox1\">");
		document.write("<form name=\"ArtistSearch\" target=\"_top\" method=\"get\" action=\"http://search.music.yahoo.com/search/\" style=\"display:inline; position:relative; top:5px; padding:3px; margin:0;\">");
		document.write("<select name=\"m\">");
		document.write("<option value=\"all\">All</option>");
		document.write("<option value=\"artist\">Artists</option>");
		document.write("<option value=\"album\">Albums</option>");
		document.write("<option value=\"song\">Songs</option>");
		document.write("<option value=\"video\">Videos</option>");
		document.write("</select><input type=\"text\" name=\"p\" size=\"13\"><input type=\"image\" src=\"" + img_path + "btn_go.gif\" border=\"0\" style=\"position:relative; top:5px;\">");
		document.write("</form>");
		document.write("</div>");
		document.write("<div id=\"searchbox2\"><img src=\"" + img_path + "search_launch.gif\" style=\"line-height:0; font-size:0; margin:0; padding:0;\"/></div>");
		document.write("<div class=\"clearright\"></div>");
		document.write("<div id=\"top_nav\">");
		top_nav();
		document.write("</div>");
	}
}

function top_nav() {
	var sOut =	'' +
				'<div id="nav_0" onClick="ln(\'' + srv + '/launchcast/default.asp\');" onMouseover="ol(this,0);" onMouseout="cl(this,0);" style="background-color:#';
	if (section == 'lcMenu') {
		sOut += '6B6BB7';
	} else {
		sOut += '000000';
	}
	sOut +=		';"><img name="top_0" src="' + img_path;
	if (section == 'lcMenu') {
		sOut += menu_arr[0][1];
	} else {
		sOut += menu_arr[0][0];
	}
	sOut += 	'"></div>' +
			'<div id="nav_1" onClick="ln(\'' + srv + '/musicvideos/default.asp\');" onMouseover="ol(this,1);" onMouseout="cl(this,1);" style="background-color:#';
	if (section == 'mvMenu') {
		sOut += '6B6BB7';
	} else {
		sOut += '000000';
	}
	sOut +=		';"><img name="top_1" src="' + img_path;
	if (section == 'mvMenu') {
		sOut += menu_arr[1][1];
	} else {
		sOut += menu_arr[1][0];
		
	}
	sOut += 	'"></div>' +
			'<div id="nav_2" onClick="ln(\'' + rdDomain + '/launch/hmpgnav/mainnav/downloads/evt=30749/*' + srv + '/unlimited/\');" onMouseover="ol(this,2);" onMouseout="cl(this,2);" style="background-color:#';
	if (section == 'audioMenu') {
		sOut += '6B6BB7';
	} else {
		sOut += '000000';
	}
	sOut +=		';"><img name="top_2" src="' + img_path;
	if (section == 'audioMenu') {
		sOut += menu_arr[2][1];
	} else {
		sOut += menu_arr[2][0];
	}
	sOut += 	'"></div>' +
			'<div id="nav_3" onClick="ln(\'' + srv + '/artist/default.asp\');" onMouseover="ol(this,3);" onMouseout="cl(this,3);" style="background-color:#';
	if (section == 'readMenu') {
		sOut += '6B6BB7';
	} else {
		sOut += '000000';
	}
	sOut +=		';"><img name="top_3" src="' + img_path;
	if (section == 'readMenu') {
		sOut += menu_arr[3][1];
	} else {
		sOut += menu_arr[3][0];
	}
	sOut += '"></div>';
	document.write(sOut);
}