// JavaScript Document
// Global Header - all scripts included in one file to avoid multiple line breaks at top of page.
/*-------------------------------------------------------------------------------------------------*/
/* Begin the Forum Resize.  Requires CSS code and two closing tags in the global footer.           */
/* http://support.proboards.com/index.cgi?board=codedatabase&action=display&thread=1151202104      */
/*-------------------------------------------------------------------------------------------------*/
document.write("<div align='center' style='align: center;'><div style='width: 920px;' width='920'>");
/*-------------------------------------------------------------------------------------------------*/
/* End of Forum Resize code (global header part)                                                   */
/*-------------------------------------------------------------------------------------------------*/


/*-------------------------------------------------------------------------------------------------*/
/* TIME LIMIT ON MODIFY/DELETE */
/* http://support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70412       */
/*-------------------------------------------------------------------------------------------------*/
// Get Forum Time for 'Time limit on deleting/modifying posts' code
var realTime = document.getElementsByTagName('font')[2].innerHTML.split(':');
var administrator;
if(document.getElementsByTagName('td')[5].innerHTML.match(/ion=admin/))
{
var administrator = 'yes';
}
/*-------------------------------------------------------------------------------------------------*/
/* End of TIME LIMIT ON MODIFY/DELETE */
/*-------------------------------------------------------------------------------------------------*/


/*-------------------------------------------------------------------------------------------------*/
/* PREVENT DOUBLE POSTING IN FIRST 24 HOURS                                                        */
/* http://support.proboards.com/index.cgi?board=codedatabase&action=display&n=1&thread=70575       */
/*-------------------------------------------------------------------------------------------------*/
/*
Get current time, by Todge
Needed for anti-bumping code in the footer
Copyright © 2006
Please keep this header intact
*/
if(location.href.match('action=display') && location.href.match('thread='))
{
var currentTime = document.getElementsByTagName('font')[2].innerHTML.split(/<br>/i)[1].split(', ');
var currentHour = parseInt(currentTime[currentTime.length-1].split(':')[0]);
var currentMinute = currentTime[currentTime.length-1].split(':')[1];
if(currentMinute.match('pm'))
{
currentHour = currentHour + 12;
}
currentMinute = parseInt(currentMinute);
document.write(currentHour+':'+currentMinute);
}
/*-------------------------------------------------------------------------------------------------*/
/* END:  PREVENT DOUBLE POSTING IN FIRST 24 HOURS                                                  */
/*-------------------------------------------------------------------------------------------------*/


/*-------------------------------------------------------------------------------------------------------------*/
/* Move the Welcome Table beneath the ADVERTISING                                                              */
/* http://support.proboards.com/index.cgi?action=display&board=codesupport&thread=1124987416&page=1#1124989455 */
/*-------------------------------------------------------------------------------------------------------------*/
document.write("<div id='wel'></div>");

var welcomeTable = document.getElementsByTagName("table").item(0);
document.getElementById('wel').appendChild(welcomeTable);
/*-------------------------------------------------------------------------------------------------------------*/
/* End of code to move Welcome Table beneath advertising */
/*-------------------------------------------------------------------------------------------------------------*/



//  *---------------------------------------------------
//  * Banner selection from profile - Created by Peter
//  * 
//  * This code cannot be reposted anywhere other than SSDesigns or ProBoards Support.
//  * 
//  * This header must stay intact.
//  * ----------------------------------------------------
//  * http://support.proboards.com/index.cgi?board=codedatabase&action=display&thread=1117972689 
//  * Place in GLOBAL HEADER (top of file).  There is a corresponding piece of code in the MAIN FOOTER. 
//  *---------------------------------------------------

// URL to the blank image (added in skin area).
var theBlank = "http://img526.imageshack.us/img526/2315/mmspaceras9.gif";

// List all the banners to show in drop down
//     ["Suits", "http://img216.imageshack.us/img216/8056/2yj4.png"],

var iBanners = [
  ["KJ", "http://img527.imageshack.us/img527/1259/kjgg8.jpg"],
    ["Suits", "http://img503.imageshack.us/img503/7339/suitsst9.jpg"],
    ["Garnier", "http://img527.imageshack.us/img527/4776/garnierjn9.jpg"],
    ["Mock Exam", "http://img401.imageshack.us/img401/4949/mockexamrevised920x174mc1.jpg"],
    ["Sando", "http://img150.imageshack.us/img150/7757/sandove1.png"],
    ["Valentine", "http://img526.imageshack.us/img526/1189/valentinefi9.jpg"],
	["Christmas","http://img407.imageshack.us/img407/2329/sparklesdw7.jpg"],
  ["No Banner", "http://img526.imageshack.us/img526/2315/mmspaceras9.gif"]
];

