sfHover = function (){
	if (document.getElementById("menunav")){
		var sfEls = document.getElementById("menunav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
		
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp("sfhover\\b"), "");
			}
		}
	}
}

function ventana(nombre,direccion) {		
	var win=new Window(nombre, {className: "alphacube", title: nombre,  width:700, height:500, resizable: true, maximizable:false, minimizable:false, url: direccion, showEffectOptions: {duration:1}});	
	win.setDestroyOnClose(); 
	win.showCenter(true);
}

function ventanaGrafica(nombre,direccion) {		
	mapita = document.getElementById('mapita');
	mapita.style.display = 'none';	
	var win=new Window(nombre, {className: "alphacube", title: nombre,  width:570, height:420, resizable: true, maximizable:false, minimizable:false, url: direccion, showEffectOptions: {duration:1}});	
	win.setDestroyOnClose(); 
	win.showCenter(true);
}

// this array consists of the id attributes of the divs we wish to alternate between
var divs_to_fade = new Array('u-header1', 'u-header2', 'u-header3', 'u-header4', 'u-header5', 'u-header6', 'u-header7', 'u-header8', 'u-header9');
// the starting index in the above array.  It should be set to the value of the div which doesn't have the CSS Display property set to "none"
var i = 0;
// the number of milliseconds between swaps.  Default is five seconds.
var wait = 5000;

// the function that performs the fade
function swapFade() {
	Effect.Fade(divs_to_fade[i], { duration:1, from:1.0, to:0.0 });
	//alert (i);
	i++;
	if (i == 9) i = 0;
	Effect.Appear(divs_to_fade[i], { duration:1, from:0.0, to:1.0 });
}

// the onload event handler that starts the fading.
function startPage() {
	setInterval('swapFade()',wait);
}


window.onload = function() {
	i = parseInt(Math.random()*8);
	elemt = $(divs_to_fade[i]);
	elemt.style.display = "block";
	startPage();
	sfHover();
}
