var moz = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
//var ie5 = false;
var sticky = false;
var close_list;
var map_X, map_Y;

var on = false;

function Start(e){ 
    if(on)   {
         window.document.onmousemove = null; 
         window.document.onmousemove = mouseMove;
         e.value ='Start'; 
    }else  { 
         window.document.onmousemove = showMousePos; 
         e.value ='Stopp'; 
    } 
    on = !on; 
} 
function showMousePos(e){ 
    var p = mouse_pos(e); 
    for(var i in p)    { 
        document.forms['usermap_form'].elements[i].value =  p[i]; 
    } 
} 


if (ie4) {
	if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) {
		ie5 = true;
	}
	moz = false;
}

window.document.onmousemove = mouseMove;

function mouseMove(e) {
                map_X = (document.all) ? window.event.x : e.layerX;
                map_Y = (document.all) ? window.event.y  : e.layerY;
        }

function hide(){
	document.getElementById('fenster').style.visibility='hidden';
	sticky=false;
}
	
function point_show(num,force){
	if(!sticky || force){
		if(force){ sticky=true; }
		if(moz){
			var range=document.createRange();
			var list=document.getElementById("liste");
			range.selectNode(list);
			var domfrag = range.createContextualFragment(Usermap_data[num]);
			while (list.hasChildNodes()) {
				list.removeChild(list.lastChild);
			}
			list.appendChild(domfrag);
		}else{
			document.all["liste"].innerHTML=Usermap_data[num];
		}
		window.clearTimeout(close_list);
		document.getElementById("fenster").style.top=map_Y+5+"px";
		document.getElementById("fenster").style.left=map_X+5+"px";
		document.getElementById("fenster").style.visibility="visible";
	}
}

function mouse_pos(e) { 
	if(!e) e = window.event; 
	var body = (window.document.compatMode && window.document.compatMode == "CSS1Compat") ?  
	window.document.documentElement : window.document.body; 
	return { 
	// Position im Dokument
	top: e.pageY ? e.pageY : e.clientY + body.scrollTop - body.clientTop, 
	left: e.pageX ? e.pageX : e.clientX + body.scrollLeft  - body.clientLeft
	}; 
} 

function point_mouseout(){
	if(!sticky){
		close_list=window.setTimeout("hide()",1000);
	}
}

function list_mouseout(){
	if(!sticky){
		close_list=window.setTimeout("hide()",1000);
	}
}

function list_hover(){
	window.clearTimeout(close_list);
}

function point_click(){
//	sticky=true;
}

function add_area(coords,index){
	document.writeln("<area shape=\"circle\" coords=\""+coords+"\" onmouseover=\"point_show("+index+",false);\" onmouseout=\"point_mouseout();\" href=\"Javascript:point_click();\">");
}
