// TO CHANGE OR ADD MARKETS
//  market()


var pax=["SIS","AR","BTBW","BG","DR","IB","JTS","LL","PL","QOM","RP","ST","SB","TTT","WW","YS","AA","BIS","CC","CLS","FT","HSR","HTZ","ND","OTD","PC08","SK","SXSW","SR","SMBH","TBK","TI","UH","EF","IDo","GS","TOT","BAB","BR","AE","WO","NPI","ACC","F","CNY","ML"] // NO MORE!
var paxc=["GOS","NS","HSC","VOTK","PWT","D","RTI","LHL","DDD","SBK","TR","EI","EB","MD","BD","HT"]
var paxe=["MMT","IW","N","NB","ENF","CF","NaD","CS","MOTD", "PP","CD","PA","AAG","STAB","FR"]
var paxg=["fix"]
var paxi=["SVD","FlT","LDU","MOR","TS","ASF","ID","TRP","EVM","PM","HL","FF","GGG","ZA","SMGS"]

var paxcnt=["41","57","26","28","35","29","59","32","39","35","66","38","48","29","26","32","28","25","26","39","32","28","57","28","26","33","26","27","39","23","29","26","26","29","48","50","51","35","30","29","44","41","33","35","33","66"] // NO MORE!
var paxcntc=["38","43","29","29","42","30","43","29","29","29","32","29","35","29","29","40"] // last is
var paxcnte=["42","35","30","12","29","43","29","32","29","35","29","26","29","35","58"] // last is
var paxcntg=["20"] // fix
var paxcnti=["37","29","40","38","40","29","32","32","41","29","37","29","57","31","24"] // last is Supermassive Gravastar

// Initial card counts:
var paxcntinit=["20","27","14","13","17","14","29","17","18","14","27","17","24","14","14","17","13","13","14","24","14","13","27","13","14","18","14","18","24","14","14","14","14","14","24","20","24","17","15","14","20","20","15","17","15","30"]
var paxcntcinit=["20","19","14","14","21","15","19","14","14","14","17","14","14","14","14","19"]
var paxcnteinit=["21","17","15","9","14","19","14","14","14","14","14","14","14","14","25"]
var paxcntiinit=["19","14","19","17","19","14","14","14","20","14","16","14","27","16","18"]

// Vault links:
var vlt=["7th-inning-stretch","ancient-realms","born-to-be-wild","boy-genius","dark-roast","in-bloom","jump-the-shark","lucha-libre","papa-louies","quest-of-montezuma","rat-pack","sleep-tight","summer-blockbuster","toys-toys-toys","winston-world","yard-sale","arctic-adventure","best-in-show","cimarron-canyon","collezioni-la-soul","full-throttle","high-seas-rivalry","hightail-zoo","ninja-dawn","oh-the-drama","primary-colors-2008","safari-kingdom","south-by-southwest","sugar-rush","supermassive-black-hole","the-bees-knees","tiki-island","urban-hipster","enchanted-forest","i-do","green-scene","trick-or-treat","bulls-and-bears","barnyard-ruckus","arctic-expedition","wizard-of-oz","north-pole-industries","a-christmas-carol","freeriders","chinese-new-year","monkey-lids"]
var vltc=["games-of-summer","ninja-storm","high-seas-century","valley-of-the-kings","pee-wee-thanksgiving","dreams","return-to-tiki-island","little-hero-league","devs-devs-devs","subterranean-kingdom","the-roswells","emerald-isle","easter-basket","mums-day","big-daddy","household-tales"]
var vlte=["magical-mystery-tour","ink-wars","nightmares","neighborhood-barbecue","enterprising-fungi","creature-feature","nacho-ducks","caterpillar-spring","mystery-of-the-deep","pangea-patrol","canada-day","peaceful-afternoon","ants-and-grasshoppers","socmo","faery-realm"]
var vlti=["saint-valentines-day","flagellum-trilogy","land-down-under","meme-o-rama","the-summit","arctic-snowball-fight","independence-day","the-razors-plunder","extra-value-meal","peace-and-music","hook-learning","forest-friends","go-go-gowalla","zombie-apocalypse","supermassive-gravastar"]

// Menu info:
var mnucur=["The Razor's Plunder;TRP;blueberry","Supermassive Gravastar;SMGS;lime","Zombie Apocalypse;ZA;mandarin","Household Tales;HT;mandarin","Go Go Gowalla;GGG;lime","Faery Realm;FR;chocolate","Forest Friends;FF;banana","Hook Learning;HL;lime","Ants & Grasshoppers;AAG;banana","Extra Value Meal;EVM;cotton","Peaceful Afternoon;PA;chocolate"]
var mnuret=["Canada Day;CD;cherry","Independence Day;ID;blueberry","Arctic Snowball Fight;ASF;lavender","Pangea Patrol;PP;chocolate","Socmo;STAB;mandarin","The Summit;TS;cherry","Meme-O-Rama;MOR;lime","Mystery of the Deep;MOTD;blueberry","Land Down Under;LDU;chocolate","Big Daddy;BD;mandarin","Peace and Music;PM;cotton","Caterpillar Spring;CS;banana","Mum's Day;MD;cotton","Flagellum Trilogy;FlT;lime","Creature Feature;CF;lavender","Nacho Ducks;NaD;mandarin","Enterprising Fungi;ENF;cotton","The Roswells;TR;blueberry","Subterranean Kingdom;SBK;chocolate","Devs Devs Devs!;DDD;mandarin","Neightborhood Barbecue;NB;banana","Saint Valentine's Day;SVD;cherry","Monkey Lids;ML;banana","Easter Basket;EB;blueberry","Little Hero League;LHL;lime","Emerald Isle;EI;lime","Return to Tiki Island;RTI;banana","Chinese New year;CNY;cherry","Freeriders;F;cherry","Dreams;D;mandarin","Nightmares;N;lavender","Wizard of Oz;WO;banana","Arctic Expedition;AE;lavender","Barnyard Ruckus;BR;lavender","High Seas Century;HSC;blueberry","Bulls and Bears;BAB;lime","Green Scene;GS;lime","Ink Wars;IW;cherry","Magical Mystery Tour;MMT;cherry","Valley of the Kings;VOTK;chocolate","A Christmas Carol;ACC;chocolate","I Do;IDo;cotton","Ninja Storm;NS;cherry","North Pole Industries;NPI;blueberry","Pee Wee Thanksgiving;PWT;mandarin","Trick or Treat;TOT;mandarin","Enchanted Forest;EF;banana","Quest of Montezuma;QOM;chocolate","In Bloom;IB;banana","Rat Pack;RP;cherry","Toys Toys Toys;TTT;lime","Yard Sale;YS;mandarin","Jump the Shark;JTS;blueberry","Lucha Libre;LL;lavender","Winston World;WW;lavender","Ancient Realms;AR;chocolate","Games of Summer;GOS;cherry","Born to Be Wild;BTBW;blueberry","Dark Roast;DR;chocolate","Papa Louie's;PL;mandarin","Summer Blockbuster;SB;blueberry","Boy Genius;BG;lime","Sleep Tight;ST;lavender","7th Inning Stretch;SIS;mandarin","The Bee's Knees;TBK;banana","Hightail Zoo;HTZ;banana","Full Throttle;FT;blueberry","Sugar Rush;SR;cotton","Best In Show;BIS;cotton","Urban Hipster;UH;cherry","Oh the Drama;OTD;cotton","Collezioni La Soul;CLS;cotton","Ninja Dawn;ND;cherry","Tiki Island;TI;banana","High Seas Rivalry;HSR;blueberry","Supermassive Black Hole;SMBH;lime","Safari Kingdom;SK;chocolate","Arctic Adventure;AA;lavender","Cimarron Canyon;CC;mandarin","South by Southwest;SXSW;lime","Primary Colors 2008;PC08;cherry"]

var ratz=["Shakirat","Mark","Ratty","Biff","Rattori","Captain","Ratina","Marcel","Princess","Rat"]

