function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	} else { 
		countfield.value = maxlimit - field.value.length;
	}
}


function fnCtrlKoord(xkoord,ykoord,exactitude) {
		fnOpenCtrlKoordWindow("/plants/fyndplats_info.asp?xkoord=" + xkoord + "&ykoord=" + ykoord + "&exactitude=" + exactitude);
	}

var ctrlKoordWindow = null;
function fnOpenCtrlKoordWindow(sURL, width, height) {
		
		if(width==null || width==0) width=810;
		if(height==null || height==0) height=440;
		

		// Om popupfönstret har använts
		if (ctrlKoordWindow != null) { 
			// Om popupfönstret har existerat men stängts, öppna nytt
			if ((!ctrlKoordWindow) || (ctrlKoordWindow.closed)) { 
				ctrlKoordWindow = open(sURL,'rapp_ctrlkoord','scrollbars=yes,resizable=no,width=' + width + ',height=' + height + '');
			// Om popupfönstret existerar ändra focus till det	
			} else { 
				ctrlKoordWindow.focus();
			}
		// Popupfönstret finns inte, öppna nytt
		} else { 
			ctrlKoordWindow = open(sURL,'rapp_ctrlkoord','scrollbars=yes,resizable=no,width=' + width + ',height=' + height + '');
		}
	}
