// constants

var gHtml		= "";

var gValueSize		= 6;
var gBlockSize		= 4;

// variables

var gSkinType		= null;
var gShowSize		= null;
var gShowType		= new Array(false, false, false, false, false, false);

// skins

var gSkinLight		= new Object();

gSkinLight.name		= "Light mode",

gSkinLight.Blue		= "#0000EE";
gSkinLight.Brown	= "#886611";
gSkinLight.Gray		= "#555555";
gSkinLight.Green	= "#009900";
gSkinLight.Indigo	= "#6600FF";
gSkinLight.LiteBlue	= "#66AAFF";
gSkinLight.Olive	= "#779900";
gSkinLight.Pink		= "#FF7777";
gSkinLight.Purple	= "#CC00FF";
gSkinLight.Red		= "#DD0000";
gSkinLight.Yellow	= "#EEAA00";

gSkinLight.back		= "#FFFFFF";
gSkinLight.head1	= "#999999";
gSkinLight.head2	= "#AAAAAA";
gSkinLight.head3	= "#CCCCCC";
gSkinLight.row		= "#EEEEEE";
gSkinLight.text		= "#000000";
gSkinLight.link		= gSkinLight.Blue;

// dark color skin

var gSkinDark		= new Object();

gSkinDark.name		= "Dark mode",

gSkinDark.Blue		= "#0044FF";
gSkinDark.Brown		= "#886611";
gSkinDark.Gray		= "#555555";
gSkinDark.Green		= "#00DD00";
gSkinDark.Indigo	= "#6600FF";
gSkinDark.LiteBlue	= "#66AAFF";
gSkinDark.Olive		= "#779900";
gSkinDark.Pink		= "#FF7777";
gSkinDark.Purple	= "#CC00FF";
gSkinDark.Red		= "#FF0000";
gSkinDark.Yellow	= "#FFDD00";

gSkinDark.back		= "#000000";
gSkinDark.head1		= "#777777";
gSkinDark.head2		= "#555555";
gSkinDark.head3		= "#333333";
gSkinDark.row		= "#111111";
gSkinDark.text		= "#DDDDDD";
gSkinDark.link		= gSkinDark.Red;

// skin & list

var gSkin		= gSkinLight;

var gSkinList = new Array(
	gSkinLight,
	gSkinDark
);

// collected data

var gValues = new Array(
	"Values:",	"1",		"2",		"3",		"4",		"5",	
	"Colors:",	"Red",		"Blue",		"Pink",		"Green",	"Yellow",	
	"Flavors:",	"Spicy",	"Dry",		"Sweet",	"Bitter",	"Sour",		
	"Conditions:",	"Cool",		"Beauty",	"Cute",		"Smart",	"Tough",		
	"Statistics:",	"Attack",	"Sp.Atk",	"Speed",	"Sp.Def",	"Defense"
);

var gBerries = new Array(
	"Cheri",	"Chesto",	"Pecha",	"Rawst",	"Aspear",
	"Leppa",	"Oran",		"Persim",	"Lum",		"Sitrus",
	"Figy",		"Wiki",		"Mago",		"Aguav",	"Iapapa",
	"Razz",		"Bluk",		"Nanab",	"Wepear",	"Pinap",
	"Pomeg",	"Kelpsy",	"Qualot",	"Hondew",	"Grepa",
	"Tamato",	"Cornn",	"Magost",	"Rabuta",	"Nomel",
	"Spelon",	"Pamtre",	"Watmel",	"Durin",	"Belue",
	"Liechi",	"Ganlon",	"Salac",	"Petaya",	"Apicot",
	"Lansat",	"Starf",	"Enigma"
);

