if(typeof(rdDomain) == "undefined" || rdDomain == null || rdDomain == "") { rdDomain = "http://us.rd.yahoo.com"; }

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 + '">');
		// ------ 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(\'' + rdDomain + '/launch/nav/lc/*' + 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(\'' + rdDomain + '/launch/nav/mv/*' + 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(\'' + rdDomain + '/launch/nav/artist/*' + 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);
}