
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Page: htdocs/common/javascript.js
//Project: Web Publishing Engine
//Version: 1.1 (Rengah Sarawak)
//Status: In production
//Author: Bruce Morrison
//Copyright: c2o
//
//
//Last update:	8-Mar-01 JC copied & modified function menu(section)
//				15-Mar-01 JC modified image rollver script
//							
//							
//
//	 	
//Checked and cleared on:
//Checked by:
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

rnd.today=new Date();
rnd.seed=rnd.today.getTime();

function rnd() {
 rnd.seed = (rnd.seed*9301+49297) % 233280;
 return rnd.seed/(233280.0);
};

function rand(number) {
  return Math.ceil(rnd()*number);
};

function padout(number) { 
  return (number < 10) ? '0' + number : number; 
}

function givemea(letter){
 document.write('<img src="/img/logo/' + letter + padout(rand(20)) + '.gif" width="45" height="60" alt="'+ letter + '">');
}

//function banner(section){
// if (section == 6){
//   document.write('<IMG SRC="/img/banner/ban' + section + padout(rand(10)) + '.gif" WIDTH="440" HEIGHT="60" ALT="Banner">');
// }else{
//   document.write('<IMG SRC="/img/banner/ban' + section + padout(rand(25)) + '.gif" WIDTH="440" HEIGHT="60" ALT="Banner">');
// }
//}


function menu(section){
  switch (section){
     case 1 : 
        menu="rsmnhom1.gif";
        break;
     case 2 : 
        menu="rsmnabo1.gif";
        break;
     case 3 : 
        menu="rsmnlin1.gif";
        break;
     case 4 : 
        menu="rsmnsea1.gif";
        break;
     case 5 : 
        menu="rsmnfor1.gif";
        break;
     case 6 : 
        menu="rsmncon1.gif";
        break;
  }
  document.write('<IMG SRC="/img/' + menu + '" WIDTH="120" HEIGHT="15" ALT="menu">');
}


// pop-out phorum
function pop(page) {
OpenWin = this.open(page, "CtrlWindow", "width=650,height=550,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no");
}


// banner rollovers
function rswap(id, newSrc) {
    var theImage = FWFindImage(document, id, 0);
    if (theImage) {
        theImage.src = newSrc;
    }
}

function FWFindImage(doc, name, j) {
    var theImage = false;
    if (doc.images) {
        theImage = doc.images[name];
    }
    if (theImage) {
        return theImage;
    }
    if (doc.layers) {
        for (j = 0; j < doc.layers.length; j++) {
            theImage = FWFindImage(doc.layers[j].document, name, 0);
            if (theImage) {
                return (theImage);
            }
        }
    }
    return (false);
}