// JavaScript Document
// Global Header - all scripts included 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'>");



/*-------------------------------------------------------------------------------------------------------------*/
/* 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);
/*-------------------------------------------------------------------------------------------------------------*/


//  *---------------------------------------------------
//  * 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://img264.imageshack.us/img264/9110/mmspaceryx8.gif";

// List all the banners to show in drop down
var iBanners = [
    ["Mock Exam", "http://img186.imageshack.us/img186/4301/mockexamrevised920x174jo5.jpg"],
    ["Suits", "http://img216.imageshack.us/img216/8056/2yj4.png"],
	["KJ", "http://img258.imageshack.us/img258/3316/kjreducedwu6.jpg"],
    ["Garnier", "http://img316.imageshack.us/img316/8709/pagingdrbanner2colouredoe7.jpg"],
    ["Sando", "http://img420.imageshack.us/img420/5127/untitledps8.png"],
    ["SRH9876", "http://img262.imageshack.us/img262/2286/srh9876newub0.jpg"],
    ["Valentine", "http://img407.imageshack.us/img407/2500/valentineba7.jpg"],
    ["Wade", "http://img525.imageshack.us/img525/3193/logonormal6lp.jpg"],
	["No Banner", "http://img264.imageshack.us/img264/9110/mmspaceryx8.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];
    }
}



// --------------------------
/* 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 );


/*----------------------------------------------------------------------------
Invision Welcome Bar
Created by Lavitz
http://retrodata.proboards91.com/
Do not redistribute w/o permission
Keep this header on at all times
------------------------------------------------------------------------------*/
/* 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/><table width='"+iFw+"' height='25' class='catbg' cellspacing='0' cellpadding='1' align='center' id=''><tr><td>");

// Begin Welcome Message
if(TD[2].innerHTML.match(/, (\d+)\ (are|is) new./i)){
var newPMs = RegExp.$1
}
if(pb_username=='Guest'){
document.write(" <center><font size=1><font class='iBartext'>Welcome Guest ( <a class='iBar' href='index.cgi?action=login'>LOG IN</a> | <a class='iBar' href='index.cgi?action=register'>REGISTER</a> )</b></font></font></center>");
}else{
document.write('<font size=1><font class="iBartext"><b>LOGGED IN AS: <a class="iBar" href="index.cgi?action=viewprofile"><u>'+pb_displayname+'</u></a></b> ( <a class="iBar" href="index.cgi?action=logout"><u>LOG OUT</u></a> )</font></font>');
}
document.write('</td><td align="right" valign="middle">');

// Begin Functions Section

if(pb_username=='Guest'){
document.write('');
}else{
document.write('<font size=1><font class="iBar"><a class="iBar" href="index.cgi?action=viewprofile">MY PROFILE</a> · <a class="iBar" href="index.cgi?action=recent">MOST RECENT POSTS</a> · <a class="iBar" href="index.cgi?action=bookmarks">MY BOOKMARKS</a> · <a class="iBar" href="index.cgi?action=pm">'+newPMs+' NEW MESSAGES</a></font></font>');
}

document.write('<font size=1><font class="iBar"> · <a class="iBar" href="mailto:pagingdr2007@yahoo.com.au">EMAIL ADMIN</a></font></font>');
document.write('<font size=1><font class="iBar"> · <a class="iBar" href="http://members.optusnet.com.au/~pagingdr">PAGING DR WEB SITE</a></font></font>');
document.write('</td></tr></table>');





// =============================
// 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';



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

var cssSkin = [];


// Skin - BLUE -- 
cssSkin["4"] = [
    ["menubg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkred20fg.gif"],
    ["catbg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/lighter4lh.gif"],
    ["newstitlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkpurple2pc.gif"],
    ["titlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/blue38mf.gif"]
];

// Skin  -- GREY
cssSkin["2"] = [
    ["menubg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/gradient1ce.gif "],
    ["catbg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/gradient1ce.gif "],
    ["newstitlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/blackedywackedy528.jpg "],
    ["titlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/blackedywackedy528.jpg "]
];

// Skin  -- PURPLE
cssSkin["3"] = [
    ["menubg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkred20fg.gif"],
    ["catbg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/lighter4lh.gif"],
    ["newstitlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkpurple2pc.gif"],
    ["titlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkpurple2pc.gif"]
];

// Skin  -- Citrus
cssSkin["1"] = [
    ["menubg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/reddishness6ygrad.jpg"],
    ["catbg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/yellowbedellowishy3451.jpg"],
    ["newstitlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/purpleygrad66675wow.jpg"],
    ["titlebg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/greenwich8879corn.jpg"]
];
// Skin  -- Valentine
cssSkin["5"] = [
    ["menubg", "http://i24.photobucket.com/albums/c3/pagingdr/Forum/bars/darkred20fg.gif"],
    ["catbg", " "],
    ["newstitlebg", " "],
    ["titlebg", " "]
];

// 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);
          }
       }
    }
}


