// JavaScript Document
function makesmaller() { 
    var newheight; newheight = 15; 
    if (document.layers) { document.banner.height = newheight+"px"; //netscape not tested 
    } else if (document.all) { banner.style.height = newheight+"px"; //mac IE and (not PC IE)
    } else { banner.style.height = newheight+"px"; //works for safari - same code as for netscape 
    } 
} 
function makebigger() { 
    var newheight; newheight = 345; 
    if (document.layers) { document.banner.height = newheight+"px"; //netscape not tested 
    } else if (document.all) { banner.style.height = newheight+"px"; //mac IE and (not PC IE)
    } else { banner.style.height = newheight+"px"; //works for safari - same code as for netscape 
    } 
} 

function ChangeCSSBgImg() {
if (!document.getElementById) return false;

var MyElement = "banner" //The ID of the element you want to change
var ImgPath = "/portalStyle/images/" //The file path to your images

if (!document.getElementById(MyElement)) return false;

var random_images = new Array ();
random_images[0]="banner0.JPG";
random_images[1]="banner1.jpg"
random_images[2]="banner2.jpg"
random_images[3]="banner3.jpg"
random_images[4]="banner4.jpg"


var $header = document.getElementById(MyElement);
var $backgroundurl = $header.style.backgroundImage;
var ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")";

if ($backgroundurl != ImgURL) {
$header.style.backgroundImage = ImgURL; 
}
}

/* random number generator */
function rand(n) {
    return ( Math.floor ( Math.random ( ) * n ) );
}

/* Custom onload function */

function addLoadEvent(func) {
    var oldonload = window.onload;
        if (typeof window.onload != 'function') {
        window.onload = func;
        } else {
        window.onload = function() {
    oldonload();
func();
}
}
}

/* trigger onload */

addLoadEvent(ChangeCSSBgImg);
