// This file is automatically generated.

var fname = new Array ("10-15 Pound Mud Snapper","15-32 Pound Salmon","17-32 Pound Catfish","34-52 Pound Redgill","40-68 Pound Grouper","70-103 Pound Mightfish","7-22 Pound Lobster","Acidic Slime","Baby Crocolisk","Barbed Gill Trout","Barrelhead Goby","Battered Chest","Bent Fishing Hook","Big-mouth Clam","Blackfin Darter","Blacktip Shark","Bloated Barbed Gill Trout","Bloated Catfish","Bloated Giant Sunfish","Bloated Monsterbelly","Bloated Mud Snapper","Bloated Redgill","Bloated Salmon","Bloated Smallfish","Bloated Trout","Bloodfin Catfish","Bloodied Prison Shank","Bloodtooth Frenzy","Bonescale Snapper","Borean Man O' War","Broken Engine Part","Broken Wine Bottle","Brownell's Blue Striped Racer","Coagulated Slime","Coal","Copper Coin","Corroded Jewelry","Crescent-Tail Skullfish","Crystal Vial","Crystallized Water","Curious Crate","Dark Herring","Darkclaw Lobster","Darkshore Grouper","Darkwater Clam","Darkwood Fishing Pole","Deep Sea Monsterbelly","Dented Crate","Deviate Fish","Deviate Scale","Dezian Queenfish","Dissolved Skull","Dragonfin Angelfish","Driftwood","Drowned Rat","Dustbringer","Electropeller","Elemental Water","Empty Clam","Empty Rum Bottle","Empty Vial","Enchanted Vial","Enormous Barbed Gill Trout","Essence of Fire","Essence of Water","Fangtooth Herring","Felblood Snapper","Feralas Ahi","Figluster's Mudfish","Firefin Snapper","Fountain Goldfish","Furious Crawdad","Gaffer Jack","Giant Darkwater Clam","Giant Sewer Rat","Giant Sunfish","Glacial Salmon","Glassfin Minnow","Globe of Water","Gold Coin","Golden Darter","Goldenscale Vendorfish","Greater Healing Potion","Greater Mana Potion","Half Empty Bottle of Prison Moonshine","Half Full Bottle of Prison Moonshine","Healing Potion","Heavy Crate","Heavy Supply Crate","Huge Spotted Feltail","Icefin Bluefish","Imbued Vial","Imperial Manta Ray","Inscribed Scrollcase","Iron Bound Trunk","Ironbound Locked Chest","Jaggal Clam","Keefer's Angelfish","Large Raw Mightfish","Leaded Vial","Lesser Healing Potion","Lesser Mana Potion","Lightning Eel","Luminous Bluetail","Magic Eater","Major Healing Potion","Mana Potion","Message in a Bottle","Minor Healing Potion","Minor Mana Potion","Misty Reed Mahi Mahi","Mithril Bound Trunk","Monstrous Felblood Snapper","Moonglow Cuttlefish","Mostly-eaten Bonescale Snapper","Mote of Water","Mr. Pinchy","Musselback Sculpin","Nettlefish","Northern Salmon","Oil Covered Fish","Oily Blackmouth","Old Boot","Old Crafty","Old Ironjaw","Old Skull","Old Teamster's Skull","Old Wagonwheel","Partially Eaten Fish","Partially Rusted File","Peacebloom","Phantom Ghostfish","Plated Armorfish","Pygmy Suckerfish","Raw Brilliant Smallfish","Raw Bristle Whisker Catfish","Raw Glossy Mightfish","Raw Greater Sagefish","Raw Loch Frenzy","Raw Longjaw Mud Snapper","Raw Mithril Head Trout","Raw Nightfin Snapper","Raw Rainbow Fin Albacore","Raw Redgill","Raw Rockscale Cod","Raw Sagefish","Raw Slitherskin Mackerel","Raw Spotted Yellowtail","Raw Summer Bass","Raw Sunscale Salmon","Raw Whitescale Salmon","Red Snapper","Reinforced Crate","Reinforced Locked Chest","Rock","Rockfin Grouper","Rockhide Strongfish","Rumsey Rum Black Label","Rumsey Rum Dark","Rumsey Rum Light","Rusted Engineering Parts","Rusty Prison Key","Sar'theris Striker","Savage Coast Blue Sailfin","Sea Turtle","Sealed Crate","Seaweed","Sewer Carp","Shimmering Minnow","Sickly Fish","Sickly Looking Fish","Silver Coin","Slimy Bone","Slippery Eel","Small Chest","Small Locked Chest","Speckled Tastyfish","Spotted Feltail","Spotted Sunfish","Steam Pump Debris","Steelscale Crushfish","Stonescale Eel","Strange Engine Part","Stranglekelp","Sturdy Locked Chest","Superior Healing Potion","Superior Mana Potion","Tangled Fishing Line","Tasty Reef Fish","Tattered Cloth","Terrorfish","The 1 Ring","Tightly Sealed Trunk","Torn Sail","Tree Branch","Water Snail","Waterlogged Crate","Watertight Trunk","Weeds","Winter Squid","Withered Kelp","World's Largest Mudfish","Zangarian Sporefish","Zulian Mudskunk");