var menuready="no";
function buildmenus() {
	for (var i=0;i<pax.length;i++) {
		document.getElementById(pax[i]+"top").innerHTML="<span class='packtitle'><img src='"+pax[i]+"_family.gif' align='top'> <a href='http://packrattools.com/info/?collection="+vlt[i]+"' target='mainwin'><span id='"+pax[i]+"tit'></span></a></span><br><span class='box1'><input type='checkbox'></span><span class='box1l'>V</span><span class='box2'><input type='checkbox'></span><span class='box2l'>P</span></span><div class='space'>&nbsp;</div><br>"
	}
	for (var i=0;i<paxc.length;i++) {
		document.getElementById(paxc[i]+"top").innerHTML="<span class='packtitle'><img src='"+paxc[i]+"_family.gif' align='top'> <a href='http://packrattools.com/info/?collection="+vltc[i]+"' target='mainwin'><span id='"+paxc[i]+"tit'></span></a></span><br><span class='box1'><input type='checkbox'></span><span class='box1l'>V</span><span class='box2'><input type='checkbox'></span><span class='box2l'>P</span></span><div class='space'>&nbsp;</div><br>"
	}
	for (var i=0;i<paxe.length;i++) {
		document.getElementById(paxe[i]+"top").innerHTML="<span class='packtitle'><img src='"+paxe[i]+"_family.gif' align='top'> <a href='http://packrattools.com/info/?collection="+vlte[i]+"' target='mainwin'><span id='"+paxe[i]+"tit'></span></a></span><br><span class='box1'><input type='checkbox'></span><span class='box1l'>V</span><span class='box2'><input type='checkbox'></span><span class='box2l'>P</span></span><div class='space'>&nbsp;</div><br>"
	}
	for (var i=0;i<paxi.length;i++) {
		document.getElementById(paxi[i]+"top").innerHTML="<span class='packtitle'><img src='"+paxi[i]+"_family.gif' align='top'> <a href='http://packrattools.com/info/?collection="+vlti[i]+"' target='mainwin'><span id='"+paxi[i]+"tit'></span></a></span><br><span class='box1'><input type='checkbox'></span><span class='box1l'>V</span><span class='box2'><input type='checkbox'></span><span class='box2l'>P</span></span><div class='space'>&nbsp;</div><br>"
	}
	var list="";
	list=list+"<div id='currentl' class='coll links linksl'><a href='#' onClick=\"colmenu('retired','current')\" class='none'>change to Retired</a> &nbsp;| &nbsp;<a href='#' onClick='closemenu()' class='none'>close Current</a></div>";
	var mnucurr=["zzz;z;z"];
	var menucur=mnucur.concat(mnucurr);
	var mnureti=["zzz;z;z"];
	var menuret=mnuret.concat(mnureti);
	for (var i=0;i<document.form.menuor.length;i++) {
		if (document.form.menuor[1].checked) { menucur.sort(); menuret.sort() }
	}
// RETIRING
	if (document.form.menuor[0].checked) { list=list+"<div class='coll retiring'>Retiring Oct. 15:</div>" }
	for (var i=0;i<1;i++) {
		mnu=menucur[i].split(";");
		((i-1)<0) ? h=mnucur.length-1 : h=i-1;
		mnnu=menucur[h].split(";");
		((i+1)>mnucur.length-1) ? j=0 : j=i+1;
		mnuu=menucur[j].split(";");
		list=list+"<a onClick=\"show('"+mnu[1]+"')\" class='none' onMouseOver=\"hilite('"+mnu[1]+"','d"+mnu[2]+"')\" onMouseOut=\"hilite('"+mnu[1]+"','"+mnu[2]+"')\"><div id='"+mnu[1]+"' class='coll "+mnu[2]+"' style='background-image:url("+mnu[1]+"_family.gif)'><span id='"+mnu[1]+"comp' class='ttiny'></span>"+mnu[0]+"</div></a>";
		document.getElementById(mnu[1]+"tit").innerHTML=mnu[0];
		document.getElementById(mnu[1]+"d").className="window pack "+mnu[2];
		document.getElementById(mnu[1]+"d").style.backgroundImage="url(light"+mnu[1]+".png)";
		var lastpart="</span>";
		var edit="";
		if (document.form.editme.value=="yes") { edit="<br><a class='lal' onClick=\"editcards('"+mnu[1]+"')\"><img src='edit.png' border='0'></a>" }
		document.getElementById(mnu[1]+"top").innerHTML="<span style='float:right'><a class='lal' onClick='hide()'><img src='close.png' border='0'></a><br><a class='lal' onClick=\"show('"+mnnu[1]+"')\"><img src='lft.png' border='0'></a><a class='lal' onClick=\"show('"+mnuu[1]+"')\"><img src='rit.png' border='0'></a>"+edit+lastpart+document.getElementById(mnu[1]+"top").innerHTML;
	}
//	if (document.form.menuor[0].checked) { list=list+"<div class='coll retiring'>Retiring Oct. 8:</div>" }
//	for (var i=1;i<3;i++) {
//		mnu=menucur[i].split(";");
//		((i-1)<0) ? h=mnucur.length-1 : h=i-1;
//		mnnu=menucur[h].split(";");
//		((i+1)>mnucur.length-1) ? j=0 : j=i+1;
//		mnuu=menucur[j].split(";");
//		list=list+"<a onClick=\"show('"+mnu[1]+"')\" class='none' onMouseOver=\"hilite('"+mnu[1]+"','d"+mnu[2]+"')\" onMouseOut=\"hilite('"+mnu[1]+"','"+mnu[2]+"')\"><div id='"+mnu[1]+"' class='coll "+mnu[2]+"' style='background-image:url("+mnu[1]+"_family.gif)'><span id='"+mnu[1]+"comp' class='ttiny'></span>"+mnu[0]+"</div></a>";
//		document.getElementById(mnu[1]+"tit").innerHTML=mnu[0];
//		document.getElementById(mnu[1]+"d").className="window pack "+mnu[2];
//		document.getElementById(mnu[1]+"d").style.backgroundImage="url(light"+mnu[1]+".png)";
//		var lastpart="</span>";
//		var edit="";
//		if (document.form.editme.value=="yes") { edit="<br><a class='lal' onClick=\"editcards('"+mnu[1]+"')\"><img src='edit.png' border='0'></a>" }
//		document.getElementById(mnu[1]+"top").innerHTML="<span style='float:right'><a class='lal' onClick='hide()'><img src='close.png' border='0'></a><br><a class='lal' onClick=\"show('"+mnnu[1]+"')\"><img src='lft.png' border='0'></a><a class='lal' onClick=\"show('"+mnuu[1]+"')\"><img src='rit.png' border='0'></a>"+edit+lastpart+document.getElementById(mnu[1]+"top").innerHTML;
//	}
	if (document.form.menuor[0].checked) { list=list+"<table cellpadding='0' cellspacing='0' border='0'><tr><td height='5' width='208' bgcolor='black'></td></tr></table>" }
// END RETIRING
	for (var i=1;i<mnucur.length;i++) {
		mnu=menucur[i].split(";");
		((i-1)<0) ? h=mnucur.length-1 : h=i-1;
		mnnu=menucur[h].split(";");
		((i+1)>mnucur.length-1) ? j=0 : j=i+1;
		mnuu=menucur[j].split(";");
		list=list+"<a onClick=\"show('"+mnu[1]+"')\" class='none' onMouseOver=\"hilite('"+mnu[1]+"','d"+mnu[2]+"')\" onMouseOut=\"hilite('"+mnu[1]+"','"+mnu[2]+"')\"><div id='"+mnu[1]+"' class='coll "+mnu[2]+"' style='background-image:url("+mnu[1]+"_family.gif)'><span id='"+mnu[1]+"comp' class='ttiny'></span>"+mnu[0]+"</div></a>";
		document.getElementById(mnu[1]+"tit").innerHTML=mnu[0];
		document.getElementById(mnu[1]+"d").className="window pack "+mnu[2];
		document.getElementById(mnu[1]+"d").style.backgroundImage="url(light"+mnu[1]+".png)";
		var lastpart="</span>";
		var edit="";
		if (document.form.editme.value=="yes") { edit="<br><a class='lal' onClick=\"editcards('"+mnu[1]+"')\"><img src='edit.png' border='0'></a>" }
		document.getElementById(mnu[1]+"top").innerHTML="<span style='float:right'><a class='lal' onClick='hide()'><img src='close.png' border='0'></a><br><a class='lal' onClick=\"show('"+mnnu[1]+"')\"><img src='lft.png' border='0'></a><a class='lal' onClick=\"show('"+mnuu[1]+"')\"><img src='rit.png' border='0'></a>"+edit+lastpart+document.getElementById(mnu[1]+"top").innerHTML;
	}
	list=list+"<table cellpadding='0' cellspacing='0' border='0'><tr><td height='1' width='208' bgcolor='black'></td></tr></table>";
	document.getElementById("current").innerHTML=list;
	list="";
	list=list+"<div id='retiredl' class='coll links linksl'><a href='#' onClick=\"colmenu('current','retired')\" class='none'>change to Current</a> &nbsp;| &nbsp;<a href='#' onClick='closemenu()' class='none'>close Retired</a></div><table cellpadding='0' cellspacing='0' border='0'><tr valign='top'><td>";
	var firstqtrs=Math.ceil(mnuret.length/4);
	var lastqtr=mnuret.length-(mnuret.length-(firstqtrs*3));
	for (var i=0;i<mnuret.length;i++) {
		mnu=menuret[i].split(";");
		((i-1)<0) ? h=mnuret.length-1 : h=i-1;
		mnnu=menuret[h].split(";");
		((i+1)>mnuret.length-1) ? j=0 : j=i+1;
		mnuu=menuret[j].split(";");
		if (document.form.hidecom.checked==false) {
			if (i==firstqtrs || i==firstqtrs*2 || i==lastqtr) { list=list+"<table cellpadding='0' cellspacing='0' border='0'><tr><td height='1' width='207' bgcolor='black'></td></tr></table></td><td>" }
			if (i<firstqtrs) { list=list+"<a onClick=\"show('"+mnu[1]+"')\" class='none' onMouseOver=\"hilite('"+mnu[1]+"','d"+mnu[2]+"')\" onMouseOut=\"hilite('"+mnu[1]+"','"+mnu[2]+"')\"><div id='"+mnu[1]+"' class='coll "+mnu[2]+"' style='background-image:url("+mnu[1]+"_family.gif)'><span id='"+mnu[1]+"comp' class='ttiny'></span>"+mnu[0]+"</div></a>" }
			else { list=list+"<a onClick=\"show('"+mnu[1]+"')\" class='none' onMouseOver=\"hilite('"+mnu[1]+"','d"+mnu[2]+" nob')\" onMouseOut=\"hilite('"+mnu[1]+"','"+mnu[2]+" nob')\"><div id='"+mnu[1]+"' class='coll "+mnu[2]+" nob' style='background-image:url("+mnu[1]+"_family.gif)'><span id='"+mnu[1]+"comp' class='ttiny'></span>"+mnu[0]+"</div></a>" }
		}
		else { list=list+"<a onClick=\"show('"+mnu[1]+"')\" class='none' onMouseOver=\"hilite('"+mnu[1]+"','d"+mnu[2]+"')\" onMouseOut=\"hilite('"+mnu[1]+"','"+mnu[2]+"')\"><div id='"+mnu[1]+"' class='coll "+mnu[2]+"' style='background-image:url("+mnu[1]+"_family.gif)'><span id='"+mnu[1]+"comp' class='ttiny'></span>"+mnu[0]+"</div></a>" }
		document.getElementById(mnu[1]+"tit").innerHTML=mnu[0];
		document.getElementById(mnu[1]+"d").className="window pack "+mnu[2];
		document.getElementById(mnu[1]+"d").style.backgroundImage="url(light"+mnu[1]+".png)";
		var lastpart="</span>";
		var edit="";
		if (mnu[1]=="D") { lastpart="<br><a href='#' onClick=\"newguide('N','D'); blur()\"><img src='bdy.png' id='Nbuddy' name='Nbuddy' border='0'></a></span>" }
		else if (mnu[1]=="N") { lastpart="<br><a href='#' onClick=\"newguide('D','N'); blur()\"><img src='bdy.png' id='Dbuddy' name='Dbuddy' border='0'></a></span>" }
		document.getElementById(mnu[1]+"top").innerHTML="<span style='float:right'><a class='lal' onClick='hide()'><img src='close.png' border='0'></a><br><a class='lal' onClick=\"show('"+mnnu[1]+"')\"><img src='lft.png' border='0'></a><a class='lal' onClick=\"show('"+mnuu[1]+"')\"><img src='rit.png' border='0'></a>"+lastpart+document.getElementById(mnu[1]+"top").innerHTML;
	}
	list=list+"<table cellpadding='0' cellspacing='0' border='0'><tr><td height='1' width='207' bgcolor='black'></td></tr></table></td></tr></table>";
	document.getElementById("retired").innerHTML=list;

	if (document.form.progdis[3].checked) { var draw="draw" }
	else {
		for (var i=0;i<pax.length;i++) {
			var colln=pax[i];
			var a=0;
			for (var j=0;j<=paxcntinit[i];++j) {
				if (document.form[pax[i]+j].checked) { a+=1 }
			}
			z=Math.round((a/j)*100);
			if (document.form.hidecom.checked && z==100) { document.getElementById(colln).style.display="none" }
			if (document.form.prog.checked && z==100) { var driw="driw" }
			else {
				var reed="";
				if (document.form.progdis[0].checked) { reed=a+"/"+j+"<br>"+z+"%" }
				if (document.form.progdis[1].checked) { reed=a+"/"+j }
				if (document.form.progdis[2].checked) { reed=z+"%" }
				document.getElementById(colln+"comp").innerHTML=reed;
			}
		}
		for (var i=0;i<paxc.length;i++) {
			var colln=paxc[i];
			var a=0;
			for (var j=0;j<=paxcntcinit[i];++j) {
				if (document.form[paxc[i]+j].checked) { a+=1 }
			}
			z=Math.round((a/j)*100);
			if (document.form.hidecom.checked && z==100) { document.getElementById(colln).style.display="none" }
			if (document.form.prog.checked && z==100) { var driw="driw" }
			else {
				var reed="";
				if (document.form.progdis[0].checked) { reed=a+"/"+j+"<br>"+z+"%" }
				if (document.form.progdis[1].checked) { reed=a+"/"+j }
				if (document.form.progdis[2].checked) { reed=z+"%" }
				document.getElementById(colln+"comp").innerHTML=reed;
			}
		}
		for (var i=0;i<paxe.length;i++) {
			var colln=paxe[i];
			var a=0;
			for (var j=0;j<=paxcnteinit[i];++j) {
				if (document.form[paxe[i]+j].checked) { a+=1 }
			}
			z=Math.round((a/j)*100);
			if (document.form.hidecom.checked && z==100) { document.getElementById(colln).style.display="none" }
			if (document.form.prog.checked && z==100) { var driw="driw" }
			else {
				var reed="";
				if (document.form.progdis[0].checked) { reed=a+"/"+j+"<br>"+z+"%" }
				if (document.form.progdis[1].checked) { reed=a+"/"+j }
				if (document.form.progdis[2].checked) { reed=z+"%" }
				document.getElementById(colln+"comp").innerHTML=reed;
			}
		}
		for (var i=0;i<paxi.length;i++) {
			var colln=paxi[i];
			var a=0;
			for (var j=0;j<=paxcntiinit[i];++j) {
				if (document.form[paxi[i]+j].checked) { a+=1 }
			}
			z=Math.round((a/j)*100);
			if (document.form.hidecom.checked && z==100) { document.getElementById(colln).style.display="none" }
			if (document.form.prog.checked && z==100) { var driw="driw" }
			else {
				var reed="";
				if (document.form.progdis[0].checked) { reed=a+"/"+j+"<br>"+z+"%" }
				if (document.form.progdis[1].checked) { reed=a+"/"+j }
				if (document.form.progdis[2].checked) { reed=z+"%" }
				document.getElementById(colln+"comp").innerHTML=reed;
			}
		}
	}
	if (document.form.refr.checked) { refresh() }
	if (document.form.mansave.checked) {
		document.getElementById("cookies").style.display="block";
		document.getElementById("cookiepaste").style.display="block";
		document.getElementById("cookies").style.top=document.getElementById("guide").offsetTop+document.getElementById("guide").offsetHeight+3+"px";
		document.getElementById("cookiepaste").style.top=document.getElementById("guide").offsetTop+document.getElementById("guide").offsetHeight+3+"px";
		document.form.cl1psopen.disabled=false;
		document.getElementById("cl1pstext").style.color="#000";
	}
	else {
		document.form.cl1psopen.disabled=true;
		document.form.cl1psopen.checked=false;
		document.getElementById("cl1pstext").style.color="#aaa";
		document.getElementById("cookies").style.display="none";
		document.getElementById("cookiepaste").style.display="none";
	}
}

