/* Super Code Tag by california - [OS]
You may edit and redistribute, but leave this notice */

var iTable = document.getElementsByTagName("pre");

function calcRows(codeContent){
    codeContent = "a"+codeContent.replace(/\n/g, '\n a')+"a";
    var nRows = codeContent.split(/\n/).length+1;
    return nRows;
}

if(location.href.match(/action=(display|search2|(user)rece|pmview)/)){
    for(c=0; c<iTable.length; c++){
        if(iTable[c].className == "code"){
            var codeContent = iTable[c].rows[0].cells[0].firstChild.innerHTML.replace(/&(amp;)?nbsp;/gi, ' ').replace(/<br\s?\/?>/gi, '\n').replace(/&{1}amp;/gi, '&').replace(/\t/g, '    ');
            var nRows = calcRows(codeContent);
            var nCols = (document.body.createTextRange) ? "76" : "72";
            var ctc = (document.body.createTextRange) ? '<button onclick="var ctccontent = this.parentNode.previousSibling.previousSibling.previousSibling.createTextRange(); ctccontent.execCommand(\'Copy\');">Copy</button> ' : '';
            iTable[c].rows[0].cells[0].innerHTML = '<textarea onfocus="this.select();" onkeyup="this.rows = calcRows(this.value);" wrap="off" cols="'+nCols+'" rows="'+nRows+'" class="codearea">'+codeContent+'</textarea><textarea style="display: none;">'+codeContent+'</textarea><br /><div style="width:100%;" align="right">'+ctc+'<button onclick="var ppp = this.parentNode.previousSibling.previousSibling.previousSibling; ppp.value = ppp.nextSibling.value; ppp.rows = calcRows(ppp.value); ppp.focus();" align="right">Revert</button></div>';
            iTable[c].parentNode.parentNode.parentNode.parentNode.width = "";
        }
    }
}

/* extra smileys in posting area by california [R.I.P.] */

var imgPath = "http://s93.photobucket.com/albums/l79/shadow_074/shadowcodes/emo/"
var smiley = [
  "BREAK",
  ['grin.gif', ':D'],
  ['smile.gif', ':)'],
  ['sad.gif', ':('],
  ['surprise.gif', ':o'],
  ['confused.gif', ':?'],
  "BREAK",
  ['eek.gif', ':eek:'],
  ['unsure.gif', ':???:'],
  ['cool.gif', '8)'],
  ['lol.gif', ':lol:'],
  ['razz.gif', ':P'],
  "BREAK",
  ['cry.gif', ':cry:'],
  ['wink.gif', ':wink:'],
  ['roll-eyes.gif', ':roll:'],
  ['red-face.gif', ':oops:'],
  ['mad.gif', ':x'],
  "BREAK",
  ['evil.gif', ':evil:'],
  ['twisted.gif', ':twisted:'],
  ['idealamp.gif', ':idea:'],
  ['exclamationmark.gif', ':!:'],
  ['questionmark.gif', ':?:'],
  ['arrow.gif', ':>>:']
];

// do not edit below this line
var td=document.getElementsByTagName("td");
if(document.postForm){
    for(i=1;i<td.length;i++){
        if(td[i].width=="70%" && td[i-1].innerHTML.match(/Add Smilies:/)){
            for(j=0;j<smiley.length;j++){
                if(smiley[j]=="BREAK"){
                    td[i].innerHTML+='<br />';
                }else{
                    var code=smiley[j][1];
                    var img=imgPath+smiley[j][0];
                    var jsadd='javascript:add(\' '+code+' \')';
                    td[i].innerHTML+=' <a href="'+jsadd+'"><img src="'+img+
                    '" border="0" alt="'+code+'" /></a>';
                }
            }
            break;
        }
    }
}


// Smiley Box
// Created By Virtuoso

var gCell = document.getElementsByTagName('td');

if(document.postForm){

for(t=0;t<gCell.length;t++){
if(gCell[t].width == "30%" && gCell[t].className == "windowbg2" && gCell[t].innerHTML.match(/Add Smilies:/)){
gCell[t].parentNode.style.display = "none";
var gSmiley = gCell[t+1].innerHTML;
}
if(gCell[t].width == "30%" && gCell[t].className == "windowbg2" && gCell[t].innerHTML.match(/Message:/)){
gCell[t].innerHTML += '<br /><center><br /><table width="80%" border="0" cellpadding="4" cellspacing="1" border="0" class="bordercolor"><tr><td width="100%" class="catbg"><center><font size="2"><b>Add Smilies:</b></font></center></td></tr><tr><td width="100%" class="windowbg2"><font size="2">'+gSmiley+'</font></td></tr></table></center><br />';
}}}

/* Insert Space Between Forum Jump And Last Table
By {XF}, http://exdat.proboards44.com
Do NOT RIP nor REPOST nor CLAIM AS YOUR OWN */

var gapSize = "10" // Size of seperation

var select = document.getElementsByTagName("select");
for (i=select.length-1; i>=0; i--) {
if (select.item(i).options.item(0).firstChild.data.match(/Forum\sJump/i)) {
var sDiv = document.createElement("div");
sDiv.style.height = gapSize + "px";
var tTarget = select.item(i).parentNode.parentNode.parentNode.parentNode;
tTarget.parentNode.insertBefore(sDiv, tTarget);
}
}
