/********* CELTIC PSYTRANCE GLOBAL FOOTER JS  *******/

// -----------------------------------------------------------------------------
// Jumps to most recent post in thread.
// By Todge.
(function(){
if (document.location.href.match('board=') && !document.location.href.match('action=')) {
    var boards = document.getElementsByTagName('td');
    for (b = 0; b < boards.length; b++) {
        if (boards[b].width.match(/4(3|8)/) && boards[b].className == 'windowbg') {
            if (boards[b].firstChild.nodeName == 'A') {
                boards[b].onclick = function() {
                    document.location.href = this.firstChild.href;
                    this.getElementsByTagName('a')[1].href = this.firstChild.href;
                };
            } else {
                boards[b].onclick = boards[b + 4].onclick;
                var click = new String(boards[b + 4].onclick);
                if (document.all) {
                    boards[b].getElementsByTagName('a')[0].href = click.split("'")[1];
                } else {
                    boards[b].getElementsByTagName('a')[0].href = click.split('"')[1];
                }
            }
        }
    }
}
})();
// -----------------------------------------------------------------------------
//Show Number of Unread Posts v1.0

//Copyright 9-25-2005 by ~Wonder
//May be reposted anywhere as long as this header remains in tact

//Put in Global Footer
(function(){
if (location.href.match(/board\=/)) {
    td = document.getElementsByTagName("td");
    for (i = 0; i < td.length; i++) {
        if (td[i].className == "windowbg" && td[i].innerHTML.match(/alt="new"/) && td[i].innerHTML.match(/thread\=(\d+)/)) {
            newposts = parseInt(td[i + 2].innerHTML.split(">")[2].split("<")[0]);
            if (document.cookie.indexOf(RegExp.$1) != -1) {
                newposts = newposts - parseInt(document.cookie.split(RegExp.$1 + "=")[1].split(';')[0]);
            }
            td[i].innerHTML += "<br>(" + (newposts + 1) + " new posts)";
        }
    }
}
if (location.href.match(/thread\=/)) {
    td = document.getElementsByTagName("td");
    for (i = 0; i < td.length; i++) {
        if (td[i].innerHTML.match(/« Reply #(\d+) on/) && td[i].width == "55%") {
        }
    }
    thread = location.href.split("thread=")[1];
    if (thread.indexOf("&")) {
        thread = thread.split("&")[0];
    }
    temp = new Date();
    temp.setTime(temp.getTime() + 1209600000);
    oldposts = 0;
    if (document.cookie.indexOf(thread + "=") != -1) {
        oldposts = parseInt(document.cookie.split(thread + "=")[1].split(';')[0]);
    }
    if (parseInt(RegExp.$1) > oldposts) {
        document.cookie = thread + "=" + RegExp.$1 + "; expires=" + temp.toGMTString();
    }
}
})();

// -----------------------------------------------------------------------------
/* set max posted image size with scrollbars for larger by Death to ALL 
edit the maxWidth and maxHeight for the max size of images posted, 
will also be the size of the iframe for larger images.
*/
(function(){
var maxWidth = 900;
var maxHeight = 900;
var img = document.getElementsByTagName("img");

for (s = 0; s < img.length; s++) {
    if (img[s].alt.match(/\[image\]/i)) {
        img[s].onload = function() {
            if (this.width > maxWidth || this.height > maxHeight) {
                var iFrame = document.createElement("iframe");
                iFrame.src = this.src;
                var iFrameWidth = maxWidth;
                if (this.width < maxWidth) {
                    iFrameWidth = this.width;
                }
                iFrame.width = iFrameWidth;
                var iFrameHeight = maxHeight;
                if (this.height < maxHeight) {
                    iFrameHeight = this.height;
                }
                iFrame.height = iFrameHeight;
                iFrame.frameBorder = "0";
                iFrame.noResize = "true";
                iFrame.scrolling = "auto";
                iFrame.style.display = "block";
                iFrame.marginHeight = "0";
                iFrame.marginWidth = "0";
                this.parentNode.replaceChild(iFrame, this);
            }
        };
    }
    if ((img[s].width > maxWidth || img[s].height > maxHeight) && img[s].alt.match(/\[image\]/i)) {
        var iFrame = document.createElement("iframe");
        iFrame.src = img[s].src;
        var iFrameWidth = maxWidth;
        if (this.width < maxWidth) {
            iFrameWidth = this.width;
        }
        iFrame.width = iFrameWidth;
        var iFrameHeight = maxHeight;
        if (this.height < maxHeight) {
            iFrameHeight = this.height;
        }
        iFrame.height = iFrameHeight;
        iFrame.frameBorder = "0";
        iFrame.noResize = "true";
        iFrame.scrolling = "auto";
        iFrame.style.display = "block";
        iFrame.marginHeight = "0";
        iFrame.marginWidth = "0";
        img[s].parentNode.replaceChild(iFrame, img[s]);
    }
}
})();

// -----------------------------------------------------------------------------
/*
Replace "Line" In Posts With Image
Coded By Moose
Requested By Kapt~`'- [ash-making some new ones]
*/
(function(){
var randomImages = [
    "http://myweb.tiscali.co.uk/dosseposse/cline.jpg",
    "http://myweb.tiscali.co.uk/dosseposse/cline2.jpg",
    "http://myweb.tiscali.co.uk/dosseposse/cline3.jpg" //no comma
];
var postimg = randomImages[Math.floor(Math.random() * randomImages.length)];
if (location.href.match(/action=display/)) {
    var td = document.getElementsByTagName('td');
    for (t = 0; t < td.length; t++) {
        if (td[t].colSpan == "3" && td[t].vAlign == "top" && td[t].firstChild.className == "hr") {
            var img = document.createElement('img');
            var center = document.createElement('center');
            img.src = postimg;
            img.border = "0";
            center.appendChild(img);
            var br = document.createElement('br');
            td[t].replaceChild(br, td[t].firstChild);
            td[t].insertBefore(center, br);
        }
    }
}
})();


// -----------------------------------------------------------------------------
//Google It v1.0 [CB]
//Copyright 01-25-2005 ~Wonder
//May be reposted anywhere as long as this header remains in tact
//In loving memory of Tess, the best dog in the world. I'll miss you :'(

//Place in Global Footer

//URL to Google Icon
(function(){
googleIcon = "http://img218.imageshack.us/img218/5996/googleicon5xs.gif";

//Google Safe Search on or off
safeSearch = "off";
if (document.postForm && document.postForm.color) {
    document.postForm.color.parentNode.innerHTML += "<a href=javascript:add(\"[google]\",\"[/google]\")><img src=\"" + googleIcon + "\" alt=\"Google It\" border=\"0\"></a>";
}

if (location.href.match(/action\=(display|pmview|recent|userrecentposts|gotopost|search|calendarview)/) || (!location.href.match(/action\=/) && document.postForm)) {
    td = document.getElementsByTagName("td");
    for (i = 0; i < td.length; i++) {
        if (td[i].width == "20%" && td[i].className.match(/windowbg/)) {
            r = td[i].nextSibling.innerHTML.match(/\[google\](.+?)\[\/google\]/i);
            if (r != null) {
                q = RegExp.$1;
                td[i].nextSibling.innerHTML = td[i].nextSibling.innerHTML.replace(r[0], "<font style=\"font-family: 'Book Antiqua'\"><font color=0033CC>G</font><font color=CC3300>o</font><font color=DDAA00>o</font><font color=0033CC>g</font><font color=009900>l</font><font color=CC3300>e</font>:</font><a href=\"http://www.google.com/search?hl=en&safe=" + safeSearch + "&q=" + escape(q.replace(/<\/?.+?>/ig, "")) + "\" target=\"_blank\">" + q + "</a>");
                i--;
            }
        }
    }
}
})();


// -----------------------------------------------------------------------------
(function(){
var menuAdd = document.getElementsByTagName('td');
for (ma = 0; ma < menuAdd.length; ma++) {
    if (menuAdd[ma].className == 'menubg') {
        menuAdd[ma].innerHTML = '<a href="http://www.google.co.uk/"><img src="http://www.google.co.uk/favicon.ico" border="0"></a> ' + menuAdd[ma].innerHTML;
    }
}
})();


// -----------------------------------------------------------------------------
(function(){
var fWidth = document.getElementsByTagName('table');
for (t = 0; t < fWidth.length; t++) {
    if (fWidth[t].width == "92%")
        fWidth[t].width = '900';
}
})();


// -----------------------------------------------------------------------------
// Look Up Words when Posting v1 by CD
// Do not redistribute without permission

// No need to edit
(function(){
var aIN = document.getElementsByTagName("INPUT");
if (document.postForm) {
    for (a = 0; a < aIN.length; a++) {
        if (aIN[a].type == "reset") {
            var but = document.createElement("INPUT");
            but.type = "button";
            but.value = "Look Up Word";
            but.onclick = function() {
                lookUp();
            };
            aIN[a].parentNode.insertBefore(but, aIN[a]);
            aIN[a].parentNode.insertBefore(document.createTextNode(" "), aIN[a].nextSibling);
            break;
        }
    }
}

function lookUp() {
    var mess = document.postForm.message;
    mess.focus();
    if (document.all) {
        var word = document.selection.createRange().text;
    } else {
        var word = mess.value.substr(mess.selectionStart, mess.selectionEnd);
    }
    if (!word.match(/\w+/)) {
        alert("Please select a word.");
        return false;
    }
    window.open("http://dictionary.reference.com/search?q=" + word, "definition", "toolbar=1, location=1, status=1, menubar=1, scrollbars=1, resizable=1, left=0, top=0");
    return true;
}
})();


// -----------------------------------------------------------------------------
/*
Extra Smilies, with preview, drop down menu and option to view all (V2)
by Todge
Copyright © 2006
Please keep this header intact
*/

(function(){
if (location.href.indexOf('action=headersfooters') == -1) {
    var smilie = new Array();

    // Edit below here...

    smilie[0] = "http://www.alienresonance.com/chilling.gif";
    smilie[1] = "http://www.alienresonance.com/hehe.gif";
    smilie[2] = "http://www.alienresonance.com/help.gif";
    smilie[3] = "http://www.alienresonance.com/inlove.gif";
    smilie[4] = "http://www.alienresonance.com/love.gif";
    smilie[5] = "http://www.alienresonance.com/naughty.gif";
    smilie[6] = "http://www.alienresonance.com/zzz.gif";
    smilie[7] = "http://www.alienresonance.com/hello.gif";
    smilie[8] = "http://www.alienresonance.com/thirdeye.gif";
    smilie[9] = "http://www.alienresonance.com/crackwip.gif";
    smilie[10] = "http://www.alienresonance.com/pokeystick.gif";
    smilie[11] = "http://www.alienresonance.com/offtopic.gif";
    smilie[12] = "http://www.alienresonance.com/nod.gif";
    smilie[13] = "http://www.alienresonance.com/shift.gif";
    smilie[14] = "http://www.alienresonance.com/praise.gif";
    smilie[15] = "http://www.alienresonance.com/devil.gif";
    smilie[16] = "http://www.alienresonance.com/nodontdoit.gif";
    smilie[17] = "http://www.alienresonance.com/wasted.gif";
    smilie[18] = "http://www.alienresonance.com/devious.gif";
    smilie[19] = "http://www.alienresonance.com/unsure.gif";
    smilie[20] = "http://www.alienresonance.com/horrid.gif";
    smilie[21] = "http://www.alienresonance.com/freaky.gif";
    smilie[22] = "http://www.alienresonance.com/chuckle.gif";
    smilie[23] = "http://www.alienresonance.com/joke.gif";
    smilie[24] = "http://www.alienresonance.com/tired.gif";
    smilie[25] = "http://www.alienresonance.com/wow.gif";
    smilie[26] = "http://www.alienresonance.com/natter.gif";
    smilie[27] = "http://www.alienresonance.com/crying.gif";
    smilie[28] = "http://www.alienresonance.com/gethigh.gif";
    smilie[29] = "http://www.alienresonance.com/claphands.gif";
    smilie[30] = "http://www.alienresonance.com/psychedelic.gif";
    smilie[31] = "http://www.alienresonance.com/rockingdude.gif";
    smilie[32] = "http://www.alienresonance.com/blah.gif";
    smilie[33] = "http://www.alienresonance.com/violin.gif";
    smilie[34] = "http://www.alienresonance.com/bull.gif";
    smilie[35] = "http://www.alienresonance.com/colours.gif";
    smilie[36] = "http://www.alienresonance.com/cyclops.gif";
    smilie[37] = "http://www.alienresonance.com/editor.gif";
    smilie[38] = "http://www.alienresonance.com/ellodave.gif";
    smilie[39] = "http://www.alienresonance.com/error.gif";
    smilie[40] = "http://www.alienresonance.com/flower.gif";
    smilie[41] = "http://www.alienresonance.com/happybirthday.gif";
    smilie[42] = "http://www.alienresonance.com/hippy.gif";
    smilie[43] = "http://www.alienresonance.com/offtheair.gif";
    smilie[44] = "http://www.alienresonance.com/party.gif";
    smilie[45] = "http://www.alienresonance.com/psy.gif";
    smilie[46] = "http://www.alienresonance.com/read.gif";
    smilie[47] = "http://www.alienresonance.com/bob.gif";
    smilie[48] = "http://www.alienresonance.com/shaking.gif";
    smilie[49] = "http://www.alienresonance.com/sleepy.gif";
    smilie[50] = "http://www.alienresonance.com/spam.gif";
    smilie[51] = "http://www.alienresonance.com/thumbsup.gif";
    smilie[52] = "http://www.alienresonance.com/umbrella.gif";
    smilie[53] = "http://www.alienresonance.com/wave.gif";
    smilie[54] = "http://www.alienresonance.com/2far.gif";
    smilie[55] = "http://www.alienresonance.com/chase.gif";
    smilie[56] = "http://www.alienresonance.com/cheers.gif";
    smilie[57] = "http://www.alienresonance.com/cnd.gif";
    smilie[58] = "http://www.alienresonance.com/congrats.gif";
    smilie[59] = "http://www.alienresonance.com/dance.gif";
    smilie[60] = "http://www.alienresonance.com/drunk.gif";
    smilie[61] = "http://www.alienresonance.com/duck.gif";
    smilie[62] = "http://www.alienresonance.com/dunce.gif";
    smilie[63] = "http://www.alienresonance.com/e.gif";
    smilie[64] = "http://www.alienresonance.com/flowerz.gif";
    smilie[65] = "http://www.alienresonance.com/gallery.gif";
    smilie[66] = "http://www.alienresonance.com/king.gif";
    smilie[67] = "http://www.alienresonance.com/laughing.gif";
    smilie[68] = "http://www.alienresonance.com/leaf.gif";
    smilie[69] = "http://www.alienresonance.com/lsd.gif";
    smilie[70] = "http://www.alienresonance.com/moon.gif";
    smilie[71] = "http://www.alienresonance.com/music.gif";
    smilie[72] = "http://www.alienresonance.com/oops.gif";
    smilie[73] = "http://www.alienresonance.com/partyon.gif";
    smilie[74] = "http://www.alienresonance.com/pcangry.gif";
    smilie[75] = "http://www.alienresonance.com/poke.gif";
    smilie[76] = "http://www.alienresonance.com/rock.gif";
    smilie[77] = "http://www.alienresonance.com/sheep.gif";
    smilie[78] = "http://www.alienresonance.com/shroom.gif";
    smilie[79] = "http://www.alienresonance.com/soapbox.gif";
    smilie[80] = "http://www.alienresonance.com/thanx.gif";
    smilie[81] = "http://www.alienresonance.com/ufo.gif";
    smilie[82] = "http://www.alienresonance.com/wink.gif";
    smilie[83] = "http://www.alienresonance.com/witch.gif";
    smilie[84] = "http://www.alienresonance.com/yikes.gif";
    smilie[85] = "http://www.alienresonance.com/noway.gif";
    smilie[86] = "http://www.alienresonance.com/applause.gif";
    smilie[87] = "http://www.alienresonance.com/bestwishes.gif";
    smilie[88] = "http://www.alienresonance.com/btw.gif";
    smilie[89] = "http://www.alienresonance.com/censored.gif";
    smilie[90] = "http://www.alienresonance.com/coffee.gif";
    smilie[91] = "http://www.alienresonance.com/whichway.gif";
    smilie[92] = "http://www.alienresonance.com/goodluck.gif";
    smilie[93] = "http://www.alienresonance.com/goodpost.gif";
    smilie[94] = "http://www.alienresonance.com/grouphug.gif";
    smilie[95] = "http://www.alienresonance.com/hanginthere.gif";
    smilie[96] = "http://www.alienresonance.com/hug.gif";
    smilie[97] = "http://www.alienresonance.com/innocent.gif";
    smilie[98] = "http://www.alienresonance.com/hug2.gif";
    smilie[99] = "http://www.alienresonance.com/hug3.gif";
    smilie[100] = "http://www.alienresonance.com/nopity.gif";
    smilie[101] = "http://www.alienresonance.com/notworthy.gif";
    smilie[102] = "http://www.alienresonance.com/pumpkin.gif";
    smilie[103] = "http://www.alienresonance.com/smdance.gif";
    smilie[104] = "http://www.alienresonance.com/thankyou.gif";
    smilie[105] = "http://www.alienresonance.com/thinking.gif";
    smilie[106] = "http://www.alienresonance.com/holiday.gif";
    smilie[107] = "http://www.alienresonance.com/welcome.gif";
    smilie[108] = "http://www.alienresonance.com/whistling.gif";
    smilie[109] = "http://www.alienresonance.com/stormy.gif";
    smilie[110] = "http://www.alienresonance.com/blinkblush.gif";
    smilie[111] = "http://www.alienresonance.com/flash.gif";
    smilie[112] = "http://www.alienresonance.com/jester.gif";
    smilie[113] = "http://www.alienresonance.com/saywhat.gif";
    smilie[114] = "http://www.alienresonance.com/shine.gif";
    smilie[115] = "http://www.alienresonance.com/shocking.gif";
    smilie[116] = "http://www.alienresonance.com/sunny.gif";
    smilie[117] = "http://www.alienresonance.com/tv.gif";
    smilie[118] = "http://www.alienresonance.com/yflower.gif";
    smilie[119] = "http://www.alienresonance.com/niceofftopic.gif";
    smilie[119] = "http://www.alienresonance.com/tumbleweed.gif";

    var topSmilies = 0;

    // Edit above here...

    var content = ' ';
    var smilieCode = ' ';
    var smilieToCheck;
    var smCode = new Array();
    var postBox;

    if (topSmilies == 0 || topSmilies > smilie.length) {
        topSmilies = smilie.length;
    }

    // Set smilie codes...
    for (t = 0; t < smilie.length; t++) {
        smCode[t] = '#' + smilie[t].split('/')[smilie[t].split('/').length - 1].split('.')[0] + '#';
    }

    // set variables
    smilieCode += '<br /><br /><table bgcolor="000000" border="0"><TR><TD><select name="selectsmilie" style="width: 240px;" onChange = "aS(this.options[this.selectedIndex].value)" > <option> Select Smilie </option>';
    for (p2 = 0; p2 < topSmilies; p2++) {
        smilieCode += '<option value=" ' + smCode[p2] + ' ">' + smCode[p2] + "</option>";
    }
    smilieCode += '</select></TD></TR><TR><TD class="windowbg2" style="width:240px;height:150px;!important;text-align:center;vertical-align:middle;overflow:scroll !important;"><div ID="smile" style="width:240px;height:150px !important;text-align:center;vertical-align:middle;overflow:scroll !important;" > ';
    for (p2 = 0; p2 < topSmilies; p2++) {
        smilieCode += ' <a href=\'javascript:add(" ' + smCode[p2] + ' ")\'><img src="' + smilie[p2] + '" border="0" alt=" ' + smCode[p2] + ' "/></a> ';
        if (p2 % 4 == 0) smilieCode += '<br>';
    }
    smilieCode += '</div></TD></TR>';
    smilieCode += '<TR><TD class="windowbg2" align="center" valign="middle" height="15"><a href="javascript:void(0)" onClick = "popsmilies()" > View all smilies < /a></TD > < /TR></table > ';

    var winleft = (screen.width / 2) - 250;
    var winatts = 'width=500,height=300,left=' + winleft + ',top=50,scrollbars';

    content = document.getElementsByTagName('style')[0].innerHTML;
    content = '<html><head></head><style>' + content + '</style><body>';
    content += '<br><table width="450" cellspacing="1" cellpadding="0" border="0" align="center" class="bordercolor">';
    content += '<tr><td width="450" class="catbg" align="center"><font>Extra Smilies</font></td></tr>';
    content += '<tr><td width="450" class="windowbg2" align="center">';
    for (t = 0; t < smCode.length; t++) {
        content += " <img src=\"" + smilie[t] + "\" border=\"0\" alt=\" " + smCode[t] + " \" style=\"cursor:hand;\" onMouseDown =\"window.opener.add(\' " + smCode[t] + " \');document.focus();\"> ";
    }
    content += '</td></tr></table></body></html>';

    // display smilies
    function aS(smiley) {
        for (t = 0; t < smCode.length; t++) {
            if (smiley.match(smCode[t])) {
                document.getElementById('smile').innerHTML = ' <a href=\'javascript:add(" ' + smCode[t] + ' ")\'><img src="' + smilie[t] + '" border="0" alt=" ' + smCode[t] + ' "/></a> ';
                break;
            }
        }
    }

    function popsmilies() {
        var smilieWindow = window.open("", "newWindow", winatts);
        smilieWindow.document.write(content);
    }

    if (document.postForm) {
        // Replace smilies in post text with codes

        var post = document.postForm.message.value;
        for (t = 0; t < smCode.length; t++) {
            post = post.replace(new RegExp(smilie[t], "g"), smCode[t]);
        }
        post = post.split('[img]#').join('#');
        post = post.split('#[/img]').join('#');
        document.postForm.message.value = post;

        // list smilies

        var TD = document.getElementsByTagName('TD');
        for (t = 0; t < TD.length; t++) {
            if (TD[t].width == '30%' && TD[t].className == 'windowbg2' && TD[t].innerHTML.match('Message:')) {
                TD[t].vAlign = 'top';
                TD[t].innerHTML += smilieCode;
            }
        }

        // get message contents...
        postBox = document.postForm.message;
    }

    // show smilies in posts
    function showSmilies() {
        var posting = document.getElementsByTagName('input');
        for (p = 0; p < posting.length; p++) {
            if (posting[p].type == 'submit') {
                posting[p].onmousedown = function() {
                    post = postBox.value;
                    for (t = 0; t < smCode.length; t++) {
                        post = post.replace(new RegExp(smCode[t], "g"), '[img]' + smilie[t] + '[/img]');
                    }
                    postBox.value = post;
                };
            }
        }
    }
    showSmilies();
}
})();


// -----------------------------------------------------------------------------
/* replace "News" in news header */

(function(){
var newHeader = "News";

var td = document.getElementsByTagName("td");
if (location.href.match(/(cgi\??(#.+)?|com\/?|logout|sread)$/)) {
    for (i = 0; i < td.length; i++) {
        if (td[i].className == "newstitlebg") {
            td[i].innerHTML = td[i].innerHTML.replace(/News/i, newHeader);
            break;
        }
    }
}
})();


// -----------------------------------------------------------------------------
(function(){
function spellChecker(textObject) {
    this.popUpUrl = '/speller/spellchecker.html';
    this.popUpName = 'spellchecker';
    this.popUpProps = "menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes";
    this.spellCheckScript = '/speller/server-scripts/spellchecker.pl';
    this.replWordFlag = "R";
    this.ignrWordFlag = "I";
    this.replAllFlag = "RA";
    this.ignrAllFlag = "IA";
    this.fromReplAll = "~RA";
    this.fromIgnrAll = "~IA";
    this.wordFlags = new Array();
    this.currentTextIndex = 0;
    this.currentWordIndex = 0;
    this.spellCheckerWin = null;
    this.controlWin = null;
    this.wordWin = null;
    this.textArea = textObject;
    this.textInputs = arguments;
    this._spellcheck = _spellcheck;
    this._getSuggestions = _getSuggestions;
    this._setAsIgnored = _setAsIgnored;
    this._getTotalReplaced = _getTotalReplaced;
    this._setWordText = _setWordText;
    this._getFormInputs = _getFormInputs;
    this.openChecker = openChecker;
    this.startCheck = startCheck;
    this.checkTextBoxes = checkTextBoxes;
    this.checkTextAreas = checkTextAreas;
    this.spellCheckAll = spellCheckAll;
    this.ignoreWord = ignoreWord;
    this.ignoreAll = ignoreAll;
    this.replaceWord = replaceWord;
    this.replaceAll = replaceAll;
    this.terminateSpell = terminateSpell;
    this.undo = undo;
    window.speller = this;
}
function checkTextBoxes() {
    this.textInputs = this._getFormInputs("^text$");
    this.openChecker();
}
function checkTextAreas() {
    this.textInputs = this._getFormInputs("^textarea$");
    this.openChecker();
}
function spellCheckAll() {
    this.textInputs = this._getFormInputs("^text(area)?$");
    this.openChecker();
}
function openChecker() {
    this.spellCheckerWin = window.open(this.popUpUrl, this.popUpName, this.popUpProps);
    if (!this.spellCheckerWin.opener) {
        this.spellCheckerWin.opener = window;
    }
}
function startCheck(wordWindowObj, controlWindowObj) {
    this.wordWin = wordWindowObj;
    this.controlWin = controlWindowObj;
    this.wordWin.resetForm();
    this.controlWin.resetForm();
    this.currentTextIndex = 0;
    this.currentWordIndex = 0;
    this.wordFlags = new Array(this.wordWin.textInputs.length);
    for (var i = 0; i < this.wordFlags.length; i++) {
        this.wordFlags[i] = [];
    }
    this._spellcheck();
    return true;
}
function ignoreWord() {
    var wi = this.currentWordIndex;
    var ti = this.currentTextIndex;
    if (!this.wordWin) {
        alert('Error: Word frame not available.');
        return false;
    }
    if (!this.wordWin.getTextVal(ti, wi)) {
        alert('Error: "Not in dictionary" text is missing.');
        return false;
    }
    if (this._setAsIgnored(ti, wi, this.ignrWordFlag)) {
        this.currentWordIndex++;
        this._spellcheck();
    }
    return true;
}
function ignoreAll() {
    var wi = this.currentWordIndex;
    var ti = this.currentTextIndex;
    if (!this.wordWin) {
        alert('Error: Word frame not available.');
        return false;
    }
    var s_word_to_repl = this.wordWin.getTextVal(ti, wi);
    if (!s_word_to_repl) {
        alert('Error: "Not in dictionary" text is missing');
        return false;
    }
    this._setAsIgnored(ti, wi, this.ignrAllFlag);
    for (var i = ti; i < this.wordWin.textInputs.length; i++) {
        for (var j = 0; j < this.wordWin.totalWords(i); j++) {
            if (( i == ti && j > wi ) || i > ti) {
                if (( this.wordWin.getTextVal(i, j) == s_word_to_repl ) && ( !this.wordFlags[i][j] )) {
                    this._setAsIgnored(i, j, this.fromIgnrAll);
                }
            }
        }
    }
    this.currentWordIndex++;
    this._spellcheck();
    return true;
}
function replaceWord() {
    var wi = this.currentWordIndex;
    var ti = this.currentTextIndex;
    if (!this.wordWin) {
        alert('Error: Word frame not available.');
        return false;
    }
    if (!this.wordWin.getTextVal(ti, wi)) {
        alert('Error: "Not in dictionary" text is missing');
        return false;
    }
    if (!this.controlWin.replacementText) {
        return true;
    }
    var txt = this.controlWin.replacementText;
    if (txt.value) {
        var newspell = new String(txt.value);
        if (this._setWordText(ti, wi, newspell, this.replWordFlag)) {
            this.currentWordIndex++;
            this._spellcheck();
        }
    }
    return true;
}
function replaceAll() {
    var ti = this.currentTextIndex;
    var wi = this.currentWordIndex;
    if (!this.wordWin) {
        alert('Error: Word frame not available.');
        return false;
    }
    var s_word_to_repl = this.wordWin.getTextVal(ti, wi);
    if (!s_word_to_repl) {
        alert('Error: "Not in dictionary" text is missing');
        return false;
    }
    var txt = this.controlWin.replacementText;
    if (!txt.value) return true;
    var newspell = new String(txt.value);
    this._setWordText(ti, wi, newspell, this.replAllFlag);
    for (var i = ti; i < this.wordWin.textInputs.length; i++) {
        for (var j = 0; j < this.wordWin.totalWords(i); j++) {
            if (( i == ti && j > wi ) || i > ti) {
                if (( this.wordWin.getTextVal(i, j) == s_word_to_repl ) && ( !this.wordFlags[i][j] )) {
                    this._setWordText(i, j, newspell, this.fromReplAll);
                }
            }
        }
    }
    this.currentWordIndex++;
    this._spellcheck();
    return true;
}
function terminateSpell() {
    var msg = "Spell check complete:\n\n";
    var numrepl = this._getTotalReplaced();
    if (numrepl == 0) {
        if (!this.wordWin) {
            msg = "";
        } else {
            if (this.wordWin.totalMisspellings()) {
                msg += "No words changed.";
            } else {
                msg += "No misspellings found.";
            }
        }
    } else if (numrepl == 1) {
        msg += "One word changed.";
    } else {
        msg += numrepl + " words changed.";
    }
    if (msg) {
        msg += "\n";
        alert(msg);
    }
    if (numrepl > 0) {
        for (var i = 0; i < this.textInputs.length; i++) {
            if (this.wordWin) {
                if (this.wordWin.textInputs[i]) {
                    this.textInputs[i].value = this.wordWin.textInputs[i];
                }
            }
        }
    }
    this.spellCheckerWin.close();
    return true;
}
function undo() {
    var ti = this.currentTextIndex;
    var wi = this.currentWordIndex;
    if (this.wordWin.totalPreviousWords(ti, wi) > 0) {
        this.wordWin.removeFocus(ti, wi);
        do {
            if (this.currentWordIndex == 0 && this.currentTextIndex > 0) {
                this.currentTextIndex--;
                this.currentWordIndex = this.wordWin.totalWords(this.currentTextIndex) - 1;
                if (this.currentWordIndex < 0) this.currentWordIndex = 0;
            } else {
                if (this.currentWordIndex > 0) {
                    this.currentWordIndex--;
                }
            }
        } while (this.wordWin.totalWords(this.currentTextIndex) == 0 || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll);
        var text_idx = this.currentTextIndex;
        var idx = this.currentWordIndex;
        var preReplSpell = this.wordWin.originalSpellings[text_idx][idx];
        if (this.wordWin.totalPreviousWords(text_idx, idx) == 0) {
            this.controlWin.disableUndo();
        }
        switch (this.wordFlags[text_idx][idx]) {
            case this.replAllFlag :
                for (var i = text_idx; i < this.wordWin.textInputs.length; i++) {
                    for (var j = 0; j < this.wordWin.totalWords(i); j++) {
                        if (( i == text_idx && j >= idx ) || i > text_idx) {
                            var origSpell = this.wordWin.originalSpellings[i][j];
                            if (origSpell == preReplSpell) {
                                this._setWordText(i, j, origSpell, undefined);
                            }
                        }
                    }
                }
                break;
            case this.ignrAllFlag :
                for (var i = text_idx; i < this.wordWin.textInputs.length; i++) {
                    for (var j = 0; j < this.wordWin.totalWords(i); j++) {
                        if (( i == text_idx && j >= idx ) || i > text_idx) {
                            var origSpell = this.wordWin.originalSpellings[i][j];
                            if (origSpell == preReplSpell) {
                                this.wordFlags[i][j] = undefined;
                            }
                        }
                    }
                }
                break;
            case this.replWordFlag :
                this._setWordText(text_idx, idx, preReplSpell, undefined);
                break; }
        this.wordFlags[text_idx][idx] = undefined;
        this._spellcheck();
    }
}
function _spellcheck() {
    var ww = this.wordWin;
    if (this.currentWordIndex == ww.totalWords(this.currentTextIndex)) {
        this.currentTextIndex++;
        this.currentWordIndex = 0;
        if (this.currentTextIndex < this.wordWin.textInputs.length) {
            this._spellcheck();
            return;
        } else {
            this.terminateSpell();
            return;
        }
    }
    if (this.currentWordIndex > 0) {
        this.controlWin.enableUndo();
    }
    if (this.wordFlags[this.currentTextIndex][this.currentWordIndex]) {
        this.currentWordIndex++;
        this._spellcheck();
    } else {
        var evalText = ww.getTextVal(this.currentTextIndex, this.currentWordIndex);
        if (evalText) {
            this.controlWin.evaluatedText.value = evalText;
            ww.setFocus(this.currentTextIndex, this.currentWordIndex);
            this._getSuggestions(this.currentTextIndex, this.currentWordIndex);
        }
    }
}
function _getSuggestions(text_num, word_num) {
    this.controlWin.clearSuggestions();
    var a_suggests = this.wordWin.suggestions[text_num][word_num];
    if (a_suggests) {
        for (var ii = 0; ii < a_suggests.length; ii++) {
            this.controlWin.addSuggestion(a_suggests[ii]);
        }
    }
    this.controlWin.selectDefaultSuggestion();
}
function _setAsIgnored(text_num, word_num, flag) {
    this.wordWin.removeFocus(text_num, word_num);
    this.wordFlags[text_num][word_num] = flag;
    return true;
}
function _getTotalReplaced() {
    var i_replaced = 0;
    for (var i = 0; i < this.wordFlags.length; i++) {
        for (var j = 0; j < this.wordFlags[i].length; j++) {
            if (( this.wordFlags[i][j] == this.replWordFlag ) || ( this.wordFlags[i][j] == this.replAllFlag ) || ( this.wordFlags[i][j] == this.fromReplAll )) {
                i_replaced++;
            }
        }
    }
    return i_replaced;
}
function _setWordText(text_num, word_num, newText, flag) {
    this.wordWin.setText(text_num, word_num, newText);
    this.wordFlags[text_num][word_num] = flag;
    return true;
}
function _getFormInputs(inputPattern) {
    var inputs = new Array();
    for (var i = 0; i < document.forms.length; i++) {
        for (var j = 0; j < document.forms[i].elements.length; j++) {
            if (document.forms[i].elements[j].type.match(inputPattern)) {
                inputs[inputs.length] = document.forms[i].elements[j];
            }
        }
    }
    return inputs;
}
function openSpellCheck() {
    if (document.postForm)
        var speller = new spellChecker(document.postForm.subject, document.postForm.message); else
        var speller = new spellChecker(document.getElementsByName('message')[0]);
    speller.openChecker();
}
})();


// -----------------------------------------------------------------------------
/* spell check with quick reply */
(function(){
var mes = document.getElementsByName('message');
if (mes[0] && !document.postForm) {
    var qrForm = mes[0].parentNode;
    var pre = document.createElement('font');
    pre.innerHTML = '<input type="button" value="Spell Check" onclick="openSpellCheck();">';
    qrForm.insertBefore(pre, qrForm.lastChild.previousSibling);
}
})();


// -----------------------------------------------------------------------------
/* preview with quick reply - by ross */
(function(){
var mes = document.getElementsByName('message');
if (location.href.match(/ion=display/) && mes[0]) {
    var qrForm = mes[0].parentNode;
    var preview = '<input name="nextaction" type="hidden" value="post">';
    preview += '<input type="submit" accesskey="p" value="Preview" onclick="qrForm.nextaction.value=\'preview\'; return true;" /> ';
    qrForm.removeChild(qrForm.lastChild);
    qrForm.innerHTML += preview;
}
})();


// -----------------------------------------------------------------------------
/* Avatar Uploader by hey */

(function(){
var fontColor = 'DBC9FF';
var typeWidth = '25';

if (location.href.match(/action=modifyprofile/i)) {
    var prsinfo = document.modifyForm.avatarurl.parentNode.parentNode.parentNode.parentNode;
    var cells = prsinfo.insertRow(prsinfo.rows.length - 5);
    var title = cells.insertCell(0);
    var uploader = cells.insertCell(1);
    var description = cells.insertCell(2);
    title.innerHTML = '<font size="2">Avatar Uploader:</font>';
    uploader.innerHTML = '<iframe src="http://imageshack.us/iframe.php?txtcolor=' + fontColor + '&type=blank&size=' + typeWidth + '" scrolling="no" allowtransparency="true" frameborder="0" width="280" height="70">Update your browser for ImageShack.us!</iframe>';
    description.innerHTML = '<font size="1">If you don\'t have an avatar uploaded onto the internet yet, you may upload one here.</font>';
}
})();


// -----------------------------------------------------------------------------
/* Created by Jay.
Divided Categories with Head/Base Images

http://ngmaster.proboards21.com
This code may not be redistributed without permission.
Please leave this header intact at all times. */

    
(function(){
var headBaseSettings = [
    ['http://myweb.tiscali.co.uk/dosseposse/headerlong.gif'], // head image
    ['http://myweb.tiscali.co.uk/dosseposse/footerlong.gif'], // base image
    ['10'] // gap size
];

var getTR = document.getElementsByTagName('tr');
if (window.location.href.match(/com(\/$|\/index\.c\wi\??($|\w{6}=home)$)$/)) {
    for (var i = 1; i < getTR.length; i ++) {
        if (getTR.item(i).firstChild.colSpan == 2 && getTR.item(i).firstChild.firstChild.className == 'titletext' && getTR.item(i).firstChild.innerHTML.match(/>Forum Name</)) {
            var titleBase = document.createElement('img');
            titleBase.src = headBaseSettings[1];
            var cloneTitle = getTR.item(i).cloneNode(true).innerHTML;
        }
        if (getTR.item(i).firstChild.colSpan == 5 && getTR.item(i).firstChild.className == 'catbg' && getTR.item(i).firstChild.align != 'right') {
            var cloneTarget = getTR.item(i).getElementsByTagName('td')[0].cloneNode(true).innerHTML;
            var newTab = '<td id="del"></td></tr></table>' + (getTR.item(i - 1).innerHTML.match(/>Forum Name</) ? '' : '<img src="' + headBaseSettings[1] + '" /><div style="height: ' + headBaseSettings[2] + 'px;"></div>') + '<img src="' + headBaseSettings[0] + '" style="vertical-align: bottom;" /><table width="100%" cellspacing="1" cellpadding="4" class="bordercolor"><tr><td class="catbg" colspan="6">' + cloneTarget + '</td></tr><tr id="frow">';
            eval("(getTR.item(i - 1).innerHTML.match(/>Forum Name</)? getTR.item(i).parentNode.parentNode.parentNode.parentNode.parentNode.insertRow(-1).insertCell(-1).appendChild(titleBase) : '')");
            getTR.item(i).parentNode.className = 'bordercolor';
            with (getTR.item(i).parentNode.parentNode.parentNode) {
                parentNode.parentNode.parentNode.style.backgroundColor = 'transparent';
                innerHTML = innerHTML.replace(getTR.item(i).cloneNode(true).innerHTML, newTab + cloneTitle);
            }
        }
        if (getTR.item(i).firstChild.id == 'del' || (getTR.item(i).id != 'frow' && getTR.item(i).getElementsByTagName('td')[0].className == 'titlebg' && getTR.item(i).getElementsByTagName('td')[0].innerHTML.match(/>Forum Name</))) {
            getTR.item(i).style.display = 'none';
        }
    }
}
})();


// -----------------------------------------------------------------------------
// Newest member in News Fader..

(function(){
if (typeof(fContent) != "undefined") {

    var helloNewbie = 'Welcome to our newest member, ';

    var newestMember = document.getElementsByTagName('td');
    for (nM = 0; nM < newestMember.length; nM++) {
        if (newestMember[nM].width == '40%' && newestMember[nM].align == 'left' && newestMember[nM].vAlign == 'top' && newestMember[nM].innerHTML.match('Newest Member: ')) {
            fContent[fContent.length] = helloNewbie + newestMember[nM].innerHTML.split('Newest Member: ')[1].split(/<br/i)[0];
        }
    }
}
})();


// -----------------------------------------------------------------------------
/* remove Forum Name | Topics | Posts...
and add thread & post info by california */
(function(){
var td = document.getElementsByTagName("td");
if (location.href.match(/com\/?((index\.cgi)?\??(action=(ma.+ad|logout|home))?(#.+)?)?$/)) {
    for (i = 0; i < td.length; i++) {
        if (td[i].width == "1%" && td[i].innerHTML.match(/\d/)) {
            if (td[i + 1].width.match(/^(1|7)%$/)) {
                td[i].innerHTML += "<br />threads";
                td[i].width = "8%";
            } else {
                td[i].innerHTML += "<br />posts";
                td[i].width = "7%";
            }
        }
        if (td[i].width == "8%" && !td[i].innerHTML.match(/thread/)) {
            td[i].width = "4%";
        }
        if (td[i].className == "titlebg" && td[i].innerHTML.match(/Forum Name/i)) {
            td[i].parentNode.style.display = "none";
        }
    }
}
})();


// -----------------------------------------------------------------------------
//Wikipedia Links v1.0 [CB]
//Copyright 04-17-2006 ~Wonder
//May be reposted|modified anywhere as long as this header remains in tact

//URL to Wikipedia UBBC Icon
(function(){
wikiIcon = "http://www.alienresonance.com/wikiicon6bb.gif";

if (document.postForm && document.postForm.color) {
    document.postForm.color.parentNode.innerHTML += "<a href=javascript:add(\"[[\",\"]]\")><img src=\"" + wikiIcon + "\" alt=\"Wikipedia Link\" border=\"0\"></a>";
}
if (location.href.match(/action\=(display|pmview|recent|userrecentposts|gotopost|search|calendarview)/) || (!location.href.match(/action\=/) && document.postForm)) {
    hrs = document.getElementsByTagName("hr");
    for (i = 0; i < hrs.length; i++) {
        if (typeof(hrs[i].nextSibling.innerHTML) == "string") {
            matches = hrs[i].nextSibling.innerHTML.match(/\[\[(.+?)\]\]/ig);
            if (matches) {
                temp = hrs[i].nextSibling.innerHTML;
                for (j = 0; j < matches.length; j++) {
                    if (matches[j].match(/(\[\[.+?)\|(.+?\]\])/)) {
                        split = [RegExp.$1,RegExp.$2];
                        temp = temp.replace(matches[j], "<a href=\"http://en.wikipedia.org/wiki/" + escape(split[0].replace(/^\[\[|\]\]$/g, "").replace(/ /g, "_")).replace(/%23/ig, "#") + "\" target=\"_blank\">" + split[1].replace(/^\[\[|\]\]$/g, "") + "</a>");
                    } else
                        temp = temp.replace(matches[j], "<a href=\"http://en.wikipedia.org/wiki/" + escape(matches[j].replace(/^\[\[|\]\]$/g, "").replace(/ /g, "_")).replace(/%23/ig, "#") + "\" target=\"_blank\">" + matches[j].replace(/^\[\[|\]\]$/g, "") + "</a>");
                }
                hrs[i].nextSibling.innerHTML = temp;
            }
        }
    }
}
})();