var loc = [[30,"Alterac Mountains",221,131,0],[47,"Alterac Valley",222,132,0],[23,"Arathi Basin",244,150,0],[31,"Arathi Highlands",240,149,0],[24,"Ashenvale",87,147,0],[38,"Azshara",129,140,0],[61,"Azshara (Bay of Storms, Hetaera's Clutch and Scalebeard's Cave only)",144,139,38],[1,"Azuremyst Isle",30,112,0],[74,"Azuremyst Isle (Ammen Vale Lakes)",30,112,1],[9,"The Barrens",102,165,0],[106,"The Barrens (Oasis)",102,182,9],[82,"The Barrens (The Sludge Fen)",108,170,9],[10,"Blackfathom Deeps",73,133,0],[100,"Blackrock Mountain",238,212,0],[11,"Bloodmyst Isle",20,93,0],[81,"Bloodmyst Isle (The Foul Pool)",10,88,11],[76,"Bloodmyst Isle (Unnamed Inland Areas)",20,93,11],[84,"Borean Tundra",122,52,0],[48,"Burning Steppes",248,218,0],[99,"Burning Steppes (Dreadmaul Rock)",248,218,48],[79,"Coilfang Reservoir",325,57,0],[89,"Crystalsong Forest",168,33,0],[90,"Dalaran",174,32,0],[93,"Dalaran (The Eventide)",174,32,90],[92,"Dalaran (The Underbelly)",174,32,90],[12,"Darkshore",77,109,0],[13,"Darnassus",57,74,0],[14,"The Deadmines",206,248,0],[49,"Deadwind Pass",234,240,0],[32,"Desolace",61,185,0],[86,"Dragonblight",166,48,0],[2,"Dun Morogh",219,193,0],[3,"Durotar",124,171,0],[25,"Duskwood",221,242,0],[33,"Dustwallow Marsh",114,212,0],[50,"Eastern Plaguelands",257,115,0],[4,"Elwynn Forest",219,226,0],[5,"Eversong Woods",260,75,0],[75,"Eversong Woods (Unnamed Inland Areas)",260,75,5],[39,"Felwood",85,119,0],[40,"Feralas",65,217,0],[51,"Feralas (Jademir Lake only)",62,203,40],[91,"The Frozen Sea",163,73,0],[15,"Ghostlands",260,88,0],[77,"Ghostlands (Southern Lakes)",260,88,15],[87,"Grizzly Hills",199,49,0],[67,"Hellfire Peninsula",363,55,0],[26,"Hillsbrad Foothills",221,142,0],[41,"The Hinterlands",247,136,0],[85,"Howling Fjord",208,61,0],[105,"Hrothgar's Landing",148,9,0],[96,"Icecrown",151,23,0],[73,"Ironforge",224,185,0],[78,"Isle of Quel'Danas",262,36,0],[16,"Loch Modan",247,187,0],[42,"Maraudon",53,183,0],[102,"Molten Core",238,212,0],[43,"Moonglade",106,95,0],[6,"Mulgore",84,196,0],[63,"Nagrand",320,73,0],[68,"Nagrand (Forge Camp: Hate only)",303,68,63],[70,"Nagrand (Lake Sunspring and Skysong Lake only)",311,72,63],[101,"Naxxramas",179,43,0],[64,"Netherstorm",369,22,0],[103,"The Obsidian Sanctum",167,47,0],[17,"Orgrimmar",123,159,0],[27,"Redridge Mountains",242,227,0],[34,"Scarlet Monastery",220,110,0],[52,"Scholomance",241,124,0],[65,"Shadowmoon Valley",378,93,0],[88,"Sholazar Basin",130,35,0],[53,"Silithus",67,252,0],[18,"Silverpine Forest",201,132,0],[28,"Stonetalon Mountains",68,160,0],[80,"Stonetalon Mountains (Blackwolf River and Cragpool Lake)",72,160,28],[97,"Storm Peaks",181,21,0],[19,"Stormwind City",212,225,0],[35,"Stranglethorn Vale",223,260,0],[59,"Stranglethorn Vale (Jaguero Isle only)",219,278,35],[104,"Stranglethorn Vale (North of Grom'Gol)",219,278,35],[54,"Stratholme",248,103,0],[36,"Swamp of Sorrows",248,237,0],[60,"Tanaris",124,256,0],[7,"Teldrassil",67,71,0],[44,"The Temple of Atal'Hakkar",253,237,0],[62,"Terokkar Forest",345,78,0],[71,"Terokkar Forest (Lakes)",357,91,62],[37,"Thousand Needles",105,229,0],[20,"Thunder Bluff",79,186,0],[8,"Tirisfal Glades",207,113,0],[95,"Ulduar",179,9,0],[58,"Undercity",213,117,0],[45,"Un'Goro Crater",90,250,0],[83,"Un'Goro Crater (Fire Plume Ridge)",90,250,45],[21,"The Wailing Caverns",100,190,0],[46,"Western Plaguelands",233,115,0],[22,"Westfall",201,240,0],[29,"Wetlands",238,170,0],[94,"Wintergrasp",149,34,0],[55,"Winterspring",122,107,0],[66,"Zangarmarsh",332,57,0],[69,"Zangarmarsh (Marshlight Lake, Sporewind Lake, and Serpent Lake only)",318,52,66],[72,"Zul'Aman",266,96,0],[98,"Zul'Drak",201,28,0],[56,"Zul'Gurub",232,256,0]];

