// TEH COED OMFG!
// do NOT rip. Rippers will not be reported, they will be PROSECUTED.
// You may NOT edit this code
// By Slaytanist and Zombiepron of the TCZ.
// http://thecodingzone.com

var inventory=[];

for (blah in users)
{
a=users[blah][8].split("@");
if (users[blah][8]!="none")
{
inventory[blah]=[];
for (i=0;i<a.length;i++)
if (items[a[i]])
inventory[blah][i]=a[i];
}
}

var done=1;

hackname="RPG Apocalypse Beta";
helpcontent="<br />Help coming soon.";
ACPbar="<div class='maintitle'>"+hackname+" ACP&nbsp;&nbsp;<form><select onchange='window.location.href=this.options[this.selectedIndex].value'><option value='"+location.href.split("?")[0]+"?act=rpga'>Go<option value='"+location.href.split("?")[0]+"?act=editboard'>Edit Global Variables<option value='"+location.href.split("?")[0]+"?act=editweapon'>Add/Edit Weapon<option value='"+location.href.split("?")[0]+"?act=editarmour'>Add/Edit Wearables<option value='"+location.href.split("?")[0]+"?act=editclass'>Add/Edit Class<option value='"+location.href.split("?")[0]+"?act=editstatitem'>Add/Edit Stat Item<option value='"+location.href.split("?")[0]+"?act=editusable'>Add/Edit Usable<option value='"+location.href.split("?")[0]+"?act=edituser'>Add/Edit User/Monster<option value='"+location.href.split("?")[0]+"?act=export'>Export Items and Classes</select></form></div>";
ACPhelp="<br />ACP help coming soon.";

if (document.getElementById("userlinks").getElementsByTagName("A")[0].href.match("showuser"))
{
uname=document.getElementById("userlinks").getElementsByTagName("A")[0].innerHTML;
uurl=document.getElementById("userlinks").getElementsByTagName("A")[0].href;
}
else
uname="";

isAdmin=0;
if (uname!="")
if (users[uname])
if (users[uname][11]==1)
isAdmin=1;


function hahaha() {
var iframe = document.createElement("iframe");
iframe.setAttribute("src", location.href.split("index")[0]+"blah.html");
iframe.setAttribute("id", "cackhander");
iframe.setAttribute("name", "cackhander");
iframe.setAttribute("width", "0");
iframe.setAttribute("height", "0");
iframe.setAttribute("frameBorder", "0");
iframe.attachEvent("onload",RefreshIE);
document.body.appendChild(iframe);
} 

function RefreshIE()
{
document.getElementById("cackhander").detachEvent("onload");
document.getElementById("cackhander").attachEvent("onload",RefreshIE);
if (refreshit==1)
window.location.reload(false);
else if (refreshit==3)
window.location=location.href.split("?")[0]+"?act=idx";
refreshit=0;
}



refreshit=0;

function Refresh()
{
if (refreshit==3)
window.location=location.href.split("?")[0]+"?act=idx";
else if (refreshit==1)
window.location.reload(false);
else if (refreshit==2)
DoFight();
}

function send(url)
{
parent.frames["cackhander"].location=url;
refreshit=1;
}

function sendfight(url)
{
//debug
//window.open (url,"Debug","resizable=1,width=800,height=600"); 
parent.frames["cackhander"].location=url;
refreshit=3;
}

function request(url)
{
parent.frames["cackhander"].location=url;
refreshit=2;
}

function buysell(url)
{
parent.frames["cackhander"].location=url;
}

function readCookie (name)
{
a = document.cookie.split(";");
for(i=0;i<a.length;i++)
if (a[i].split("=")[0].replace(" ","")==name)
return unescape(a[i].split("=")[1]);
return "";
}

function setCookie(name,data) {
document.cookie = name + "=" + escape(data) + ";expires=Thu, 5 Aug 3000 24:00:00 UTC; path=/"
}

function showbox(x, y)
{
for (i=1;i<=4;i++)
document.getElementById("box"+i+"_"+y).style.display="none";
document.getElementById("box"+x+"_"+y).style.display="";
}

function GetLevel(xp, theusar)
{
if (!users[theusar])
 return 0;
if (!users[theusar][0])
 return 0;
if (users[theusar][0] == "NoClass")
 return 0;
z = classes[users[theusar][0]][1];
z = Math.floor((Math.log(xp/z)));
return z;
}

function GetQuantity(name, num)
{
if (!inventory[name])
return 0;
for (z=0;z<inventory[name].length;z+=2)
if (inventory[name][z]==num)
return inventory[name][z+1];
return 0;
}

function SetQuantity(name, num, lamer)
{
if (!inventory[name])
return;
for (z=0;z<inventory[name].length;z+=2)
if (inventory[name][z]==num)
inventory[name][z+1]=lamer;
}

function HaveItem(name, num)
{
if (!inventory[name])
return 0;
for (z=0;z<inventory[name].length;z+=2)
if (inventory[name][z]==num)
if (inventory[name][z+1]!="none")
return 1;
return 0;
}

function CanUse(name, num)
{
z=classes[users[name][0]][13].split("@");
for (y=0;y<z.length;y++)
if (z[y]==items[num][12])
return 0;
return 1;
}

function IsProficient(name, num)
{
z=classes[users[name][0]][4].split("@");
for (y=0;y<z.length;y++)
if (z[y]==items[num][12])
return 1;
return 0;
}

function IsDeficient(name, num)
{
z=classes[users[name][0]][5].split("@");
for (y=0;y<z.length;y++)
if (z[y]==items[num][12])
return 1;
return 0;
}

function GetHpBonus(num)
{
if (num<2)
 return -3;
if (num<4)
 return -2;
if (num<7)
 return -1;
if (num<15)
 return 0;
if (num<16)
 return 1;
if (num<17)
 return 2;
if (num<18)
 return 3;
if (num<19)
 return 4;
if (num<21)
 return 5;
if (num<24)
 return 6;
return 7;
}

function replaceboard(text)
{
document.getElementById("theBoard").innerHTML=text;
}


function bar(num, col, id)
{
return "<img src='http://slaytanist.co.uk/RPG_Stuffs/"+col+"_bar_left.gif' border='0' width='4' height='11' align='middle' alt='' id='barl_"+id+"' /><img src='http://slaytanist.co.uk/RPG_Stuffs/"+col+"_bar.gif' border='0' width='"+Math.floor(num)+"' height='11' align='middle' alt='' id='bar_"+id+"' /><img src='http://slaytanist.co.uk/RPG_Stuffs/"+col+"_bar_right.gif' border='0' width='4' height='11' align='middle' alt='' id='barr_"+id+"' />&nbsp;"
}

function ubar(num, col, id)
{
document.getElementById("barl_"+id).src="http://slaytanist.co.uk/RPG_Stuffs/"+col+"_bar_left.gif";
document.getElementById("bar_"+id).src="http://slaytanist.co.uk/RPG_Stuffs/"+col+"_bar.gif";
document.getElementById("bar_"+id).width=Math.floor(num);
document.getElementById("barr_"+id).src="http://slaytanist.co.uk/RPG_Stuffs/"+col+"_bar_right.gif";
}

function itemboxchange(thebox,thename) {
thebox = "itembox"+thebox;
a = document.getElementById(thebox);
a.innerHTML = items[thename][3];
}

function itemboxclear(thebox) {
thebox = "itembox"+thebox;
a = document.getElementById(thebox);
a.innerHTML = "&nbsp;";
}

function itemcard(num)
{
popUp= window.open ("","Item Stats","status=1,resizable=1,width=340,height=490"); 
rawr=popUp.document;
a="<img src='http://zombiepron.hamsoft-hq.com/rpg/testing/cards.php?background="+RPG_theCard+"&itemid="+num+"' />";
/*a="<div id='gah'>";
a+="<table height='480px' width='320px' cellpadding='0' cellspacing='0'><tr><td style='background-image: url(http://slaytanist.co.uk/RPG_Stuffs/card3.jpg); background-repeat: no-repeat;' widht='320px' height='480px' valign='top'>"
a+="<table><tr><td width='150px' height='200px' align='center'>"
a+="<table><tr><td>"
a+="<img src='"+items[num][1]+"' width='130' height='130' />";
a+="</td></tr><tr><td>"
a+="<hr><div align='center'><b>"
a+=items[num][3];
a+="</b></div></td></tr></table>"
a+="</td><td align='right' valign='top' width='170px'>"
a+="<table><tr><td width='60px' height='60px' align='center'>"
a+="<img src='"+items[num][2]+"' />";
a+="</td></tr></table>"
a+="</td></tr>";
a+="<tr><td colspan='2'>"
a+="<table><tr><td width='7px'>&nbsp;</td><td>"
a+=items[num][4];
a+="</td><td width='7px'>&nbsp;</td></tr></table></tr></td></table></div>"*/
rawr.write(a);
rawr.close();
}

var ads=[];
if ((navigator.appName).indexOf("Microsoft")!=-1)
ads[0]="<a href='http://rpghaven.co.uk/ie.html'><img src='http://zombiepron.hamsoft-hq.com/images/gashery.gif' /></a>";
else
{
ads[0]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=st1&mode=videogames&search=RPG&=1&fc1=&lt1=&lc1=&bg1=&f=ifr" marginwidth="0" marginheight="0" width="468" height="60" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
ads[1]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=st1&mode=books&search=RPG&=1&fc1=&lt1=&lc1=&bg1=&f=ifr" marginwidth="0" marginheight="0" width="468" height="60" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
ads[2]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=st1&mode=dvd&search=fantasy&=1&fc1=&lt1=&lc1=&bg1=&f=ifr" marginwidth="0" marginheight="0" width="468" height="60" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
ads[3]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=st1&mode=magazines&search=fantasy&=1&fc1=&lt1=&lc1=&bg1=&f=ifr" marginwidth="0" marginheight="0" width="468" height="60" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
ads[4]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=st1&mode=music&search=metal&=1&fc1=&lt1=&lc1=&bg1=&f=ifr" marginwidth="0" marginheight="0" width="468" height="60" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
ads[5]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=bn1&mode=videogames&browse=468642&=1&fc1=&lt1=&lc1=&bg1=&f=ifr" marginwidth="0" marginheight="0" width="468" height="60" border="0" frameborder="0" style="border:none;" scrolling="no"></iframe>';
ads[6]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=ur1&category=games&banner=0SHM20AGDF3RTX3R3DG2&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>';
ads[7]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=ur1&category=dvd&banner=1Y6X580CSWSE2JYBZ6R2&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>';
ads[8]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=ur1&category=books&banner=1N4P1140VP34Z6816KR2&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>';
ads[9]='<iframe src="http://rcm.amazon.com/e/cm?t=hamsoft-20&o=1&p=13&l=ur1&category=music&banner=1DDZ5PY330HYPB7Q0BG2&f=ifr" width="468" height="60" scrolling="no" border="0" marginwidth="0" style="border:none;" frameborder="0"></iframe>';
}


if (location.href.match("showuser="))
{
a=document.getElementsByTagName("DIV");
for (i=0;i<a.length;i++)
if (a[i].id=="profilename")
a[i+1].innerHTML+="&nbsp;&middot;&nbsp;<a href='"+location.href+"&rpg=profile'>View this member's RPG Profile</a>";
}

//RPG CP
if (location.href.match("&rpg="))
{
document.title="My RPG CP";
a=document.getElementsByTagName("TD");
for (i=0;i<a.length;i++)
if ((a[i].innerHTML.match("Total Cumulative Posts"))&&(a[i].className=="row3"))
posts=parseInt(a[i+1].getElementsByTagName("B")[0].innerHTML.replace(",",""));

thecash=cashperpost*posts+users[uname][9];
theXP=XPperpost*posts+users[uname][10];

getname=document.getElementById("profilename").innerHTML;

a='<table cellspacing="0" cellpadding="0" width="100%"><tr>'
a+="<td colspan='7' align='center'>";
a+= ads[Math.floor(Math.random()*ads.length)];
a+="</td></tr><tr>";
a+='<td id="ucpmenu" valign="top">'
a+="<div class='maintitle'>RPG</div>"
a+="<div class='pformstrip'>Navigation</div><p>"
if (users[uname][0]==NoClass)
a+="&middot; <a href='"+uurl+"&rpg=class'>Character Selection</a><br />";
else
{
a+= "&middot; <a href='"+uurl+"&rpg=shop'>Shop</a><br />";
a+= "&middot; <a href='"+uurl+"&rpg=equip'>Equip Character</a><br />";
a+= "&middot; <a href='"+uurl+"&rpg=battle'>Fight!</a><br />";
a+= "&middot; <a href='"+uurl+"&rpg=lottery'>Lottery</a><br />";
a+= "&middot; <a href='"+uurl+"&rpg=clans'>Clans</a><br />";
if (users[uname][19]>0)
a+= "&middot; <a href='"+uurl+"&rpg=clan&clan="+escape(users[uname][18])+"'>My Clan</a><br />";
}
a+="</p><div class='pformstrip'>Character Details</div><p>"
a+="<div align='center'>"
if (users[uname][1] == 1)
{
if (GetLevel(theXP, uname) < 9)
a+= "<img src='" + classes[users[uname][0]][9] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, uname) < 18)
a+= "<img src='" + classes[users[uname][0]][10] + "' width='100px' height='100px'>";
else
a+= "<img src='" + classes[users[uname][0]][11] + "' width='100px' height='100px'>";
}
else
{
if (GetLevel(theXP, uname) < 9)
a+= "<img src='" + classes[users[uname][0]][6] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, uname) < 18)
a+= "<img src='" + classes[users[uname][0]][7] + "' width='100px' height='100px'>";
else
a+= "<img src='" + classes[users[uname][0]][8] + "' width='100px' height='100px'>";
}
a+="<br /><br />"+classes[users[uname][0]][0]+"<br /><br />";
a+="Level: "+GetLevel(theXP,uname)+"<br />";
a+="Experience: "+theXP+"<br />";
a+="Cash: "+sign+"<span id='cashcash'>"+thecash+"</span>"+postsign;
a+="<br />";
a+="Fights won: "+users[uname][15]+"/"+(users[uname][15]+users[uname][16])+"<br />";
a+="</div>"
a+="</p><div class='pformstrip'>Inventory</div><p>"
boxnum=0;
d = "<table width='100%' class='tableborder' align='left'><tr><td width='100%' align='left'>";
for (blah in items)
{
if ((HaveItem(uname,blah)) && (items[blah][7] != 0))
d += "<img src='"+items[blah][2]+"' onMouseOver=(itemboxchange('"+boxnum+"','"+blah+"')); onMouseOut=(itemboxclear('"+boxnum+"')); onClick=(itemcard('"+blah+"'));> &nbsp;"
}
d += "<\/td><\/tr><tr height='20px'><td width = '100%' id='itembox"+boxnum+"'>";
d += "&nbsp;<\/td><\/tr><\/table>";
boxnum++;
a+=d;

a+="</p><br /><div class='pformstrip'>Equipped Items</div><p>"

