/*#########################################*\
##            Evil Pet System V1           ##
##  By Godkillah from Phantom-designs.net  ##
## Code cannot be edited/rehosted/reposted ##
##       Without creators permission       ##
\*#########################################*/
document.getElementById("submenu").rows[0].cells[1].innerHTML += " <img src='"+PetIcon+"'> <a href='"+document.getElementById("navstrip").getElementsByTagName("a")[0].href.split("?")[0]+"?act=UserCP&CODE=22&pet=true'>Pets</a>";
function filter(conts){
Co=conts.split(" ").length
for(ca=0;ca<Co;ca++){
conts=conts.replace(" ","")
}
return conts
}
D=new Date().getHours()+"-"+new Date().getDay()+"-"+new Date().getMonth()+"-"+new Date().getYear()
if(location.href.match(/act=UserCP&CODE=22&pet=true/i)){
pet=false
contentucp=document.getElementById("ucpcontent").innerHTML
document.getElementById("extraPage").innerHTML="<div class='tableborder'><div class='maintitle'>Pet System</div><div class='pformstrip'></div><center><div id='THECONT'><b>Loading please wait...</b></div></center><div class='pformstrip'><a href='http://www.phantom-designs.net'>Evil Pet System V1 by Godkillah © phantom-designs.net</a></div></div><span style='display:none'>"+contentucp+"</span>"
a=document.getElementsByTagName("textarea")
for(i=0;i<a.length;i++){
if(a[i].name=="Post"){
a[i].id='SigArea'
if(a[i].value.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
sigcode="[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]"
var pet=[]
pet[0]=RegExp.$1
pet[1]=RegExp.$2
pet[2]=pets[RegExp.$3][0]
pet[3]=pets[RegExp.$3][1]
pet[4]=RegExp.$3
break
}}}
function getPet(n){
if(!document.getElementById("SigArea").value.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
var name=prompt("Please enter a name for your new "+pets[n][0],pets[n][0])
if(name==null){
alert("You did not enter a valid name for your pet!")
}else{
document.getElementById("SigArea").value="[pet="+name+"]"+D+"["+n+"=pet]"+document.getElementById("SigArea").value
a=document.getElementsByTagName("input")
for(i=0;i<a.length;i++){
if(a[i].value=="Update my Signature" && a[i].type=="submit"){
a[i].click()
}}}}}
if(pet!=false){
document.getElementById("THECONT").innerHTML="<b>Your "+pet[2]+" "+pet[0]+" remains on in this page, take good care of him/her!</b><br>"
if(D==pet[1]){
document.getElementById("THECONT").innerHTML+="<br><b>Food:</b><br><a href='javascript:alert(\""+pet[0]+" does not want the food, you already gave him/her food this hour!\")'>Give "+pet[0]+" some "+pet[3]+"</a>"
}else{
function rawr(ta){
alert(ta)
document.getElementById("SigArea").value=document.getElementById("SigArea").value.split("[pet="+pet[0]+"]"+pet[1]+"["+pet[4]+"=pet]").join("[pet="+pet[0]+"]"+D+"["+pet[4]+"=pet]")
a=document.getElementsByTagName("input")
for(i=0;i<a.length;i++){
if(a[i].value=="Update my Signature" && a[i].type=="submit"){
a[i].click()
}}}
document.getElementById("THECONT").innerHTML+="<br><b>Food:</b><br><a href='javascript:rawr(\""+pet[0]+" whas pretty hungry and enjoyed the "+pet[3]+"!\")'>Give "+pet[0]+" some "+pet[3]+"</a>"
}
function killPet(){
var conf=confirm("Are you sure you wish you kill "+pet[0]+"?")
if(conf==true){
if(document.getElementById("SigArea").value.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
document.getElementById("SigArea").value=document.getElementById("SigArea").value.split("[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]").join("")
a=document.getElementsByTagName("input")
for(i=0;i<a.length;i++){
if(a[i].value=="Update my Signature" && a[i].type=="submit"){
a[i].click()
}}}}}
document.getElementById("THECONT").innerHTML+="<br><br><b>Sick and tired of your pet?:</b><br><a href='javascript:killPet()'>Kill "+pet[0]+"!</a>"
}else{
document.getElementById("THECONT").innerHTML="<b>You do not have a pet yet! click on one of the links to pick one:</b>"
for(j=0;j<pets.length;j++){
document.getElementById("THECONT").innerHTML+="<br><a href='javascript:getPet("+j+")'>"+pets[j][0]+"</a>"
}}}
if(location.href.match(/act=UserCP&CODE=22/i) && !location.href.match(/&pet=true/i)){
if(document.referrer.match(/&pet=true/i)){
location.href=document.referrer
}
backup=""
function backitup(){
if(!document.getElementById("SigArea").value.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
document.getElementById("SigArea").value=backup+document.getElementById("SigArea").value
}}
a=document.getElementsByTagName("textarea")
for(i=0;i<a.length;i++){
if(a[i].name=="Post"){
a[i].id='SigArea'
if(a[i].value.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
backup="[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]"
a[i].value=a[i].value.split("[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]").join("")
break
}}}
a=document.getElementsByTagName("div")
for(i=0;i<a.length;i++){
if(a[i].className=="signature" && a[i].innerHTML.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
a[i].innerHTML=a[i].innerHTML.split("[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]").join("")
}}
a=document.getElementsByTagName("input")
for(i=0;i<a.length;i++){
if(a[i].value=="Update my Signature" && a[i].type=="submit"){
a[i].onclick=backitup
}}}
if(location.href.match(/showtopic=/i)){
a=document.getElementsByTagName("span")
for(i=0;i<a.length;i++){
tehcode="none"
if(a[i].innerHTML.match(/Member No.:/i) && a[i].className=="postdetails"){
pet="None"
d=a[i].parentNode.parentNode.getElementsByTagName("div")
for(p=0;p<d.length;p++){
if(d[p].className=="signature" && d[p].innerHTML.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
pet="<a href='javascript:alert(\""+RegExp.$1+" the "+pets[RegExp.$3][0]+"\")'>"+RegExp.$1+"</a>"
d[p].innerHTML=d[p].innerHTML.split("[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]").join("")
if(filter(d[p].innerHTML)==""){
d[p].parentNode.innerHTML=d[p].parentNode.innerHTML.split("--------------------").join("")
}}}
a[i].innerHTML=a[i].innerHTML.replace("Joined:","Pet: "+pet+"<br>Joined:")
}}}
if(location.href.match(/showuser=/i)){
pet="<i>No Information</i>"
a=document.getElementsByTagName("TD");
for (i=0;i<a.length;i++){
if(a[i].innerHTML.match(/\[pet=(.*)\](.*)\[(\d+)=pet\]/i)){
pet="<b><a href='javascript:alert(\""+RegExp.$1+" the "+pets[RegExp.$3][0]+"\")'>"+RegExp.$1+"</a></b>"
a[i].innerHTML=a[i].innerHTML.split("[pet="+RegExp.$1+"]"+RegExp.$2+"["+RegExp.$3+"=pet]").join("")
break
}}
for (i=0;i<a.length;i++){
if (a[i].innerHTML=="Information"){
b=a[i].parentNode.parentNode.parentNode;
b.insertRow(-1);
b.rows[5].insertCell(-1);
b.rows[5].insertCell(-1);
b.rows[5].cells[0].className="row3";
b.rows[5].cells[1].className="row1";
b.rows[5].cells[0].innerHTML="<b>Pet</b>";
b.rows[5].cells[1].innerHTML=pet;
}}}