if(document.getElementsByTagName("img").item(0).src == theBlank){
    document.getElementsByTagName("img").item(0).id = "banselect";
}

function getCook(){
    if(document.cookie.match(/banid=(\d+)/)){
        return RegExp.$1;
    } else {
        if(document.getElementById("banselect")){
            document.getElementById("banselect").src = iBanners[0][1];
        }
        return null;
    }
}

if(document.getElementById("banselect")){
    if(getCook() != null){
        document.getElementById("banselect").src = iBanners[getCook()][1];
    }
}
/*------------------------------*/
/* END OF BANNER SELECTION CODE */
/*------------------------------*/




// --------------------------
/* Clickable banner
http://support.proboards.com/index.cgi?board=codedatabase&action=display&thread=1136264310
created by CrAzY_J
Open Source
*/
// --------------------------
var Main = document.body.getElementsByTagName('font')[0];
var Source = Main.firstChild.src;
Main.removeChild( Main.firstChild );
var Link = document.createElement('a');
var Image = document.createElement('img');
Link.href = this.location.href.split('.com')[0]+'.com';
Image.src = Source;
Image.border = 0;
Link.appendChild( Image );
Main.appendChild( Link );
/*------------------------------*/
/* END OF CLICKABLE BANNER CODE */
/*------------------------------*/



/*------------------------------------------------------------------------------*/
// Invision Welcome Bar
// Created by Lavitz
// http://retrodata.proboards91.com/
// Do not redistribute w/o permission
// Keep this header on at all times
// -- Code has been customised by WunderBunny to include more links --
// -- and to use the category class instead of the iBar class.      --
/*------------------------------------------------------------------------------*/
/* There is also a style sheet specification which goes with this file. */

// Edit this part
iFw = '100%'; // Your Forum width.

// No need to edit below
var TD = document.getElementsByTagName('td');
// document.write('<br/>');
document.write('<table width="' + iFw + '" height="25" class="catbg" cellspacing="0" cellpadding="0" align="center" id="">');
document.write('<tr>');

// Begin Welcome Message
document.write('<td>');

if(TD[2].innerHTML.match(/, (\d+)\ (are|is) new./i)) {

var newPMs = RegExp.$1

}
document.write('<font size="1" class="iBartext">');
if(pb_username=='Guest') {
document.write('<center>');
document.write('Welcome Guest ( <a href="index.cgi?action=login">LOG IN</a>');
document.write('<font color="#FD3F3F"> · </font>');
document.write('<a href="index.cgi?action=register">REGISTER</a> )');
document.write('<font color="#FD3F3F"> · </font><a href="index.cgi?action=recent">MOST RECENT POSTS</a>');
document.write('</center>');
 }else {
document.write('Welcome ');
document.write('<a  href="index.cgi?action=viewprofile">' + pb_displayname + '</a>');
document.write(' ( <a  href="index.cgi?action=logout">LOG OUT</a> )');
 }
document.write('</font>');
document.write('</td>');

// Begin Functions Section


document.write('<td align="right" valign="middle">');
document.write('<font size="1">');

if(pb_username=='Guest') {
document.write('');
 }else {
document.write('<font color="#FD3F3F"> · </font><a href="index.cgi?action=recent">MOST RECENT POSTS</a>');
document.write('<font color="#FD3F3F"> · </font><a href="index.cgi?action=bookmarks">BOOKMARKS</a>');
document.write('<font color="#FD3F3F"> · </font><a href="index.cgi?action=pm">' + newPMs + ' NEW MESSAGES</a>');
document.write('<font color="#FD3F3F"> · </font><a HREF="http://s24.photobucket.com/albums/c3/pagingdr/Forum/smileys/?start=all">SMILEYS</A>');
document.write('<font color="#FD3F3F"> · </font><a HREF="http://members.optusnet.com.au/~pagingdr/index.shtml">PAGING DR WEB SITE</A>');
document.write('<font color="#FD3F3F"> · </font><a HREF="http://vtac.proboards103.com/index.cgi">MUSEUM</A>');
}

document.write('<font color="#FD3F3F">   </font>');

document.write('</font>');
document.write('</td></tr></table>');
/*------------------------------*/
/* END OF WELCOME BAR CODE      */
/*------------------------------*/




