var BM2={
//////////////////////////////////////
// kell hozzá: BM2_almenuk[] tömb!!!
//////////////////////////////////////
menuDelay: 500,
ani_speed: 10, //(kisebb szám=gyorsabb)
ani_time: 20, //(kisebb szám=gyorsabb)
//////////////////////////////////////
rejtID: null,
timerOn : false,
next:"",
activ_menuItem:"",
offsw: 0,
offsh: 0,
temp_hided_selbox:new Array(),
//////////////////////////////////////

mutat: function(id){
	if(this.timerOn==true)
	{
		this.next=id;
	}
	else
	{
		this.next="";
		this.hideAll();
		this.showDiv(id);
		this.activ_menuItem=id;
	}		
},

rejt_delayed: function(){
	this.hideAll();
	this.next_mutat();
	this.timerOn = false;
	this.rejtID=null;
},

rejt: function(){
	if (this.timerOn == false)
	{
		this.timerOn = true;
		this.rejtID=setTimeout( "BM2.rejt_delayed()", this.menuDelay);
	}
},

next_mutat: function(){
	this.hideAll();
	if(this.next!="")
	{
		this.showDiv(this.next);
		this.activ_menuItem=this.next;
	}
},

showDiv: function(id){
	var obj;
	if(document.all && !window.opera)
	{
		obj=document.all[id];
	}
	else
	{
		obj=document.getElementById(id)
	}
	
	if(this.activ_menuItem!=id || this.next=="")
	{
		obj.style.display='block';
		this.get_offsw(id);
		this.get_offsh(id);
		obj.style.width="0";
		obj.style.height="0";
		this.mutat_ani(id);
	}
	else
	{
		obj.style.display='block';
	}

	//hide and save selectboxes in IE4-6:
	if(document.all && !window.opera && typeof document.body.style.maxHeight == "undefined")
	{
		var selects = document.all.tags('select');
		var i;
		var sl=selects.length;
		for(i=0;i<sl;i++)
		{
			if(selects[i].style.visibility!="hidden" && selects[i].style.display!="none")
			{
				selects[i].style.visibility="hidden"
				this.temp_hided_selbox.push(selects[i]);
			}
		}//end for		
	}
},

get_offsw: function(id){
	if(document.all && !window.opera)
	{
		if(document.all(id).offsetWidth)
		{
			this.offsw=document.all(id).offsetWidth
		}
	}			
	else
	{
		if(document.getElementById(id).offsetWidth)
		{
			this.offsw=document.getElementById(id).offsetWidth
		}
	}
},

get_offsh: function(id){
	if(document.all && !window.opera)
	{
			if(document.all(id).offsetHeight)
			{
				this.offsh=document.all(id).offsetHeight
			}
	}
	else
	{
			if(document.getElementById(id).offsetHeight)
			{
				this.offsh=document.getElementById(id).offsetHeight
			}
	}
},

mutat_ani: function(id){
	var elm;
	if(document.all && !window.opera)
  	{
		elm=document.all[id];
  	}
	else
  	{
		elm=document.getElementById(id);
  	}

  	if (parseInt(elm.style.width,10) < this.offsw || parseInt(elm.style.height,10) < this.offsh)
	{
    		if (parseInt(elm.style.width,10) < this.offsw )
    		{
    			elm.style.width = (parseInt(elm.style.width,10)+(this.offsw/this.ani_speed) )+"px";
    		}
    		if (parseInt(elm.style.height,10) < this.offsh)
    		{
    			elm.style.height = (parseInt(elm.style.height,10)+(this.offsh/this.ani_speed))+"px";
    		}
    		var aniID = setTimeout('BM2.mutat_ani("'+id+'")',this.ani_time);
    	}	
  	else
  	{
  		clearTimeout(aniID);
  	}


},

hideAll: function(){
	if(BM2_almenuk.length>0)
	{
		var i;
		var il=BM2_almenuk.length
		for (i=0;i<il;i++)
		{
			if(document.all && !window.opera)
			{
				var obj=document.all[BM2_almenuk[i]];
			}
			else
			{
				var obj=document.getElementById(BM2_almenuk[i])
			}			
			obj.style.display='none';
		}
	}
	
	//Show hided selectboxes in IE4-6:
	if(document.all && !window.opera && typeof document.body.style.maxHeight == "undefined")
	{
		var i;
		var sl=this.temp_hided_selbox.length;
		for(i=0;i<sl;i++)
		{
			this.temp_hided_selbox[i].style.visibility="visible"
		}		
		
	}
	
	//empty array
	this.temp_hided_selbox.splice(0,this.temp_hided_selbox.length) 	
},

hideAllDiv:function ()
{
	this.next="";
}

}//end class