var gBlocks2 = new Array(
//	Pokéblocks	Conditions	Level		Firm
	"Red",		"1",		"12",		"23",	// 00 Cheri
	"Blue",		"2",		"12",		"23",	// 01 Chesto
	"Pink",		"3",		"12",		"23",	// 02 Pecha
	"Green",	"4",		"12",		"23",	// 03 Rawst
	"Yellow",	"5",		"12",		"23",	// 04 Aspear
	"Red",		"1",		"23",		"20",	// 05 Leppa
	"Blue",		"2",		"12",		"20",	// 06 Oran
	"Pink",		"3",		"12",		"20",	// 07 Persim
	"Green",	"4",		"12",		"20",	// 08 Lum
	"Yellow",	"5",		"12",		"20",	// 09 Sitrus
	"Red",		"1",		"23",		"23",	// 10 Figy
	"-",		"-",		"-",		"-",	// 11 Wiki
	"-",		"-",		"-",		"-",	// 12 Mago
	"-",		"-",		"-",		"-",	// 13 Aguav
	"Yellow",	"5",		"23",		"23",	// 14 Iapapa
	"Purple",	"1/2",		"12",		"20",	// 15 Razz
	"Indigo",	"2/3",		"12",		"20",	// 16 Bluk
	"Brown",	"3/4",		"12",		"20",	// 17 Nanab
	"LiteBlue",	"4/5",		"12",		"20",	// 18 Wepear
	"Purple",	"1/5",		"12",		"20",	// 19 Pinap
	"Purple",	"1/4",		"23",		"20",	// 20 Pomeg
	"Indigo",	"2/5",		"23",		"20",	// 21 Kelpsy
	"Brown",	"1/3",		"23",		"20",	// 22 Qualot
	"-",		"-",		"-",		"-",	// 23 Hondew
	"Olive",	"3/5",		"23",		"20",	// 24 Grepa
	"-",		"-",		"-",		"-",	// 25 Tamato
	"Indigo",	"2/3",		"25",		"25",	// 26 Cornn
	"Brown",	"3/4",		"25",		"25",	// 27 Magost
	"LiteBlue",	"4/5",		"25",		"25",	// 28 Rabuta
	"-",		"-",		"-",		"-",	// 29 Nomel
	"-",		"-",		"-",		"-",	// 30 Spelon
	"-",		"-",		"-",		"-",	// 31 Pamtre
	"-",		"-",		"-",		"-",	// 32 Watmel
	"-",		"-",		"-",		"-",	// 33 Durin
	"-",		"-",		"-",		"-",	// 34 Belue
	"-",		"-",		"-",		"-",	// 35 Liechi
	"-",		"-",		"-",		"-",	// 36 Ganlon
	"-",		"-",		"-",		"-",	// 37 Salac
	"-",		"-",		"-",		"-",	// 38 Petaya
	"-",		"-",		"-",		"-",	// 39 Apicot
	"-",		"-",		"-",		"-",	// 40 Lansat
	"-",		"-",		"-",		"-",	// 41 Starf
	"-",		"-",		"-",		"-"	// 42 Enigma
);                                                           	