// =============================
// Various Table altering codes
// =============================
document.getElementsByTagName('table')[0].cellSpacing = 0;
document.getElementsByTagName('td').item(2).style.display="none";
document.getElementsByTagName('font').item(1).style.display="none";
//20 January 2007:  comment out following line.
//document.getElementsByTagName('table').item(0).width = '1000px';
// ===================================
// End of Various Table altering codes
// ===================================



// ==========================================
// Different gradients for different skins
// Global header
// ==========================================

var cssSkin = [];


// Skin - BLUE -- 
cssSkin["4"] = [
    ["menubg", "http://img85.imageshack.us/img85/319/darkred20fgxp0.gif"],
    ["catbg", "http://img156.imageshack.us/img156/1498/lighter4lhcf1.gif"],
    ["newstitlebg", "http://img148.imageshack.us/img148/9979/darkpurple2pcup8.gif"],
    ["titlebg", "http://img148.imageshack.us/img148/1789/blue38mfth7.gif"]
];

// Skin  -- GREY
cssSkin["2"] = [
    ["menubg", "http://img81.imageshack.us/img81/7731/gradient1cerd2.gif"],
    ["catbg", "http://img81.imageshack.us/img81/7731/gradient1cerd2.gif"],
    ["newstitlebg", "http://img300.imageshack.us/img300/1904/blackedywackedy528yq7.jpg"],
    ["titlebg", "http://img300.imageshack.us/img300/1904/blackedywackedy528yq7.jpg"]
];

// Skin  -- PURPLE
cssSkin["1"] = [
    ["menubg", "http://img85.imageshack.us/img85/319/darkred20fgxp0.gif"],
    ["catbg", "http://img156.imageshack.us/img156/1498/lighter4lhcf1.gif"],
    ["newstitlebg", "http://img148.imageshack.us/img148/9979/darkpurple2pcup8.gif"],
    ["titlebg", "http://img148.imageshack.us/img148/9979/darkpurple2pcup8.gif"]
];

// Skin  -- CITRUS
cssSkin["3"] = [
    ["menubg", "http://img84.imageshack.us/img84/9119/orange32vcmk3.gif"],
    ["catbg", "http://img156.imageshack.us/img156/1498/lighter4lhcf1.gif"],
    ["newstitlebg", "http://img84.imageshack.us/img84/9933/orange5qunp5.gif"],
    ["titlebg", "http://img84.imageshack.us/img84/17/orange27mrjn4.gif"]
];
// Skin  -- Valentine
cssSkin["5"] = [
    ["menubg", "http://img85.imageshack.us/img85/319/darkred20fgxp0.gif"],
    ["catbg", theBlank],
    ["newstitlebg", "http://img85.imageshack.us/img85/319/darkred20fgxp0.gif"],
    ["titlebg", theBlank]
];

// Skin  -- Christmaas
cssSkin["6"] = [
    ["menubg", "http://img85.imageshack.us/img85/319/darkred20fgxp0.gif"],
    ["catbg", "http://img156.imageshack.us/img156/1498/lighter4lhcf1.gif"],
    ["newstitlebg", "http://img84.imageshack.us/img84/9731/greeny5bihp1.gif"],
    ["titlebg", "http://img85.imageshack.us/img85/319/darkred20fgxp0.gif"]
];

// Skin  - WHITE -- not used -- retain for image links only
cssSkin["999"] = [
    ["titlebg", "http://img117.imageshack.us/img117/1413/gradient18cz.gif"],
    ["catbg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/blue38mf.gif"],
    ["menubg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkred20fg.gif"],
    ["newstitlebg", "http://img117.imageshack.us/img117/1413/gradient18cz.gif"]
];

var iSheet = document.styleSheets.item(0);
var isIE = (document.all)? true : false;

if(iSheet) {
    if(cssSkin[pb_skinid]) {
       for(s = 0; s < cssSkin[pb_skinid].length; s ++) {
          var tRule = "." + cssSkin[pb_skinid][s][0];
          var tVal = cssSkin[pb_skinid][s][1];

          if(isIE) {
             iSheet.addRule(tRule, "background-image: url(" + tVal + "); background-repeat: repeat;");
           } else  {
             iSheet.insertRule(tRule + " {" + "background-image: url(" + tVal + "); background-repeat: repeat; }", 0);
           }
        }
     }
 }
/*------------------------------------------------*/
/* End of DIFFERENT GRADIENTS FOR DIFFERENT SKINS */
/*------------------------------------------------*/