var Cookies = {
	init: function () {
		var allCookies = document.cookie.split('; ');
		for (var i=0;i<allCookies.length;i++) {
			var cookiePair = allCookies[i].split('=');
			this[cookiePair[0]] = cookiePair[1];
		}
	},
	create: function (name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
		this[name] = value;
	}
}

Cookies.init();

function save_field(name,field) {
	var x = field;
	if (x) { Cookies.create(name,x,30) }
}

function init() {
	var wHeight=window.innerHeight;
	var wWidth=window.innerWidth;
	if (navigator.userAgent.indexOf("IE")!=-1) {
		wHeight=document.body.clientHeight;
		wWidth=document.body.clientWidth;
	}
	document.form.wHeight.value=wHeight;
	document.form.wWidth.value=wWidth;
	
	alert("Because of various reasons, I will no longer be updating the Tracker. My suggestion to you is to migrate over to the automated Tracker. I very much appreciate all of you who have been enjoying my work and especially those who have urged me along monetarily. Happy Packratting!");

	if (navigator.userAgent.indexOf("IE")!=-1) {
		var b=confirm("Warning:"+'\n'+"Internet Explorer does not know how to process standard Javascript and will not load the cookies for the Tracker. You will be required to manually save the data if you wish to use IE. There are buttons provided which will allow you to do that. If you would like to use a REAL browser instead of this good-for-nothing browser, click OK. If you would like to continue to use a worthless browser created by inconsiderate pricks who care nothing about their users or about Internet standards, click Cancel.")
		document.form.mansave.checked=true;
	} 
	else {
		if (document.form.macmessage.value!="doneagain") {
			if ((navigator.userAgent.indexOf("Safari")!=-1) && (navigator.platform.indexOf("Mac")!=-1)) {
				alert("The Mac OS X 10.5.6 upgrade is causing problems with Safari's cookies and your browser may not save the data you enter into the Tracker. There are some options which work for some and not for others (Google: Safari losing cookies). If all else fails, you can manually save your Tracker data. Buttons are provided.");
				document.form.macmessage.value="doneagain";
			}
		}
		var x=Cookies["PRTa"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="3") { // if saved with 3
				var h=1;
				for (var i=0;i<=pax.length;++i) {
					for (var j=0;j<=paxcnt[i];++j) { document.form[pax[i]+j].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTa","",-1);
		}
		var x=Cookies["PRTb"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") { // if saved with 2
				var h=1;
				for (var i=0;i<=paxc.length;++i) {
					for (var j=0;j<=paxcntc[i];++j) { document.form[paxc[i]+j].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTb","",-1);
		}
		var x=Cookies["PRTr"];
		if (!x) { x=",,,,,,,,,," }
		var arr=new Array();
		arr=x.split(",");
		for (var i=0;i<ratz.length;i++) { document.form[ratz[i]].value=arr[i] }
		var x=Cookies["PRTap"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="3") {  // if saved with 3
				var h=1;
				for (var i=0;i<=pax.length;++i) {
					for (var j=0;j<=paxcntinit[i];++j) { document.form[pax[i]+j+"p"].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTap","",-1);
		}
		var x=Cookies["PRTbp"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") {  // if saved with 2
				var h=1;
				for (var i=0;i<=paxc.length;++i) {
					for (var j=0;j<=paxcntcinit[i];++j) { document.form[paxc[i]+j+"p"].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTbp","",-1);
		}
		var x=Cookies["PRTc"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") {  // if saved with 2
				var h=1;
				for (var i=0;i<=paxe.length;++i) {
					for (var j=0;j<=paxcnte[i];++j) { document.form[paxe[i]+j].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTc","",-1);
		}
		var x=Cookies["PRTcp"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") {  // if saved with 2
				var h=1;
				for (var i=0;i<=paxe.length;++i) {
					for (var j=0;j<=paxcnteinit[i];++j) { document.form[paxe[i]+j+"p"].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTcp","",-1);
		}
		var x=Cookies["PRTg"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") {  // if saved with 2
				var h=1;
				for (var i=0;i<=paxg.length;++i) {
					for (var j=0;j<=paxcntg[i];++j) { document.form[paxg[i]+j].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTg","",-1);
		}
		var x=Cookies["PRTt"];
		if (!x) { x="" }
		x=unescape(x);
		document.form.textbo.value=x;
		var x=Cookies["PRTm"];
		if (x) {
			var arr=new Array();
			arr=x.split(",");
			document.form.packlink.value=arr[0];
			document.form.menuor[arr[1]].checked=true;
			document.form.prog.checked=(arr[2]=="1");
			document.form.progdis[arr[3]].checked=true;
			document.form.wikic[arr[4]].checked=true;
			document.form.winside[arr[5]].checked=true;
			document.form.macmessage.value=arr[6];
			document.form.refr.checked=(arr[7]=="1");
			document.form.mansave.checked=(arr[8]=="1");
			document.form.hidecom.checked=(arr[9]=="1");
			document.form.showratz.checked=(arr[10]=="1");
			document.form.cl1psopen.checked=(arr[11]=="1");
		}
		var x=Cookies["PRTi"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") {  // if saved with 2
				var h=1;
				for (var i=0;i<=paxi.length;++i) {
					for (var j=0;j<=paxcnti[i];++j) { document.form[paxi[i]+j].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTi","",-1);
		}
		var x=Cookies["PRTip"];
		if (x) {
			var arr=new Array();
			arr=x.split("");
			if (arr[1]==",") { arr=x.split(",") }
			if (arr[0]=="2") {  // if saved with 2
				var h=1;
				for (var i=0;i<=paxi.length;++i) {
					for (var j=0;j<=paxcntiinit[i];++j) { document.form[paxi[i]+j+"p"].checked=(arr[h++]=="1") }
				}
			}
		Cookies.create("PRTip","",-1);
		}
		saveem();
	}
	if (b==true) { parent.mainwin.location="http://www.mozilla.com/firefox/" }
	gothreads();
}

function saveem() {
	if (navigator.userAgent.indexOf("IE")!=-1) { var drew="drew" } else {
		var a="3";
		for (var i=0;i<=pax.length;i++) {
			for (var j=0;j<=paxcnt[i];j++) { a+=(document.form[pax[i]+j].checked) ? "1":"0" }
		}
		save_field("PRTa",a);
		var a="2";
		for (var i=0;i<=paxc.length;i++) {
			for (var j=0;j<=paxcntc[i];j++) { a+=(document.form[paxc[i]+j].checked) ? "1":"0" }
		}
		save_field("PRTb",a);
		var a="2";
		for (var i=0;i<=paxe.length;i++) {
			for (var j=0;j<=paxcnte[i];j++) { a+=(document.form[paxe[i]+j].checked) ? "1":"0" }
		}
		save_field("PRTc",a);
		var a="2";
		for (var i=0;i<=paxi.length;i++) {
			for (var j=0;j<=paxcnti[i];j++) { a+=(document.form[paxi[i]+j].checked) ? "1":"0" }
		}
		save_field("PRTi",a);
		var a="3";
		for (var i=0;i<=pax.length;++i) {
			for (var j=0;j<=paxcntinit[i];++j) { a+=(document.form[pax[i]+j+"p"].checked) ? "1":"0" }
		}
		save_field("PRTap",a);
		var a="2";
		for (var i=0;i<=paxc.length;++i) {
			for (var j=0;j<=paxcntcinit[i];++j) { a+=(document.form[paxc[i]+j+"p"].checked) ? "1":"0" }
		}
		save_field("PRTbp",a);
		var a="2";
		for (var i=0;i<=paxe.length;++i) {
			for (var j=0;j<=paxcnteinit[i];++j) { a+=(document.form[paxe[i]+j+"p"].checked) ? "1":"0" }
		}
		save_field("PRTcp",a);
		var a="2";
		for (var i=0;i<=paxi.length;++i) {
			for (var j=0;j<=paxcntiinit[i];++j) { a+=(document.form[paxi[i]+j+"p"].checked) ? "1":"0" }
		}
		save_field("PRTip",a);
		var a="";
		for (var i=0;i<ratz.length;++i) { a+=document.form[ratz[i]].value+"," }
		save_field("PRTr",a);
		var a="2";
		for (var i=0;i<=paxg.length;++i) {
			for (var j=0;j<=paxcntg[i];++j) { a+=(document.form[paxg[i]+j].checked) ? "1":"0" }
		}
		save_field("PRTg",a);
		var a=escape(document.form.textbo.value);
		save_field("PRTt",a);
		var a=document.form.packlink.value+",";
		for (var i=0;i<document.form.menuor.length;i++) {
			if (document.form.menuor[i].checked) { a+=i+"," }
		}
		a+=(document.form.prog.checked) ? "1,":"0,";
		for (var i=0;i<document.form.progdis.length;i++) {
			if (document.form.progdis[i].checked) { a+=i+"," }
		}
		for (var i=0;i<document.form.wikic.length;i++) {
			if (document.form.wikic[i].checked) { a+=i+"," }
		}
		for (var i=0;i<document.form.winside.length;i++) {
			if (document.form.winside[i].checked) { a+=i+"," }
		}
		a+=document.form.macmessage.value+",";
		a+=(document.form.refr.checked) ? "1,":"0,";
		a+=(document.form.mansave.checked) ? "1,":"0,";
		a+=(document.form.hidecom.checked) ? "1,":"0,";
		a+=(document.form.showratz.checked) ? "1,":"0,";
		a+=(document.form.cl1psopen.checked) ? "1,":"0,";
		save_field("PRTm",a);
	}
}

var nV=0;
var nW=0;
function refresh() {
	(!window.mainwin.document.body.scrollTop) ? nV=window.mainwin.document.documentElement.scrollTop : nV=window.mainwin.document.body.scrollTop;
	if (nV!=nW) {
		document.getElementById("slider").style.display="none";
		nW=nV;
	}
	else {
		document.getElementById("slider").style.display="block";
	}
	setTimeout("refresh()",50);
}

function gowikipack() { parent.mainwin.location="http://packrattools.com/info/" }

function show(a) {
	if (document.form.whichagain.value) { progress() };
	document.form.whichagain.value=a;
	for (var i=0;i<pax.length;i++) { document.getElementById(pax[i]+"d").style.display="none" }
	for (var i=0;i<paxc.length;i++) { document.getElementById(paxc[i]+"d").style.display="none" }
	for (var i=0;i<paxe.length;i++) { document.getElementById(paxe[i]+"d").style.display="none" }
	for (var i=0;i<paxi.length;i++) { document.getElementById(paxi[i]+"d").style.display="none" }
	dnduo();
	document.getElementById(a+"d").style.display="block";
	document.getElementById(a+"d").style.opacity=1;
	document.form.which.value=a+"d";
	if (84+document.getElementById(a+"d").clientHeight+20>=window.innerHeight) {
		document.getElementById(a+"d").style.top=((window.innerHeight-document.getElementById(a+"d").clientHeight)-20)+"px";
	}
	if (document.getElementById(a+"d").clientHeight>window.innerHeight) {
		document.getElementById(a+"d").style.height=window.innerHeight-23+"px";
		document.getElementById(a+"d").style.width="226px";
	}
	if (navigator.userAgent.indexOf("IE")!=-1) { if (84+document.getElementById(a+"d").clientHeight+20>=document.body.clientHeight) { document.getElementById(a+"d").style.top=((document.body.clientHeight-document.getElementById(a+"d").clientHeight)-20)+"px" } }
	if (parseInt(document.getElementById(a+"d").style.top)<8) { document.getElementById(a+"d").style.top="8px" }
	document.getElementById("guide").style.display="none";
	sizetb(a+"d");
	closemenu();
}
function hide() {
	a=document.form.which.value;
	if (a=="Nd") { var don="D" }
	else { var don="N" }
	document.getElementById(don+"d").style.display="none";
	document.getElementById(don+"d").style.left="8px";
	document.getElementById("guide").style.display="block";
	if (document.getElementById(a).style.opacity>0) {
		document.getElementById(a).style.opacity-=.1;
		TimerIdd=setTimeout(hide,1);
	}
	else {
		clearTimeout(TimerIdd);
		document.getElementById(a).style.display="none";
		document.form.which.value="guide";
		sizetb("guide");
		if (navigator.userAgent.indexOf("IE")!=-1) { var blew="blew" } else { saveem() }
		if (document.form.whichagain.value) { progress() };
	}
}

function showrepe(recip) {
	var recipr=recip+"r";
	var recipw=recip+"w";
	howhigh=document.getElementById(recipw).offsetTop;
	document.getElementById(recipr).style.display="block";
  	if (document.getElementById(recipr).clientHeight<28) { document.getElementById(recipr).style.top=howhigh-25 }
  	else { document.getElementById(recipr).style.top=howhigh-37 }
  	if (document.getElementById(recipr).clientHeight>45) { document.getElementById(recipr).style.top=howhigh-50 }
	if (document.getElementById(recipw).innerHTML!="close") { document.getElementById(recipw).innerHTML="show" }
}

function hiderepe(recip) {
	var recipr=recip+"r";
	var recipw=recip+"w";
	if (document.getElementById(recipw).innerHTML!="close") { document.getElementById(recipw).innerHTML="recipe" }
	document.getElementById(recipr).style.display="none";
}

function showrec(recip) {
	var recipw=recip+"w";
	var recip=recip+"rec";
	if (document.getElementById(recipw).innerHTML=="show") {
		document.getElementById(recip).style.display="block";
		document.getElementById(recipw).innerHTML="close";
	}
	else {
		document.getElementById(recip).style.display="none";
		document.getElementById(recipw).innerHTML="recipe";
	}

	var set=recip.slice(0, -4)
	if (set!="PC08") {
		var Char=set.charAt(set.length-1);
		if (Char=="1" || Char=="2" || Char=="3" || Char=="4" || Char=="5" || Char=="6" || Char=="7" || Char=="8" || Char=="9" || Char=="0") { var set=set.slice(0, -1) }
	}
	sizetb(set+"d");
	var bb=document.form.which.value;
	document.getElementById(bb).style.height="";
	document.getElementById(bb).style.width="212px";
	if (navigator.userAgent.indexOf("IE")!=-1) {
		if (106+document.getElementById(bb).clientHeight+10>=document.body.clientHeight) {
			document.getElementById(bb).style.top=((document.body.clientHeight-document.getElementById(bb).clientHeight)-20)+"px";
		}
		if (document.getElementById(bb).clientHeight>(document.body.clientHeight-18)) {
			document.getElementById(bb).style.height=document.body.clientHeight-23+"px";
			document.getElementById(bb).style.width="226px";
		}
	}
	else {
		if (106+document.getElementById(bb).clientHeight+10>=window.innerHeight) {
			document.getElementById(bb).style.top=((window.innerHeight-document.getElementById(bb).clientHeight)-20)+"px";
		}
		else { document.getElementById(bb).style.top="106px" }
		if (document.getElementById(bb).clientHeight>(window.innerHeight-18)) {
			document.getElementById(bb).style.height=window.innerHeight-23+"px";
			document.getElementById(bb).style.width="226px";
		}
	}
	if (parseInt(document.getElementById(bb).style.top)<8) { document.getElementById(bb).style.top="8px" }
}
function httpgo() {
	if (document.form.showratz.checked==true) {
		document.getElementById("guidethreads").style.display="none";
		flip();
	}
	else {
		if (document.getElementById("linx").style.display=="block") { document.getElementById("linx").style.display="none" }
		else { document.getElementById("linx").style.display="block" }
	}
}

function slide() {
	var door=document.getElementById("slider");
	if (door.style.left=="0px") { slideleft() } else { slideright() }
}
function slideleft() {
	var door=document.getElementById("slider");
	if (door.style.left!="-240px") {
		door.style.left=parseInt(door.style.left)-10+"px";
		TimerIdd=setTimeout(slideleft,1);
	}
	else {
		clearTimeout(TimerIdd);
		document.getElementById("tabb").src="tab.png";
	}
}
function slideright() {
	var door=document.getElementById("slider");
	if (door.style.left!="0px") {
		door.style.left=parseInt(door.style.left)+10+"px";
		TimerIdd=setTimeout(slideright,1);
	}
	else {
		clearTimeout(TimerIdd);
		document.getElementById("tabb").src="tabo.png";
	}
}

function slider() {
	var door=document.getElementById("slider");
	if (document.getElementById("barshowright").style.display=="none") { sliderright() } else { sliderleft() }
}
function sliderleft() {
	wWidth=document.form.wWidth.value;
	if (fullwidth=="no") { var sleft=wWidth-265 }
	if (fullwidth=="yes") { var sleft=wWidth-240 }
	var stophere=sleft;
	var door=document.getElementById("slider");
	door.style.display="block";
	document.getElementById("tabshowright").style.display="none";
	document.getElementById("barshowright").style.display="none";
	if (parseInt(door.style.left)!=stophere) {
		door.style.left=parseInt(door.style.left)-10+"px";
		TimerIdd=setTimeout(sliderleft,1);
	}
	else {
		clearTimeout(TimerIdd);
	}
}
function sliderright() {
	wWidth=document.form.wWidth.value;
	var door=document.getElementById("slider");
	if (fullwidth=="no") { var stophere=wWidth-15 }
	if (fullwidth=="yes") { var stophere=wWidth }
	if (parseInt(door.style.left)!=stophere) {
		door.style.left=parseInt(door.style.left)+10+"px";
		if (parseInt(door.style.left)>stophere) { door.style.left=stophere+"px" }
		TimerIdd=setTimeout(sliderright,1);
	}
	else {
		clearTimeout(TimerIdd);
		document.getElementById("tabshowright").style.display="block";
		document.getElementById("barshowright").style.display="block";
		door.style.display="none";
	}
}

function moveslide() {
	var door=document.getElementById("slider");
	document.getElementById("tabforleft").style.display="none";
	document.getElementById("tabforright").style.display="none";
	document.getElementById("baronright").style.display="block";
	if (door.style.left=="0px") { moveslideright() } else { moveslideleft() }
}
var agm="no";
function moveslideright() {
	closemenu();
	wWidth=document.form.wWidth.value;
	var door=document.getElementById("slider");
	if (fullwidth=="no") { var sleft=wWidth-265 }
	if (fullwidth=="yes") { var sleft=wWidth-240 }
	if (parseInt(door.style.left)>sleft) { door.style.left=sleft+"px" }
	if (parseInt(door.style.left)!=sleft) {
		door.style.left=parseInt(door.style.left)+10+"px";
		TimerIdd=setTimeout(moveslideright,1);
		if (parseInt(door.style.left)>sleft) { door.style.left=sleft+"px" }
		if (parseInt(door.style.left)>sleft-15 && fullwidth=="yes") { document.getElementById("baronright").style.display="none" }
	}
	else { 
		clearTimeout(TimerIdd);
		movesliderightb();
	}
}
function movesliderightc() {
	wWidth=document.form.wWidth.value;
	if (fullwidth=="no") { var sleft=wWidth-265 }
	if (fullwidth=="yes") { var sleft=wWidth-240 }
	document.getElementById("slider").style.left=sleft+"px";
	document.getElementById("slider").style.top="0px";
	movesliderightb();
}
function movesliderightb() {
	wHeight=document.form.wHeight.value;
	document.getElementById("slider").style.height=wHeight;
	document.getElementById("attachright").style.display="none";
	document.getElementById("attachleft").style.display="none";
	document.getElementById("mainwindiv").style.left="0px";
	if (fullwidth=="no") { document.getElementById("mainwin").width=(parseInt(document.getElementById("mainwin").width)+10)+"px" }
	document.getElementById("toright").style.display="none";
	document.getElementById("lttabl").style.display="none";
	document.getElementById("toleft").style.display="block";
	document.getElementById("lttabr").style.display="block";
	document.getElementById("title").style.left="20px";
	document.getElementById("titledet").style.left="20px";
	document.getElementById("tabforright").style.display="block";
	document.getElementById("curmenu").style.left="34px";
	document.getElementById("retmenu").style.left="136px";
	document.getElementById("detachright").style.display="block";
	document.getElementById("detachleft").style.display="none";
	document.getElementById("baronright").style.height=wHeight;
	document.getElementById("baronleft").style.height=wHeight;
		document.getElementById("textboxlink").style.top=wHeight-14;
		document.getElementById("attachright").style.top=wHeight-14;
		document.getElementById("attachleft").style.top=wHeight-14;
	document.getElementById("slider").style.height=wHeight;
	if (agm=="no") { alert("Like the Tracker on the right side of the window? Now, there's a preference to start it that way every time. Just click on Tracker Preferences on the Main Window to make the change.") }
	agm="yes";
}
function moveslideleft() {
	closemenu();
	var door=document.getElementById("slider");
	var sleft=0;
	if (parseInt(door.style.left)<0) { door.style.left="0px" }
	if (parseInt(door.style.left)!=0) {
		door.style.left=parseInt(door.style.left)-10+"px";
		TimerIdd=setTimeout(moveslideleft,1);
		if (parseInt(door.style.left)<sleft) { door.style.left=sleft+"px" }
	}
	else {
		clearTimeout(TimerIdd);
		moveslideleftb();
	}
}
function moveslideleftc() {
	document.getElementById("slider").style.left="0px";
	document.getElementById("slider").style.top="0px";
	moveslideleftb();
}
function moveslideleftb() {
	wHeight=document.form.wHeight.value;
	document.getElementById("slider").style.height=wHeight;
	document.getElementById("attachright").style.display="none";
	document.getElementById("attachleft").style.display="none";
	if (fullwidth=="no") { document.getElementById("mainwindiv").style.left="10px" }
	else { document.getElementById("mainwindiv").style.left="250px" }
	if (fullwidth=="no") { document.getElementById("mainwin").width=(parseInt(document.getElementById("mainwin").width)-10)+"px" }
	document.getElementById("toright").style.display="block";
	document.getElementById("lttabl").style.display="block";
	document.getElementById("toleft").style.display="none";
	document.getElementById("lttabr").style.display="none";
	document.getElementById("title").style.left="6px";
	document.getElementById("titledet").style.left="6px";
	document.getElementById("tabforleft").style.display="block";
	document.getElementById("curmenu").style.left="20px";
	document.getElementById("retmenu").style.left="122px";
	document.getElementById("detachright").style.display="none";
	document.getElementById("detachleft").style.display="block";
	document.getElementById("baronright").style.height=wHeight;
	document.getElementById("baronleft").style.height=wHeight;
		document.getElementById("textboxlink").style.top=wHeight-14;
		document.getElementById("attachright").style.top=wHeight-14;
		document.getElementById("attachleft").style.top=wHeight-14;
	document.getElementById("slider").style.height=wHeight;
}

function checkall(coll) {
	for (var i=0;i<=paxcntinit[coll];i++) { document.form[pax[coll]+i].checked=true }
}
function vault(coll) {
	for (var i=0;i<=paxcntinit[coll];++i) {
		if (document.form[pax[coll]+i+"p"].checked) { document.form[pax[coll]+i].checked=true; document.form[pax[coll]+i+"p"].checked=false; }
	}
}
function checkallc(coll) {
	for (var i=0;i<=paxcntcinit[coll];i++) { document.form[paxc[coll]+i].checked=true }
}
function vaultc(coll) {
	for (var i=0;i<=paxcntcinit[coll];++i) {
		if (document.form[paxc[coll]+i+"p"].checked) { document.form[paxc[coll]+i].checked=true; document.form[paxc[coll]+i+"p"].checked=false; }
	}
}
function checkalle(coll) {
	for (var i=0;i<=paxcnteinit[coll];i++) { document.form[paxe[coll]+i].checked=true }
}
function vaulte(coll) {
	for (var i=0;i<=paxcnteinit[coll];++i) {
		if (document.form[paxe[coll]+i+"p"].checked) { document.form[paxe[coll]+i].checked=true; document.form[paxe[coll]+i+"p"].checked=false; }
	}
}
function checkalli(coll) {
	for (var i=0;i<=paxcntiinit[coll];i++) { document.form[paxi[coll]+i].checked=true }
}
function vaulti(coll) {
	for (var i=0;i<=paxcntiinit[coll];++i) {
		if (document.form[paxi[coll]+i+"p"].checked) { document.form[paxi[coll]+i].checked=true; document.form[paxi[coll]+i+"p"].checked=false; }
	}
}

function rover(wimg,wimgt) {
	document.getElementById(wimg).src=wimgt+"over.gif";
}
function rout(wimg,wimgt) {
	document.getElementById(wimg).src=wimgt+".gif";
}

function market(market) {
	if (market=="C") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/washington-dc" }
	if (market=="L") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/london" }
	if (market=="N") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/venice" }
	if (market=="S") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/moscow" }
	if (market=="B") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/berkeley" }
	if (market=="P") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/paris" }
	if (market=="D") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/beijing" }
	if (market=="SD") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/portofino" }
	if (market=="A") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/austin" }
	if (market=="SP") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/singapore" }
	if (market=="V") { parent.mainwin.location="http://apps.facebook.com/packrat/markets/vancouver" }
}

function moveboxes() {
	if (navigator.userAgent.indexOf("IE")!=-1) { changeRulei(1) }
	document.getElementById("shebang").style.display="block";
	clearTimeout(loadin);
	document.getElementById("pleasewait").style.display="none";
}
function changeRulei(theNumber) {
	var theRules = new Array();
	if (document.styleSheets[0].cssRules) { theRules = document.styleSheets[0].cssRules }
	else if (document.styleSheets[0].rules) { theRules = document.styleSheets[0].rules }
	theRules[theNumber].style.left="5px";
	theRules[theNumber].style.top="19px";
	theRules[theNumber+1].style.left="11px";
	theRules[theNumber+1].style.top="22px";
	theRules[theNumber+2].style.left="25px";
	theRules[theNumber+2].style.top="19px";
	theRules[theNumber+3].style.left="31px";
	theRules[theNumber+3].style.top="22px";
	theRules[theNumber+4].style.padding="0px 0px 0px 20px";
	theRules[theNumber+5].style.width="224px";
	theRules[theNumber+9].style.width="208px";
	theRules[theNumber+9].style.padding="2px 0px 2px 25px;";
	document.getElementById("curmenu").style.width="91px";
	document.getElementById("curmenu").style.height="19px";
	document.getElementById("retmenu").style.width="91px";
	document.getElementById("retmenu").style.height="19px";
	theRules[theNumber+10].style.padding="2px 0px 2px 0px";
	theRules[theNumber+10].style.width="208px";
}

function savethread(aaa) {
	if (document.getElementById("thread"+aaa).innerHTML=="save thread") {
		document.form["thread"+aaa+"save"].value=document.getElementById("mainwin").contentWindow.location;
		document.getElementById("thread"+aaa).innerHTML=document.getElementById("mainwin").contentWindow.document.title;
	}
	else { parent.mainwin.location=document.form["thread"+aaa+"save"].value }
}
function clearthread(aaa) {
	document.form["thread"+aaa+"save"].value="";
	document.getElementById("thread"+aaa).innerHTML="save thread";
}

function resized() {
	var wHeight=window.innerHeight;
	var wWidth=window.innerWidth;
	if (navigator.userAgent.indexOf("IE")!=-1) {
		wHeight=document.body.clientHeight;
		wWidth=document.body.clientWidth;
	}
	document.form.wHeight.value=wHeight;
	document.form.wWidth.value=wWidth;
	cWidth=wWidth-10;
	document.getElementById("mainwin").style.height=wHeight;
	document.getElementById("mainwin").style.width=wWidth;
	if (document.getElementById("lineonbottom2").style.display=="none") {
	wWidth<1152 ? fullwidth="no" : fullwidth="yes";
		document.getElementById("slider").style.top="0px";
		document.getElementById("slider").style.height=wHeight;
		if (document.getElementById("titledet").style.display=="none") {
			document.getElementById("slider").style.height=wHeight
			if (wWidth<1152) {
				document.getElementById("mainwindiv").style.left="10px";
				document.getElementById("mainwin").style.width=cWidth;
			}
			else {
				document.getElementById("mainwindiv").style.left="250px";
				document.getElementById("mainwin").style.width=wWidth-250;
			}
		}
		else { document.getElementById("slider").style.height=wHeight-60 }
		wHeight=document.getElementById("slider").offsetHeight;
		document.getElementById("baronleft").style.height=wHeight;
		document.getElementById("baronright").style.height=wHeight;
		document.getElementById("barshowright").style.height=wHeight;
		document.getElementById("tabforleft").style.top=wHeight-270;
		document.getElementById("tabforright").style.top=wHeight-270;
		document.getElementById("tabshowright").style.top=wHeight-270;
		document.getElementById("toright").style.top=wHeight-14;
		document.getElementById("toleft").style.top=wHeight-14;
		document.getElementById("detachright").style.top=wHeight-14;
		document.getElementById("detachleft").style.top=wHeight-14;
		document.getElementById("lineonbottom").style.top=wHeight-1;
		document.getElementById("lineonbottom2").style.top=wHeight-1;
		document.getElementById("textboxlink").style.top=wHeight-14;
		document.getElementById("attachright").style.top=wHeight-14;
		document.getElementById("attachleft").style.top=wHeight-14;
		sizetb(document.form.which.value);

		var bb=document.form.which.value;
		document.getElementById(bb).style.height="";
		document.getElementById(bb).style.width="212px";
		if (navigator.userAgent.indexOf("IE")!=-1) {
			if (106+document.getElementById(bb).clientHeight+10>=document.body.clientHeight) {
				document.getElementById(bb).style.top=((document.body.clientHeight-document.getElementById(bb).clientHeight)-20)+"px";
			}
			if (document.getElementById(bb).clientHeight>(document.body.clientHeight-18)) {
				document.getElementById(bb).style.height=document.body.clientHeight-23+"px";
				document.getElementById(bb).style.width="226px";
			}
		}
		else {
			if (106+document.getElementById(bb).clientHeight+10>=window.innerHeight) {
				document.getElementById(bb).style.top=((window.innerHeight-document.getElementById(bb).clientHeight)-20)+"px";
			}
			else { document.getElementById(bb).style.top="106px" }
			if (document.getElementById(bb).clientHeight>(window.innerHeight-18)) {
				document.getElementById(bb).style.height=window.innerHeight-23+"px";
				document.getElementById(bb).style.width="226px";
			}
		}
		if (parseInt(document.getElementById(bb).style.top)<8) { document.getElementById(bb).style.top="8px" }
		if (document.getElementById("curmenu").style.left=="34px") {
			movesliderightc();
			if (fullwidth=="no") { document.getElementById("baronright").style.display="block" }
		}
	}
}

function textboxshow() {
	if (document.getElementById("textbox").style.display=="none") { document.getElementById("textbox").style.display="block" }
	else { document.getElementById("textbox").style.display="none" }
}
function sizetb(a) {
	wHeight=parseInt(document.getElementById("slider").style.height);
	document.getElementById("textbox").style.top=84+document.getElementById(a).clientHeight+34+"px";
	var dHeight=wHeight-(parseInt(document.getElementById("textbox").style.top))-21;
	if (dHeight<100) {
		dHeight=100;
		document.getElementById("textbox").style.top=(wHeight-105)+"px";
	}
	document.getElementById("textbo").style.height=dHeight+"px";
}

function colmenu(bb,cc) {
	if (document.form.whichagain.value) { progress() };
	(parseInt(document.getElementById("slider").style.left)>600) ? document.getElementById("retired").style.left="-605px" : document.getElementById("retired").style.left="16px";
	for (var i=0;i<document.form.menuor.length;i++) { if (document.form.menuor[i].checked) { var rad_val=document.form.menuor[i].value } }
	(parseInt(document.getElementById("slider").style.left)>600) ? document.getElementById("retiredl").className="coll links linksr" : document.getElementById("retiredl").className+="coll links linksl";
	document.getElementById(bb).style.display="block";
	document.getElementById(cc).style.display="none";
	if (!document.getElementById(bb).style.left) { document.getElementById(bb).style.left="16px" }
}
function closemenu() {
	document.getElementById("current").style.display="none";
	document.getElementById("retired").style.display="none";
}

function hilite(ab,bc,cd) {
	document.getElementById(ab).className="coll "+ab+" "+bc+" "+cd;
}
function idd() {
	var goahead=confirm("Input your pack link to access additional Tracker features. To do so now, click OK. (You will need to have just copied it.)");
	if (goahead) {
		var msg1="Paste your pack link below:";
		var ans1="";
		ans1="http://apps.facebook.com/packrat/users/"+document.form.packlink.value;
		if (ans1=="http://apps.facebook.com/packrat/users/") { ans1="" }
		var iddadd=prompt(msg1,ans1);
		iddlen=iddadd.length;
		var iddd="";
		for (var i=39;i<=iddlen;i++) {
			iddchar=iddadd.charAt(i);
			iddd=iddd+iddchar;
		}
		for (var i=iddlen-1;i>=iddlen-2;i--) {
			if (iddchar=="/") { iddd="" }
		}
		document.form.packlink.value=iddd;
		checkid();
	}
}
function checkid() {
	for (var i=0;i<pax.length;i++) {
		document.getElementById(pax[i]+"bot").innerHTML="<p align='center'><a href='http://packrattools.com/tracker/?type=&market_type=&market=&collection="+vlt[i]+"&filter=Filter' target='mainwin'>Check this Collection's Market Report</a><br><a class='lal' onClick=\"stillneed(document.form['"+pax[i]+"text'].value)\">What You Need</a> | <a class='lal' onClick=\"vault('"+i+"')\">Vault Pack Cards</a><span id='"+pax[i]+"lks'> | <a href='http://apps.facebook.com/packrat/' target='mainwin'></span>Pack</a></p>"
	}
	for (var i=0;i<paxc.length;i++) {
		document.getElementById(paxc[i]+"bot").innerHTML="<p align='center'><a href='http://packrattools.com/tracker/?type=&market_type=&market=&collection="+vltc[i]+"&filter=Filter' target='mainwin'>Check this Collection's Market Report</a><br><a class='lal' onClick=\"stillneed(document.form['"+paxc[i]+"text'].value)\">What You Need</a> | <a class='lal' onClick=\"vaultc('"+i+"')\">Vault Pack Cards</a><span id='"+paxc[i]+"lks'> | <a href='http://apps.facebook.com/packrat/' target='mainwin'></span>Pack</a></p>"
	}
	for (var i=0;i<paxe.length;i++) {
		document.getElementById(paxe[i]+"bot").innerHTML="<p align='center'><a href='http://packrattools.com/tracker/?type=&market_type=&market=&collection="+vlte[i]+"&filter=Filter' target='mainwin'>Check this Collection's Market Report</a><br><a class='lal' onClick=\"stillneed(document.form['"+paxe[i]+"text'].value)\">What You Need</a> | <a class='lal' onClick=\"vaulte('"+i+"')\">Vault Pack Cards</a><span id='"+paxe[i]+"lks'> | <a href='http://apps.facebook.com/packrat/' target='mainwin'></span>Pack</a></p>"
	}
	for (var i=0;i<paxi.length;i++) {
		document.getElementById(paxi[i]+"bot").innerHTML="<p align='center'><a href='http://packrattools.com/tracker/?type=&market_type=&market=&collection="+vlti[i]+"&filter=Filter' target='mainwin'>Check this Collection's Market Report</a><br><a class='lal' onClick=\"stillneed(document.form['"+paxi[i]+"text'].value)\">What You Need</a> | <a class='lal' onClick=\"vaulti('"+i+"')\">Vault Pack Cards</a><span id='"+paxi[i]+"lks'> | <a href='http://apps.facebook.com/packrat/' target='mainwin'></span>Pack</a></p>"
	}
	if (document.form.packlink.value.length>0) {
		var idd=document.form.packlink.value;
		document.getElementById("idd").innerHTML="<img src='mbutidb.gif' border='0'>";
		document.getElementById("iddd").innerHTML="<a href='#' onClick='copyid()'><img src='mbutshowb.gif' border='0'></a>";
		document.getElementById("plink").innerHTML="<br><a href='#' onClick='copyid(); blur(); httpgo()'><img src='dispacklink.gif' border='0'></a>";
		document.getElementById("prlinkst").innerHTML="<br><a href='http://apps.facebook.com/packrat/users/"+idd+"/vault' target='mainwin' onClick='blur(); httpgo()'><img src='packyourvault.gif' border='0'></a><br><a href='http://apps.facebook.com/packrat/users/"+idd+"/friends' target='mainwin' onClick='blur(); httpgo()'><img src='packsteal.gif' border='0'></a>";
		document.getElementById("prlinks2t").innerHTML="<br><a href='http://apps.facebook.com/packrat/users/"+idd+"/trades' target='mainwin' onClick='blur(); httpgo()'><img src='packtrades.gif' border='0'></a>";
		for (var i=0;i<pax.length;i++) {
			document.getElementById(pax[i]+"lks").innerHTML="<br><a href='http://apps.facebook.com/packrat/users/"+idd+"/vault?collection="+vlt[i]+"' target='mainwin'>This Collection\'s Vault</a> | <a href='http://apps.facebook.com/packrat/' target='mainwin'>Your "
		}
		for (var i=0;i<paxc.length;i++) {
			document.getElementById(paxc[i]+"lks").innerHTML="<br><a href='http://apps.facebook.com/packrat/users/"+idd+"/vault?collection="+vltc[i]+"' target='mainwin'>This Collection\'s Vault</a> | <a href='http://apps.facebook.com/packrat/' target='mainwin'>Your "
		}
		for (var i=0;i<paxe.length;i++) {
			document.getElementById(paxe[i]+"lks").innerHTML="<br><a href='http://apps.facebook.com/packrat/users/"+idd+"/vault?collection="+vlte[i]+"' target='mainwin'>This Collection\'s Vault</a> | <a href='http://apps.facebook.com/packrat/' target='mainwin'>Your "
		}
		for (var i=0;i<paxi.length;i++) {
			document.getElementById(paxi[i]+"lks").innerHTML="<br><a href='http://apps.facebook.com/packrat/users/"+idd+"/vault?collection="+vlti[i]+"' target='mainwin'>This Collection\'s Vault</a> | <a href='http://apps.facebook.com/packrat/' target='mainwin'>Your "
		}
	}
	else {
		document.getElementById("idd").innerHTML="<img src='mbutida.gif' border='0'>";
		document.getElementById("iddd").innerHTML="<img src='mbutshowa.gif' border='0'>";
		document.getElementById("plink").innerHTML="";
//		document.getElementById("prlinks").innerHTML="";
		document.getElementById("prlinkst").innerHTML="";
//		document.getElementById("prlinks2").innerHTML="";
		document.getElementById("prlinks2t").innerHTML="";
	}
}
function copyid() { prompt("Highlight and copy this to paste:","http://apps.facebook.com/packrat/users/"+document.form.packlink.value) }
function progress() {
	var coll=document.form.whichagain.value;
	for (var i=0;i<pax.length;i++) {
		if (pax[i]==coll) {
			var colln=pax[i];
			var a=0;
			for (var j=0;j<=paxcntinit[i];++j) {
				if (document.form[pax[i]+j].checked) { a+=1 }
			}
		}
	}
	for (var i=0;i<paxc.length;i++) {
		if (paxc[i]==coll) {
			var colln=paxc[i];
			var a=0;
			for (var j=0;j<=paxcntcinit[i];++j) {
				if (document.form[paxc[i]+j].checked) { a+=1 }
			}
		}
	}
	for (var i=0;i<paxe.length;i++) {
		if (paxe[i]==coll) {
			var colln=paxe[i];
			var a=0;
			for (var j=0;j<=paxcnteinit[i];++j) {
				if (document.form[paxe[i]+j].checked) { a+=1 }
			}
		}
	}
	for (var i=0;i<paxi.length;i++) {
		if (paxi[i]==coll) {
			var colln=paxi[i];
			var a=0;
			for (var j=0;j<=paxcntiinit[i];++j) {
				if (document.form[paxi[i]+j].checked) { a+=1 }
			}
		}
	}
	z=Math.round((a/j)*100);
	if (document.form.hidecom.checked && z==100) { document.getElementById(colln).style.display="none" }
	if (document.form.prog.checked && z==100) { var reed="" }
	else {
		var reed="";
		if (document.form.progdis[0].checked) { reed=a+"/"+j+"<br>"+z+"%" }
		if (document.form.progdis[1].checked) { reed=a+"/"+j }
		if (document.form.progdis[2].checked) { reed=z+"%" }
	}
	document.getElementById(colln+"comp").innerHTML=reed;
}
function prefs() {
	if (document.getElementById("prefs").style.display=="none") {
		document.getElementById("prefs").style.display="block";
		document.getElementById("prefshad").style.height=document.getElementById("prefs").clientHeight;
		document.getElementById("prefshad").style.display="block";
	}
	else {
		document.getElementById("prefs").style.display="none";
		document.getElementById("prefshad").style.display="none";
	}
}
function setwiki() {
	if (document.form.winside[1].checked) { movesliderightc() }
}

function newguide(don,donn) {
	if (document.getElementById(don+"d").style.display=="none") {
		document.getElementById(don+"d").style.left="238px";
		if (document.getElementById("tabforleft").style.display=="none") { document.getElementById(don+"d").style.left="-226px" }
		document.getElementById(don+"d").style.opacity="1";
		document.getElementById(don+"d").style.display="block";
		document.getElementById(don+"buddy").src="bdyr.png";
		document.getElementById(donn+"buddy").src="spacer.gif";
	}
	else {
		document.getElementById(don+"d").style.left="8px";
		document.getElementById(don+"d").style.display="none";
		document.getElementById(don+"buddy").src="bdy.png";
		document.getElementById(donn+"buddy").src="bdy.png";
	}
}
function dnduo() {
	document.getElementById("Dd").style.display="none";
	document.getElementById("Dd").style.left="8px";
	document.getElementById("Nd").style.display="none";
	document.getElementById("Nd").style.left="8px";
	document.getElementById("Dbuddy").src="bdy.png";
	document.getElementById("Nbuddy").src="bdy.png";
}

var incr=60;
function makedetached() {
	wWidth=document.form.wWidth.value;
	document.getElementById("titledet").style.display="block";
	document.getElementById("title").style.display="none";
	document.getElementById("tabforleft").style.display="none";
	document.getElementById("tabforright").style.display="none";
	document.getElementById("baronright").style.display="block";
	document.getElementById("toright").style.display="none";
	document.getElementById("toleft").style.display="none";
	document.getElementById("lttabl").style.display="block";
	document.getElementById("lttabr").style.display="none";
	document.getElementById("title").style.left="6px";
	document.getElementById("titledet").style.left="6px";
	document.getElementById("curmenu").style.left="20px";
	document.getElementById("retmenu").style.left="122px";
	document.getElementById("detachright").style.display="none";
	document.getElementById("detachleft").style.display="none";
	document.getElementById("mainwindiv").style.left="0px";
	document.getElementById("mainwin").style.width=wWidth;
	document.getElementById("attachright").style.display="block";
	document.getElementById("attachleft").style.display="block";
	document.getElementById("slider").style.top="25px";
	document.getElementById("lineonbottom2").style.left=parseInt(document.getElementById("lineonbottom").style.left)-10;
	document.getElementById("lineonbottom2").style.top=document.getElementById("lineonbottom").style.top;
	document.getElementById("lineonbottom2").style.display="block";
	document.getElementById("lineonbottom").style.display="none";
	detachsize();
	alert("You may now move the Tracker around the window by clicking and dragging the logo.");
}
function reattach(side) {
	document.getElementById("title").style.display="block";
	document.getElementById("titledet").style.display="none";
	document.getElementById("lineonbottom2").style.display="none";
	document.getElementById("lineonbottom").style.display="block";
	side=="left" ? movesliderightc() : moveslideleftc();
	sizetb("guide");
}
function detachsize() {
	wHeight=document.form.wHeight.value;
	document.getElementById("baronright").style.height=wHeight-incr;
	document.getElementById("baronleft").style.height=wHeight-incr;
	document.getElementById("attachright").style.top=parseInt(document.getElementById("attachright").style.top)-incr;
	document.getElementById("attachleft").style.top=parseInt(document.getElementById("attachleft").style.top)-incr;
	document.getElementById("textboxlink").style.top=parseInt(document.getElementById("textboxlink").style.top)-incr;
	document.getElementById("lineonbottom2").style.top=parseInt(document.getElementById("lineonbottom").style.top)-incr;
	document.getElementById("slider").style.height=wHeight-incr;
	sizetb("guide");
}
var cl1pwin;
function getcookie() {
	saveem();
	var cuke="3,";
	for (var i=0;i<=pax.length;i++) {
		for (var j=0;j<=paxcnt[i];j++) { cuke+=(document.form[pax[i]+j].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxc.length;i++) {
		for (var j=0;j<=paxcntc[i];j++) { cuke+=(document.form[paxc[i]+j].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxe.length;i++) {
		for (var j=0;j<=paxcnte[i];j++) { cuke+=(document.form[paxe[i]+j].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxi.length;i++) {
		for (var j=0;j<=paxcnti[i];j++) { cuke+=(document.form[paxi[i]+j].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="3,";
	for (var i=0;i<=pax.length;++i) {
		for (var j=0;j<=paxcntinit[i];++j) { cuke+=(document.form[pax[i]+j+"p"].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxc.length;++i) {
		for (var j=0;j<=paxcntcinit[i];++j) { cuke+=(document.form[paxc[i]+j+"p"].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxe.length;++i) {
		for (var j=0;j<=paxcnteinit[i];++j) { cuke+=(document.form[paxe[i]+j+"p"].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxi.length;++i) {
		for (var j=0;j<=paxcntiinit[i];++j) { cuke+=(document.form[paxi[i]+j+"p"].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	for (var i=0;i<ratz.length;++i) { cuke+=document.form[ratz[i]].value+"," }
	cuke+="BreAk";
	cuke+="2,";
	for (var i=0;i<=paxg.length;++i) {
		for (var j=0;j<=paxcntg[i];++j) { cuke+=(document.form[paxg[i]+j].checked) ? "1,":"0," }
	}
	cuke+="BreAk";
	cuke+=escape(document.form.textbo.value);
	cuke+="BreAk";
	cuke+=document.form.packlink.value+",";
	for (var i=0;i<document.form.menuor.length;i++) {
		if (document.form.menuor[i].checked) { cuke+=i+"," }
	}
	cuke+=(document.form.prog.checked) ? "1,":"0,";
	for (var i=0;i<document.form.progdis.length;i++) {
		if (document.form.progdis[i].checked) { cuke+=i+"," }
	}
	for (var i=0;i<document.form.wikic.length;i++) {
		if (document.form.wikic[i].checked) { cuke+=i+"," }
	}
	for (var i=0;i<document.form.winside.length;i++) {
		if (document.form.winside[i].checked) { cuke+=i+"," }
	}
	cuke+=document.form.macmessage.value+",";
	cuke+=(document.form.refr.checked) ? "1,":"0,";
	cuke+=(document.form.mansave.checked) ? "1,":"0,";
	cuke+=(document.form.hidecom.checked) ? "1,":"0,";
	cuke+=(document.form.showratz.checked) ? "1,":"0,";
	cuke+=(document.form.cl1psopen.checked) ? "1,":"0,";
	prompt("Highlight and copy this data to save in a text document, in an e-mail, or to cl1ps.net:",cuke);
	if (document.form.cl1psopen.checked) {
		cl1pwin=window.open("http://cl1p.net/"+document.form.packlink.value+"/");
	}
}
var coopen=0;
function usecookie() {
	if (document.form.cl1psopen.checked==false) { coopen=1 }
	if (coopen==0) {
		alert("Opening cl1ps.net. Click Manual Data Load again after you have copied your data from cl1ps.net.");
		coopen=1;
		cl1pwin=window.open("http://cl1p.net/"+document.form.packlink.value+"/")
	}
	else {
		var cuke;
		cuke=prompt("Paste saved data below:","");
		if (cuke) {
			var cukeArray=cuke.split("BreAk");
			var x=cukeArray[0];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="3") { // if saved with 3
					var h=1;
					for (var i=0;i<=pax.length;++i) {
						for (var j=0;j<=paxcnt[i];++j) { document.form[pax[i]+j].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[1];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") { // if saved with 2
					var h=1;
					for (var i=0;i<=paxc.length;++i) {
						for (var j=0;j<=paxcntc[i];++j) { document.form[paxc[i]+j].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[8];
			if (!x) { x=",,,,,,,,,," }
			var arr=new Array();
			arr=x.split(",");
			for (var i=0;i<ratz.length;i++) { document.form[ratz[i]].value=arr[i] }
			var x=cukeArray[4];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="3") {  // if saved with 3
					var h=1;
					for (var i=0;i<=pax.length;++i) {
						for (var j=0;j<=paxcntinit[i];++j) { document.form[pax[i]+j+"p"].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[5];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") {  // if saved with 2
					var h=1;
					for (var i=0;i<=paxc.length;++i) {
						for (var j=0;j<=paxcntcinit[i];++j) { document.form[paxc[i]+j+"p"].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[2];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") {  // if saved with 2
					var h=1;
					for (var i=0;i<=paxe.length;++i) {
						for (var j=0;j<=paxcnte[i];++j) { document.form[paxe[i]+j].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[6];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") {  // if saved with 2
					var h=1;
					for (var i=0;i<=paxe.length;++i) {
						for (var j=0;j<=paxcnteinit[i];++j) { document.form[paxe[i]+j+"p"].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[9];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") {  // if saved with 2
					var h=1;
					for (var i=0;i<=paxg.length;++i) {
						for (var j=0;j<=paxcntg[i];++j) { document.form[paxg[i]+j].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[10];
			if (!x) { x="" }
			x=unescape(x);
			document.form.textbo.value=x;
			var x=cukeArray[11];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				document.form.packlink.value=arr[0];
				document.form.menuor[arr[1]].checked=true;
				document.form.prog.checked=(arr[2]=="1");
				document.form.progdis[arr[3]].checked=true;
				document.form.wikic[arr[4]].checked=true;
				document.form.winside[arr[5]].checked=true;
				document.form.macmessage.value=arr[6];
				document.form.refr.checked=(arr[7]=="1");
				document.form.mansave.checked=(arr[8]=="1");
				document.form.hidecom.checked=(arr[9]=="1");
				document.form.showratz.checked=(arr[10]=="1");
				document.form.cl1psopen.checked=(arr[10]=="1");
			}
			var x=cukeArray[3];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") {  // if saved with 2
					var h=1;
					for (var i=0;i<=paxi.length;++i) {
						for (var j=0;j<=paxcnti[i];++j) { document.form[paxi[i]+j].checked=(arr[h++]=="1") }
					}
				}
			}
			var x=cukeArray[7];
			if (x) {
				var arr=new Array();
				arr=x.split(",");
				if (arr[0]=="2") {  // if saved with 2
					var h=1;
					for (var i=0;i<=paxi.length;++i) {
						for (var j=0;j<=paxcntiinit[i];++j) { document.form[paxi[i]+j+"p"].checked=(arr[h++]=="1") }
					}
				}
			}
		}
		gothreads();
		setwiki();
		buildmenus();
		coopen=0;
	}
}
var nowup=0;
function loading() {
	if (nowup==0) {
		document.getElementById("pleasewait").style.opacity-=.1;
		if (document.getElementById("pleasewait").style.opacity==0) {
			nowup=1;
		}
	}	
	else {
		document.getElementById("pleasewait").style.opacity=(document.getElementById("pleasewait").style.opacity*1)+.1;
		if (document.getElementById("pleasewait").style.opacity==1) {
			nowup=0;
		}
	}
	loadin=setTimeout(loading,100);
}
function editcards(abbr) {
	inputgo();
	parent.inputwin.location="inputcards.html?data="+document.form[abbr+"text"].value;
}
function checkme() {
	if (document.form.cl1psopen.checked) { return "Click CANCEL to save to cl1ps.net first." }
}
function mansavecheck() {
	if (document.form.mansave.checked) {
			document.form.cl1psopen.disabled=true;
			document.getElementById("cl1pstext").style.color="#aaa";
	}
	else {
		document.form.cl1psopen.disabled=false;
		document.getElementById("cl1pstext").style.color="#000";
	}
}
function cl1psopencheck() {
	if (!document.form.packlink.value) {
		alert("You must input your Pack ID before enabling this feature.");
		document.form.cl1psopen.checked=true;
	}
}
var bb;
var cc;
var dd;
function stillneed(block) {
	if (document.form.editme.value!="yes") { alert("This function is not fully reliable. Do not purchase ticket cards based on these results without checking them yourself first.") }
	var cards=block;
	cards=cards.substr(9);
	var aa=cards.indexOf("d\"");
	var wabbr=cards.substr(0,aa);  // abbreviation
	cards=cards.substr(wabbr.length);
	cards=cards.substr(3);
	aa=cards.indexOf(";");
	var winit=cards.substr(0,aa); // # of cards (# before ;)
//	var wcn=new Array([winit]);
//	alert(wcn);
	cards=cards.substr(winit.length+1);
//	aa=cards.indexOf(">");
//	var wrecn=cards.substr(0,aa);
	var wcn="";
	var scn="";
	var wmorr="";
	var wrec="";
	var wlen;
//	var cnum="";
	for (var i=0;i<winit;i++) {
		aa=cards.indexOf("p\"> ");

		dd=cards.indexOf("<div s"); // special
		if (dd==-1) { dd=cards.length }
		(dd<aa) ? scn+="1;" : scn+="0;";

		cc=cards.charAt(aa-2);
		if (isNaN(cc)) { cc="" }
		cc=parseInt(cc+""+cards.charAt(aa-1))+1; // this card's #
//		cnum+=cc+";";
		cards=cards.substr(aa+4);
		aa=cards.indexOf(" <"); // market
		if (aa==-1) { aa=cards.length }
		bb=cards.indexOf(" ("); // recipe
		if (bb==-1) { bb=cards.length }
		if (bb<aa) { // recipe
			if (wcn!="") { wcn+=";" }
			wcn+=cards.substr(0,bb);
			wlen=cards.substr(0,bb);
			cards=cards.substr(wlen.length+1);
			aa=cards.indexOf("</div>");
			if (wmorr!="") { wmorr+=";" }
			wmorr+=cards.substr(0,aa+6);
			wlen=cards.substr(0,aa+6);
			aa=cards.indexOf(" on");
			if (wrec!="") { wrec+=":" }
			wrec+=cards.substr(4,aa-4);
		}
		else { // markets
			if (wcn!="") { wcn+=";" }
			wcn+=cards.substr(0,aa);
			wlen=cards.substr(0,aa);
			cards=cards.substr(wlen.length+1);
			aa=cards.indexOf("<br>");
			if (wmorr!="") { wmorr+=";" }
			wmorr+=cards.substr(0,aa);
			wlen=cards.substr(0,aa);
			(i==0) ? wrec+=":::" : wrec+="::::";
		}
		cards=cards.substr(wlen.length);
	}

	var mainList=wcn;
	wcn=wcn.split(";");
	wrec=wrec.split(":");
	var lstlsta="";
	var lstlstb="";
	var lstlstd="";
	var lstlsthm="";
	var lstlsth="";
	for (var i=0;i<wcn.length;i++) {
		if (wrec[i*4]) {
			lstlsta+=wcn[wrec[(i*4)+1]*1+1]+"+";
			lstlsta+=wcn[wrec[(i*4)+2]*1+1]+"+";
			lstlsta+=wcn[wrec[(i*4)+3]*1+1]+";";
			lstlstb+=wcn[i]+";";
		}
		else {
			lstlsta+=wcn[i]+";";
			lstlstb+="nothingnothing;";
			lstlsthm+=wcn[i]+";";
			lstlsth+="0;";
		}
	}
	lstlsta=lstlsta.substring(0,lstlsta.length-1);
	lstlstb=lstlstb.substring(0,lstlstb.length-1);
	mainList=mainList.split(";");
	lstlsta=lstlsta.split(";");
	lstlstb=lstlstb.split(";");

	var lstlstc="";
	scn=scn.split(";");
	for (var i=0;i<mainList.length;i++) {
		if (document.form[wabbr+i].checked==false) {
			if (scn[i]=="0") {
				lstlstc+=mainList[i]+";";
			}
		}
	}
	lstlstc=lstlstc.substring(0,lstlstc.length-1);
	lstlstc=lstlstc.split(";");

	var keepgoing=0;
	var hmt=0;
	do {
		keepgoing=1;
		for (i=0;i<lstlstc.length;i++) {
			for (var j=0;j<lstlstb.length;j++) {
				if (lstlstc[i]==lstlstb[j]) {
					for (var k=0;k<mainList.length;k++) {
						if (mainList[k]==lstlstc[i]) {
							lstlstc[i]=lstlsta[k];
							keepgoing=0;
						}
					}
				}
			}
		}
		for (i=0;i<lstlstc.length;i++) {
			lstlstd+=lstlstc[i]+";";
		}
		lstlstc=lstlstd.substring(0,lstlstd.length-1);
		lstlstd="";
		lstlstc=lstlstc.replace(/\+/g, ";");
		lstlstc=lstlstc.split(";");
		hmt+=1;
		if (hmt>10) {
			alert("The Tracker cannot process this request. There may be a coding complication with this collection. Try again later, after you have collected more cards.");
			return false;
		}
	}
	while (keepgoing==0);
	
	lstlsthm=lstlsthm.substring(0,lstlsthm.length-1);
	lstlsthm=lstlsthm.split(";");
	lstlsth=lstlsth.substring(0,lstlsth.length-1);
	lstlsth=lstlsth.split(";");
	for (i=0;i<lstlstc.length;i++) {
		for (j=0;j<lstlsthm.length;j++) {
			if (lstlstc[i]==lstlsthm[j]) {
				lstlsth[j]=(lstlsth[j]*1)+1;
			}
		}
	}
	document.form.textbo.value="";
	for (i=0;i<lstlsthm.length;i++) {
		if (lstlsth[i]!="0") {
			document.form.textbo.value+=(lstlsth[i]+"x "+lstlsthm[i])+"\n";
		}
	}
	
	textboxshow();
}