b=users[uname][14].split("@");
d = "<table width='100%' class='tableborder' align='left'><tr><td width='100%' align='left'>";
for (i=0;i<b.length;i++)
if (items[b[i]])
{
if (items[b[i]][11]==1)
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\"  onClick=(itemcard('"+b[i]+"'));> &nbsp;"
else if (items[b[i]][11]==2)
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\" onClick=(itemcard('"+b[i]+"'));> &nbsp;"
else
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\"  onClick=(itemcard('"+b[i]+"'));> &nbsp;"
}
d += "<\/td><\/tr><tr height='20px'><td width = '100%' id='itembox"+boxnum+"'>";
d += "&nbsp;<\/td><\/tr><\/table>";
boxnum++;
a+=d;

a+="</p><br /><div class='pformstrip'>Stats</div><p>"
a+="<acronym title='"+stats[0][1]+"'>"+stats[0][0]+"</acronym>&nbsp;"+users[uname][2]+"<br />";
a+="<acronym title='"+stats[1][1]+"'>"+stats[1][0]+"</acronym>&nbsp;"+users[uname][3]+"<br />";
a+="<acronym title='"+stats[2][1]+"'>"+stats[2][0]+"</acronym>&nbsp;"+users[uname][4]+"<br />";
a+="<acronym title='"+stats[3][1]+"'>"+stats[3][0]+"</acronym>&nbsp;"+users[uname][5]+"<br />";
a+="<acronym title='"+stats[4][1]+"'>"+stats[4][0]+"</acronym>&nbsp;"+users[uname][6]+"<br />";
a+="<acronym title='"+stats[5][1]+"'>"+stats[5][0]+"</acronym>&nbsp;"+users[uname][7]+"<br />";

a+="</p></td><td style='padding:2px'><!-- --></td>"
a+='<td valign="top" id="ucpcontent">'
a+="<div class='maintitle'>Welcome to "+hackname+" </div>"
a+= helpcontent;
a+="</td></tr></table>"

replaceboard(a);
}

function BuyTicket()
{
if (thecash<ticketprice)
alert ("Not enough cash!")
else
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=11');
}

//Lottery
if (location.href.match("&rpg=lottery"))
{

a="<a href='Javascript:BuyTicket();'>Buy Ticket</a> ("+sign+ticketprice+postsign+")";

document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Lottery </div>"+a;
}

function ClanPromote(nm)
{
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=10&membername='+escape(nm)+'&status='+(users[nm][19]+1));
}

function ClanKick(nm)
{
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=10&membername='+escape(nm)+'&status='+(users[nm][19]-1));
}

function ClanApply(nm)
{
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=9&clanname='+escape(nm));
}

function ClanFound()
{
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=13&clanname='+escape(document.getElementsByName("clanname")[0].value));
}

//FIXME: Add a sort here
//Clans
if (location.href.match("&rpg=clans"))
{
a="<table width='100%'><tr><td>Name</td><td>Members</td><td>Score</td><td>Admin</td></tr><tr><td colspan='4'><hr /></td></tr>";
theclans=[];
for (blah in users)
if (users[blah][19]==3)
theclans[users[blah][18]]=blah;

for (rawr in theclans)
{
num=0;
score=0;
for (blah in users)
if (users[blah][19]>1)
if (users[blah][18]==users[theclans[rawr]][18])
{score+=users[blah][15]-users[blah][16];num+=1;}
a+="<tr><td><a href='"+location.href.split("rpg=clans")[0]+"rpg=clan&clan="+escape(rawr)+"'>"+rawr+"</a></td><td>"+num+"</td><td>"+score+"</td><td>"+theclans[rawr]+"</td></tr>";
}
a+="</table>";

if (users[blah][19]==0)
a+="<br /><br /><a href='Javascript:ClanFound();'>Found New Clan</a> (Name: <input type='text' value='' name='clanname' id='clanname' />)"

document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Clans </div>"+a;
}

function clanlevel(num)
{
if (num==1)
return "<i>Validating</i>";
else if (num==2)
return "Member";
else if (num==3)
return "<b>Admin</b>";
}

//meh should have used ? : in retrospect
function clankick(thename, isad)
{
if (!isad)
return "";
return " <i><a href='Javascript:ClanBan(\""+thename+"\")'>Kick</a> <a href='Javascript:ClanPromote(\""+thename+"\")'>Promote</a>"
}

//FIXME: Add a sort here
//Clan
if (location.href.match("&rpg=clan&clan="))
{
rawr=unescape(location.href.split("&rpg=clan&clan=")[1]);
a="<table width='100%'><tr><td>Member</td><td>Score</td><td>Status</td></tr><tr><td colspan='=3'><hr /></td></tr>";

clanadmin=0;
if (users[uname])
if (users[uname][19]==3)
if (users[uname][18]==rawr)
clanadmin=1;

for (blah in users)
if (users[blah][19]>0)
if (users[blah][18]==rawr)
a+="<tr><td>"+blah+"</td><td>"+(users[blah][15]-users[blah][16])+"</td><td>"+clanlevel(users[blah][19])+clankick(blah,clanadmin)+"</td></tr>";

a+="</table>";

if (users[uname])
{
if (users[uname][18]==rawr)
{
if (users[uname][19]>1)
a+="<br /><b>You are in this clan<b>";
else
if (users[uname][19]==1)
a+="<br />Application pending";
}
else if (users[uname][19]==0)
a+="<br /><a href='Javascript:ClanApply(\""+rawr+"\")'>Apply to this clan</a>"
}

document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>"+rawr+" Clan </div>"+a;
}

//battle select
if (location.href.match("&rpg=battle"))
{

a="<br /><form><select name='gah' onchange='SetBattle(this.options[this.selectedIndex].value)'><option value='0'>None"
for (blah in users)
if (users[blah][0]!=NoClass)
a+="<option value='"+blah+"'>"+blah;
a+="</select></form>"
a+="<br /><br /><input type='button' value='Submit' onclick='Fight(document.getElementsByName(\"gah\")[0].options[document.getElementsByName(\"gah\")[0].selectedIndex].value)'>"

document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Choose Character to Fight </div>"+a;
}


if (location.href.match("&rpg=profile"))
{
a="<table cellpadding='0' align='center' cellspacing='2' border='0' width='100%'>";
a+="<tr><td width='50%' valign='top' class='plainborder'>";
a+="<table cellspacing='1' cellpadding='6' width='100%'>";
a+="<tr><td align='center' colspan='2' class='maintitle'>Stats</td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>"+stats[0][1]+"</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][2]+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>"+stats[1][1]+"</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][3]+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>"+stats[2][1]+"</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][4]+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>"+stats[3][1]+"</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][5]+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>"+stats[4][1]+"</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][6]+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>"+stats[5][1]+"</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][7]+"</b></td></tr>";
a+="</table></td><td width='50%' valign='top' class='plainborder'>";
a+="<table cellspacing='1' cellpadding='6' width='100%'>";
a+="<tr><td align='center' colspan='2' class='maintitle'>Inventory</td></tr>";
a+="<tr><td>";
d = "<table width='100%' class='tableborder' align='left'><tr><td width='100%' align='left'>";
for (blah in items)
{
if ((HaveItem(getname,blah)) && (items[blah][7] != 0))
d += "<img src='"+items[blah][2]+"' onMouseOver=(itemboxchange('"+boxnum+"','"+blah+"')); onMouseOut=(itemboxclear('"+boxnum+"')); onClick=(itemcard('"+blah+"'));> &nbsp;"
}
d += "<\/td><\/tr><tr height='20px'><td width = '100%' id='itembox"+boxnum+"'>";
d += "&nbsp;<\/td><\/tr><\/table>";
boxnum++;
a+=d;
a+="</td></tr></table>"
a+="</tr><tr><td width='50%' valign='top' class='plainborder'>";
a+="<table cellspacing='1' cellpadding='6' width='100%'>";
a+="<tr><td align='center' colspan='2' class='maintitle'>Information</td></tr>";
a+="<tr><td>";
a+="Bio here";
a+="</td></tr></table></td>";
a+="<td width='50%' valign='top' class='plainborder'>";
a+="<table cellspacing='1' cellpadding='6' width='100%'>";
a+="<tr><td align='center' colspan='2' class='maintitle'>Character</td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Class</b></td><td align='left' width='70%' class='row1'><b>"+classes[users[getname][0]][0]+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Picture</b></td><td align='left' width='70%' class='row1'>"
if (users[getname][1] == 1)
{
if (GetLevel(theXP, getname) < 9)
a+="<img src='" + classes[users[getname][0]][9] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, getname) < 18)
a+="<img src='" + classes[users[getname][0]][10] + "' width='100px' height='100px'>";
else
a+="<img src='" + classes[users[getname][0]][11] + "' width='100px' height='100px'>";
}
else
{
if (GetLevel(theXP, getname) < 9)
a+="<img src='" + classes[users[getname][0]][6] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, getname) < 18)
a+="<img src='" + classes[users[getname][0]][7] + "' width='100px' height='100px'>";
else
a+="<img src='" + classes[users[getname][0]][8] + "' width='100px' height='100px'>";
}
a+="</td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Level</b></td><td align='left' width='70%' class='row1'><b>"+GetLevel(theXP,getname)+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Experience</b></td><td align='left' width='70%' class='row1'><b>"+theXP+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Money</b></td><td align='left' width='70%' class='row1'><b>"+sign+thecash+postsign+"</b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Donate</b></td><td align='left' width='70%' class='row1'><b><a href='Javascript:Donate(\""+getname+"\")'><img src='"+RPG_donate+"' /></a></b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Fight</b></td><td align='left' width='70%' class='row1'><b><a href='Javascript:Fight(\""+getname+"\")'><img src='"+RPG_fight+"' /></a></b></td></tr>";
a+="<tr><td class='row3' width='30%' valign='top'><b>Fights Won</b></td><td align='left' width='70%' class='row1'><b>"+users[getname][15]+"/"+(users[getname][15]+users[getname][16])+"</b></td></tr>";

a+="</td></tr></table></td></tr></table>";
document.title="Viewing "+getname+"'s RPG Profile";
replaceboard(a);
}

function Addrep(to)
{
if (uname==to)
alert ("No repping yourself!")
else if (!users[uname][13])
alert("You have already repped today!")
else
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=7&direction=up&recievername='+to);
}

function Subrep(to)
{
if (uname==to)
alert ("No repping yourself!")
else if (!users[uname][13])
alert("You have already repped today!")
else
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=7&direction=down&recievername='+to);
}

function Donate(to)
{
if (uname==to)
alert ("No donating to yourself!")
else
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=6&amount='+prompt("How much?")+'&recievername='+to);
}

function Fight(to)
{
if (uname==to)
alert ("No fighting yourself!")
else if (users[to][0]==NoClass)
alert ("No fighting non-players!")
else
sendfight("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=900&name='+escape(to));
}


function EditMember(to,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p)
{
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=669&uname='+escape(to)+'&class='+a+'&gender='+b+'&stats='+c+'@'+d+'@'+e+'@'+f+'@'+g+'@'+h+'&items='+i+'&cash='+j+'&xp='+k+'&admin='+l+'&newpassword='+m+"&equipped="+n+"&clan="+o+"&clanstatus="+p);
}

function SubCash(to)
{
EditMember(to,users[to][0],users[to][1],users[to][2],users[to][3],users[to][4],users[to][5],users[to][6],users[to][7],users[to][8],users[to][9]-parseInt(prompt("How much?")),users[to][10],users[to][11],"",users[to][14],users[to][18],users[to][19]);
}

function AddCash(to)
{
EditMember(to,users[to][0],users[to][1],users[to][2],users[to][3],users[to][4],users[to][5],users[to][6],users[to][7],users[to][8],users[to][9]+parseInt(prompt("How much?")),users[to][10],users[to][11],"",users[to][14],users[to][18],users[to][19]);
}


//showtopic stuffs
if (location.href.match("showtopic"))
{

stat1=new Image(21,17);
stat1.src = RPG_stats[0][1];
stat2=new Image(19,17);
stat2.src = RPG_stats[1][1];
stat3=new Image(20,17);
stat3.src = RPG_stats[2][1];
stat4=new Image(18,17);
stat4.src = RPG_stats[3][1];

boxnum=0;
a=document.getElementsByTagName("TD");
for (i=0;i<a.length;i++)
{
b=a[i].getElementsByTagName("DIV");
if (b[0])
if (b[0].className=="postcolor")
{
getname=a[i-3].innerHTML.replace(/<[^>]*>/g,"").replace(/&nbsp;/g,"");
if (users[getname])
{
if (a[i-1].innerHTML.replace(",","").match(/Posts: ([0-9]*?)</m))
posts=parseInt(RegExp.$1);
thecash=cashperpost*posts+users[getname][9];
theXP=XPperpost*posts+users[getname][10];
a[i-1].getElementsByTagName("SPAN")[0].id="box1_"+boxnum;

c="<br /><br /><a href='Javascript:Addrep(\""+getname+"\")'>+</a>Reputation:"+users[getname][12]+"<a href='Javascript:Subrep(\""+getname+"\")'>-</a>"

if (uname!="")
a[i-1].getElementsByTagName("SPAN")[0].innerHTML+=c;

c=document.createElement("SPAN");
if (users[getname][1] == 1)
{
if (GetLevel(theXP, getname) < 9)
c.innerHTML = "<img src='" + classes[users[getname][0]][9] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, getname) < 18)
c.innerHTML = "<img src='" + classes[users[getname][0]][10] + "' width='100px' height='100px'>";
else
c.innerHTML = "<img src='" + classes[users[getname][0]][11] + "' width='100px' height='100px'>";
}
else
{
if (GetLevel(theXP, getname) < 9)
c.innerHTML = "<img src='" + classes[users[getname][0]][6] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, getname) < 18)
c.innerHTML = "<img src='" + classes[users[getname][0]][7] + "' width='100px' height='100px'>";
else
c.innerHTML = "<img src='" + classes[users[getname][0]][8] + "' width='100px' height='100px'>";
}

c.innerHTML+="<br /><br />"+classes[users[getname][0]][0]+"<br /><br />";
c.innerHTML+="Level: "+GetLevel(theXP,getname)+"<br />";
c.innerHTML+="Experience: "+theXP+"<br />";
if (isAdmin)
c.innerHTML+="<a href='Javascript:AddCash(\""+getname+"\")'>+</a>";
c.innerHTML+="Cash: "+sign+thecash+postsign;
if (isAdmin)
c.innerHTML+="<a href='Javascript:SubCash(\""+getname+"\")'>-</a>";
c.innerHTML+="<br />";
if (uname!="")
{
c.innerHTML+="<a href='Javascript:Donate(\""+getname+"\")'><img src='"+RPG_donate+"' /></a><br />";
c.innerHTML+="<br />";
c.innerHTML+="<a href='Javascript:Fight(\""+getname+"\")'><img src='"+RPG_fight+"' /></a><br />";
}
c.innerHTML+="Fights won: "+users[getname][15]+"/"+(users[getname][15]+users[getname][16])+"<br />";

c.id="box2_"+boxnum;
c.style.display="none";
a[i-1].insertBefore(c,a[i-1].childNodes[0]);
c=document.createElement("SPAN");
d = "<b>Inventory</b><br /><br /><table width='100%' class='tableborder' align='left'><tr><td width='100%' align='left'>";
for (blah in items)
{
if ((HaveItem(getname,blah)) && (items[blah][7] != 0))
d += "<img src='"+items[blah][2]+"' onMouseOver=(itemboxchange('"+boxnum+"','"+blah+"')); onMouseOut=(itemboxclear('"+boxnum+"')); onClick=(itemcard('"+blah+"'));> &nbsp;"
}
d += "<\/td><\/tr><tr height='20px'><td width = '100%' id='itembox"+boxnum+"'>";
d += "&nbsp;<\/td><\/tr><\/table>";
c.innerHTML=d;
c.id="box3_"+boxnum;
c.style.display="none";
a[i-1].insertBefore(c,a[i-1].childNodes[0]);
c=document.createElement("SPAN");
c.innerHTML="<b>Stats:</b><br /><br />";
c.innerHTML+="<acronym title='"+stats[0][1]+"'>"+stats[0][0]+"</acronym>&nbsp;"+users[getname][2]+"<br />";
c.innerHTML+="<acronym title='"+stats[1][1]+"'>"+stats[1][0]+"</acronym>&nbsp;"+users[getname][3]+"<br />";
c.innerHTML+="<acronym title='"+stats[2][1]+"'>"+stats[2][0]+"</acronym>&nbsp;"+users[getname][4]+"<br />";
c.innerHTML+="<acronym title='"+stats[3][1]+"'>"+stats[3][0]+"</acronym>&nbsp;"+users[getname][5]+"<br />";
c.innerHTML+="<acronym title='"+stats[4][1]+"'>"+stats[4][0]+"</acronym>&nbsp;"+users[getname][6]+"<br />";
c.innerHTML+="<acronym title='"+stats[5][1]+"'>"+stats[5][0]+"</acronym>&nbsp;"+users[getname][7]+"<br />";
c.id="box4_"+boxnum;
c.style.display="none";
a[i-1].insertBefore(c,a[i-1].childNodes[0]);

a[i-2].getElementsByTagName("SPAN")[0].innerHTML="<a href='javascript:showbox(1,"+boxnum+");' title='Member Stats'><img src='"+RPG_stats[0][0]+"' onmouseover='this.src=\""+RPG_stats[0][1]+"\"' onmouseout='this.src=\""+RPG_stats[0][0]+"\"' /></a><a href='javascript:showbox(2,"+boxnum+");' title='RPG Stats'><img src='"+RPG_stats[1][0]+"' onmouseover='this.src=\""+RPG_stats[1][1]+"\"' onmouseout='this.src=\""+RPG_stats[1][0]+"\"' /></a><a href='javascript:showbox(3,"+boxnum+");' title='Inventory'><img src='"+RPG_stats[2][0]+"'  onmouseover='this.src=\""+RPG_stats[2][1]+"\"' onmouseout='this.src=\""+RPG_stats[2][0]+"\"'/></a><a href='javascript:showbox(4,"+boxnum+");' title='Vital Statistics'><img src='"+RPG_stats[3][0]+"' onmouseover='this.src=\""+RPG_stats[3][1]+"\"' onmouseout='this.src=\""+RPG_stats[3][0]+"\"' /></a>&nbsp;&nbsp;&nbsp;"+a[i-2].getElementsByTagName("SPAN")[0].innerHTML;

boxnum++;
}
}
}
}

