this.randomHeader = function(){

	var pause = 5000; // define the pause for each tip (in milliseconds)
	var topImages = $$("#rotating_images li"); 
	var numImages = topImages.length; 
	var temp = -1;
	var ran = 0
	
	this.getRan = function(){
		// get the random number
		var ran = Math.floor(Math.random()*numImages) + 1;
		return ran;
	};
	this.displayImages = function(){

		//var ran = getRan();
		
		// to avoid repeating
		while ((ran == temp) || (ran < 0) || (ran > numImages) || (!(topImages[ran]))) {
			ran = ran + 1;
			if (ran > numImages) { ran = 0 }
		}; 
		
		temp = ran;
		
		for(var i=0; i < numImages; i++){
			topImages[i].hide();
		}
		
		//topImages[ran].show();
		new Effect.Appear(topImages[ran], {queue: "end", duration: 0.8});
	};
	
	displayImages(); setInterval(displayImages,pause);
	
};

var cSection = null;
var cSubsection = null;

var pn = document.location.pathname.substr(1);
var splittedPath = pn.split("/");

cSection = splittedPath[0];
if (splittedPath.length == 3) { cSubsection = splittedPath[1]; }
if (splittedPath.length == 1) { cSection = 'home'; }


function chBg(o, s) {
	if (o.id != cSection) {
		o.style.background = 'url(/images/menubutton_background_'+s+'.gif)';
	}
}

function chSub(o, s) {
	o.style.backgroundColor = s;
}

function toggleMenu(o) {
	alert(o);
}

function goToUrl(u) {
	document.location.href = u;
}

menuBgImg = new Image();
menuBgImg.src = "/images/menubutton_background_on.gif";

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