var gBlocks3 = new Array(                                       	
//	Pokéblocks	Conditions	Level		Firm 	
	"Red",		"1",		"12",		"22",	// 00 Cheri
	"Blue",		"2",		"12",		"22",	// 01 Chesto
	"Pink",		"3",		"12",		"22",	// 02 Pecha
	"Green",	"4",		"12",		"22",	// 03 Rawst
	"Yellow",	"5",		"12",		"22",	// 04 Aspear
	"Purple",	"1/3",		"23",		"20",	// 05 Leppa
	"Indigo",	"2/4",		"10",		"20",	// 06 Oran
	"Brown",	"3/5",		"10",		"20",	// 07 Persim
	"Purple",	"1/4",		"10",		"20",	// 08 Lum
	"Indigo",	"2/5",		"10",		"20",	// 09 Sitrus
	"Purple",	"1/3",		"23",		"22",	// 10 Figy
	"-",		"-",		"-",		"-",	// 11 Wiki
	"-",		"-",		"-",		"-",	// 12 Mago
	"-",		"-",		"-",		"-",	// 13 Aguav
	"Olive",	"2/5",		"23",		"22",	// 14 Iapapa
	"Purple",	"1/3",		"12",		"20",	// 15 Razz
	"Indigo",	"2/4",		"12",		"20",	// 16 Bluk
	"Brown",	"3/5",		"12",		"20",	// 17 Nanab
	"Purple",	"1/4",		"12",		"20",	// 18 Wepear
	"Indigo",	"2/5",		"12",		"20",	// 19 Pinap
	"Gray",		"1/3/4",	"23",		"20",	// 20 Pomeg
	"Gray",		"2/4/5",	"23",		"20",	// 21 Kelpsy
	"Gray",		"1/3/5",	"23",		"20",	// 22 Qualot
	"-",		"-",		"-",		"-",	// 23 Hondew
	"Gray",		"2/3/5",	"23",		"20",	// 24 Grepa
	"-",		"-",		"-",		"-",	// 25 Tamato
	"Indigo",	"2/4",		"25",		"23",	// 26 Cornn
	"Brown",	"3/5",		"25",		"23",	// 27 Magost
	"LiteBlue",	"1/4",		"25",		"23",	// 28 Rabuta
	"-",		"-",		"-",		"-",	// 29 Nomel
	"-",		"-",		"-",		"-",	// 30 Spelon
	"-",		"-",		"-",		"-",	// 31 Pamtre
	"-",		"-",		"-",		"-",	// 32 Watmel
	"-",		"-",		"-",		"-",	// 33 Durin
	"-",		"-",		"-",		"-",	// 34 Belue
	"-",		"-",		"-",		"-",	// 35 Liechi
	"-",		"-",		"-",		"-",	// 36 Ganlon
	"-",		"-",		"-",		"-",	// 37 Salac
	"-",		"-",		"-",		"-",	// 38 Petaya
	"-",		"-",		"-",		"-",	// 39 Apicot
	"-",		"-",		"-",		"-",	// 40 Lansat
	"-",		"-",		"-",		"-",	// 41 Starf
	"-",		"-",		"-",		"-"	// 42 Enigma
);

var gBlocks4 = new Array(
//	Pokéblocks	Conditions	Level		Firm
	"Red",		"1",		"12",		"21",	// 00 Cheri
	"Blue",		"2",		"12",		"21",	// 01 Chesto
	"Pink",		"3",		"12",		"21",	// 02 Pecha
	"Green",	"4",		"12",		"21",	// 03 Rawst
	"Yellow",	"5",		"12",		"21",	// 04 Aspear
	"Purple",	"1/4",		"23",		"19",	// 05 Leppa
	"Indigo",	"2/5",		"10",		"19",	// 06 Oran
	"Purple",	"1/3",		"10",		"19",	// 07 Persim
	"Indigo",	"2/4",		"10",		"19",	// 08 Lum
	"Brown",	"3/5",		"10",		"19",	// 09 Sitrus
	"Purple",	"1/4",		"23",		"21",	// 10 Figy
	"-",		"-",		"-",		"-",	// 11 Wiki
	"-",		"-",		"-",		"-",	// 12 Mago
	"-",		"-",		"-",		"-",	// 13 Aguav
	"Olive",	"3/5",		"23",		"21",	// 14 Iapapa
	"Purple",	"1/4",		"12",		"19",	// 15 Razz
	"Indigo",	"2/5",		"12",		"19",	// 16 Bluk
	"Purple",	"1/3",		"12",		"19",	// 17 Nanab
	"Indigo",	"2/4",		"12",		"19",	// 18 Wepear
	"Brown",	"3/5",		"12",		"19",	// 19 Pinap
	"Purple",	"1/4",		"23",		"19",	// 20 Pomeg
	"Indigo",	"2/5",		"23",		"19",	// 21 Kelpsy
	"Purple",	"1/3",		"23",		"19",	// 22 Qualot
	"-",		"-",		"-",		"-",	// 23 Hondew
	"Brown",	"3/5",		"23",		"19",	// 24 Grepa
	"-",		"-",		"-",		"-",	// 25 Tamato
	"Indigo",	"2/5",		"25",		"22",	// 26 Cornn
	"Brown",	"1/3",		"25",		"22",	// 27 Magost
	"LiteBlue",	"2/4",		"25",		"22",	// 28 Rabuta
	"-",		"-",		"-",		"-",	// 29 Nomel
	"-",		"-",		"-",		"-",	// 30 Spelon
	"-",		"-",		"-",		"-",	// 31 Pamtre
	"-",		"-",		"-",		"-",	// 32 Watmel
	"-",		"-",		"-",		"-",	// 33 Durin
	"-",		"-",		"-",		"-",	// 34 Belue
	"-",		"-",		"-",		"-",	// 35 Liechi
	"-",		"-",		"-",		"-",	// 36 Ganlon
	"-",		"-",		"-",		"-",	// 37 Salac
	"-",		"-",		"-",		"-",	// 38 Petaya
	"-",		"-",		"-",		"-",	// 39 Apicot
	"-",		"-",		"-",		"-",	// 40 Lansat
	"-",		"-",		"-",		"-",	// 41 Starf
	"-",		"-",		"-",		"-"	// 42 Enigma
);

