var active = 0;

bOK = (document.all || document.layers || document.getElementById);

buttonList = new Array();
buttonList[0] = "clasificados"; buttonList[1] = "usuarios"; buttonList[2] = "anunciantes";


clasificados_on = new Image(); clasificados_off = new Image(); clasificados_off.src = "/images/buttons/eu2MenuTabs/clasificados_off.gif"; clasificados_on.src = "/images/buttons/eu2MenuTabs/clasificados_on.gif";
usuarios_on = new Image(); usuarios_off = new Image(); usuarios_off.src = "/images/buttons/eu2MenuTabs/usuarios_off.gif"; usuarios_on.src = "/images/buttons/eu2MenuTabs/usuarios_on.gif";
anunciantes_on = new Image(); anunciantes_off = new Image(); anunciantes_off.src = "/images/buttons/eu2MenuTabs/anunciantes_off.gif"; anunciantes_on.src = "/images/buttons/eu2MenuTabs/anunciantes_on.gif";

layerList = new Array();
layerList[0] = "clasificados"; layerList[1] = "usuarios"; layerList[2] = "anunciantes"; 

var section = "home";

var actLayer = "none";

function resetAllButtons() {
	for (i = 0; i < buttonList.length; i++) {
		flip(buttonList[i],0);
	}

}

function fullResetButtons() {
	var actLayer = "none";
	if (bOK && active) {
		for (i = 0; i < layerList.length; i++) {
			thisimage = layerList[i];
			if (document[thisimage] && thisimage != section) document[thisimage].src = eval(thisimage+'_off.src');
		}
	}
}

function flip(name,over) {
	if (bOK && active){
		if (document.images && (name != section)) {
			image = (over == 1) ? eval(name+"_on.src") : eval(name+"_off.src");
			if (name != actLayer) document[name].src = image;
		}
	}
}



function getLayer(thislayer) {
	if (bOK && active) {
		if (document.layers) {
			layerReturn = eval('document.layers["'+thislayer+'layer"]');
		} else if (document.all) {
			if (eval('document.all["'+thislayer+'layer"]'+'.style')) layerReturn = eval('document.all["'+thislayer+'layer"]'+'.style');
		} else if (document.getElementById) {
			if (document.getElementById(thislayer+'layer')) layerReturn = document.getElementById(thislayer+'layer');
			layerReturn = layerReturn.style;
		}   
	}
	return layerReturn;
}

function showLayer(numshow) {
	if (bOK && active && layerList[numshow]) {
		showThisLayer = getLayer(layerList[numshow]);   
		if (showThisLayer) {
			actLayer = layerList[numshow];
			resetAllButtons();
			hideAllLayers();
			showThisLayer.visibility = (document.layers) ? 'show' : 'visible';
		}
	}
}


function hideLayer(numhide) {
	if (bOK && active && layerList[numhide]) {
		hideThisLayer = getLayer(layerList[numhide]);
		if (hideThisLayer) {
			hideThisLayer.visibility = (document.layers) ? 'hide' : 'hidden';
		}
	}
}

function hideAllLayers() {
	if (bOK && active) {
		for (i = 0; i < layerList.length; i++) hideLayer(i);
		clearTimeout(menuTimer);
	}
}

menuTimer = setTimeout("actLayer='none',clearAll()",600);

function clearMenus() {
	menuTimer = setTimeout("actLayer='none',clearAll()",600);
}



function clearAll() {
	var actLayer = "none";
	hideAllLayers();
	fullResetButtons();
}

function openAudioFile(){
	window.open('http://www.eluniversal.com/popupFileUrosa.shtml','popup','width=408,height=480');
}

function openaudiofile(path){
	window.open('http://www.eluniversal.com/popupFileUrosa2.shtml','popup','width=408,height=480');
}

function openmediafile(path){
	window.open(path,'popup','width=380,height=200');
}

function openpopup(path,widht,height){	
	if (widht== undefined)
		width=408;
	if (height== undefined)
		height=300;
	window.open(path,'popup','width='+widht+',height='+height);
}
