function showDiv(div, visibility)
{
 if(document.all)
   {
	layer = document.all[div];
	} 
	else
	{
		layer = document.getElementById(div);
	}
	display = (visibility)?'block':'none';
	layer.style.display = display;
}

function Menu1(llave, cantidad) {
	//este es el constructor
	this.llave		= llave;
	this.cantidad	= cantidad;
	this.autoClose	= true;
	this.closeAll	= true;

	var iDelay = 3000 ;
	var sDisplayTimer = null;
	var oLastItem = true;
	var iNSWidth = 100;
 
	//this.id			= id;
	var entrada		= new Array();
	var content		= new Array();
	
	isOPERA = (navigator.userAgent.indexOf('Opera') >= 0)? true : false;
	isIE    = (document.all && !isOPERA)? true : false;
	isDOM   = (document.getElementById && !isIE)? true : false;
	
	this.initArray = function() {
		for (x=0; x < this.cantidad; x++) {
			entrada [this.llave + "_" + x] = true;
		}
	}
	
	this.make_menu1 = function(id){
		if(this.closeAll) {
			this.hide_all();
		}
		if (entrada[this.llave + "_" + id]) {
			this.show (id, 'table-row');
			for (x=0; x < this.cantidad; x++){
				entrada [this.llave + "_" + x] = true;
			}
			if(this.autoClose) {
				entrada[this.llave + "_" + id] = false;
			}
		}else{
			if(this.autoClose) {
				this.hide(llave + "_" + id);
			}
			entrada[this.llave + "_" + id]=true;
		} 
	}	
	
	this.hide_all = function() {
		for (i=0; i<this.cantidad;i++){
			this.hide(this.llave + "_" + i);
		}
	}
	
	this.hide = function(id){
		if (isDOM) {
			document.getElementById(id).style.display = "none";
		} else if (isIE) {
			document.all[id].style.display = "none";
		}
	}
	
	
	this.show = function(id, displayValue){
		if (isDOM) {
			document.getElementById(this.llave +  "_" + id).style.display = (displayValue)? displayValue: "block";
		} else if (isIE) {
			document.all[this.llave + "_" + id].style.display = "block";
		}
	}

	this.stopTimer = function () {
		clearTimeout(sDisplayTimer)
	}

	this.startTimer = function () {
	  this.stopTimer()
	  objMenu1 = this;
	  sDisplayTimer = setTimeout('callHideItem()',iDelay)
	}

	this.hideItem = function () {
		if (oLastItem) {
			this.hide_all();
		}
	}
}
var objMenu1;
function callHideItem() {
	objMenu1.hideItem();
}

function MakeMenu1(llave, cantidad) {
  menu1 = new Menu1(llave, cantidad);
	menu1.initArray();
	return menu1;
} 

function loadMenu1(cant) {
	menu1Faq = MakeMenu1('preguntas', cant);
}


