function popup(obj,W,H, wtype){
	if (document.all){
		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 - W)/2, yOffset = (yMax - H)/2;
	open(obj.href + '&single_module=1', wtype, 'location=yes,scrollbars=yes,width='+W+',height='+H+',top='+yOffset+',left='+xOffset);
	return false;
}

function popup_menu(obj,W,H, wtype){
	if (document.all){
		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 - W)/2, yOffset = (yMax - H)/2;
	open(obj.href + '&single_module=1', wtype, 'location=yes,scrollbars=yes,menubar=yes,width='+W+',height='+H+',top='+yOffset+',left='+xOffset);
	return false;
}



function calculate(){
	var sum = parseInt(document.getElementById('csum').value);
	var years = parseInt(document.getElementById('cyears').value);
	var percentage = document.getElementById('cpercentage').value;
	var pay = document.getElementById('cpay');
	if(isNaN(years) || isNaN(sum))
	{
		return;
	}
	percentage=1+(percentage/12);
	years=12*years+1;
	pay.value=Math.round(sum/((1-1/Math.pow(percentage,years))/(1-1/(percentage))-1));
}