CategoryNames	= new Array("Introduction","Special Occasions","Rendezvous with Friends","Romantic Getaway","Power Lunch","Bar Scene","Early Morning\\Late Night","Restaurant Matrix","Index","Restaurant Map");
CategoryHREFs	= new Array("introduction.html","special_occasions.html","rendezvous_with_friends.html","romantic_getaway.html","power_lunch.html","bar_scene.html","early_morning_late_night.html","restaurant_matrix.html","restaurant_index.html","map_manhattan.html");

Restaurants	= new Array();
Restaurants[0]	= new Array("Master Survey","New York Timeline");
Restaurants[1]	= new Array("The River Café","Per Se","Osteria del Circo","Remi","Oceana","Daniel","Daniel - the Lounge","Avra","English is Italian","Nice Matin","Onera");
Restaurants[2]	= new Array("Serafina Fabulous Grill","Circus","Paper Moon Milano","Spanky's BBQ","Molyvos","Frederick's Madison","Café Boulud","Rue 57","Piola","Abboccato","Marseille","Butter");
Restaurants[3]	= new Array("Chanterelle","David Burke & Donatella","Novita","The Water Club","Teodora","Geisha","Bouterin","Le Monde","Le Colonial","Beppe","La Goulue","Sushi Samba Park");
Restaurants[4]	= new Array("The Four Seasons","Bice","Town","DB Bistro Moderne","Le Bernardin","Aureole New York","Ben Benson's Steakhouse","Orsay");
Restaurants[5]	= new Array("Highline","The Stanton Social","Frederick's Lounge","Olives New York","Tao","Heartland Brewery","Django","Maison","Butai","Opia","Sushi Samba 7","Sugarcane");
Restaurants[6]	= new Array("Pershing Square","Terramare Café","L'Express","Link","French Roast Uptown","French Roast Downtown","Pigalle");
Restaurants[7]	= new Array();
Restaurants[8]	= new Array();
Restaurants[9]	= new Array();
Restaurants[10]	= new Array();
Restaurants[11]	= new Array();

RestTypes	= new Array();
RestTypes[0]	= new Array();
RestTypes[1]	= new Array("Modern American","Modern American","Northern Italian","Italian","Seafood","French","French","Greek - Fish & Seafood","Mediterranean Italian","French Mediterranean","Greek American");
RestTypes[2]	= new Array("Northern Italian Grill","Modern Brazilian","Milanese-Italian","American BBQ South West","Greek","Mediterranean","French International","French & Japanese","Italian","Italian","French Marsille","Modern American");
RestTypes[3]	= new Array("French","Modern American","Northern Italian","Modern American","Northern Italian","Japanese French","French Provancal","French Bistro Loire Valley","Asian Vietnamese","Italian Tuscan","French Bistro","Japanese S. American");
RestTypes[4]	= new Array("Modern American","Northern Italian Milanese","Modern American","Contemporary French Bistro","French","Modern American","American","French Bistro");
RestTypes[5]	= new Array("Thai","Modern American","Pan-Asian","Mediterranean","Asian","American","French Mediterranean","French Bistro Bretagne","Japanese Grill","French Mediterranean","Japanese S. American","Japanese S. American");
RestTypes[6]	= new Array("American","Italian Café","French Bistro Lyonnaise","Mediterranean","French Bistro Parisian","French Bistro Parisian","French Bistro Southwest-France");
RestTypes[7]	= new Array();
RestTypes[8]	= new Array();
RestTypes[9]	= new Array();
RestTypes[10]	= new Array();
RestTypes[11]	= new Array();