function setrpgpass()
{
b=0;
a=document.getElementsByTagName("input")
for (i=0;i<a.length;i++)
if (a[i].name=="CookieDate")
if (a[i].checked)
b=a[i].value;
if (b==1)
setCookie("RPGpass",document.getElementsByName("RPGpass")[0].value);
else
document.cookie="RPGpass="+document.getElementsByName("RPGpass")[0].value;
}

//register if unregistered
if (uname!="")
if (!location.href.match('&fight='))
{
while (readCookie("RPGpass")=="")
document.cookie="RPGpass="+prompt("Please enter your RPG password")+";";
if (!users[uname])
document.write("<iframe id=cackhander name=cackhander style='display:none' src='http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+"&memid="+document.getElementById("userlinks").getElementsByTagName("A")[0].href.split("=")[1]+"&command=1' onload='Refresh()'></iframe>");
else
{
if ((navigator.appName).indexOf("Microsoft")!=-1)
hahaha();
else
document.write("<iframe id=cackhander name=cackhander src='"+location.href.split("index")[0]+"blah.html' width='0' height='0' frameborder='0' onload='Refresh()'></iframe>");
}
}
//login stuffs
if (location.href.match("act=Login&CODE=00"))
{
a=document.getElementsByTagName("TABLE");
for (i=0;i<a.length;i++)
if ((a[i].className=="tablebasic")&&(a[i].rows[0].cells[0].innerHTML=="Please enter your name"))
{
a[i].insertRow(-1);
a[i].rows[2].insertCell(-1);
a[i].rows[2].insertCell(-1);
a[i].rows[2].cells[0].innerHTML="Please enter your RPG password"
a[i].rows[2].cells[1].innerHTML="<input type='password' size='20' name='RPGpass' class='forminput' />"
}
a=document.getElementsByTagName("input");
for (i=0;i<a.length;i++)
if (a[i].value=="Log me in")
a[i].onclick=setrpgpass;
}

if (location.href.match("act=Reg&CODE=00"))
{
a=document.getElementsByTagName("TABLE");
for (i=0;i<a.length;i++)
if ((a[i].className=="tablebasic")&&(a[i].rows[0].cells[0].innerHTML.match(/Please choose a username/i)))
{
a[i].insertRow(-1);
a[i].rows[5].insertCell(-1);
a[i].rows[5].insertCell(-1);
a[i].rows[5].cells[0].innerHTML="Please choose an RPG password:"
a[i].rows[5].cells[1].innerHTML="<input type='password' size='32' name='RPGpass' class='forminput' />"
}
a=document.getElementsByTagName("input");
for (i=0;i<a.length;i++)
if (a[i].value=="Submit my registration")
a[i].onclick=setrpgpass;
}

function PostClass(theclass)
{
if (theclass==0)
return;
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+"&gender="+gender+"&class="+theclass+"&command=2");
}

function ChangeClass(theclass)
{
if (gender==0)
document.getElementById("thepic").getElementsByTagName("IMG")[0].src=classes[theclass][6];
else
document.getElementById("thepic").getElementsByTagName("IMG")[0].src=classes[theclass][9];
a = "<table><th><b>Stats</b></th><tr><td>EXP Speed:</td><td>"
if (classes[theclass][1] > 12)
 a += "Slow"
else if (classes[theclass][1] < 9)
 a += "Fast"
else
 a += "Midrange"
a += "</td></tr><tr><td>Hit Chance:</td><td>"
if (classes[theclass][2] > 2)
 a += "Bad"
else if (classes[theclass][2] < 1.5)
 a += "Good"
else
 a += "Midrange"
a += "</td></tr><tr><td>Health:</td><td>"
if (classes[theclass][3] > 9)
 a += "High"
else if (classes[theclass][3] < 7)
 a += "Low"
else
 a += "Midrange"
a += "</td></tr><tr><td>Proficiency:</td><td>"
 a += classes[theclass][4].replace(/@/g,", ");
a += "</td></tr><tr><td>Deficiency:</td><td>"
 a += classes[theclass][5].replace(/@/g,", ");
a += "</td></tr><tr><td>Unusable:</td><td>"
 a += classes[theclass][13].replace(/@/g,", ");

a += "</td></tr></table><br>"

a+= "<input type ='button' onclick='Javascript:PostClass("+theclass+")' value='Choose "+classes[theclass][0]+"'>";
document.getElementById("thestats").innerHTML = a;
tehclass=theclass;
}

function ChangeGender(thegender)
{
gender=thegender;
if (gender==0)
document.getElementById("thepic").getElementsByTagName("IMG")[0].src=classes[tehclass][6];
else
document.getElementById("thepic").getElementsByTagName("IMG")[0].src=classes[tehclass][9];
}

//Class Selection
if (location.href.match("rpg=class"))
{
a = "<div class='pformstrip'>Your Character Info</div>"
a += '<table width="100%" border="0" cellspacing="0" cellpadding="4">'
a += "<tr>"
a += '<td width="40%">Character Class:</td>'
a += '<td width="60%">'
b = '<form><select onChange="ChangeClass(this.options[this.selectedIndex].value);">'
b += '<option value='+NoClass+'>No Class';
for (blah in classes)
if (blah != "NoClass")
if (classes[blah][12])
b += '<option value="'+blah+'">'+classes[blah][0];
b += '</select></form>'
b += '</td></tr><tr><td id="thepic"><img src="'+classes[NoClass][9]+'" height="100px" width="100px"></td><td id="thestats"></td></td></table><br></table>'
a += b;

a+= "<br><br>"+'<form><select onChange="ChangeGender(this.options[this.selectedIndex].value);">'+'<option value="0">Gender<option value="0">Male<option value="1">Female</select></form>';

document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Select Class and Gender </div>"+a;
gender=0;
tehclass=0;
}