var xpage = [["About","About Fish Finder..."],["Fish","Fish by Name..."],["Skill","Skill..."],["Pools","Pool Type..."],["Buffs","Cooked Buff..."],["Zones","All Zones..."],["Cooking","Cooked fish dishes..."],["History","Patch Changes..."],["Seas","Seas and oceans..."],["Eastern Kingdoms","All Eastern Kingdoms..."],["Kalimdor","All Kalimdor..."],["Northrend","All Northrend..."],["Outland","All Outland..."]]; 
		
var fish_pref = load_fish_pref();
		
function needpngfix() {
	// Pre IE 7 does not allow full png transparency. Pre IE 4 ignored, since these don't support JS 1.2.
	var ua = navigator.userAgent.toLowerCase();
	if (((ua.indexOf("msie")!=-1) && (ua.indexOf("opera")==-1) && (ua.indexOf("webtv")==-1))) {
		if ((parseFloat(ua.substring(ua.indexOf('msie ')+5))<=6)) {
			return true;
			} else {
			return false;
			}
		} else {
		return false;
		}
	}
		
function menu(p,d) {
	// Return menu. p=0 if on main page, 1 if in menu. d=Selected fish name or blank.
	var a='<form id="fishmenu" action="#"><label for="name">Jump to:</label> <select id="fishname'+p+'" title="Select a fish." onchange="if (document.getElementById(\'fishname'+p+'\').value!=\'0\') { self.location=urlise(document.getElementById(\'fishname'+p+'\').value); }"><option value="0">Select...</option>';
	if(p>0) {
		a=a+'<optgroup label="Browse">';
		for(var c=0;c<xpage.length;c++) {
			a=a+'<option value="'+xpage[c][0]+'"';
			if(d==xpage[c][0]) { a=a+' selected="selected"'; }
			a=a+'>'+xpage[c][1]+'</option>';
			}
		a=a+'</optgroup>';
		}
	a=a+'<optgroup label="Fish">';
	for(var c=0;c<fname.length;c++) {
		a=a+'<option value="'+fname[c]+'"';
		if(d==fname[c]) { a=a+' selected="selected"'; }
		a=a+'>'+fname[c]+'</option>';
		}
	a=a+'</optgroup><optgroup label="Area">';
	for(var c=0;c<loc.length;c++) {
		if(loc[c][4]==0) {
			a=a+'<option value="'+loc[c][1]+'"';
			if(d==loc[c][1]) { a=a+' selected="selected"'; }
			a=a+'>'+loc[c][1]+'</option>';
			}
		}
	a=a+'</optgroup></select> <a href="javascript:if (document.getElementById(\'fishname'+p+'\').value!=\'0\') { self.location=urlise(document.getElementById(\'fishname'+p+'\').value); } " title="View information about the selected fish.">&raquo;</a></form>';
	return a;
	}

