function initKLayers(){
	isDOM=(document.getElementById)?true:false
	isMSIE=isIE=(document.all && document.all.item)?true:false
	isNC6=isMozilla=isDOM && navigator.appName=="Netscape"
	isNC4=(navigator.appName=="Netscape" && !isNC6)?true:false
	isNC=isNC4 || isNC6
	isOpera=false; //(window.opera)?true:false
	isOpera5=isOpera && isDOM
	isOpera6=(isOpera5 && window.print)?true:false

	if(!isDOM && !isNC && !isMSIE && !isOpera5){
		KLayers=false
		return false
	}

	KL_styleSwitch=".style"
	KL_layerPostfix="\"]"

	if(isNC4){
		KL_layerRef="document.layers[\""
		KL_styleSwitch=""
	}

	if(isMSIE){
		KL_layerRef="document.all[\""
	}

	if(isDOM){
		KL_layerRef="document.getElementById(\""
		KL_layerPostfix="\")"
	}

	KLayers=true
	return true
}

initKLayers()

function getDocumentWidth(){
	var d=document
	if(isMSIE) return d.body.scrollWidth
	if(isNC) return d.width
	if(isOpera) return d.body.style.pixelWidth
}


function layer(name)
{
	return new KLayer(name,false)
}

function KLayer(name,parent)
{
	this.id=name
	this.path=KL_layerRef+name+KL_layerPostfix
	this.object=eval(this.path)
	if(!this.object)return
	this.css=eval(this.path+KL_styleSwitch)
}

KLP=KLayer.prototype

KLP.getLeft=function()
{
	var o=this.object
	if(isMSIE || isNC6 || isOpera5) return o.offsetLeft
	if(isNC4) return o.pageX
}

KLP.getTop=function()
{
	var o=this.object
	if(isMSIE || isNC6 || isOpera5) return o.offsetTop
	if(isNC4) return o.pageY
}

KLP.getWidth=function()
{
	var o=this.object
	if(isOpera5) return this.css.pixelWidth
	if(isMSIE || isNC6) return o.offsetWidth
	if(isNC4) return o.document.width
}

KLP.getHeight=function()
{
	var o=this.object
	if(isOpera5) return this.css.pixelHeight
	if(isMSIE || isNC6) return o.offsetHeight
	if(isNC4) return o.document.height
}

KLP.setLeft=KLP.moveX=function(x)
{
	if(isOpera)
	{
		this.css.pixelLeft=x
	}
	else
	{
		this.css.left=x
	}
}

KLP.setTop=KLP.moveY=function(y)
{
	if(isOpera)
	{
		this.css.pixelTop=y
	}
	else
	{
		this.css.top=y
	}
}

KLP.moveTo=KLP.move=function(x,y)
{
	this.setLeft(x)
	this.setTop(y)
}

KLP.moveBy=function(x,y)
{
	this.moveTo(this.getLeft()+x,this.getTop()+y)
}

KLP.show=function()
{
	this.setVisibility(true)
}

KLP.hide=function()
{
	this.setVisibility(false)
}

KLP.setVisibility=function(v)
{
	this.css.visibility=(v)?(isNC4?"show":"visible"):(isNC4?"hide":"hidden")
}

KLP.isVisible=KLP.getVisibility=function()
{
	return (this.css.visibility.toLowerCase().charAt(0)=='h')?false:true
}

KLP.appear=function()
{
	this.setDisplay(true)
}

KLP.disappear=function()
{
	this.setDisplay(false)
}

KLP.setDisplay=function(v)
{
	this.css.display=(v)?(isNC4?"":""):(isNC4?"none":"none")
}

KLP.isDisplayed=KLP.getDisplay=function()
{
	return (this.css.display.toLowerCase().charAt(0)=='n')?false:true
}
	
function show(id)
{
	var menu=layer('menu_'+id);
	if (menu.isDisplayed())
	{
		menu.disappear();
		document.getElementById('img_'+id).src='img/'+id+'.gif';
	} else {
		menu.appear();
		document.getElementById('img_'+id).src='img/'+id+'_.gif';
	}
}