function EditEquip()
{
a="";b=0;
if (document.getElementsByName("slide1")[0].value!="0")
{if (b==1) a+="@"; else b=1;a+=document.getElementsByName("slide1")[0].value;}
if (document.getElementsByName("slide2")[0].value!="0")
{if (b==1) a+="@"; else b=1;a+=document.getElementsByName("slide2")[0].value;}
for (i in gear)
if (document.getElementsByName("slide"+i)[0])
if (document.getElementsByName("slide"+i)[0].value!="0")
{if (b==1) a+="@"; else b=1;a+=document.getElementsByName("slide"+i)[0].value;}
whank=a;
send("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=8&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+"&equipped="+whank);
}

//equip screen
if (location.href.match("rpg=equip"))
{
b=[];
b[1]=1;
b[2]=1;
a="<table><tr><td>Melee</td><td><form><select name='slide1'><option value='0'>None"
for (blah in items)
if (HaveItem(uname,blah))
if (items[blah][8]==1)
if (items[blah][11]==1)
if (CanUse(uname, blah))
a+="<option value='"+blah+"'>"+items[blah][3];
a+="</form></td></tr><tr><td>Ranged</td><td><form><select name='slide2'><option value='0'>None"
for (blah in items)
if (HaveItem(uname,blah))
if (items[blah][8]==1)
if (items[blah][11]==2)
if (CanUse(uname, blah))
a+="<option value='"+blah+"'>"+items[blah][3];
for (rawr in items)
if (HaveItem(uname,rawr))
if (items[rawr][8]==1)
if (items[rawr][11]>2)
if (CanUse(uname, rawr))
if (!b[items[rawr][11]])
{
a+="</form></td></tr><tr><td>"+gear[items[rawr][11]]+"</td><td><form><select name='slide"+items[rawr][11]+"'><option value='0'>None"
for (blah in items)
if (HaveItem(uname,blah))
if (items[blah][8]==1)
if (items[blah][11]==items[rawr][11])
if (CanUse(uname, blah))
a+="<option value='"+blah+"'>"+items[blah][3];
b[items[rawr][11]]=1;
}
a+="</form></td></tr></table>"
a+="<br /><br /><input type='button' value='Submit' onclick='EditEquip()'>"

document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Equip Character </div>"+a;

if (users[uname][14]!="")
{
a=users[uname][14].split("@");
for (i=0;i<a.length;i++)
document.getElementsByName("slide"+items[a[i]][11])[0].value=a[i];
}
}

var battles=[];

thepass=escape(readCookie("RPGpass"));

if (location.href.match("&fight="))
{
if ((navigator.appName).indexOf("Microsoft")==-1)
document.write("<script src='"+"http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+parent.thepass+'&command=901&subcommand='+location.href.split("&fight=")[1].split("&")[0]+'&item='+location.href.split("&item=")[1]+"</script>");
else
{
a=document.createElement("SCRIPT");
a.src="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+parent.thepass+'&command=901&subcommand='+location.href.split("&fight=")[1].split("&")[0]+'&item='+location.href.split("&item=")[1]
document.body.appendChild(a);
}
}

function clocktick()
{
clock-=1;
document.getElementById("theclock").innerHTML=clock;
if (clock==0)
{refreshit=1;Refresh();}
else if ((hp1>0)&&(hp2>0))
setTimeout("clocktick();",1000);
}

function Melee(num)
{
if (numranged>0)
alert ("You are too far away!");
else if (hp1<1)
alert ("You are dead!");
else if (hp2<1)
alert (enemy+" is dead!");
else
request(location.href+"&fight=3&item="+num);
}

function Ranged(num)
{
if (numranged<1)
alert("You are too close!");
else if (hp1<1)
alert ("You are dead!");
else if (hp2<1)
alert (enemy+" is dead!");
else
request(location.href+"&fight=3&item="+num);
}

function UseItem(num)
{
if ((hp1<1)&&(num!=-1))
alert ("You are dead!");
else if ((hp2<1)&&(num!=-1))
alert (enemy+" is dead!");
else
request(location.href+"&fight=1&item="+num);
}

function RunFight2()
{
if (hp1!=nhp1)
{
if (hp1<nhp1)
hp1++;
else
hp1--;
theXP=XPperpost*posts2+users[uname][10];
document.getElementById("hp1").innerHTML=hp1;
ubar(100*hp1/(GetLevel(theXP,uname)*(classes[users[uname][0]][3]+GetHpBonus(users[uname][7]))),Math.round(8-7*hp1/(GetLevel(theXP,uname)*(classes[users[uname][0]][3]+GetHpBonus(users[uname][7])))),1);
setTimeout("RunFight2()",100);
}
else
{
if ((hp1<1)||(hp2<1))
document.getElementById("thebuttons").innerHTML= "<br /><img src='"+RPG_exit+"' onclick='refreshit=1;Refresh();'></div>"
done=1;
}
}

function RunFight3()
{
document.getElementById("fightdata").innerHTML+=desc2+"<br />";
document.getElementById("ap2").innerHTML=ap_2;
RunFight2();
}

function RunFight1()
{
if (hp2==nhp2)
setTimeout("RunFight3();",2000);
else
{
if (hp2<nhp2)
hp2++;
else
hp2--;
theXP=XPperpost*posts2+users[enemy][10];
document.getElementById("hp2").innerHTML=hp2;
ubar(100*hp2/(GetLevel(theXP,enemy)*(classes[users[enemy][0]][3]+GetHpBonus(users[enemy][7]))),Math.round(8-7*hp2/(GetLevel(theXP,enemy)*(classes[users[enemy][0]][3]+GetHpBonus(users[enemy][7])))),2);

setTimeout("RunFight1()",100);
}
}

var nhp1;
var nhp2;
var desc1;
var desc2;

function DoFight(x,y)
{
//debug
//debugwindow.innerHTML += parent.frames["cackhander"].debug;
clock=55;
if ((navigator.appName).indexOf("Microsoft")!=-1)
{
ba_1=x.split("@");
ba_2=y.split("@");
}
else
{
ba_1=parent.frames["cackhander"].battles[uname][0].split("@");
ba_2=parent.frames["cackhander"].battles[enemy][0].split("@");
}
nhp1=ba_1[3];
nhp2=ba_2[3];
desc1=ba_1[7];
desc2=ba_1[8];
numranged=ba_1[9];
ap_1=ba_1[20];
ap_2=ba_2[20];
if (numranged > 0)
document.getElementById("roundtype").innerHTML="Ranged";
else
document.getElementById("roundtype").innerHTML="Melee";
document.getElementById("fightdata").innerHTML=desc1+"<br />";
document.getElementById("ap1").innerHTML=ap_1;
RunFight1();
}

//FIGHT!
if (uname != "")
if (users[uname])
if (users[uname][17]!="none")
{
a=users[uname][17].split("@");
if (a[0]=="1")
if (a[2]=="0")
{


if (document.images)
{
ibar1=new Image(1,8);
ibar1.src = "http://slaytanist.co.uk/RPG_Stuffs/1_bar.gif";
ibar1l=new Image(2,8);
ibar1l.src = "http://slaytanist.co.uk/RPG_Stuffs/1_bar_left.gif";
ibar1r=new Image(2,8);
ibar1r.src = "http://slaytanist.co.uk/RPG_Stuffs/1_bar_right.gif";

ibar2=new Image(1,8);
ibar2.src = "http://slaytanist.co.uk/RPG_Stuffs/2_bar.gif";
ibar2l=new Image(2,8);
ibar2l.src = "http://slaytanist.co.uk/RPG_Stuffs/2_bar_left.gif";
ibar2r=new Image(2,8);
ibar2r.src = "http://slaytanist.co.uk/RPG_Stuffs/2_bar_right.gif";

ibar3=new Image(1,8);
ibar3.src = "http://slaytanist.co.uk/RPG_Stuffs/3_bar.gif";
ibar3l=new Image(2,8);
ibar3l.src = "http://slaytanist.co.uk/RPG_Stuffs/3_bar_left.gif";
ibar3r=new Image(2,8);
ibar3r.src = "http://slaytanist.co.uk/RPG_Stuffs/3_bar_right.gif";

ibar4=new Image(1,8);
ibar4.src = "http://slaytanist.co.uk/RPG_Stuffs/4_bar.gif";
ibar4l=new Image(2,8);
ibar4l.src = "http://slaytanist.co.uk/RPG_Stuffs/4_bar_left.gif";
ibar4r=new Image(2,8);
ibar4r.src = "http://slaytanist.co.uk/RPG_Stuffs/4_bar_right.gif";

ibar5=new Image(1,8);
ibar5.src = "http://slaytanist.co.uk/RPG_Stuffs/5_bar.gif";
ibar5l=new Image(2,8);
ibar5l.src = "http://slaytanist.co.uk/RPG_Stuffs/5_bar_left.gif";
ibar5r=new Image(2,8);
ibar5r.src = "http://slaytanist.co.uk/RPG_Stuffs/5_bar_right.gif";

ibar6=new Image(1,8);
ibar6.src = "http://slaytanist.co.uk/RPG_Stuffs/6_bar.gif";
ibar6l=new Image(2,8);
ibar6l.src = "http://slaytanist.co.uk/RPG_Stuffs/6_bar_left.gif";
ibar6r=new Image(2,8);
ibar6r.src = "http://slaytanist.co.uk/RPG_Stuffs/6_bar_right.gif";

ibar7=new Image(1,8);
ibar7.src = "http://slaytanist.co.uk/RPG_Stuffs/7_bar.gif";
ibar7l=new Image(2,8);
ibar7l.src = "http://slaytanist.co.uk/RPG_Stuffs/7_bar_left.gif";
ibar7r=new Image(2,8);
ibar7r.src = "http://slaytanist.co.uk/RPG_Stuffs/7_bar_right.gif";

ibar8=new Image(1,8);
ibar8.src = "http://slaytanist.co.uk/RPG_Stuffs/8_bar.gif";
ibar8l=new Image(2,8);
ibar8l.src = "http://slaytanist.co.uk/RPG_Stuffs/8_bar_left.gif";
ibar8r=new Image(2,8);
ibar8r.src = "http://slaytanist.co.uk/RPG_Stuffs/8_bar_right.gif";

ibarfrozen=new Image(1,8);
ibarfrozen.src = "http://slaytanist.co.uk/RPG_Stuffs/frozen_bar.gif";
ibarfrozenl=new Image(2,8);
ibarfrozenl.src = "http://slaytanist.co.uk/RPG_Stuffs/frozen_bar_left.gif";
ibarfrozenr=new Image(2,8);
ibarfrozenr.src = "http://slaytanist.co.uk/RPG_Stuffs/frozen_bar_right.gif";

ibarpoison=new Image(1,8);
ibarpoison.src = "http://slaytanist.co.uk/RPG_Stuffs/poison_bar.gif";
ibarpoisonl=new Image(2,8);
ibarpoisonl.src = "http://slaytanist.co.uk/RPG_Stuffs/poison_bar_left.gif";
ibarpoisonr=new Image(2,8);
ibarpoisonr.src = "http://slaytanist.co.uk/RPG_Stuffs/poison_bar_right.gif";

ibarfire=new Image(1,8);
ibarfire.src = "http://slaytanist.co.uk/RPG_Stuffs/fire_bar.gif";
ibarfirel=new Image(2,8);
ibarfirel.src = "http://slaytanist.co.uk/RPG_Stuffs/fire_bar_left.gif";
ibarfirer=new Image(2,8);
ibarfirer.src = "http://slaytanist.co.uk/RPG_Stuffs/fire_bar_right.gif";

}


boxnum=0;
enemy=a[5];
posts1=a[6];
posts2=users[enemy][17].split("@")[6];
hp1=parseInt(a[3]);
hp2=parseInt(a[4]);
numranged=10;
a="<div align='center'>";
if ((navigator.appName).indexOf("Microsoft")!=-1)
a+="<a href='http://rpghaven.co.uk/ie.html'><img src='http://zombiepron.hamsoft-hq.com/images/gashery.gif' /></a>";
else
a += ads[Math.floor(Math.random()*ads.length)];
a+="<br /><span id='roundtype'>Ranged</span> Combat<table width='800px' cellspacing='1'><tr><td width='120px' valign='top' align='center' class='tablepad'>";
theXP=XPperpost*posts1+users[uname][10];
if (users[uname][1] == 1)
{
if (GetLevel(theXP, uname) < 9)
a += "<img src='" + classes[users[uname][0]][9] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, uname) < 18)
a += "<img src='" + classes[users[uname][0]][10] + "' width='100px' height='100px'>";
else
a += "<img src='" + classes[users[uname][0]][11] + "' width='100px' height='100px'>";
}
else
{
if (GetLevel(theXP, uname) < 9)
a += "<img src='" + classes[users[uname][0]][6] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, uname) < 18)
a += "<img src='" + classes[users[uname][0]][7] + "' width='100px' height='100px'>";
else
a += "<img src='" + classes[users[uname][0]][8] + "' width='100px' height='100px'>";
}

a +="<br /><br />"+classes[users[uname][0]][0]+"<br /><br />";
a +="Level: "+GetLevel(theXP,uname)+"<br />";
a +="Experience: "+theXP+"<br /><br />";
a +="Hitpoints: <span id='hp1'>"+hp1+"</span>/"+(GetLevel(theXP,uname)*(classes[users[uname][0]][3]+GetHpBonus(users[uname][7])))+"</span><br />";
a +="<table width='104px'><tr><td align='left' id='bar1'>"+bar(100*hp1/(GetLevel(theXP,uname)*(classes[users[uname][0]][3]+GetHpBonus(users[uname][7]))),Math.round(8-7*hp1/(GetLevel(theXP,uname)*(classes[users[uname][0]][3]+GetHpBonus(users[uname][7])))),1)+"</td></tr></table><br />";
a+="Action points: <b><span id='ap1'>20</span></b><br />"
a+="<br />"
b=users[uname][14].split("@");
d = "<b>Inventory</b><br /><br /><table width='100%' class='tableborder' align='left'><tr><td width='100%' align='left'>";
for (i=0;i<b.length;i++)
if (items[b[i]])
{
if (items[b[i]][11]==1)
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\" onclick='Melee("+b[i]+")'> &nbsp;"
else if (items[b[i]][11]==2)
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\" onclick='Ranged("+b[i]+")'> &nbsp;"
else
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\"> &nbsp;"
}
for (blah in items)
{
if ((HaveItem(uname,blah)) && (items[blah][7] != 0))
if ((items[blah][8]==1)&&(items[blah][11]==0))
d += "<img src='"+items[blah][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+blah+"'));this.border=1;\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.border=0\"  title='"+items[blah][20]+" Action Points' onclick='UseItem("+blah+")'> &nbsp;"
}
d += "<\/td><\/tr><tr height='20px'><td width = '100%' id='itembox"+boxnum+"'>";
d += "&nbsp;<\/td><\/tr><\/table>";
boxnum++;
a+=d;
a += "<br /><br /><div id='thebuttons'><br /><img src='"+RPG_skip+"' onclick='UseItem(-1)'>"
a += "<br /><img src='"+RPG_retreat+"' onclick='UseItem(-2)'></div>"
a+="</td><td width='560px' valign='top' align='center' class='tablepad' id='fightdata'>"
a+="<b>Fight Data:</b><br /><br />"
a+="</td><td width='120px' valign='top' align='center' class='tablepad'>"
theXP=XPperpost*posts2+users[enemy][10];
if (users[enemy][1] == 1)
{
if (GetLevel(theXP, enemy) < 9)
a += "<img src='" + classes[users[enemy][0]][9] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, enemy) < 18)
a += "<img src='" + classes[users[enemy][0]][10] + "' width='100px' height='100px'>";
else
a += "<img src='" + classes[users[enemy][0]][11] + "' width='100px' height='100px'>";
}
else
{
if (GetLevel(theXP, enemy) < 9)
a += "<img src='" + classes[users[enemy][0]][6] + "' width='100px' height='100px'>";
else if (GetLevel(theXP, enemy) < 18)
a += "<img src='" + classes[users[enemy][0]][7] + "' width='100px' height='100px'>";
else
a += "<img src='" + classes[users[enemy][0]][8] + "' width='100px' height='100px'>";
}

a +="<br /><br />"+classes[users[enemy][0]][0]+"<br /><br />";
a +="Level: "+GetLevel(theXP,enemy)+"<br />";
a +="Experience: "+theXP+"<br /><br />";
a +="Hitpoints: <span id='hp2'>"+hp2+"</span>/"+(GetLevel(theXP,enemy)*(classes[users[enemy][0]][3]+GetHpBonus(users[enemy][7])))+"<br />";
a +="<table width='104px'><tr><td align='left' id='bar2'>"+bar(100*hp2/(GetLevel(theXP,enemy)*(classes[users[enemy][0]][3]+GetHpBonus(users[enemy][7]))),Math.round(8-7*hp2/(GetLevel(theXP,enemy)*(classes[users[enemy][0]][3]+GetHpBonus(users[enemy][7])))),2)+"</td></tr></table><br />";
a+="Action points: <b><span id='ap2'>20</span></b><br />"
a+="<br />"
b=users[enemy][14].split("@");
d = "<b>Inventory</b><br /><br /><table width='100%' class='tableborder' align='left'><tr><td width='100%' align='left'>";
for (i=0;i<b.length;i++)
if (items[b[i]])
d += "<img src='"+items[b[i]][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+b[i]+"'));this.style.borderStyle='solid';\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.style.borderStyle='none'\"> &nbsp;"
for (blah in items)
{
if ((HaveItem(enemy,blah)) && (items[blah][7] != 0))
if ((items[blah][8]==1)&&(items[blah][11]==0))
d += "<img src='"+items[blah][2]+"' onMouseOver=\"(itemboxchange('"+boxnum+"','"+blah+"'));this.style.borderStyle='solid';\" onMouseOut=\"(itemboxclear('"+boxnum+"'));this.style.borderStyle='none'\"> &nbsp;"
}
d += "<\/td><\/tr><tr height='20px'><td width = '100%' id='itembox"+boxnum+"'>";
d += "&nbsp;<\/td><\/tr><\/table>";
boxnum++;
a+=d;

a+="</td></tr></table></div>"

a+="<br /><br /><span id='theclock' style='font-weight:bold;'>55</span>"
setTimeout("clocktick();",1000);
clock=55;

//debug
//a+="<div id='debugwindow' class='tableborder'><b>Debug:</b><br /></div>"

replaceboard(a);

}}

theitem=0;
quantity=0;
newcash=0;
newquantity=0;

function BuyOut()
{
if ((newcash==thecash)&&(quantity==newquantity))
done=1;
else
{
if (thecash-newcash>50)
thecash-=Math.floor(((thecash-newcash)/10));
thecash-=7;
if (thecash<newcash)
thecash=newcash;
quantity-=1;
if (quantity<newquantity)
quantity=newquantity;
document.getElementById("itam_"+theitem).innerHTML=quantity;
document.getElementById("cashcash").innerHTML=thecash;
setTimeout("BuyOut()",100);
}
}

function SellOut()
{
if ((newcash==thecash)&&(quantity==newquantity))
done=1;
else
{
if (newcash-thecash>50)
thecash+=Math.floor(((newcash-thecash)/10));
thecash+=7;
if (thecash>newcash)
thecash=newcash;
quantity-=1;
if (quantity<newquantity)
quantity=newquantity;
document.getElementById("itam_"+theitem).innerHTML=quantity;
document.getElementById("cashcash").innerHTML=thecash;
setTimeout("SellOut()",100);
}
}

