// find out if ie runs in quirks mode
//
var docEl = (
             typeof document.compatMode != "undefined" && 
             document.compatMode        != "BackCompat"
            )? "documentElement" : "body";
            
var exPos;
var eyPos;
var landmark;


// register event
// capture it for nc 4x (ok it\'s a dino)
//
function init_mousemove() {
    if(document.layers) document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove =	dpl_mouse_pos;
}

function dpl_mouse_pos(e) {

    // position where mousemove fired
    //
    var xPos    =  e? e.pageX : window.event.x;
		var yPos    =  e? e.pageY : window.event.y;

	
	// for ie add scroll position
	//
	if (document.all && !document.captureEvents) {
	    xPos    += document[docEl].scrollLeft;
	    yPos    += document[docEl].scrollTop;
    }
    
    //exPos = xPos - 137;
    exPos = xPos - ((screen.width/2) - 503);
    //exPos = xPos - (window.innerWidth - 1264);
    //exPos = xPos - 15;
    eyPos = yPos - 136;
    
    // display position
    //
    //document.feld.ausg.value    =  "Left = " + ( xPos - 145 ) + " : Top = " + ( yPos - 106 );
    
    // for the dino pass event
    //
    if (document.layers) routeEvent(e);
}

function resetSelector() {
	document.getElementById(landmark).style.left = exPos;
	document.getElementById(landmark).style.top  = eyPos;
	
	var1 = landmark + "_xPos";
	var2 = landmark + "_yPos";
	document.picedit.elements[var1].value = exPos;
	document.picedit.elements[var2].value = eyPos;
	
	document.debug.xPos.value = exPos;
	document.debug.yPos.value = eyPos;
}

function activateLandmark(id) {
	landmark = id;
	
	document.debug.landmark.value = id;
}

function showLandmarks() {
	opacity('felandmark0', 0, 60, 0);
	opacity('felandmark1', 0, 60, 0);
	opacity('felandmark2', 0, 60, 0);
	opacity('felandmark3', 0, 60, 0);
	opacity('felandmark4', 0, 60, 0);
}

function hideLandmarks() {
	opacity('felandmark0', 60, 0, 0);
	opacity('felandmark1', 60, 0, 0);
	opacity('felandmark2', 60, 0, 0);
	opacity('felandmark3', 60, 0, 0);
	opacity('felandmark4', 60, 0, 0);
}

function increaseOpacityLevel(id) {
	document.getElementById(id).style.opacity = 1;
	document.getElementById(id).style.filter = "Alpha(opacity=100)";
}

function decreaseOpacityLevel(id) {
	document.getElementById(id).style.opacity = 0.5;
	document.getElementById(id).style.filter = "Alpha(opacity=50)";
}

function showLayer(id) {
 if(document.getElementById(id).style.display == 'none') {
	  document.getElementById(id).style.display = 'block';
	} else {
	  document.getElementById(id).style.display = 'none';
	}
}

function closeThumb(id) {
	document.getElementById(id).style.display = 'none';
	
}