<!-- 
// (c) 2001-2004 Live365, Inc.  All rights reserved.

// Data related to genres

var cGenreName	= 0;
var cGenreID	= 1;
var cGenreAd	= 2;
var cGenreCt	= 3;

var gSpecialGenres = 6 + 1;

//
// Complete set of genres that appear in drop-down list
//
var gGenreData = new Array(
// START META_GENRES
"All Broadcasts",	"All",	"other",
"My Presets",	"Presets",	"other",
"Recommendations",	"Recommendations",	"other",
"Editor's Picks",	"ESP",	"other",
"Indy/Official",	"Indy%2FOfficial",	"other",
"Professional",	"Pro",	"other",
	"----------------------",	"All",							"other",
// END META_GENRES
//	Genre Name					Genre ID						Ad Category
//	------------------------	-------------------------------	----------------
// START GENRE LIST
"Alternative",	"alternative",	"alternative",
"Americana",	"americana",	"americana",
"- Bluegrass",	"bluegrass",	"americana",
"- Blues",	"blues",	"americana",
"- Country",	"country",	"americana",
"- Folk",	"folk",	"americana",
"- Western",	"western",	"americana",
"Christian",	"christian",	"religious",
"Classical",	"classical",	"classical",
"College",	"college",	"rock",
"Comedy",	"comedy",	"comedy",
"Community",	"community",	"other",
"Dance",	"dance",	"pop",
"Easy Listening",	"easy%20listening",	"easy",
"Electronica/Dance",	"electronica",	"electronic",
"- Ambient",	"ambient",	"electronic",
"- Breakbeat",	"breakbeat",	"electronic",
"- Downtempo",	"downtempo",	"electronic",
"- Drum 'n' Bass",	"drum%26bass",	"electronic",
"- Dub",	"dub",	"electronic",
"- Electro",	"electro",	"electronic",
"- Experimental",	"experimental",	"electronic",
"- Hard House",	"hard%20house",	"electronic",
"- House",	"house",	"electronic",
"- Industrial",	"industrial",	"electronic",
"- Jungle",	"jungle",	"electronic",
"- Techno",	"techno",	"electronic",
"- Trance",	"trance",	"electronic",
"- UK Garage/2-Step",	"uk%20garage",	"electronic",
"Freeform",	"freeform",	"other",
"Funk",	"funk",	"hiphop",
"Goth",	"goth",	"alternative",
"Government",	"government",	"talk",
"Hip-Hop",	"hip%2dhop",	"hiphop",
"Holiday",	"holiday",	"pop",
"International",	"international",	"world",
"- African",	"african",	"world",
"- Asian",	"asian",	"pop",
"- Indian",	"indian",	"world",
"- Irish",	"irish",	"world",
"- Latin",	"latin",	"latin",
"- Middle Eastern",	"middle%20eastern",	"world",
"- World",	"world",	"world",
"Jazz",	"jazz",	"jazz",
"- Smooth Jazz",	"smooth%20jazz",	"easy",
"- Swing",	"swing",	"jazz",
"Music To ... To",	"music%20to%20%2e%2e%2e%20to",	"other",
"New Age",	"new%20age",	"easy",
"Oldies",	"oldies",	"pop",
"- Old Time Radio",	"old%20time%20radio",	"talk",
"- 50s",	"50s",	"pop",
"- 60s",	"60s",	"pop",
"- 70s",	"70s",	"pop",
"- 80s",	"80s",	"pop",
"- 90s",	"90s",	"pop",
"Pop",	"pop",	"pop",
"R&B",	"r%26b",	"jazz",
"Rap",	"rap",	"hiphop",
"Reality",	"reality",	"other",
"Reggae",	"reggae",	"world",
"Religious",	"religious",	"religious",
"Rock",	"rock",	"rock",
"- Classic Rock",	"classic%20rock",	"rock",
"- Extreme Metal",	"extreme%20metal",	"rock",
"- Hard Rock",	"hard%20rock",	"rock",
"- Indie Rock",	"indie%20rock",	"rock",
"- Metal",	"metal",	"rock",
"- Punk",	"punk",	"rock",
"Soundtracks",	"soundtracks",	"pop",
"Spoken Word",	"spoken%20word",	"talk",
"Sports",	"sports",	"talk",
"Talk",	"talk",	"talk",
"Valentine",	"valentine",	"pop",
"Various",	"various",	"other",
"Other",	"other",	"other"
// END GENRE LIST
);


function GetGenreData(index, which)
{
	if (GetGenreData.arguments.length < 2)
		which = 0;

	if (index < 0 || index >= gGenreData.length/cGenreCt)
		index = 0;

	return gGenreData[(cGenreCt*index)+which];
}


function GetGenreName(index)
{
	return GetGenreData(index, cGenreName);
}


function GetGenreID(index)
{
	return GetGenreData(index, cGenreID);
}


function GetGenreAd(index)
{
	return GetGenreData(index, cGenreAd);
}


function DrawNamedGenreSelections(boxName, prompt1, action, current, showSpecials, tabIndex)
{
	var i;
	var cur;
	var extra = "";
	
	if (!boxName)
		boxName = "MainCategoryBox";

	if (!prompt1)
		prompt1 = "-- Pick a genre --";

	if (action)
		extra += ' onchange="' + action + '()"';

	if (tabIndex)
		extra += ' tabindex=' + tabIndex;

	if (!current)
		current = "All";
	
	cur = GetGenreIndex(current);

	document.writeln('<SELECT NAME=' + boxName + extra + ' class="searchinput">');
	document.writeln('<OPTION VALUE="" class="searchinput">' + prompt1);

	for (i = (showSpecials) ? 0 : gSpecialGenres; i < gGenreData.length/cGenreCt; i++) {
		if (i == cur)
			extra = " SELECTED";
		else
			extra = "";

		document.writeln('<OPTION VALUE="' + unescape(gGenreData[(i*cGenreCt)+cGenreID]) + '"' + extra + '>' + gGenreData[(i*cGenreCt)+cGenreName]);
	}

	document.writeln('</SELECT>');
}


function CleanUpGenreString(genre)
{
	genre = genre.replace(/^\s+/g, "");
	genre = genre.replace(/\s+$/g, "");
	genre = genre.replace(/[ ]/g, "%20");
	genre = genre.replace(/[\-]/g, "%2d");
	genre = genre.replace(/[\[]/g, "%5b");
	genre = genre.replace(/[\]]/g, "%5d");
	genre = genre.replace(/[\.]/g, "%2e");
	genre = genre.replace(/[\&]/g, "%26");
    genre = genre.replace(/[\/]/g, "%2f");
	
	return genre;
}


function GetGenreIndex(genre)
{
	var i;
    
	if (!isNaN(genre))
		return genre;
		
	genre = CleanUpGenreString(genre);

	for (i = 0; i < gGenreData.length/cGenreCt; i++) {
		if (i == gSpecialGenres)
			genre = genre.toLowerCase();

		if (genre == gGenreData[(i*cGenreCt)+cGenreID])
			return i;
	}

	return -1;
}


function GetGenreNameFromId(id)
{
	var i;
	var name;
    var tag = id;

    if (id == "")
		tag = "All";

	tag = CleanUpGenreString(tag);

	for (i = 0; i < gGenreData.length/cGenreCt; i++) {
		if (i == gSpecialGenres)
			tag = tag.toLowerCase();

		if (tag == gGenreData[(i*cGenreCt)+cGenreID]) {
			name = gGenreData[(i*cGenreCt)+cGenreName];
			name = name.replace(/\- /, '');
			return name;
		}
	}

	return "Search Results";
}


// -->