RestClasses	= new Array();
RestClasses[0]	= new Array();
RestClasses[1]	= new Array("Gourmet","Gourmet","Casual","Gourmet","Gourmet","Gourmet","Gourmet","Gourmet","Casual","Casual","Casual");
RestClasses[2]	= new Array("Casual","Gourmet","Casual","Comfort","Gourmet","Casual","Gourmet","Casual","Comfort","Casual","Casual","Casual");
RestClasses[3]	= new Array("Gourmet","Gourmet","Casual","Gourmet","Casual","Gourmet","Casual","Casual","Casual","Casual","Casual","Casual");
RestClasses[4]	= new Array("Gourmet","Casual","Gourmet","Gourmet","Gourmet","Gourmet","Casual","Casual");
RestClasses[5]	= new Array("Casual","Casual","Casual","Gourmet","Casual","Casual","Gourmet","Casual","Casual","Gourmet","Casual","Casual");
RestClasses[6]	= new Array("Casual","Comfort","Casual","Comfort","Casual","Casual","Casual");
RestClasses[7]	= new Array();
RestClasses[8]	= new Array();
RestClasses[9]	= new Array();
RestClasses[10]	= new Array();
RestClasses[11]	= new Array();

RestScores	= new Array();
RestScores[0]	= new Array();
RestScores[1]	= new Array("3","5","5","1","4","5","4","1","4","5","5");
RestScores[2]	= new Array("4","1","4","5","2","5","3","3","4","5","4","3");
RestScores[3]	= new Array("4","4","5","1","4","2","4","3","4","4","5","4");
RestScores[4]	= new Array("5","5","3","2","5","3","5","5");
RestScores[5]	= new Array("3","4","4","2","4","2","1","2","1","1","3","3");
RestScores[6]	= new Array("3","5","3","3","1","1","3");
RestScores[7]	= new Array();
RestScores[8]	= new Array();
RestScores[9]	= new Array();
RestScores[10]	= new Array();
RestScores[11]	= new Array();

RestHREFs	= new Array();
RestHREFs[0]	= new Array("master_survey.html","timeline_new_york.html");
RestHREFs[1]	= new Array("the_river_cafe.html","per_se.html","osteria_del_circo.html","remi.html","oceana.html","daniel.html","daniel_lounge.html","avra.html","english_is_italian.html","nice_matin.html","onera.html");
RestHREFs[2]	= new Array("serafina_fabulous_grill.html","circus.html","paper_moon_milano.html","spankys_bbq.html","molyvos.html","fredericks_madison.html","cafe_boulud.html","rue_57.html","piola.html","abboccato.html","marseille.html","butter.html");
RestHREFs[3]	= new Array("chanterelle.html","david_burke_donatella.html","novita.html","the_water_club.html","teodora.html","geisha.html","bouterin.html","le_monde.html","le_colonial.html","beppe.html","la_goulue.html","sushi_samba_park.html");
RestHREFs[4]	= new Array("the_four_seasons.html","bice.html","town.html","db_bistro_moderne.html","le_bernardin.html","aureole_new_york.html","ben_bensons_steakhouse.html","orsay.html");
RestHREFs[5]	= new Array("highline.html","the_stanton_social.html","fredericks_lounge.html","olives_new_york.html","tao.html","heartland_brewery.html","django.html","maison.html","butai.html","opia.html","sushi_samba_7.html","sugarcane.html");
RestHREFs[6]	= new Array("pershing_square.html","terramare_cafe.html","lexpress.html","link.html","french_roast_uptown.html","french_roast_downtown.html","pigalle.html");
RestHREFs[7]	= new Array();
RestHREFs[8]	= new Array();
RestHREFs[9]	= new Array();
RestHREFs[10]	= new Array();
RestHREFs[11]	= new Array();