function BuyIt(itam)
{
if (parseInt(document.getElementsByName("quant")[0].value)*items[itam][0]>thecash)
alert ("You cannot afford that many!")
else if (parseInt(document.getElementsByName("quant")[0].value)>items[itam][6])
alert ("There are not enough in stock.")
else if (done==1)
{
buysell("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=4&quantity='+document.getElementsByName("quant")[0].value+'&itemid='+itam);
quantity=items[itam][6];
newquantity=quantity-parseInt(document.getElementsByName("quant")[0].value);
theitem=itam;
newcash=thecash-(parseInt(document.getElementsByName("quant")[0].value)*items[itam][0]);
setTimeout("BuyOut()",100);
items[itam][6]=newquantity;
done=0;
}
}

function BankIt()
{
if (parseInt(document.getElementsByName("quant")[0].value)>thecash)
alert ("You have not got that much!")
else if (done==1)
{
buysell("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=12&amount='+document.getElementsByName("quant")[0].value);
newcash=thecash-(parseInt(document.getElementsByName("quant")[0].value));
users[uname][23]+=(parseInt(document.getElementsByName("quant")[0].value));
done=1;
}
}

function WithdrawIt()
{
if (parseInt(document.getElementsByName("quant")[0].value)>users[uname][23])
alert ("You have not got that much!")
else if (done==1)
{
buysell("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=12&amount='+(0-parseInt(document.getElementsByName("quant")[0].value)));
newcash=thecash+(parseInt(document.getElementsByName("quant")[0].value));
users[uname][23]-=(parseInt(document.getElementsByName("quant")[0].value));
done=1;
}
}

function SellIt(itam)
{
if (parseInt(document.getElementsByName("quant")[0].value)>GetQuantity(uname,itam))
alert("You don't have that many!")
else if (done==1)
{
buysell("http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+'&command=5&quantity='+document.getElementsByName("quant")[0].value+'&itemid='+itam);
quantity=GetQuantity(uname,itam);
newquantity=quantity-parseInt(document.getElementsByName("quant")[0].value);
theitem=itam;
newcash=thecash+Math.floor(parseInt(document.getElementsByName("quant")[0].value)*items[itam][0]/2);
setTimeout("SellOut()",100);
SetQuantity(uname,itam,newquantity);
done=0;
}
}

function SortByPrice(y,z)
{
if (items[y][0] < items[z][0])
 return 1;
else if (items[y][0] > items[z][0])
 return -1;
else
 return 0;
}

function shoptag(num, name)
{
if (!CanUse(name, num))
 return "<span style='color:red;'>You cannot use this.</span>"
else if (IsProficient(name, num))
 return "<span style='color:green;'>You are proficient with this item.</span>"
else if (IsDeficient(name, num))
 return "<span style='color:#777777;'>You are deficient in this item's class.</span>"
return "";
}

function storeboxchange(theitem) {
a = document.getElementById("tehitempix");
a.innerHTML = "<img src='"+items[theitem][1]+"' width='100px' height='100px'>";
a = document.getElementById("tehitemdesc");
a.innerHTML = items[theitem][4]+"<br /><br />"+shoptag(theitem,uname);
}

function storeboxblank() {
a = document.getElementById("tehitempix");
a.innerHTML = "&nbsp;";
a = document.getElementById("tehitemdesc");
a.innerHTML = "&nbsp;";
}


function AddItemToList(itam)
{
a = document.getElementById("tehtabel");
b = a.getElementsByTagName('TR');
c = b[1].cloneNode(true);
c.className="";
b[1].parentNode.insertBefore(c,b[1])
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[0].innerHTML="<a href='Javascript:BuyIt("+'"'+itam+'"'+")' onMouseOver=(storeboxchange('"+itam+"')); onMouseOut=(storeboxblank());>"+items[itam][3]+"</a>";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[1].innerHTML="<img src='"+items[itam][2]+"'onMouseOver=(storeboxchange('"+itam+"')); onMouseOut=(storeboxblank());>";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[2].innerHTML="<span id='itam_"+itam+"'>"+items[itam][6]+"</span>";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[3].innerHTML=sign+items[itam][0]+postsign;
}


function AddItemToSellList(itam)
{
a = document.getElementById("tehtabel");
b = a.getElementsByTagName('TR');
c = b[1].cloneNode(true);
c.className="";
b[1].parentNode.insertBefore(c,b[1])
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[0].innerHTML="<a href='Javascript:SellIt("+'"'+itam+'"'+")' onMouseOver=(storeboxchange('"+itam+"')); onMouseOut=(storeboxblank());>"+items[itam][3]+"</a>";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[1].innerHTML="<img src='"+items[itam][2]+"'onMouseOver=(storeboxchange('"+itam+"')); onMouseOut=(storeboxblank());>";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[2].innerHTML="<span id='itam_"+itam+"'>"+GetQuantity(uname, itam)+"</span>";
a.getElementsByTagName('TR')[1].getElementsByTagName("TD")[3].innerHTML=sign+Math.floor(items[itam][0]/2);
}

//Shop
if (location.href.match("rpg=shop"))
{
a = "<table width='100%'><tr><td width='75%' valign='top' align='center'>";
a += "<table width='450' border='4' id='tehtabel'>"
a += " <tr>"
a += "  <th align='left' width='50%'>Item Name</th>"
a += "  <th align='left' width='10%'>Icon</th>"
a += "  <th align='left' width='20%'>Stock</th>"
a += "  <th align='left' width='20%'>Item Price</th>"
a += " </tr>"
a += " <tr class='darkrow2'>"
a += "  <td align='left'> </td>"
a += "  <td align='center'> </td>"
a += "  <td align='right'> </td>"
a += "  <td align='right'> </td>"
a += " </tr>"
a += "</table>"
a += "<table width='450' border='4'>"
a += " <tr height='100px'>"
a += "  <td align='middle' width='100px' id='tehitempix'> </td>"
a += "  <td align='right' id='tehitemdesc'> </td>"
a += " </tr>"
a += "</table>"
a += "</td><td width='25%' valign='top'>"
a += "<div class='tableborder'>"
a += "<div class='maintitle'><img src='http://67.18.37.14/style_images/1/nav_m.gif'> <b>Quantity</b></div>"
a += "<div class='row4'><br />"
a += "<input type='text' name='quant' value='1'>"
a += "<br /></div>"
a += "</div>"
a += "<br />"
a += "<div class='tableborder'>"
a += "<div class='maintitle'><img src='http://67.18.37.14/style_images/1/nav_m.gif'> <b>Bank</b></div>"
a += "<div class='row4'>"
a += "Amount: " + users[uname][23]
a += "<br />"
a += "» <a href='javascript:BankIt()'>Deposit</a><br>"
a += "» <a href='javascript:WithdrawIt()'>Withdraw</a><br>"
a += "<br /></div>"
a += "</div>"
a += "<br />"
a += "<div class='tableborder'>"
a += "<div class='maintitle'><img src='http://67.18.37.14/style_images/1/nav_m.gif'> <b>Store categories</b></div>"
a += "<div class='row4'><br />"
a += "<div id='tehcats'>"
a += "</div>"
a += "<br />"
a += "</div>"
a += "</td></tr></table>"
document.getElementById("ucpcontent").innerHTML="<div class='maintitle'>Shop </div>"+a;

cats=[];
if (location.href.match("sell"))
{

ims =[];

catshtml = "";
for(blah in items)
{
if (items[blah][8] != 2)
if (HaveItem(uname,blah))
{AddItemToSellList(blah);
 if (document.images)
 {ims[blah]=new Image(100,100);
  ims[blah].src = items[blah][1];}
}
if ((!cats[items[blah][5]]) && (blah != "nothing"))
{
cats[items[blah][5]] = 1;
catshtml += '» <a href="' + uurl + "&rpg=shop&category=" + items[blah][5].replace(" ","%20") +'">'+ items[blah][5] +"</a><br>"
}
}
catshtml += '» <a href="' + uurl + '&rpg=shop">Buy Items</a><br>';
catshtml += '» <a href="' + uurl + '&rpg=auction">Auctions</a><br>';
a=document.getElementById("tehcats");
a.innerHTML = catshtml;
}
else
{
ims =[];
storeitems = [];
storeitemindex=0;

if (location.href.indexOf("category") != -1)
{
b = location.href;
b = b.split("&category=")[1];
b = b.replace("%20"," ");
defaultstorecategory = b;
}
catshtml = "";
for(blah in items)
{
if ((defaultstorecategory == items[blah][5]) && (items[blah][3] != "nothing"))
{
//AddItemToList(blah);
storeitems[storeitemindex++]=blah;
if (document.images)
{ims[blah]=new Image(100,100);
ims[blah].src = items[blah][1];}
}
if (!cats[items[blah][5]])
{
cats[items[blah][5]] = 1;
catshtml += '» <a href="' + uurl + "&rpg=shop&category=" + items[blah][5].replace(" ","%20") +'">'+ items[blah][5] +"</a><br>"
}
}
storeitems.sort(SortByPrice);
for (blah=0;blah<storeitems.length;blah++)
AddItemToList(storeitems[blah]);
catshtml += '» <a href="' + uurl + '&rpg=shop&sell">Sell Items</a><br>';
catshtml += '» <a href="' + uurl + '&rpg=auction">Auctions</a><br>';
a=document.getElementById("tehcats");
a.innerHTML = catshtml;
}

}

function EditArmour()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=700&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&itemid="+theItem+"&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=1"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class="+escape(document.getElementsByName("box9")[0].value)
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal=0"
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone="+escape(document.getElementsByName("box15")[0].value)
url+="&specialpowertwo="+escape(document.getElementsByName("box16")[0].value)
url+="&luckthaco=0"
url+="&statdamage=0"
url+="&statthaco=0"
url+="&statac=0"
send(url);
}


function AddArmour()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=667&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=1"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class="+escape(document.getElementsByName("box9")[0].value)
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal=0"
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone="+escape(document.getElementsByName("box15")[0].value)
url+="&specialpowertwo="+escape(document.getElementsByName("box16")[0].value)
url+="&luckthaco=0"
url+="&statdamage=0"
url+="&statthaco=0"
url+="&statac=0"
buysell(url);
}


function ChangeArmourToMod(blah)
{
theItem=blah;
document.getElementsByName("box2")[0].value=items[blah][0];
document.getElementsByName("box3")[0].value=items[blah][1];
document.getElementsByName("box4")[0].value=items[blah][2];
document.getElementsByName("box5")[0].value=items[blah][3];
document.getElementsByName("box6")[0].value=items[blah][4];
document.getElementsByName("box7")[0].value=items[blah][5];
document.getElementsByName("box8")[0].value=items[blah][6];
document.getElementsByName("box21")[0].value=items[blah][9];
document.getElementsByName("box22")[0].value=items[blah][10];
document.getElementsByName("box9")[0].value=items[blah][11];
document.getElementsByName("box10")[0].value=items[blah][12];
document.getElementsByName("box12")[0].value=items[blah][14];
document.getElementsByName("box13")[0].value=items[blah][15];
document.getElementsByName("box14")[0].value=items[blah][16];
document.getElementsByName("box15")[0].value=items[blah][17];
document.getElementsByName("box16")[0].value=items[blah][18];

}

function EditWeapon()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=700&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&itemid="+theItem+"&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=1"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class="+escape(document.getElementsByName("box9")[0].value)
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal="+escape(document.getElementsByName("box11")[0].value)
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone="+escape(document.getElementsByName("box15")[0].value)
url+="&specialpowertwo="+escape(document.getElementsByName("box16")[0].value)
url+="&luckthaco="+escape(document.getElementsByName("box17")[0].value)
url+="&statdamage="+escape(document.getElementsByName("box18")[0].value)
url+="&statthaco="+escape(document.getElementsByName("box19")[0].value)
url+="&statac="+escape(document.getElementsByName("box20")[0].value)
send(url);
}


function AddWeapon()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=667&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=1"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class="+escape(document.getElementsByName("box9")[0].value)
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal="+escape(document.getElementsByName("box11")[0].value)
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone="+escape(document.getElementsByName("box15")[0].value)
url+="&specialpowertwo="+escape(document.getElementsByName("box16")[0].value)
url+="&luckthaco="+escape(document.getElementsByName("box17")[0].value)
url+="&statdamage="+escape(document.getElementsByName("box18")[0].value)
url+="&statthaco="+escape(document.getElementsByName("box19")[0].value)
url+="&statac="+escape(document.getElementsByName("box20")[0].value)
buysell(url);
}


function ChangeWeaponToMod(blah)
{
theItem=blah;
document.getElementsByName("box2")[0].value=items[blah][0];
document.getElementsByName("box3")[0].value=items[blah][1];
document.getElementsByName("box4")[0].value=items[blah][2];
document.getElementsByName("box5")[0].value=items[blah][3];
document.getElementsByName("box6")[0].value=items[blah][4];
document.getElementsByName("box7")[0].value=items[blah][5];
document.getElementsByName("box8")[0].value=items[blah][6];
document.getElementsByName("box21")[0].value=items[blah][9];
document.getElementsByName("box22")[0].value=items[blah][10];
document.getElementsByName("box9")[0].value=items[blah][11];
document.getElementsByName("box10")[0].value=items[blah][12];
document.getElementsByName("box11")[0].value=items[blah][13];
document.getElementsByName("box12")[0].value=items[blah][14];
document.getElementsByName("box13")[0].value=items[blah][15];
document.getElementsByName("box14")[0].value=items[blah][16];
document.getElementsByName("box15")[0].value=items[blah][17];
document.getElementsByName("box16")[0].value=items[blah][18];
document.getElementsByName("box17")[0].value=items[blah][19];
document.getElementsByName("box18")[0].value=items[blah][20];
document.getElementsByName("box19")[0].value=items[blah][21];
document.getElementsByName("box20")[0].value=items[blah][22];

}



function EditUsable()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=700&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&itemid="+theItem+"&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=1"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class=0"
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal="+escape(document.getElementsByName("box11")[0].value)
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone="+escape(document.getElementsByName("box15")[0].value)
url+="&specialpowertwo="+escape(document.getElementsByName("box16")[0].value)
url+="&luckthaco="+escape(document.getElementsByName("box17")[0].value)
url+="&statdamage="+escape(document.getElementsByName("box18")[0].value)
url+="&statthaco=0"
url+="&statac=0"
send(url);
}



function AddUsable()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=667&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=1"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class=0"
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal="+escape(document.getElementsByName("box11")[0].value)
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone="+escape(document.getElementsByName("box15")[0].value)
url+="&specialpowertwo="+escape(document.getElementsByName("box16")[0].value)
url+="&luckthaco="+escape(document.getElementsByName("box17")[0].value)
url+="&statdamage="+escape(document.getElementsByName("box18")[0].value)
url+="&statthaco=0"
url+="&statac=0"
buysell(url);
}

function ChangeUsableToMod(blah)
{
theItem=blah;
document.getElementsByName("box2")[0].value=items[blah][0];
document.getElementsByName("box3")[0].value=items[blah][1];
document.getElementsByName("box4")[0].value=items[blah][2];
document.getElementsByName("box5")[0].value=items[blah][3];
document.getElementsByName("box6")[0].value=items[blah][4];
document.getElementsByName("box7")[0].value=items[blah][5];
document.getElementsByName("box8")[0].value=items[blah][6];
document.getElementsByName("box21")[0].value=items[blah][9];
document.getElementsByName("box22")[0].value=items[blah][10];
document.getElementsByName("box10")[0].value=items[blah][12];
document.getElementsByName("box11")[0].value=items[blah][13];
document.getElementsByName("box12")[0].value=items[blah][14];
document.getElementsByName("box13")[0].value=items[blah][15];
document.getElementsByName("box14")[0].value=items[blah][16];
document.getElementsByName("box15")[0].value=items[blah][17];
document.getElementsByName("box16")[0].value=items[blah][18];
document.getElementsByName("box17")[0].value=items[blah][19];
document.getElementsByName("box18")[0].value=items[blah][20];
document.getElementsByName("box19")[0].value=items[blah][21];
document.getElementsByName("box20")[0].value=items[blah][22];

}

function EditStatItem()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=700&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&itemid="+theItem+"&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=4"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class="+escape(document.getElementsByName("box9")[0].value)
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal="+escape(document.getElementsByName("box11")[0].value)
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone=0"
url+="&specialpowertwo=0"
url+="&luckthaco=0"
url+="&statdamage=0"
url+="&statthaco=0"
url+="&statac=0"
send(url);
}


