var m=new MenuBar();
	m.addMenu('M1');
	m.addMenu('M2');
	m.addMenu('M3');

var imgArr=new Array();
function preload(url)
	{if(document.images!=null)
		{var length=imgArr.length;
		imgArr[length]=new Image();
		imgArr[length].src=url;
		}
	}
preload("images/about1.gif");
preload("images/catalog1.gif");
preload("images/contacts1.gif");
preload("images/news3.gif");
preload("images/start1.gif");
preload("images/izbran1.gif");
preload("images/karta1.gif");
preload("images/vxod70.jpg");

function change(x,y)
	{if(document.images!=null)
		{with(document)
			{var s=images[x].src;
			images[x].src=imgArr[y].src;
			imgArr[y].src=s;
			}
		}
	}

function changer(x,y)
	{if(document.images!=null)
		{with(document)
			{var s=images[x].src;
			document.images['vezd'].filters.blendTrans.apply();
        	document.images['vezd'].filters.blendTrans.play();
			images[x].src=imgArr[y].src;
			imgArr[y].src=s;
			setTimeout("changer('vezd',7)",10000);
			}
		}
	}
	
function setBrowserType(){
	if(navigator.appName=='Microsoft Internet Explorer'){
		if(document.getElementById) 
			this.IEnew=true;
		else 
			this.IEold=true;
	}else if(navigator.appName=='Netscape'){
		if(parseInt(navigator.appVersion)==4) 
			this.NNold=true;
		else if(parseInt(navigator.appVersion)==5) 
			this.NNnew=true;
	}
}

function setVisible(visible){
	if(visible){
		if(this.IEold) eval(this.id+'.style.visibility="visible"');
		else if(this.NNold) eval('document.'+this.id+'.visibility="show"');
		else if(this.NNnew || this.IEnew) document.getElementById(this.id).style.visibility="visible";
	}else{
		if(this.IEold) eval(this.id+'.style.visibility="hidden"');
		else if(this.NNold) eval('document.'+this.id+'.visibility="hide"');
		else if(this.NNnew || this.IEnew) document.getElementById(this.id).style.visibility="hidden";
	}
}

function Menu(id){
	this.id=id; 
	this.NNold=this.NNnew=this.IEold=this.IEnew=false; 
	this.setBrowserType=setBrowserType;
	this.setVisible=setVisible;
	this.setBrowserType();
}

function addMenu(id){
	var length=this.menus.length;
	this.menus[length]=new Menu(id);
}

function show(id){
	clearTimeout(this.timer);
	this.timer=0;
	for(var i=0; i<this.menus.length; i++){
		if(this.menus[i].id==id){
			this.menus[i].setVisible(true);
		}else{
			this.menus[i].setVisible(false);
		}
	}
}

var tmpObject;
function hide(id){
	for(var i=0; i<this.menus.length; i++){
		if(this.menus[i].id==id){
			tmpObject=this.menus[i];
			this.timer=setTimeout("tmpObject.setVisible(false)",800);			
			break;
		}
	}
}

function MenuBar(){
	this.menus=new Array(); 
	this.timer=0; 
	this.addMenu=addMenu;
	this.show=show;
	this.hide=hide;
}