function urlise(a) {
	a=a.toLowerCase();
	for(var c=0;c<a.length;c++) {
		a=a.replace("'","");
		a=a.replace(".","");
		a=a.replace(" ","_");
		a=a.replace("(","");
		a=a.replace(")","");
		a=a.replace(",","");
		a=a.replace(":","");
		}
	return a+".html";
	}

function submap(z) {
	// z=array of location ids. -1 is dummy.
	var a="";
	var f=needpngfix();
	for(var c=0;c<z.length;c++) {
		for(var d=0;d<loc.length;d++) {
			if(loc[d][0]==z[c]) {
				if((loc[d][2]+loc[d][3])>0) { // Do not map 0,0.
					a=a+'<div style="position: absolute; left: '+(loc[d][2]-8)+'px; top: '+(loc[d][3]-8)+'px; background: none;"><img src="/images/map_pin.';
					if (f) {
						a=a+'gif'; // IE<7
						} else {
						a=a+'png';
						}
					a=a+'" height="16" width="16" alt="'+loc[d][1]+'" title="'+loc[d][1]+'" /></div>';
					}
				}
			}
		}
	if(document.getElementById('maplayer')) {
		document.getElementById('maplayer').innerHTML=a;
		}
	a=null;
	}
	
function map(l) {
	// l=array of locations to be mapped
	var m = new Array (); // all mappable locs
	var k = new Array (l.length); // one per checkbox
	for(var c=0;c<k.length;c++) {
		if(document.getElementById("check_"+c).checked) {
			k[c]=1; // true
			} else {
			k[c]=0; // false
			}
		}
	for(var c=0;c<k.length;c++) {
		if(k[c]==1) { // map this set
			for(var d=0;d<l[c].length;d++) { // valid locs. add to m if not there already
				var f=0; // found in m flag
				for(var e=0;e<m.length;e++) {
					if(m[e]==l[c][d]) {
						f=1;
						}
					}
				if(f==0) {
					m[m.length]=l[c][d]; // push broken pre-IE 5.5
					}
				}
			}
		}
	return submap(m);
	}
	
