var mousex = 0
var mousey = 0
var mouseb = -10
var altl = 0;
if(isNC4) document.captureEvents(Event.MOUSEMOVE)
if(isMSIE || isOpera7){
  document.onmousemove=function(){
   	mousex=event.clientX+getScrollX()
    mousey=event.clientY+getScrollY()
    KRF_drag();
   	moveFollower(altl);
   	return true
  }
}else if(isOpera){
  document.onmousemove=function(){
   	mousex=event.clientX
   	mousey=event.clientY
   	KRF_drag();
   	moveFollower(altl);
   	return true
  }
}else if(isNC){
  document.onmousemove=function(e){
   	mousex = e.pageX
   	mousey = e.pageY
   	KRF_drag();
   	moveFollower(altl);
   	return true
  }  
}
if(isNC4) document.captureEvents(Event.MOUSEDOWN)
if(isMSIE || isOpera7){
  document.onmousedown=function(){
    mouseb = event.button;
    return true
  }
}else if(isOpera){
  document.onmousedown=function(){
    mouseb = event.button;
    return true
  }
}else if(isNC){
  document.onmousedown=function(e){
    mouseb = e.button;
    return true
  }  
}

if(isNC4) document.captureEvents(Event.MOUSEUP)
if(isMSIE || isOpera7){
  document.onmouseup=function(){
  	dragID = 0;
    mouseb = -10;
    return true
  }
}else if(isOpera){
  document.onmouseup=function(){
    dragID = 0;
    mouseb = -10;
    return true
  }
}else if(isNC){
  document.onmouseup=function(e){
    dragID = 0;
    mouseb = -10;
    return true
  }  
}

function initalt(){
	altl=layer("altmessage");
	altl.hide();
}

function doalt(message){
	if (!altl) return;
	if (message != ''){
		altl.write(message);
        altl.show();
	}
}
function realt(){
	if (!altl) return;
	altl.hide();
	altl.moveTo(0,0);
}

function moveFollower(l){
	if (!l && !altl) return;
	if (!l) l = altl;
	if (l.getVisibility()) 
	{
		l.css.position = 'absolute';
		posy = mousey+15;
		posx = mousex;
		if (l.getWidth()  + posx >= getDocumentWidth()  + getScrollX()) posx = getScrollX() + getDocumentWidth()  - l.getWidth();
		if (l.getHeight() + posy + 20 >= getWindowHeight() + getScrollY()) posy = getScrollY() + getWindowHeight() - l.getHeight() - 20;
		if (posy + l.getHeight() > mousey && posy < mousey)
		{
			posy = mousey-l.getHeight()-15;
		}
		l.moveTo(posx,posy)
	}
}

function moveUnder(l){
	if (!l) return;
	if (l.getVisibility()) 
	{
		l.css.position = 'absolute';
		posy = mousey;
		posx = mousex;
		if (l.getWidth()  + posx >= getDocumentWidth()  + getScrollX()) posx = getScrollX() + getDocumentWidth()  - l.getWidth();
		if (l.getHeight() + posy + 20 >= getWindowHeight() + getScrollY()) posy = getScrollY() + getWindowHeight() - l.getHeight() - 20;
		if (posy + l.getHeight() > mousey && posy < mousey)
		{
			posy = mousey-l.getHeight();
		}
		l.moveTo(posx,posy)
	}
}