function AddStatItem()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=667&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&cost="+document.getElementsByName("box2")[0].value+"&largepicture="+escape(document.getElementsByName("box3")[0].value)+"&icon="+escape(document.getElementsByName("box4")[0].value)
url+="&name="+escape(document.getElementsByName("box5")[0].value)
url+="&description="+escape(document.getElementsByName("box6")[0].value)
url+="&category="+escape(document.getElementsByName("box7")[0].value)
url+="&stock="+escape(document.getElementsByName("box8")[0].value)
url+="&inventoryflag=1"
url+="&type=4"
url+="&rarity="+escape(document.getElementsByName("box21")[0].value)
url+="&level="+escape(document.getElementsByName("box22")[0].value)
url+="&class="+escape(document.getElementsByName("box9")[0].value)
url+="&subtype="+escape(document.getElementsByName("box10")[0].value)
url+="&damageheal="+escape(document.getElementsByName("box11")[0].value)
url+="&damageadd="+escape(document.getElementsByName("box12")[0].value)
url+="&hitchancemodifier="+escape(document.getElementsByName("box13")[0].value)
url+="&armourmodifier="+escape(document.getElementsByName("box14")[0].value)
url+="&specialpowerone=0"
url+="&specialpowertwo=0"
url+="&luckthaco=0"
url+="&statdamage=0"
url+="&statthaco=0"
url+="&statac=0"
buysell(url);
}

function ChangeStatItemToMod(blah)
{
theItem=blah;
document.getElementsByName("box2")[0].value=items[blah][0];
document.getElementsByName("box3")[0].value=items[blah][1];
document.getElementsByName("box4")[0].value=items[blah][2];
document.getElementsByName("box5")[0].value=items[blah][3];
document.getElementsByName("box6")[0].value=items[blah][4];
document.getElementsByName("box7")[0].value=items[blah][5];
document.getElementsByName("box8")[0].value=items[blah][6];
document.getElementsByName("box21")[0].value=items[blah][9];
document.getElementsByName("box22")[0].value=items[blah][10];
document.getElementsByName("box9")[0].value=items[blah][11];
document.getElementsByName("box10")[0].value=items[blah][12];
document.getElementsByName("box11")[0].value=items[blah][13];
document.getElementsByName("box12")[0].value=items[blah][14];
document.getElementsByName("box13")[0].value=items[blah][15];
document.getElementsByName("box14")[0].value=items[blah][16];
}


function EditClass()
{
b=[];
for (rawr in items)
if (parseInt(items[rawr][8])==1)
b[items[rawr][12]]=1;
url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=701&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))+"&classid="+theItem
url+="&name="+escape(document.getElementsByName("box1")[0].value)
url+="&xpdenom="+escape(document.getElementsByName("box2")[0].value)
url+="&hitchance="+escape(document.getElementsByName("box3")[0].value)
url+="&hpperlevel="+escape(document.getElementsByName("box4")[0].value)
a="None";
c=0;
for (rawr in b)
if (rawr!="0")
if (document.getElementsByName("prof_"+rawr)[0].checked)
{
if (c)
a+="@"+rawr;
else
{a=rawr;c=1;}
}
url+="&proweapon="+escape(a);
a="None";
c=0;
for (rawr in b)
if (rawr!="0")
if (document.getElementsByName("def_"+rawr)[0].checked)
{
if (c)
a+="@"+rawr;
else
{a=rawr;c=1;}
}
url+="&defweapon="+escape(a);
url+="&maletoeight="+escape(document.getElementsByName("box5")[0].value)
url+="&maletoseventeen="+escape(document.getElementsByName("box6")[0].value)
url+="&maleeighteenon="+escape(document.getElementsByName("box7")[0].value)
url+="&femaletoeight="+escape(document.getElementsByName("box8")[0].value)
url+="&femaletoseventeen="+escape(document.getElementsByName("box9")[0].value)
url+="&femaleeighteenon="+escape(document.getElementsByName("box10")[0].value)
url+="&classselectablebyuser="+escape(document.getElementsByName("box11")[0].value)
a="None";
c=0;
for (rawr in b)
if (rawr!="0")
if (document.getElementsByName("ban_"+rawr)[0].checked)
{
if (c)
a+="@"+rawr;
else
{a=rawr;c=1;}
}
url+="&banneditems="+escape(a);
a="None";
c=0;
for (i=0;i<6;i++)
if (document.getElementsByName("stats_"+i)[0].value=="1")
{
if (c)
a+="@"+i;
else
{a=i;c=1;}
}
url+="&prostats="+escape(a);
a="None";
c=0;
for (i=0;i<6;i++)
if (document.getElementsByName("stats_"+i)[0].value=="2")
{
if (c)
a+="@"+i;
else
{a=i;c=1;}
}
url+="&defstats="+escape(a);
send(url);
}

function AddClass()
{
b=[];
for (rawr in items)
if (parseInt(items[rawr][8])==1)
b[items[rawr][12]]=1;
url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=668&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"))
url+="&name="+escape(document.getElementsByName("box1")[0].value)
url+="&xpdenom="+escape(document.getElementsByName("box2")[0].value)
url+="&hitchance="+escape(document.getElementsByName("box3")[0].value)
url+="&hpperlevel="+escape(document.getElementsByName("box4")[0].value)
a="None";
c=0;
for (rawr in b)
if (rawr!="0")
if (document.getElementsByName("prof_"+rawr)[0].checked)
{
if (c)
a+="@"+rawr;
else
{a=rawr;c=1;}
}
url+="&proweapon="+escape(a);
a="None";
c=0;
for (rawr in b)
if (rawr!="0")
if (document.getElementsByName("def_"+rawr)[0].checked)
{
if (c)
a+="@"+rawr;
else
{a=rawr;c=1;}
}
url+="&defweapon="+escape(a);
url+="&maletoeight="+escape(document.getElementsByName("box5")[0].value)
url+="&maletoseventeen="+escape(document.getElementsByName("box6")[0].value)
url+="&maleeighteenon="+escape(document.getElementsByName("box7")[0].value)
url+="&femaletoeight="+escape(document.getElementsByName("box8")[0].value)
url+="&femaletoseventeen="+escape(document.getElementsByName("box9")[0].value)
url+="&femaleeighteenon="+escape(document.getElementsByName("box10")[0].value)
url+="&classselectablebyuser="+escape(document.getElementsByName("box11")[0].value)
a="None";
c=0;
for (rawr in b)
if (rawr!="0")
if (document.getElementsByName("ban_"+rawr)[0].checked)
{
if (c)
a+="@"+rawr;
else
{a=rawr;c=1;}
}
url+="&banneditems="+escape(a);
a="None";
c=0;
for (i=0;i<6;i++)
if (document.getElementsByName("stats_"+i)[0].value=="1")
{
if (c)
a+="@"+i;
else
{a=i;c=1;}
}
url+="&prostats="+escape(a);
a="None";
c=0;
for (i=0;i<6;i++)
if (document.getElementsByName("stats_"+i)[0].value=="2")
{
if (c)
a+="@"+i;
else
{a=i;c=1;}
}
url+="&defstats="+escape(a);
buysell(url);
}


function ChangeClassToMod(blah)
{
theItem=blah;

b=[];
for (rawr in items)
if (parseInt(items[rawr][8])==1)
b[items[rawr][12]]=1;
for (rawr in b)
if (rawr!="0")
{document.getElementsByName("prof_"+rawr)[0].checked=0;document.getElementsByName("ban_"+rawr)[0].checked=0;document.getElementsByName("def_"+rawr)[0].checked=0;};
document.getElementsByName("box1")[0].value=classes[blah][0];
document.getElementsByName("box2")[0].value=classes[blah][1];
document.getElementsByName("box3")[0].value=classes[blah][2];
document.getElementsByName("box4")[0].value=classes[blah][3];
if (classes[blah][4]!="None")
{
a=classes[blah][4].split("@");
for (i=0;i<a.length;i++)
document.getElementsByName("prof_"+a[i])[0].checked=1;
}
if (classes[blah][5]!="None")
{
a=classes[blah][5].split("@");
for (i=0;i<a.length;i++)
document.getElementsByName("def_"+a[i])[0].checked=1;
}
document.getElementsByName("box5")[0].value=classes[blah][6];
document.getElementsByName("box6")[0].value=classes[blah][7];
document.getElementsByName("box7")[0].value=classes[blah][8];
document.getElementsByName("box8")[0].value=classes[blah][9];
document.getElementsByName("box9")[0].value=classes[blah][10];
document.getElementsByName("box10")[0].value=classes[blah][11];
document.getElementsByName("box11")[0].value=classes[blah][12];

if (classes[blah][13]!="None")
{
a=classes[blah][13].split("@");
for (i=0;i<a.length;i++)
document.getElementsByName("ban_"+a[i])[0].checked=1;
}

for (i=0;i<6;i++)
document.getElementsByName("stats_"+i)[0].value=0;

if (classes[blah][14]!="none")
{
a=classes[blah][14].split("@");
for (i=0;i<a.length;i++)
document.getElementsByName("stats_"+a[i])[0].value=1;
}

if (classes[blah][15]!="none")
{
a=classes[blah][15].split("@");
for (i=0;i<a.length;i++)
document.getElementsByName("stats_"+a[i])[0].value=2;
}
}