function display_cat_menu(SelectedCat,SelectedRest)
	{
		hide = 0;
		if (SelectedCat != 0) {SelectedCat -= 1;} else {hide = 1;}
		SelectedRest -= 1;
		cat_bg_color1	= '#540000';
		cat_bg_color2	= '#996666';
		bg_color1	= '#995736';
		bg_color2	= '#BF6C43';
		for (j = 0; j < CategoryNames.length; j++)
			{
				CategoryName	= CategoryNames[j].toUpperCase();
				CategoryHREF	= CategoryHREFs[j];
				if (CategoryName == 'RENDEZVOUS WITH FRIENDS') {CategoryName = 'RENDEZVOUS WITH<br><span style="padding-left: 12px">FRIENDS</span>';}
				if (CategoryName == 'EARLY MORNING\\LATE NIGHT') {CategoryName = 'EARLY MORNING LATE<br><span style="padding-left: 12px">NIGHT</span>';}
				td_Cat_off	= '<tr><td class="navMenu && hand" onMouseOver="this.style.backgroundColor=\''+cat_bg_color2+'\'; window.status=\'http://'+location.host+CategoryHREF+'\'" onMouseOut="this.style.backgroundColor=\''+cat_bg_color1+'\'; window.status=\'\'" onClick="location.href=\''+CategoryHREF+'\'"><span class="navDeco">-</span> '+CategoryName+'</td></tr>';
				td_Cat_on	= '<tr><td class="navMenu && hand" style="background-color: '+cat_bg_color2+'" onClick="location.href=\''+CategoryHREF+'\'"><span class="navDeco">•</span> '+CategoryName+'</td></tr>';
				if (j != SelectedCat)
					{document.write(td_Cat_off);}
					else
					{
						if (hide == 1)
							{document.write(td_Cat_off);}
							else
							{
								document.write(td_Cat_on);
								for (i = 0; i < Restaurants[SelectedCat].length; i++)
									{
										RestName	= Restaurants[SelectedCat][i].toUpperCase();
										if (RestName == 'SERAFINA FABULOUS GRILL') {RestName = 'SERAFINA FABULOUS<br><span style="padding-left: 12px">GRILL</span>';}
										if (RestName == 'DAVID BURKE & DONATELLA') {RestName = 'DAVID BURKE &<br><span style="padding-left: 12px">DONATELLA</span>';}
										if (RestName == 'BEN BENSON\'S STEAKHOUSE') {RestName = 'BEN BENSON\'S<br><span style="padding-left: 12px">STEAKHOUSE</span>';}
										if (RestName == 'FRENCH ROAST DOWNTOWN') {RestName = 'FRENCH ROAST<br><span style="padding-left: 12px">DOWNTOWN</span>';}
										if (RestName == 'FRENCH ROAST UPTOWN') {RestName = 'FRENCH ROAST<br><span style="padding-left: 12px">UPTOWN</span>';}
										RestHREF	= RestHREFs[SelectedCat][i];
										td_RestName_off	= '<tr><td class="navMenu_cat1 && hand" onMouseOver="this.style.backgroundColor=\''+bg_color2+'\'; window.status=\'http://'+location.host+RestHREF+'\'" onMouseOut="this.style.backgroundColor=\''+bg_color1+'\'; window.status=\'\'" onClick="location.href=\''+RestHREF+'\'"><span class="navDeco">-</span> '+RestName+'</td></tr>';
										td_RestName_on	= '<tr><td class="navMenu_cat1" style="background-color: '+bg_color2+'"><span class="navDeco">•</span> '+RestName+'</td></tr>';
										if (i != SelectedRest) {document.write(td_RestName_off);} else {document.write(td_RestName_on);}
									}
							}
					}
			}
	}


