var spFieldID = null;
        
function GetIDInDiv(div, controlID, fieldType)
{                           
	var returnResult = "";    
	var divObj = document.getElementById(div);            
	var re = new RegExp("id=\\w*"+controlID+"\\w*"+fieldType+"\\w*displayContent");
	var controlObj = divObj.innerHTML.match(re);                                 
            
	if (controlObj)
	{   
		// Cast controlObj to string and chop of the 'id=' part.
		controlObj = controlObj+"";
		returnResult = controlObj.substr(3);                
	}
	return returnResult;
}
        
function validateText(invoerDiv, errorDiv)
{   
	if ( spFieldID == null )
	{
		// Get the sharepoint object id.
		spFieldID = GetIDInDiv(invoerDiv,"NieuwsSamenvatting","RichHtmlField");
	}            
	var obj = document.getElementById( spFieldID );            
	if( obj != null)
	{                
		var errorLbl = document.getElementById(errorDiv);
		if ( obj.innerText.length >= 200)
		{            
			// Too many chars have been inputed.
			// Show error warning.
			errorLbl.style.display = "block";
		}
		else 
		{
			// Hide error warning.
			errorLbl.style.display = "none";
		}
	}
}