function openPopup(url, width, height, params) {
	
	if (screen) {
		var xMax = screen.width, yMax = screen.height;
	}
	else {
		if (document.layers) {
			var xMax = window.outerWidth, yMax = window.outerHeight;
		} else { 
			var xMax = 640, yMax=480;
		}
	}
	
	var xOffset = (xMax - width)/2, yOffset = (yMax - height)/2;
	var str = 'width='+width+',height='+height+',screenX='+xOffset+',screenY='+yOffset+',top='+(yOffset-30)+',left='+xOffset+''
	
	if (params) {
		str += ','+params;  
	}
	
	if (window._popupWindow) {
		window._popupWindow.close();
	}
	
	window._popupWindow = window.open(url, '_popupWindow', str); 
	
	if (window._popupWindow) {
		window._popupWindow.focus();
		return false;
	}
	
	return true;

}

function skaiciuotiKieki() {
    this.ilgis = document.getElementById('ilgis');
    this.ilgis.value = this.ilgis.value.replace(/,/gi, "."); 
    this.plotis = document.getElementById('plotis');
    this.plotis.value = this.plotis.value.replace(/,/gi, "."); 
    this.gylis = document.getElementById('gylis');
    this.kiekis = document.getElementById('kiekis');
    this.maisai = document.getElementById('maisai');
    this.kiekis.value = this.ilgis.value * this.plotis.value * this.gylis.value / 100;
    this.maisai.value = Math.ceil(this.kiekis.value / 0.07);
}