//edit weapon page
if (location.href.match("act=editweapon"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td>Price:</td><td><input type="text" value="" name="box2" id="box2">(Integer)'
a+='</td></tr><tr><td>Large pic:</td><td><input type="text" value="" name="box3" id="box3">(URL)'
a+='</td></tr><tr><td>Icon:</td><td><input type="text" value="" name="box4" id="box4">(URL)'
a+='</td></tr><tr><td>Name:</td><td><input type="text" value="" name="box5" id="box5">'
a+='</td></tr><tr><td>Description:</td><td><input type="text" value="" name="box6" id="box6">'
a+='</td></tr><tr><td>Shop Category:</td><td><input type="text" value="" name="box7" id="box7">'
a+='</td></tr><tr><td>Number in Stock:</td><td><input type="text" value="" name="box8" id="box8">(Integer)'
a+='</td></tr><tr><td>Rarity:</td><td><input type="text" value="" name="box21" id="box21">(Integer)'
a+='</td></tr><tr><td>Level:</td><td><input type="text" value="" name="box22" id="box22">(Integer)'
a+='</td></tr><tr><td>Weapon Type:</td><td><select name="box9" id="box9"><option value=1>Melee<option value=2>Ranged</select>'
a+='</td></tr><tr><td>Weapon Class:</td><td><input type="text" value="" name="box10" id="box10">'
a+='</td></tr><tr><td>Random Damage:</td><td><input type="text" value="" name="box11" id="box11">(Integer)'
a+='</td></tr><tr><td>Additional Damage:</td><td><input type="text" value="" name="box12" id="box12">(Integer)'
a+='</td></tr><tr><td>Hit Chance Modifier (minus numbers are good):</td><td><input type="text" value="" name="box13" id="box13">(Integer)'
a+='</td></tr><tr><td>Armour Class Modifier (minus numbers are good):</td><td><input type="text" value="" name="box14" id="box14">(Integer)'
a+='</td></tr><tr><td>Special Power:</td><td><select name="box15" id="box15"><option value="0">None<option value="Regen">Regeneration<option value="Fury">Fury<option value="Shock">Shock<option value="Vorpal">Vorpal<option value="Smoke">Smoke<option value="Fire">Fire<option value="Poison">Poison<option value="Freeze">Freeze<option value="Smash">Smash<option value="Backstab">Backstab<option value="Steal">Steal<option value="Leech">Leech<option value="Speed">Speed<option value="Flight">Flight<option value="Antidote">Antidote<option value="Fire1">One-shot Fire<option value="Critical">Critical Hit</select>'
a+='</td></tr><tr><td>Special Power:</td><td><select name="box16" id="box16"><option value="0">None<option value="Regen">Regeneration<option value="Fury">Fury<option value="Shock">Shock<option value="Vorpal">Vorpal<option value="Smoke">Smoke<option value="Fire">Fire<option value="Poison">Poison<option value="Freeze">Freeze<option value="Smash">Smash<option value="Backstab">Backstab<option value="Steal">Steal<option value="Leech">Leech<option value="Speed">Speed<option value="Flight">Flight<option value="Antidote">Antidote<option value="Fire1">One-shot Fire<option value="Critical">Critical Hit</select>'
a+='</td></tr><tr><td>Hit chance based on Charater\'s?:</td><td><select name="box17" id="box17"><option value=0>No<option value=1>Yes</select>'
a+='</td></tr><tr><td>Stat to increase damage:</td><td><select name="box18" id="box18"><option value=0>0<option value=1>1<option value=2>2<option value=3>3<option value=4>4<option value=5>5</select>'
a+='</td></tr><tr><td>Stat to increase hit chance:</td><td><select name="box19" id="box19"><option value=0>0<option value=1>1<option value=2>2<option value=3>3<option value=4>4<option value=5>5</select>'
a+='</td></tr><tr><td>Stat to increase armour (on enemy):</td><td><select name="box20" id="box20"><option value=0>0<option value=1>1<option value=2>2<option value=3>3<option value=4>4<option value=5>5</select>'
a+='</td></tr></table>'

a+="<br /><br />"

a += '<form><select onChange="ChangeWeaponToMod(this.options[this.selectedIndex].value);">'
for (blah in items)
if ((parseInt(items[blah][11])==1)||(parseInt(items[blah][11])==2))
if (parseInt(items[blah][8])==1)
a += '<option value='+blah+'>'+items[blah][3];
a += '</select></form>'
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Edit' onclick='EditWeapon()'>"
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Add' onclick='AddWeapon()'>"
replaceboard(a);
}


//edit usables page
if (location.href.match("act=editusable"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td>Price:</td><td><input type="text" value="" name="box2" id="box2">(Integer)'
a+='</td></tr><tr><td>Large pic:</td><td><input type="text" value="" name="box3" id="box3">(URL)'
a+='</td></tr><tr><td>Icon:</td><td><input type="text" value="" name="box4" id="box4">(URL)'
a+='</td></tr><tr><td>Name:</td><td><input type="text" value="" name="box5" id="box5">'
a+='</td></tr><tr><td>Description:</td><td><input type="text" value="" name="box6" id="box6">'
a+='</td></tr><tr><td>Shop Category:</td><td><input type="text" value="" name="box7" id="box7">'
a+='</td></tr><tr><td>Number in Stock:</td><td><input type="text" value="" name="box8" id="box8">(Integer)'
a+='</td></tr><tr><td>Rarity:</td><td><input type="text" value="" name="box21" id="box21">(Integer)'
a+='</td></tr><tr><td>Level:</td><td><input type="text" value="" name="box22" id="box22">(Integer)'
a+='</td></tr><tr><td>Item Class:</td><td><input type="text" value="" name="box10" id="box10">'
a+='</td></tr><tr><td>Heal Amount:</td><td><input type="text" value="" name="box11" id="box11">(Integer)'
a+='</td></tr><tr><td>Additional Damage:</td><td><input type="text" value="" name="box12" id="box12">(Integer)'
a+='</td></tr><tr><td>Hit Chance Modifier (minus numbers are good):</td><td><input type="text" value="" name="box13" id="box13">(Integer)'
a+='</td></tr><tr><td>Armour Class Modifier (minus numbers are good):</td><td><input type="text" value="" name="box14" id="box14">(Integer)'
a+='</td></tr><tr><td>Special Power:</td><td><select name="box15" id="box15"><option value="0">None<option value="Regen">Regeneration<option value="Fury">Fury<option value="Shock">Shock<option value="Vorpal">Vorpal<option value="Smoke">Smoke<option value="Fire">Fire<option value="Poison">Poison<option value="Freeze">Freeze<option value="Smash">Smash<option value="Backstab">Backstab<option value="Steal">Steal<option value="Leech">Leech<option value="Speed">Speed<option value="Flight">Flight<option value="Antidote">Antidote<option value="Fire1">One-shot Fire<option value="Critical">Critical Hit</select>'
a+='</td></tr><tr><td>Reusable?:</td><td><select name="box16" id="box16"><option value=0>No<option value=1>Yes</select>'
a+='</td></tr><tr><td>Luckmod:</td><td><input type="text" value="" name="box17" id="box17">(Integer)'
a+='</td></tr><tr><td>Chance to Use:</td><td><input type="text" value="" name="box18" id="box18">(Integer)'
a+='</td></tr></table>'

a+="<br /><br />"

a += '<form><select onChange="ChangeUsableToMod(this.options[this.selectedIndex].value);">'
for (blah in items)
if (parseInt(items[blah][11])==0)
if (parseInt(items[blah][8])==1)
a += '<option value='+blah+'>'+items[blah][3];
a += '</select></form>'
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Edit' onclick='EditUsable()'>"
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Add' onclick='AddUsable()'>"
replaceboard(a);
}


//edit armour page
if (location.href.match("act=editarmour"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td>Price:</td><td><input type="text" value="" name="box2" id="box2">(Integer)'
a+='</td></tr><tr><td>Large pic:</td><td><input type="text" value="" name="box3" id="box3">(URL)'
a+='</td></tr><tr><td>Icon:</td><td><input type="text" value="" name="box4" id="box4">(URL)'
a+='</td></tr><tr><td>Name:</td><td><input type="text" value="" name="box5" id="box5">'
a+='</td></tr><tr><td>Description:</td><td><input type="text" value="" name="box6" id="box6">'
a+='</td></tr><tr><td>Shop Category:</td><td><input type="text" value="" name="box7" id="box7">'
a+='</td></tr><tr><td>Number in Stock:</td><td><input type="text" value="" name="box8" id="box8">(Integer)'
a+='</td></tr><tr><td>Rarity:</td><td><input type="text" value="" name="box21" id="box21">(Integer)'
a+='</td></tr><tr><td>Level:</td><td><input type="text" value="" name="box22" id="box22">(Integer)'
a+='</td></tr><tr><td>Armour Type:</td><td><input type="text" value="" name="box9" id="box9">(Integer)'
a+='</td></tr><tr><td>Armour Class:</td><td><input type="text" value="" name="box10" id="box10">'
a+='</td></tr><tr><td>Additional Damage:</td><td><input type="text" value="" name="box12" id="box12">(Integer)'
a+='</td></tr><tr><td>Hit Chance Modifier (minus numbers are good):</td><td><input type="text" value="" name="box13" id="box13">(Integer)'
a+='</td></tr><tr><td>Armour Class Modifier (minus numbers are good):</td><td><input type="text" value="" name="box14" id="box14">(Integer)'
a+='</td></tr><tr><td>Special Power:</td><td><select name="box15" id="box15"><option value="0">None<option value="Regen">Regeneration<option value="Fury">Fury<option value="Shock">Shock<option value="Vorpal">Vorpal<option value="Smoke">Smoke<option value="Fire">Fire<option value="Poison">Poison<option value="Freeze">Freeze<option value="Smash">Smash<option value="Backstab">Backstab<option value="Steal">Steal<option value="Leech">Leech<option value="Speed">Speed<option value="Flight">Flight<option value="Antidote">Antidote<option value="Fire1">One-shot Fire<option value="Critical">Critical Hit</select>'
a+='</td></tr><tr><td>Special Power:</td><td><select name="box16" id="box16"><option value="0">None<option value="Regen">Regeneration<option value="Fury">Fury<option value="Shock">Shock<option value="Vorpal">Vorpal<option value="Smoke">Smoke<option value="Fire">Fire<option value="Poison">Poison<option value="Freeze">Freeze<option value="Smash">Smash<option value="Backstab">Backstab<option value="Steal">Steal<option value="Leech">Leech<option value="Speed">Speed<option value="Flight">Flight<option value="Antidote">Antidote<option value="Fire1">One-shot Fire<option value="Critical">Critical Hit</select>'
a+='</td></tr></table>'

a+="<br /><br />"

a += '<form><select onChange="ChangeArmourToMod(this.options[this.selectedIndex].value);">'
for (blah in items)
if (parseInt(items[blah][11])>2)
if (parseInt(items[blah][8])==1)
a += '<option value='+blah+'>'+items[blah][3];
a += '</select></form>'
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Edit' onclick='EditArmour()'>"
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Add' onclick='AddArmour()'>"
replaceboard(a);



}


//edit stat item page
if (location.href.match("act=editstatitem"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td>Price:</td><td><input type="text" value="" name="box2" id="box2">(Integer)'
a+='</td></tr><tr><td>Large pic:</td><td><input type="text" value="" name="box3" id="box3">(URL)'
a+='</td></tr><tr><td>Icon:</td><td><input type="text" value="" name="box4" id="box4">(URL)'
a+='</td></tr><tr><td>Name:</td><td><input type="text" value="" name="box5" id="box5">'
a+='</td></tr><tr><td>Description:</td><td><input type="text" value="" name="box6" id="box6">'
a+='</td></tr><tr><td>Shop Category:</td><td><input type="text" value="" name="box7" id="box7">'
a+='</td></tr><tr><td>Number in Stock:</td><td><input type="text" value="" name="box8" id="box8">(Integer)'
a+='</td></tr><tr><td>Rarity:</td><td><input type="text" value="" name="box21" id="box21">(Integer)'
a+='</td></tr><tr><td>Level:</td><td><input type="text" value="" name="box22" id="box22">(Integer)'
a+='</td></tr><tr><td>'+stats[0][1]+' Mod:</td><td><input type="text" value="" name="box9" id="box9">(Integer)'
a+='</td></tr><tr><td>'+stats[1][1]+' Mod:</td><td><input type="text" value="" name="box10" id="box10">(Integer)'
a+='</td></tr><tr><td>'+stats[2][1]+' Mod:</td><td><input type="text" value="" name="box11" id="box11">(Integer)'
a+='</td></tr><tr><td>'+stats[3][1]+' Mod:</td><td><input type="text" value="" name="box12" id="box12">(Integer)'
a+='</td></tr><tr><td>'+stats[4][1]+' Mod:</td><td><input type="text" value="" name="box13" id="box13">(Integer)'
a+='</td></tr><tr><td>'+stats[5][1]+' Mod:</td><td><input type="text" value="" name="box14" id="box14">(Integer)'
a+='</td></tr></table>'

a+="<br /><br />"

a += '<form><select onChange="ChangeStatItemToMod(this.options[this.selectedIndex].value);">'
for (blah in items)
if (parseInt(items[blah][8])==4)
a += '<option value='+blah+'>'+items[blah][3];
a += '</select></form>'
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Edit' onclick='EditStatItem()'>"
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Add' onclick='AddStatItem()'>"
replaceboard(a);
}

var itemlist=[];

function GetEquipList()
{
b=[];
b[1]=1;
b[2]=1;
a="<table><tr><td>Melee</td><td><form><select name='slide1'><option value='0'>None"
for (blah in items)
if (items[blah][8]==1)
if (items[blah][11]==1)
for (hahaha in itemlist)
if (hahaha == blah)
a+="<option value='"+blah+"'>"+items[blah][3];
a+="</form></td></tr><tr><td>Ranged</td><td><form><select name='slide2'><option value='0'>None"
for (blah in items)
if (items[blah][8]==1)
if (items[blah][11]==2)
for (hahaha in itemlist)
if (hahaha == blah)
a+="<option value='"+blah+"'>"+items[blah][3];
for (rawr in items)
if (items[rawr][8]==1)
if (items[rawr][11]>2)
for (hahaha in itemlist)
if (hahaha == rawr)
if (!b[items[rawr][11]])
{
a+="</form></td></tr><tr><td>"+gear[items[rawr][11]]+"</td><td><form><select name='slide"+items[rawr][11]+"'><option value='0'>None"
for (blah in items)
for (hahaha in itemlist)
if (hahaha == blah)
if (items[blah][8]==1)
if (items[blah][11]==items[rawr][11])
a+="<option value='"+blah+"'>"+items[blah][3];
b[items[rawr][11]]=1;
}
a+="</form></td></tr></table>"
return a;
}

function AddItemToModList(num,quant)
{
for (blah in itemlist)
if (blah==num)
return;
if (!items[num])
return;
if (!quant)
quant=1;
itemlist[num]=quant;
document.getElementById("tehitamz").insertRow(-1);
document.getElementById("tehitamz").rows[document.getElementById("tehitamz").rows.length-1].insertCell(-1);
document.getElementById("tehitamz").rows[document.getElementById("tehitamz").rows.length-1].insertCell(-1);
document.getElementById("tehitamz").rows[document.getElementById("tehitamz").rows.length-1].cells[0].innerHTML=items[num][3];
document.getElementById("tehitamz").rows[document.getElementById("tehitamz").rows.length-1].cells[1].innerHTML='<input type="text" name="tehitamz_'+num+'" id="tehitamz_'+num+'" value='+quant+'>(Integer)'
document.getElementById("tehequip").innerHTML=GetEquipList();
}

theuser="";

function ChangeUserToMod(num)
{
num=unescape(num);
theuser=num;
if (!users[num])
return;
document.getElementById("tehitamz").innerHTML="";
document.getElementById("tehequip").innerHTML=GetEquipList();
document.getElementById("box0").value=users[num][0];
document.getElementById("box1").value=users[num][1];
document.getElementById("box2").value=users[num][2];
document.getElementById("box3").value=users[num][3];
document.getElementById("box4").value=users[num][4];
document.getElementById("box5").value=users[num][5];
document.getElementById("box6").value=users[num][6];
document.getElementById("box7").value=users[num][7];
if (users[num][8]!="none")
{
z=users[num][8].split("@");
for (i=0;i<z.length;i+=2)
AddItemToModList(z[i],z[i+1]);
}
document.getElementById("box9").value=users[num][9];
document.getElementById("box10").value=users[num][10];
document.getElementById("box11").value=users[num][11];
document.getElementById("box12").value="";
if (users[num][14]!="none")
{
z=users[num][14].split("@");
for (i=0;i<z.length;i++)
if (document.getElementsByName("slide"+items[z[i]][11])[0])
document.getElementsByName("slide"+items[z[i]][11])[0].value=z[i];
}
document.getElementById("box18").value=users[num][18];
document.getElementById("box19").value=users[num][19];
}

function EditUser()
{
a="";
n=0;
for (blah in itemlist)
if (document.getElementById("tehitamz_"+blah))
{
if (n)
a+="@"+blah+"@"+document.getElementById("tehitamz_"+blah).value;
else
{
a=blah+"@"+document.getElementById("tehitamz_"+blah).value;
n=1;
}
}
n=0;
thegear=[];
for (blah in itemlist)
if (items[blah][8]==1)
if (!thegear[items[blah][11]])
if (document.getElementsByName("slide"+items[blah][11])[0])
{
if (n)
b+="@"+document.getElementsByName("slide"+items[blah][11])[0].value;
else
{n=1;b=document.getElementsByName("slide"+items[blah][11])[0].value;}
thegear[items[blah][11]]=1;
}
//I don't trust Javascript to have a proper stack :P
aa=a;
bb=b;
EditMember(theuser,document.getElementById("box0").value,document.getElementById("box1").value,document.getElementById("box2").value,document.getElementById("box3").value,document.getElementById("box4").value,document.getElementById("box5").value,document.getElementById("box6").value,document.getElementById("box7").value,aa,document.getElementById("box9").value,document.getElementById("box10").value,document.getElementById("box11").value,document.getElementById("box12").value,bb,document.getElementById("box18").value,document.getElementById("box19").value);
}

//edit user page
if (location.href.match("act=edituser"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td>Class:</td><td>'
a += '<form><select name="box0" id="box0">'
for (blah in classes)
a += '<option value='+blah+'>'+classes[blah][0];
a += '</select></form>'
a+='</td></tr><tr><td>Gender:</td><td><form><select name="box1" id="box1"><option value="0">Male<option value="1">Female</select></form>'
a+='</td></tr><tr><td>'+stats[0][1]+':</td><td><input type="text" value="" name="box2" id="box2">(Integer)'
a+='</td></tr><tr><td>'+stats[1][1]+':</td><td><input type="text" value="" name="box3" id="box3">(Integer)'
a+='</td></tr><tr><td>'+stats[2][1]+':</td><td><input type="text" value="" name="box4" id="box4">(Integer)'
a+='</td></tr><tr><td>'+stats[3][1]+':</td><td><input type="text" value="" name="box5" id="box5">(Integer)'
a+='</td></tr><tr><td>'+stats[4][1]+':</td><td><input type="text" value="" name="box6" id="box6">(Integer)'
a+='</td></tr><tr><td>'+stats[5][1]+':</td><td><input type="text" value="" name="box7" id="box7">(Integer)'
a+='</td></tr><tr><td colspan="2">Items</td></tr><tr><td colspan="2"><table id="tehitamz"></table><br /><select onchange="AddItemToModList(this.options[this.selectedIndex].value)">'
for (blah in items)
a+='<option value='+blah+'>'+items[blah][3];
a+='</select>'
a+='</td></tr><tr><td>Cash offset:</td><td><input type="text" value="" name="box9" id="box9">(Integer)'
a+='</td></tr><tr><td>XP offset:</td><td><input type="text" value="" name="box10" id="box10">(Integer)'
a+='</td></tr><tr><td>Admin:</td><td><form><select name="box11" id="box11"><option value="0">No<option value="1">Yes</select></form>'
a+='</td></tr><tr><td>New Password:</td><td><input type="text" value="" name="box12" id="box12">'
a+='</td></tr><tr><td colspan="2">Equipped</td></tr><tr><td colspan="2" id="tehequip">'
a+='</td></tr><tr><td>Clan:</td><td><input type="text" value="" name="box18" id="box18">'
a+='</td></tr><tr><td>Clan Status:</td><td><form><select name="box19" id="box19"><option value="0">Not in clan<option value="2">Member<option value="1">Validating<option value="3">Admin</select></form>'
a+='</td></tr></table>'

a+="<br /><br />"

a += '<form><select onChange="ChangeUserToMod(this.options[this.selectedIndex].value);">'
for (blah in users)
a += '<option value='+escape(blah)+'>'+blah;
a += '</select></form>'
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Edit' onclick='EditUser()'>"
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Add' onclick='AddUser()'>"
replaceboard(a);
}

//edit class page
if (location.href.match("act=editclass"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td>Name:</td><td><input type="text" value="" name="box1" id="box1">'
b=[];
for (blah in items)
if (parseInt(items[blah][8])==1)
b[items[blah][12]]=1;
a+='</td></tr><tr><td>XP Per Level Modifier:</td><td><input type="text" value="" name="box2" id="box2">(Integer)'
a+='</td></tr><tr><td>Levels per Thaco Increase:</td><td><input type="text" value="" name="box3" id="box3">(Integer)'
a+='</td></tr><tr><td>Hit Points Per Level:</td><td><input type="text" value="" name="box4" id="box4">(Integer)'
a+='</td></tr><tr><td colspan="2" class="pformstrip">Proficient Items</td></td></tr><tr><td colspan="2">'
for (blah in b)
if (blah != "0")
a+="<input type='checkbox' name='prof_"+blah+"'>&nbsp;"+blah+"<br />"
a+='</td></tr><tr><td colspan="2" class="pformstrip">Deficient Items</td></td></tr><tr><td colspan="2">'
for (blah in b)
if (blah != "0")
a+="<input type='checkbox' name='def_"+blah+"'>&nbsp;"+blah+"<br />"
a+='</td></tr><tr><td>Male Picture (level 0-8):</td><td><input type="text" value="" name="box5" id="box5">(URL)'
a+='</td></tr><tr><td>Male Picture (level 9-17):</td><td><input type="text" value="" name="box6" id="box6">(URL)'
a+='</td></tr><tr><td>Male Picture (level 18+):</td><td><input type="text" value="" name="box7" id="box7">(URL)'
a+='</td></tr><tr><td>Female Picture (level 0-8):</td><td><input type="text" value="" name="box8" id="box8">(URL)'
a+='</td></tr><tr><td>Female Picture (level 9-17):</td><td><input type="text" value="" name="box9" id="box9">(URL)'
a+='</td></tr><tr><td>Female Picture (level 18+):</td><td><input type="text" value="" name="box10" id="box10">(URL)'
a+='</td></tr><tr><td>Selectable?:</td><td><select name="box11" id="box11"><option value=0>No<option value=1>Yes</select>'
a+='</td></tr><tr><td colspan="2" class="pformstrip">Banned Items</td></td></tr><tr><td colspan="2">'
for (blah in b)
if (blah != "0")
a+="<input type='checkbox' name='ban_"+blah+"'>&nbsp;"+blah+"<br />"
a+='</td></tr><tr><td colspan="2" class="pformstrip">Stats'
for (i=0;i<6;i++)
a+='</td></tr><tr><td>'+stats[i][1]+':</td><td><select name="stats_'+i+'" id="stats_'+i+'"><option value=0>No Change<option value=1>Higher<option value=2>Lower</select>'

a+="</td></tr></table>"

a += '<form><select onChange="ChangeClassToMod(this.options[this.selectedIndex].value);">'
for (blah in classes)
a += '<option value='+blah+'>'+classes[blah][0];
a += '</select></form>'
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Edit' onclick='EditClass()'>"
a+="&nbsp;&nbsp;&nbsp;<input type='button' value='Add' onclick='AddClass()'>"
replaceboard(a);
}


//export page
if (location.href.match("act=export"))
{
replaceboard(ACPbar+"<div align='center'><textarea name='items' cols='100' rows='15' wrap='soft' class='multitext'></textarea><br /><br /><textarea name='classes' cols='100' rows='15' wrap='soft' class='multitext'></textarea></div>");

n=0;
for (blah in items)
document.getElementsByName("items")[0].value+="items["+(n++)+"]=['"+items[blah][0]+"','"+items[blah][1]+"','"+items[blah][2]+"','"+items[blah][3]+"','"+items[blah][4]+"','"+items[blah][5]+"','"+items[blah][6]+"','"+items[blah][7]+"','"+items[blah][8]+"','"+items[blah][9]+"','"+items[blah][10]+"','"+items[blah][11]+"','"+items[blah][12]+"','"+items[blah][13]+"','"+items[blah][14]+"','"+items[blah][15]+"','"+items[blah][16]+"','"+items[blah][17]+"','"+items[blah][18]+"','"+items[blah][19]+"','"+items[blah][20]+"','"+items[blah][21]+"','"+items[blah][22]+"']\n"
n=0;
for (blah in classes)
document.getElementsByName("classes")[0].value+="classes["+(n++)+"]=['"+classes[blah][0]+"','"+classes[blah][1]+"','"+classes[blah][2]+"','"+classes[blah][3]+"','"+classes[blah][4]+"','"+classes[blah][5]+"','"+classes[blah][6]+"','"+classes[blah][7]+"','"+classes[blah][8]+"','"+classes[blah][9]+"','"+classes[blah][10]+"','"+classes[blah][11]+"','"+classes[blah][12]+"','"+classes[blah][13]+"','"+classes[blah][14]+"','"+classes[blah][15]+"']\n"
}
if (users[uname])
{
if (isAdmin)
document.getElementById("userlinks").rows[0].cells[0].innerHTML=document.getElementById("userlinks").rows[0].cells[0].innerHTML.replace(")","&middot; <b><a href='"+location.href.split("?")[0]+"?act=rpga'>RPG ACP</a></b> )");
document.getElementById("userlinks").rows[0].cells[1].innerHTML="<b><a href='"+uurl+"&rpg=menu'>RPG CP</a></b> &middot;"+document.getElementById("userlinks").rows[0].cells[1].innerHTML;
}


function EditBoard()
{

url="http://zombiepron.hamsoft-hq.com/rpg/testing/index.php?command=702&mode=1&username="+escape(uname)+"&password="+escape(readCookie("RPGpass"));
url+="&stats="+escape(document.getElementsByName("stat0a")[0].value)+"@"+escape(document.getElementsByName("stat0b")[0].value)+"@"+escape(document.getElementsByName("stat1a")[0].value)+"@"+escape(document.getElementsByName("stat1b")[0].value)+"@"+escape(document.getElementsByName("stat2a")[0].value)+"@"+escape(document.getElementsByName("stat2b")[0].value)+"@"+escape(document.getElementsByName("stat3a")[0].value)+"@"+escape(document.getElementsByName("stat3b")[0].value)+"@"+escape(document.getElementsByName("stat4a")[0].value)+"@"+escape(document.getElementsByName("stat4b")[0].value)+"@"+escape(document.getElementsByName("stat5a")[0].value)+"@"+escape(document.getElementsByName("stat5b")[0].value);
url+="&xpperpost="+document.getElementsByName("xpperpost")[0].value;
url+="&cashperpost="+document.getElementsByName("cashperpost")[0].value;
url+="&defaultstorecategory="+escape(document.getElementsByName("defaultstorecategory")[0].value);
url+="&sign="+escape(document.getElementsByName("sign")[0].value);
url+="&postsign="+escape(document.getElementsByName("postsign")[0].value);
url+="&noclass="+document.getElementsByName("noclass")[0].value;
url+="&ticketprice="+document.getElementsByName("ticketprice")[0].value;
url+="&gear="
for (i=0;i<gearnum;i++)
{url+=escape(document.getElementsByName("gear"+i+"b")[0].value)+"@"+escape(document.getElementsByName("gear"+i+"a")[0].value); if (i<(gearnum-1)) url+="@";}
if (document.getElementsByName("gear"+gearnum+"a")[0].value!="")
if (document.getElementsByName("gear"+gearnum+"b")[0].value!="")
url+="@"+escape(document.getElementsByName("gear"+gearnum+"b")[0].value)+"@"+escape(document.getElementsByName("gear"+gearnum+"a")[0].value);
url+="&rpgthecard="+escape(document.getElementsByName("rpgthecard")[0].value);
url+="&rpgdonate="+escape(document.getElementsByName("rpgdonate")[0].value);
url+="&rpgskip="+escape(document.getElementsByName("rpgskip")[0].value);
url+="&rpgexit="+escape(document.getElementsByName("rpgexit")[0].value);
url+="&rpgretreat="+escape(document.getElementsByName("rpgretreat")[0].value);
url+="&rpgfight="+escape(document.getElementsByName("rpgfight")[0].value);
url+="&boardurl="+escape(document.getElementsByName("boardurl")[0].value);
url+="&rpgstats="+escape(document.getElementsByName("rpgstats1a")[0].value) + "@"+escape(document.getElementsByName("rpgstats1b")[0].value) + "@"+escape(document.getElementsByName("rpgstats2a")[0].value) + "@"+escape(document.getElementsByName("rpgstats2b")[0].value) + "@"+escape(document.getElementsByName("rpgstats3a")[0].value) + "@"+escape(document.getElementsByName("rpgstats3b")[0].value) + "@"+escape(document.getElementsByName("rpgstats4a")[0].value) + "@"+escape(document.getElementsByName("rpgstats4b")[0].value);
send(url);
}



//edit board page
if (location.href.match("act=editboard"))
{
a=ACPbar;
a+='<table>'
a+='<tr><td><input type="text" value="'+stats[0][0]+'" name="stat0a" id="stat0a"></td><td><input type="text" value="'+stats[0][1]+'" name="stat0b" id="stat0b">'
a+='</td></tr><tr><td><input type="text" value="'+stats[1][0]+'" name="stat1a" id="stat1a"></td><td><input type="text" value="'+stats[1][1]+'" name="stat1b" id="stat1b">'
a+='</td></tr><tr><td><input type="text" value="'+stats[2][0]+'" name="stat2a" id="stat2a"></td><td><input type="text" value="'+stats[2][1]+'" name="stat2b" id="stat2b">'
a+='</td></tr><tr><td><input type="text" value="'+stats[3][0]+'" name="stat3a" id="stat3a"></td><td><input type="text" value="'+stats[3][1]+'" name="stat3b" id="stat3b">'
a+='</td></tr><tr><td><input type="text" value="'+stats[4][0]+'" name="stat4a" id="stat4a"></td><td><input type="text" value="'+stats[4][1]+'" name="stat4b" id="stat4b">'
a+='</td></tr><tr><td><input type="text" value="'+stats[5][0]+'" name="stat5a" id="stat5a"></td><td><input type="text" value="'+stats[5][1]+'" name="stat5b" id="stat5b">'
a+='</td></tr><tr><td>XP Per Post:</td><td><input type="text" value="'+XPperpost+'" name="xpperpost" id="xpperpost">'
a+='</td></tr><tr><td>Cash Per Post:</td><td><input type="text" value="'+cashperpost+'" name="cashperpost" id="cashperpost">'
a+='</td></tr><tr><td>Default Store Category:</td><td><input type="text" value="'+ defaultstorecategory +'" name="defaultstorecategory" id="defaultstorecategory">'
a+='</td></tr><tr><td>Cash Prefix:</td><td><input type="text" value="'+ sign +'" name="sign" id="sign">'
a+='</td></tr><tr><td>Cash Suffix:</td><td><input type="text" value="'+ postsign +'" name="postsign" id="postsign">'
a+='</td></tr><tr><td>No Class:</td><td>'
a += '<form><select name="noclass" id="noclass" value='+ NoClass +'>'
for (blah in classes)
a += '<option value='+blah+'>'+classes[blah][0];
a += '</select></form>'
a+='</td></tr><tr><td>Ticket Price:</td><td><input type="text" value="'+ ticketprice +'" name="ticketprice" id="ticketprice">'
b=0;
for (blah in gear)
{a+='</td></tr><tr><td>Gear <input type="text" value="'+ blah +'" name="gear'+b+'a" id="gear'+blah+'a">:</td><td><input type="text" value="'+ gear[blah] +'" name="gear'+b+'b" id="gear'+b+'b">'
b++;
}
a+='</td></tr><tr><td>Gear <input type="text" value="" name="gear'+b+'a" id="gear'+b+'a">:</td><td><input type="text" value="" name="gear'+b+'b" id="gear'+b+'b">'
gearnum=b;
a+='</td></tr><tr><td>Card Background Pic:</td><td><input type="text" value="'+ RPG_theCard +'" name="rpgthecard" id="rpgthecard">'
a+='</td></tr><tr><td>Donate Pic:</td><td><input type="text" value="'+ RPG_donate +'" name="rpgdonate" id="rpgdonate">'
a+='</td></tr><tr><td>Fight Pic:</td><td><input type="text" value="'+ RPG_fight +'" name="rpgfight" id="rpgfight">'
a+='</td></tr><tr><td>Exit Fight Pic:</td><td><input type="text" value="'+ RPG_exit +'" name="rpgexit" id="rpgexit">'
a+='</td></tr><tr><td>Skip Round Pic:</td><td><input type="text" value="'+ RPG_skip +'" name="rpgskip" id="rpgskip">'
a+='</td></tr><tr><td>Retreat Pic:</td><td><input type="text" value="'+ RPG_retreat +'" name="rpgretreat" id="rpgretreat">'
a+='</td></tr><tr><td>Stats 1 Pic:</td><td><input type="text" value="'+ RPG_stats[0][0] +'" name="rpgstats1a" id="rpgstats1a">'
a+='</td></tr><tr><td>Stats 1 Mouseover:</td><td><input type="text" value="'+ RPG_stats[0][1] +'" name="rpgstats1b" id="rpgstats1b">'
a+='</td></tr><tr><td>Stats 2 Pic:</td><td><input type="text" value="'+ RPG_stats[1][0] +'" name="rpgstats2a" id="rpgstats2a">'
a+='</td></tr><tr><td>Stats 2 Mouseover:</td><td><input type="text" value="'+ RPG_stats[1][1] +'" name="rpgstats2b" id="rpgstats2b">'
a+='</td></tr><tr><td>Stats 3 Pic:</td><td><input type="text" value="'+ RPG_stats[2][0] +'" name="rpgstats3a" id="rpgstats3a">'
a+='</td></tr><tr><td>Stats 3 Mouseover:</td><td><input type="text" value="'+ RPG_stats[2][1] +'" name="rpgstats3b" id="rpgstats3b">'
a+='</td></tr><tr><td>Stats 4 Pic:</td><td><input type="text" value="'+ RPG_stats[3][0] +'" name="rpgstats4a" id="rpgstats4a">'
a+='</td></tr><tr><td>Stats 4 Mouseover:</td><td><input type="text" value="'+ RPG_stats[3][1] +'" name="rpgstats4b" id="rpgstats4b">'
a+='</td></tr><tr><td>Board URL:</td><td><input type="text" value="'+ boardurl +'" name="boardurl" id="boardurl">'
a+="</td></tr></table>";
a+="<br /><input type='button' value='Edit' onclick='EditBoard()'>"
replaceboard(a);
document.getElementsByName("noclass")[0].value=NoClass;
}


if (location.href.match("act=rpga"))
replaceboard(ACPbar+ACPhelp);

a=location.href.split("?")[1];
if (!a)
document.write('<script language="Javascript" src="http://www.rpghaven.co.uk/announce.php"><\/script>');
else if ((a=="act=idx")||(a==""))
document.write('<script language="Javascript" src="http://www.rpghaven.co.uk/announce.php"><\/script>');