var gNatures = new Array(
	"Nature",
	"Spicy<BR>Cool<BR>Attack",
	"Dry<BR>Beauty<BR>Sp.Atk",
	"Sweet<BR>Cute<BR>Speed",
	"Bitter<BR>Smart<BR>Sp.Def",
	"Sour<BR>Tough<BR>Defense",

	"Adamant",	"O",	"X",	"-",	"-",	"-",
	"Bashful",	"-",	"-",	"-",	"-",	"-",
	"Bold",		"X",	"-",	"-",	"-",	"O",
	"Brave",	"O",	"-",	"X",	"-",	"-",
	"Calm",		"X",	"-",	"-",	"O",	"-",
	"Careful",	"-",	"X",	"-",	"O",	"-",
	"Docile",	"-",	"-",	"-",	"-",	"-",
	"Gentle",	"-",	"-",	"-",	"O",	"X",
	"Hardy",	"-",	"-",	"-",	"-",	"-",
	"Hasty",	"-",	"-",	"O",	"-",	"X",
	"Impish",	"-",	"X",	"-",	"-",	"O",
	"Jolly",	"-",	"X",	"O",	"-",	"-",
	"Lax",		"-",	"-",	"-",	"X",	"O",
	"Lonely",	"O",	"-",	"-",	"-",	"X",
	"Mild",		"-",	"O",	"-",	"-",	"X",
	"Modest",	"X",	"O",	"-",	"-",	"X",
	"Naughty",	"O",	"-",	"-",	"X",	"-",
	"Naďve",	"-",	"-",	"O",	"X",	"-",
	"Quiet",	"-",	"O",	"X",	"-",	"-",
	"Quirky",	"-",	"-",	"-",	"-",	"-",
	"Rash",		"-",	"O",	"-",	"X",	"-",
	"Relaxed",	"-",	"-",	"X",	"-",	"O",
	"Sassy",	"-",	"-",	"X",	"O",	"-",
	"Serious",	"-",	"-",	"-",	"-",	"-",
	"Timid",	"X",	"-",	"O",	"-",	"-"
);

var gConditions = new Array(
	"Condition",
	"Beauty<BR>Contest",
	"Cool<BR>Contest",
	"Cute<BR>Contest",
	"Smart<BR>Contest",
	"Tough<BR>Contest",
	
	"Beauty",	"O",	"-",	"-",	"X",	"X",
	"Cool",		"-",	"O",	"X",	"X",	"-",
	"Cute",		"-",	"X",	"O",	"-",	"X",
	"Smart",	"X",	"X",	"-",	"O",	"-",
	"Tough",	"X",	"-",	"X",	"-",	"O"
);

