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

// Data related to genres

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

var gSpecialGenres = 7;

//
// 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",
	"Editor's Picks",			"ESP",							"other",
	"Live Stations",			"Live",							"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",
	"Asian",					"asian",						"pop",
	"Blues",					"blues",						"blues",
	"Christian",				"christian",					"religious",
	"Classical",				"classical",					"classical", 
	"Classic Rock",				"classic%20rock",				"rock",
	"College",					"college",						"rock",
	"Comedy",					"comedy",						"comedy",
	"Country",					"country",						"country",
	"Dance",					"dance",						"pop",
	"Dub",						"dub",							"electronic",
	"Easy Listening",			"easy%20listening",				"pop",
	"Electronica/Dance",		"electronica",					"electronic",
	"- Ambient",				"ambient",						"electronic",
	"- Breakbeat",				"breakbeat",					"electronic",
	"- Downtempo",				"downtempo",					"electronic",
	"- Drum 'n' Bass",			"drum%26bass",					"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", 
	"Folk",						"folk",							"rock",
	"Funk",						"funk",							"hiphop",
	"Goth",						"goth",							"alternative",
	"Government",				"government",					"talk",
	"Hip-Hop",					"hip%2dhop",					"hiphop",
	"Holiday",					"holiday",						"pop",
	"Indie Rock",				"indie%20rock",					"rock",
	"International",			"international",				"world", 
	"Irish",					"irish",						"world",
	"Jazz",						"jazz",							"jazz", 
	"Latin",					"latin",						"latin",
	"Metal",					"metal",						"rock",
	"Music To ... To",			"music%20to%20%2e%2e%2e%20to",	"other",
	"New Age",					"new%20age",					"jazz",
	"Oldies",					"oldies",						"pop", 
	"Pop",						"pop",							"pop", 
	"Punk",						"punk",							"rock",
	"R&B",						"r%26b",						"jazz",
	"Rap",						"rap",							"hiphop",
	"Reality",					"reality",						"other",
	"Reggae",					"reggae",						"world",
	"Religious",				"religious",					"religious",
	"Rock",						"rock",							"rock", 
	"Soundtracks",				"soundtracks",					"pop", 
	"Spoken Word",				"spoken%20word",				"talk", 
	"Sports",					"sports",						"talk", 
	"Swing",					"swing",						"jazz",
	"Talk",						"talk",							"talk", 
	"Valentine",				"valentine",					"pop",
	"Various",					"various",						"other",
	"Western",					"western",						"country",
	"World",					"world",						"world", 
	"50s",						"50s",							"pop",
	"60s",						"60s",							"pop",
	"70s",						"70s",							"pop",
	"80s",						"80s",							"pop",
	"90s",						"90s",							"pop",
	"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="' + 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";
}


// -->
