/**
 *
 * LCMS and its source-code is licensed under the LGPL.
 * You may copy, adapt, and redistribute this file for commercial or non-commercial use.
 * When copying, adapting, or redistributing this document in keeping with the guidelines above,
 * you are required to provide proper attribution to champion open systems.
 * If you reproduce or distribute the document without making any substantive modifications to its content,
 * please use the following attribution line:
 *
 * Copyright 2007 champion open systems (http://www.chaosys.ch) All rights reserved.
 *
 */


/**
* 
* Updating the Infoscreen.
*
*/

function updateInfo() {
	//object positions
	viewObjectElement = document.getElementById('viewObject');
	
	leftThis = parseFloat(viewObjectElement.style.left);
	topThis = parseFloat(viewObjectElement.style.top);
	
	//Position in Percent
	xperc = parseFloat(calculatePercLeft(50));
	yperc = parseFloat(calculatePercTop(50));
	
	//Position in Pixel
	xpixel = 0;
	if(leftThis > 0){
		xpixel = (-1 * leftThis) + getObjectivX() / 2;
	}else{
		xpixel = leftThis + getObjectivX() / 2;
	}
	
	ypixel = 0;
	if(topThis > 0){
		ypixel = (-1 * topThis) + getObjectivY() / 2;
	}else{
		ypixel = topThis + getObjectivY() / 2;
	}



	xmicrometer = getMicrometerX(xperc);
	ymicrometer = getMicrometerY(yperc);
	objectivWidthMicrometer = getMicrometerObjectivX();
	//Display values
	if(infoRoundedFlag){
		xmicrometer = xmicrometer.toFixed(2);
		ymicrometer = ymicrometer.toFixed(2);
		objectivWidthMicrometer = objectivWidthMicrometer.toFixed(2);
		xperc = xperc.toFixed(2); 
		yperc = yperc.toFixed(2); 
		xpixel = parseInt(xpixel);
		ypixel = parseInt(ypixel);
	}
	
	document.getElementById("micrometertext").firstChild.nodeValue = "Display Width : " + objectivWidthMicrometer + " \u00B5m";
	document.getElementById("positionmicrometer").firstChild.nodeValue = "Position : " + xmicrometer + " \u00B5m " +" / "+ymicrometer + " \u00B5m";

	//document.getElementById('infocenterpositfionPerc').firstChild.nodeValue = "- % (X/Y): " + xperc + "/" + yperc;
	//document.getElementById('infocenterpositionPixel').firstChild.nodeValue = "- pixel (X/Y): " + xpixel + "/" + ypixel;
}