/* javascript function to update form field
 *  field		form field that is being counted
 *  count		form field that will show characters left
 *  maxchars 	maximum number of characters
*/

function klockprisNetpay(price)
{
	var w = 1024, h = 768;

	if (document.all || document.layers) {
	   w = screen.availWidth;
	   h = screen.availHeight;
	}

	var popW = 500, popH = 520;

	var leftPos = (w-popW)/2, topPos = (h-popH)/2;

	window.open('netpay-kalkylsnurra.php?price=' + price,'Kalkylsnurra','width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos + ', location=no, status=no, url=no, directories=no');
}

function characterCount(field, count, maxchars) {
	if (field.value.length > maxchars) {
		field.value = field.value.substring(0, maxchars);
		alert("Error:\n\n- You are only allowed to enter up to "+maxchars+" characters.");
	} else {
		count.value = maxchars - field.value.length;
	}
}