function fill_mapbox() {
	return "<div id='mapbox' class='mapbox' title='Pins on the map show the location of areas.'><div id='maplayer' class='maplayer'><span style='padding: 2px;'><img src='/images/icon/rotation.gif' height='16' width='16' alt='Adding pins...' /></span></div></div>";
	}
	
function fill_check(n) {
	return '<form action="#"><input type="checkbox" checked="checked" id="check_'+n+'" onclick="javascript: map(locstack);" title="Mark these areas on the map with a pin." class="check" /></form>';
	}

function fill_skillbox(locskill) {
	return '<form action="#">At <label for="skillbox_myskill">skill</label> <select id="skillbox_myskill" name="skillbox_myskill" title="Enter your effective fishing skill." onchange="javascript: set_fish_pref(1,document.getElementById(\'skillbox_myskill\').value); document.getElementById(\'skillbox_result\').innerHTML=get_junk(document.getElementById(\'skillbox_myskill\').value,'+locskill+');">'+get_skill_selector(1,667,fish_pref[1])+'</select>, <span id="skillbox_result">'+get_junk(fish_pref[1],locskill)+'</span> of catches will be junk.</form>';
	}

function get_skill_selector(minskill,maxskill,selected) {
	var s="";
	for (i=minskill;i<(maxskill+1);i++) { if (i == selected) { s=s+'<option value="'+i+'" selected="selected">'+i+'</option>';	} else { s=s+'<option value="'+i+'">'+i+'</option>'; } }
	return s;
	}

function get_junk(myskill,locskill) {
	if (myskill >= locskill) {
		return "0%";
		} else if ( myskill > 0 && locskill > 0) {
		return Math.round(( 1 - ( Math.pow(( (myskill*1.0) / (locskill*1.0) ),2))) * 100)+"%";
		} else {
		return "unknown";
		}
	}

function expand_link(id,c,l) {
	if(document.getElementById) {
			return '<a href="javascript: show_hide(\'expand_'+id+'\',\'more_'+id+'\');" title="Expand view to read more.">[+] Expand ('+c+' more comments)</a>';
		} else {
			return '<a href="'+l+'" title="Read more.">Read '+c+' more comments &raquo;</a>';
		}
	}

function expand_cooking(id) {
	if (id == 0) {
		return '<a href="javascript: show_hide(\'cookingmore\',\'cookingless\'); set_fish_pref(0,1);" title="Show information about dishes and recipes.">[+] Expand cooking</a>';
		} else {
		return '<a href="javascript: show_hide(\'cookingless\',\'cookingmore\'); set_fish_pref(0,0);" title="Collapse view to display less cooking information.">[-] Hide cooking</a>';
		}
	}

function show_hide(show,hide) {
	document.getElementById(hide).style.display="none";
	document.getElementById(hide).style.visibility="hidden";
	document.getElementById(show).style.display="inline";
	document.getElementById(show).style.visibility="visible";
	}

function set_fish_pref(position,value) {
	fish_pref[position]=value;
	write_pref('fish_pref',fish_pref.toString());
	}

function load_fish_pref() {
	p = new Array (0,1); // default: cook, skill
	c = read_pref('fish_pref');
	if (c != null) {
		s = c.split(",");
		if (s.length <= p.length) {
			for (i=0;i<s.length;i++) p[i] = parseInt(s[i]);
			}
		}
	return p;
	}

function write_pref(name,value) {
	document.cookie=name+'='+escape(value);
	}

function read_pref(name) {
	var start = document.cookie.indexOf(name + '=');
	var len = start + name.length + 1;
	if ((!start) && (name != document.cookie.substring(0,name.length))) return null;
	if (start == -1) return null;
	var end = document.cookie.indexOf(';',len);
	if (end == -1) end = document.cookie.length;
	return unescape(document.cookie.substring(len,end));
	}

