String.prototype.strip_tags = function(){
tags = this;
stripped = tags.replace(/(<\/?[^>]+>)/gi, "");
return stripped;
}


var Fckvalue = '';

function limitFCKSize(objFCK, limit)
{
//this line is where I am getting the FCKeditorAPI is not defined error.
var fckEditor = FCKeditorAPI.GetInstance(objFCK);

var FckStripText = fckEditor.GetHTML().strip_tags();
var FCKLen = FckStripText.length;

if(FCKLen >= limit) {
		fckEditor.EditorDocument.body.innerHTML = FckStripText.substr(0,500);	
		if(Fckvalue == '') alert('Wklejony tekst jest zbyt długi, zostanie obcięty i pozbawiony formatowania.');
		return false;
}else Fckvalue = fckEditor.GetHTML();
}


onchangeListener = function(){
//updateFCKCounter("strJobDesc", "bulletcount", 35)
}
updateCounter = function(){
limitFCKSize("company_description", 500)
}



function FCKeditor_OnComplete(){
delayHook("company_description");
}
function delayHook(name)
{

if(window.attachEvent){
FCKeditorAPI.GetInstance(name).EditorDocument.attachEvent( "onkeypress",updateCounter);
FCKeditorAPI.GetInstance(name).EditorDocument.attachEvent( "onkeyup",updateCounter);
FCKeditorAPI.GetInstance(name).EditorDocument.attachEvent( "onkeydown",updateCounter);
FCKeditorAPI.GetInstance(name).EditorDocument.attachEvent( "onpaste",updateCounter);
FCKeditorAPI.GetInstance(name).EditorDocument.attachEvent( "onupdate",updateCounter);
}else{
FCKeditorAPI.GetInstance(name).EditorDocument.addEventListener( "keypress",updateCounter,false);
FCKeditorAPI.GetInstance(name).EditorDocument.addEventListener( "keyup",updateCounter,false);
FCKeditorAPI.GetInstance(name).EditorDocument.addEventListener( "keydown",updateCounter,false);
FCKeditorAPI.GetInstance(name).EditorDocument.addEventListener( "paste",updateCounter,false);
FCKeditorAPI.GetInstance(name).EditorDocument.addEventListener( "update",updateCounter,false);
}
}

function changeStyleFCK(name) {
		if(document.getElementById(name + '___Frame')){
		var height = document.getElementById(name + '___Frame').style.height;
		height = parseInt(height.replace("px", ""));
		document.getElementById(name + '___Frame').style.height = (height+100)+'px';
		}
}