function initKLayers(){
  isDOM=(document.getElementById)?true:false
  isOpera=(window.opera)?true:false
  isOpera5=isOpera && isDOM
  isOpera6=(isOpera5 && window.print)?true:false
  isMSIE=isIE=(document.all && document.all.item && !isOpera)
  isNC=navigator.appName=="Netscape"
  isNC4=isNC && !isDOM
  isNC6=isMozilla=isNC && isDOM

  if(!isDOM && !isNC && !isMSIE && !isOpera5){
    KLayers=false
    return false
  }

  pageLeft=0
  pageTop=0

  KL_imagePostfix="\"]"
  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()

var KL_LAYER=0

function KL_getObjectPath(name,parent,type){
  var l=((parent && isNC4)?(parent+"."):(""))+((type==KL_LAYER)?KL_layerRef:KL_imageRef)+name+((type==KL_LAYER)?KL_layerPostfix:KL_imagePostfix)
  if(eval(l))return l
  if(!isNC4){
    return l
  }else{
    return KL_findObject(name,"document.layers",type)
  }
}

function layer(name){
  return new KLayer(name,null)
}

function KLayer(name,parent){
  this.path=KL_getObjectPath(name,parent,KL_LAYER)
  this.object=eval(this.path)
  if(!this.object)return
  this.style=this.css=eval(this.path+KL_styleSwitch)
}

KLP=KLayer.prototype

KLP.isExist=KLP.exists=function(){
  return (this.object)?true:false
}

KLP.setLeft=KLP.moveX=function(x){
  x+=pageLeft
  if(isOpera){
    this.css.pixelLeft=x
  }else if(isNC4){
  	this.object.x=x
  }else{
    this.css.left=x
  }
}

KLP.setTop=KLP.moveY=function(y){
  y+=pageTop
  if(isOpera){
    this.css.pixelTop=y
  }else if(isNC4){
  	this.object.y=y
  }else{
    this.css.top=y
  }
}

KLP.moveTo=KLP.move=function(x,y){
  if(isMSIE){
    x += event.clientX+document.body.scrollLeft
    y += event.clientY+document.body.scrollTop
  }
  this.setLeft(x)
  this.setTop(y)
}

KLP.setVisibility=function(v){
  this.css.visibility=(v)?(isNC4?"show":"visible"):(isNC4?"hide":"hidden")
}

KLP.show=function(){
  this.setVisibility(true)
  this.moveTo(mousex+10,mousey-100);
}

KLP.hide=function(){
  this.setVisibility(false)
}

var mousex = 0
var mousey = 0
if(isNC4) document.captureEvents(Event.MOUSEMOVE)
if(isOpera){
  document.onmousemove=function(){
    mousex=event.clientX+document.body.scrollLeft
    mousey=event.clientY+document.body.scrollTop
    return true
  }
}else if(isOpera6){
  document.onmousemove=function(){
    mousex=event.clientX
    mousey=event.clientY
    return true
  }
}else if(isNC){
  document.onmousemove=function(e){
    mousex = e.pageX
    mousey = e.pageY
    return true
  }  
}