function display_cat_rest(CatNum)
	{
		CatNum -= 1;
		table_open	= '<table border="0" cellpadding="0" cellspacing="0">';
		table_close	= '</table>';
		row_color1	= '#8F856B'; // Grey: 1A1A1A // Orange: CC8329 Pink: D92B74 // D98B2B
		row_color2	= '#A89D7E'; // Grey: 404040 // Orange: E5932E Pink: E55C95
		row_color3	= '#1A1A1A'; //999999

		document.write(table_open);
		for (i = 0; i < Restaurants[CatNum].length; i++)
			{
				RestName	= Restaurants[CatNum][i];
				RestType	= RestTypes[CatNum][i];
				RestClass	= RestClasses[CatNum][i];
				RestScore	= RestScores[CatNum][i];
				RestHREF	= RestHREFs[CatNum][i];
				td_RestName	= '<td width="185" class="restList" style="padding-left: 10px">'+RestName+'</td>';
				td_RestType	= '<td width="195" class="restList">'+RestType+'</td>';
				td_RestClass	= '<td width="70" class="restList">'+RestClass+'</td>';
				DisplayScore(RestClass,'png',RestScore);
				td_RestScore	= '<td width="115" style="padding-right: 5px">'+Output+'</td>';
				if ((i % 2) != 0) {color = row_color2;} else {color = row_color1;}
				document.write('<tr class="hand" style="background-color: '+color+'" onMouseOver="this.style.backgroundColor=\''+row_color3+'\'; window.status=\'http://'+location.host+RestHREF+'\'"  onMouseOut="this.style.backgroundColor=\''+color+'\'; window.status=\'\'" onClick="location.href=\''+RestHREF+'\'">');
				document.write(td_RestName);
				document.write(td_RestType);
				document.write(td_RestClass);
				document.write(td_RestScore);
				document.write('</tr>');
				document.write('<tr><td colspan="4" height="1"></td></tr>');
			}
		document.write(table_close);

	}


function DisplayScore(RestClass,imgType,RestScore)
	{
		RatingIcon =	RestClass.toLowerCase();
		if (imgType == 'png') {RatingIcon += '_clear'; StylePNG = ' style="behavior: url(\'../styles/pngbehavior.htc\');"';}
		IconBox =	'<td width="22" height="20" align="right"><img src="../images/icon_'+RatingIcon+'.'+imgType+'" width="17" height="17" border="0"'+StylePNG+'></td>';
		EmptyBox =	'<td width="22" height="20" align="right"><img src="../images/icon_dot_clear.png" width="17" height="17" border="0"'+StylePNG+'></td>';
		LastBox =	'<td width="5" height="20"></td>';
		FullBoxes =	'';
		EmptyBoxes =	'';

		if (RestScore > 0) {for (j = 1; j <= RestScore; j++) {FullBoxes += IconBox;}}
		if ((5 - RestScore) > 0 ) {for (j = 1; j <= (5 - RestScore); j++) {EmptyBoxes += EmptyBox;}}

		Output = '<table border="0" cellpadding="0" cellspacing="0"><tr>' + FullBoxes + EmptyBoxes + LastBox + '</tr></table>';
	}


