function  tabPrincipal (id, destino, activa)
   {
	   this.menuSel = null;
	   this.id = id;
       this.destino = destino;	   
	   this.activa = activa;
	   this.tabs = new Array();
   };
tabPrincipal.prototype.crear = function ()
   {
	   for (var t = 0; t<= this.tabs.length-1; t++)
	      {
			  var tabTemp = document.getElementById(this.tabs[t].id);
			  tabTemp._parent = this;
			  tabTemp._recurso = this.tabs[t].recurso;
			  tabTemp._funcion = this.tabs[t]._funcion;
			  tabTemp._funcion2 = this.tabs[t]._funcion2;
			  tabTemp.onclick = function ()
			     {					 
					this._parent.peticionMenu(this, this._recurso, this._funcion, this._funcion2); 
					return false;
				 }
		  }
	  if (this.activa >= 0)
	     {
			 this.peticionMenu(document.getElementById(this.tabs[this.activa].id),this.tabs[this.activa].recurso); 
		 }
car(); //aqui se manda a llamr la hoja prncipal
   };
tabPrincipal.prototype.agregaTab = function (id,recurso, funcion, funcion2)
   {
	   var tabTemp= new Object();
	   tabTemp.id = id;
	   tabTemp.recurso = recurso;
	  tabTemp._funcion = funcion;
	  tabTemp._funcion2 = funcion2;
	   this.tabs.push(tabTemp);
   }
tabPrincipal.prototype.peticionMenu = function (celda, recurso, funcion, funcion2)	
   {	          
      
	   oThis = this;
	   if (celda != false)
			 {
				this.menuOut(celda);
			 }  
	   this.despliegaInfo("<img src='images/cargando.gif' width='20' height='20' />");	
	   var oXMLHttp = zXmlHttp.createRequest();
	   oXMLHttp.open("get", recurso, true);	
	   oXMLHttp.onreadystatechange = function ()
		   {
			   if (oXMLHttp.readyState == 4)
				 {
					 if (oXMLHttp.status == 200)
						{
							oThis.despliegaInfo(oXMLHttp.responseText, funcion, funcion2);
						}else
						{
							oThis.despliegaInfo("Ocurre un error de comunicación: "+ oXMLHttp.statusText)
						}
				 }
		   }	
//		document.documentElement.scrollTop = 100;	
		oXMLHttp.send(null);			   	   
		 
   }
tabPrincipal.prototype.menuPress = function (celda)   
   {
	   celda.className = "tabNoActivo";
   }
tabPrincipal.prototype.menuOut = function (celda)   
   {
	   if (this.menuSel != null)
   	   	  this.menuPress (this.menuSel);
	   celda.className = "tabActivo";
	   this.menuSel = celda;
   }

tabPrincipal.prototype.despliegaInfo = function (contenido, funcion, funcion2)	   
   {
      var divR = document.getElementById(this.destino);
	  divR.innerHTML = contenido;
	  if (funcion != null || funcion != undefined)
		{							  
		   funcion();


		}
		if (funcion2 != null || funcion2 != undefined)
		{							  
		   funcion2();
		   
		}
		

   }
/************************************************************/


