// JavaScript Document

function imageLabeling(){}


imageLabeling.prototype.init = function(){
	this.labels = [];
}


imageLabeling.prototype.addLabel = function(value, left, top, id){
	var _this = imageLabeling;
	
	/* 34.615% of the left and top values has to be used
		100% is original, img dimensions 780px x 585px
		34.615% is the new, img dimensions 270px x 202px */
	var percentage = 34.615;
	
	left = (left/100)*percentage;
	top = (top/100)*percentage;
	
	var label = document.createElement('input');
	label.type = 'text';
	label.value = value;
	label.readOnly = true;
	label.style.position = 'absolute';
	label.style.left = left + 'px';
	label.style.top = top + 'px';
		
	document.getElementById(id).appendChild(label);
	_this.labels.push(label);
}

imageLabeling.prototype.fillLabels = function(list){
	var input = document.getElementById('drawingParameters').getElementsByTagName('input');
	
	for(var i=0; i<input.length; i++){
		input[i].value = list[i];
	}
}