function master(Cat,Rest)
	{
		Cat	-= 1;
		Rest	-= 1;
		Layout 	= new Array();
		RestType	= RestTypes[Cat][Rest];
		RestClass	= RestClasses[Cat][Rest];
		RestScore	= RestScores[Cat][Rest];
		Type = RestType.replace(/ /g,'_');
		FixType(Cat,Rest);
		RestIcon =	'<img src="../images/icon_'+Type.toLowerCase()+'.png" width="65" height="47" border="0" alt="'+RestType+'" title="'+RestType+'" style="behavior: url(\'../styles/pngbehavior.htc\');"><div class="ms_rest_type">'+RestType+'</div></td>';
		TitleGourmet	= '<td width="59" class="ms_text" style="padding-left: 5px; padding-right: 5px; border-right: 1px solid #000000; border-top: 1px solid #000000">Gourmet</td>';
		TitleCasual	= '<td width="59" class="ms_text" style="padding-left: 5px; padding-right: 5px; border-right: 1px solid #000000; border-top: 1px solid #000000">Casual</td>';
		TitleComfort	= '<td width="59" class="ms_text" style="padding-left: 5px; padding-right: 5px; border-right: 1px solid #000000; border-top: 1px solid #000000">Comfort</td>';
		Transparent	= '<img src="../images/transparent.gif" width="1" height="1" border="0" alt="">';
		IconBox	= '<td height="20" class="ms_score" style="padding-left: 5px; border-top: 1px solid #000000"><img src="../images/icon_'+RestClass.toLowerCase()+'_clear.png" width="17" height="17" border="0" alt="" style="behavior: url(\'../styles/pngbehavior.htc\');"></td>';
		EmptyBox	= '<td height="20" class="ms_score" style="padding-left: 5px; border-top: 1px solid #000000"><img src="../images/icon_dot_clear.png" width="17" height="17" border="0" alt="" style="behavior: url(\'../styles/pngbehavior.htc\');"></td>';
		LastBox	= '<td width="5" height="20" class="ms_score" style="border-top: 1px solid #000000">'+Transparent+'</td>';
		ClearRow	= '<td colspan="6" height="20" style="border-top: 1px solid #000000">'+Transparent+'</td></tr>';
		FullBoxes	= '';
		EmptyBoxes	= '';

		for (i = 0; i < RestScore; i++) {FullBoxes += IconBox; Boxes = RestScore;}
		Blanks = 5 - Boxes;
		if (Blanks > 0 ) {for (i = 0; i < Blanks; i++) {EmptyBoxes += EmptyBox;}}
		Output = FullBoxes + EmptyBoxes + LastBox + '</tr>';

		switch (RestClass)
			{
				case (RestClass = 'Gourmet'):
					Layout[0] = Output; Layout[1] = ClearRow; Layout[2] = ClearRow;
					break
				case (RestClass = 'Casual'):
					Layout[0] = ClearRow; Layout[1] = Output; Layout[2] = ClearRow;
					break
				case (RestClass = 'Comfort'):
					Layout[0] = ClearRow; Layout[1] = ClearRow; Layout[2] = Output;
					break
			}

		document.write('<table border="0" cellpadding="0" cellspacing="0"><tr><td width="100" align="center" valign="top" style="padding-right: 8px">');
		document.write(RestIcon);
		document.write('<td><table border="0" cellpadding="0" cellspacing="0" width="187" style="border-left: 1px solid #000000; border-right: 1px solid #000000; border-bottom: 1px solid #000000"><tr>');
		document.write(TitleGourmet + Layout[0]);
		document.write(TitleCasual + Layout[1]);
		document.write(TitleComfort + Layout[2]);
		document.write('</table></td></tr></table>');
	}


function FixType(Cat,Rest)
	{
		if (Cat == 1 && Rest == 2) {Type = 'Italian';}
		if (Cat == 1 && Rest == 7) {Type = 'Greek';}
		if (Cat == 1 && Rest == 8) {Type = 'Italian';}
		if (Cat == 1 && Rest == 9) {Type = 'Mediterranean';}
		if (Cat == 1 && Rest == 10) {Type = 'Greek';}

		if (Cat == 2 && Rest == 0) {Type = 'Italian';}
		if (Cat == 2 && Rest == 1) {Type = 'Brazilian';}
		if (Cat == 2 && Rest == 2) {Type = 'Italian';}
		if (Cat == 2 && Rest == 3) {Type = 'American';}
		if (Cat == 2 && Rest == 6) {Type = 'French';}
		if (Cat == 2 && Rest == 7) {Type = 'French';}
		if (Cat == 2 && Rest == 10) {Type = 'French';}

		if (Cat == 3 && Rest == 2) {Type = 'Italian';}
		if (Cat == 3 && Rest == 4) {Type = 'Italian';}
		if (Cat == 3 && Rest == 5) {Type = 'Japanese';}
		if (Cat == 3 && Rest == 6) {Type = 'French';}
		if (Cat == 3 && Rest == 7) {Type = 'French';}
		if (Cat == 3 && Rest == 8) {Type = 'Asian';}
		if (Cat == 3 && Rest == 9) {Type = 'Italian';}
		if (Cat == 3 && Rest == 10) {Type = 'French';}
		if (Cat == 3 && Rest == 11) {Type = 'Japanese';}

		if (Cat == 4 && Rest == 1) {Type = 'Italian';}
		if (Cat == 4 && Rest == 3) {Type = 'French';}
		if (Cat == 4 && Rest == 7) {Type = 'French';}

		if (Cat == 5 && Rest == 2) {Type = 'Asian';}
		if (Cat == 5 && Rest == 6) {Type = 'French';}
		if (Cat == 5 && Rest == 7) {Type = 'French';}
		if (Cat == 5 && Rest == 8) {Type = 'Japanese';}
		if (Cat == 5 && Rest == 9) {Type = 'French';}
		if (Cat == 5 && Rest == 10) {Type = 'Japanese';}
		if (Cat == 5 && Rest == 11) {Type = 'Japanese';}

		if (Cat == 6 && Rest == 1) {Type = 'Italian';}
		if (Cat == 6 && Rest == 2) {Type = 'French';}
		if (Cat == 6 && Rest == 4) {Type = 'French';}
		if (Cat == 6 && Rest == 5) {Type = 'French';}
		if (Cat == 6 && Rest == 6) {Type = 'French';}
	}