function ParseArgs() {
	var ques = location.href.indexOf("?");
	
	if (ques != -1) {
		var args = location.href.substr(ques + 1).split("&");

		for (var ii = 0; ii < args.length; ii++) {
			var pair = args[ii].split("=");
			var name = pair[0];
			var data = pair[1];

			if (name == "skinName") {
				for (var jj = 0; jj < gSkinList.length; jj++) {
					if (gSkinList[jj].name == data) {
						gSkin = gSkinList[jj];
					}
				}
			} else if (name == "showSize") {
				gShowSize	= data;
			} else if (name == "showType") {
				gShowType[data]	= true;
			}
		}
	}
					
	gSkin["O"]	= gSkin.Green;
	gSkin["-"]	= gSkin.text;
	gSkin["X"]	= gSkin.Red;
	
	gSkin[0]       	= gSkin.text;
	gSkin[1]       	= gSkin.Red;
	gSkin[2]       	= gSkin.Blue;
	gSkin[3]       	= gSkin.Pink;
	gSkin[4]       	= gSkin.Green;
	gSkin[5]       	= gSkin.Yellow;
	
	if (gShowSize == null) {
		gShowSize = 0;
	}
}

function Colorizer(text, optColor) {
	if (optColor != null) {
		return "<font color=\"" + optColor + "\">" + text + "</font>";
	} else {
		for (var jj in gSkin) {
			if (jj == text) {
				return "<font color=\"" + gSkin[jj] + "\">" + text + "</font>";
			}
		}
	}
	
	return text;
}

function PrintLine(value) {
	gHtml += value + "\n";
}

function WriteDocument() {
	document.write(gHtml);

	gHtml = "";
}

function PrintStart(width) {
	PrintLine("<head>");
	
	PrintLine("<title>Rat's Nest - The Pokémon & Pokéblock Cheat Sheet</title>");
	
	PrintLine("<style type=\"text/css\">");
	
	PrintLine("body		{ font-family: arial; font-size: 75%;  color: "	+ gSkin.text	+ " }");
	PrintLine("td		{ font-family: arial; font-size: 75%;  color: "	+ gSkin.text	+ " }");
	PrintLine("th		{ font-family: arial; font-size: 75%;  color: "	+ gSkin.text	+ " }");

	PrintLine("a:link	{ color: "			       		+ gSkin.link	+ " }");
	PrintLine("a:active	{ color: "			       		+ gSkin.link	+ " }");
	PrintLine("a:visited	{ color: "			       		+ gSkin.text	+ " }");
					
	PrintLine(".back	{ background-color: "		       		+ gSkin.back	+ " }");
	PrintLine(".head1	{ background-color: "		       		+ gSkin.head1	+ " }");
	PrintLine(".head2	{ background-color: "		       		+ gSkin.head2	+ " }");
	PrintLine(".head3	{ background-color: "		       		+ gSkin.head3	+ " }");
	PrintLine(".row		{ background-color: "		       		+ gSkin.row	+ " }");
	PrintLine(".text	{ background-color: "		       		+ gSkin.text	+ " }");
	
	PrintLine(".title	{ font-family: arial; font-size: 200%; color: "	+ gSkin.text	+ " }");
	PrintLine(".subtitle	{ font-family: arial; font-size: 100%; color: "	+ gSkin.text	+ " }");
	PrintLine(".footnote	{ font-family: arial; font-size: 80%;  color: "	+ gSkin.text	+ " }");
	
	PrintLine("</style>");
	
	PrintLine("</head>\n");
	PrintLine("<body class=\"back\">");

	if (arguments.length) {
		width = "width=\"" + width + "\" ";
	} else {
		width = "";
	}
	
 	PrintLine("<table border=\"0\" " + width + "cellpadding=\"2\" cellspacing=\"0\">");
}

function PrintEnd(copy) {
        PrintLine("</table>");

	if (copy) {
		PrintLine("<font class=\"footnote\">");
		PrintLine("©2003 Peter A. Kemmer<br>");
		PrintLine("<a href=\"mailto://pokemon@ratsnest.com\">rat at ratsnest dot com</a><br>");
		PrintLine("<a href=\"http://www.ratsnest.com\">www.ratsnest.com</a><br>");
		PrintLine("<a href=\"http://www.ratsnest.com/phpBB2/index.php\">discuss</a>");
		PrintLine("<hr>");
		PrintLine("All trademarks and copyrights contained in this document are owned by their respective trademark and copyright holders.<br>");
		PrintLine("* Data from Prima's Pokémon Ruby & Sapphire guide, don't trust it! :)");
		PrintLine("</font>");
	}

	PrintLine("</body>");
}
