function PopUp(picname)
	{
		properties="width=780,height=400,top="+(screen.height/2-200)+",left="+(screen.width/2-400);
		ShowPicture=window.open('restaurant_matrix_large.html','Picture',properties);
		ShowPicture.focus();
	}

function alphabet_sort()
	{
		S_index	= 0;
		S_Restaurants	= new Array();
		for (j = 1; j < 7; j++)
			{
				for (i = 0; i < Restaurants[j].length; i++)
					{
						S_Restaurants[S_index] = Restaurants[j][i];
						S_index++;
					}
			}
		S_Restaurants.sort();

		table_open	= '<table border="0" cellpadding="0" cellspacing="0">';
		table_close	= '</table>';
		row_color1	= '#8F856B';
		row_color2	= '#A89D7E';
		row_color3	= '#1A1A1A';

		document.write(table_open);

		for (m = 0; m < S_Restaurants.length; m++)
			{
				RestName	= S_Restaurants[m];
				k = 1;
				while (k <= 6)
					{
						for (i = 0; i < Restaurants[k].length; i++) {if (RestName == Restaurants[k][i]) {R_index = i; R_array = k; k = 6;}}
						k++;
					}
				RestType	= RestTypes[R_array][R_index];
				RestClass	= RestClasses[R_array][R_index];
				RestScore	= RestScores[R_array][R_index];
				RestHREF	= RestHREFs[R_array][R_index]
				RestHREF	= RestHREF.substring(0,RestHREF.lastIndexOf("."));
				td_RestName	= '<td width="185" class="restList" style="padding-left: 10px">'+RestName+'</td>';
				td_RestType	= '<td width="195" class="restList">'+RestType+'</td>';
				td_RestClass	= '<td width="70" class="restList">'+RestClass+'</td>';
				DisplayScore(RestClass,'png',RestScore);
				td_RestScore	= '<td width="115" style="padding-right: 5px">'+Output+'</td>';
				if ((m % 2) != 0) {color = row_color2;} else {color = row_color1;}
				document.write('<tr class="hand" style="background-color: '+color+'" onMouseOver="this.style.backgroundColor=\''+row_color3+'\'"  onMouseOut="this.style.backgroundColor=\''+color+'\'" onClick="location.href=\'?show='+RestHREF+'\'">');
				document.write(td_RestName);
				document.write(td_RestType);
				document.write(td_RestClass);
				document.write(td_RestScore);
				document.write('</tr>');
				document.write('<tr><td colspan="4" height="1"></td></tr>');
			}
		document.write(table_close);
	}

function showBanner()
{
	business	= new Array("heartland_brewery","paper_moon_milano","serafina_fabulous_grill","wine_care_storage");
	pic_index	= Math.floor(Math.random()*business.length);
	pic_name	= '../images/banners/banner_' + business[pic_index] + '.jpg';
	if (pic_index != 3) {pic_href = '?show=' + business[pic_index];} else {pic_href = 'http://www.winecare.com';}
	document.getElementById("banner_pic").src = pic_name;
	document.getElementById("banner_link").href = pic_href;
}
