function ArticleCategoryPAFSetup( formId , hasImageFieldName , imageWidthFieldName , imageHeightFieldName, imageFitTypeFieldName , hasThumbnailFieldName, thumbnailWidthFieldName , thumbnailHeightFieldName, thumbnailFitTypeFieldName  ) {
	var form = document.getElementById( formId );
	form.actions = getChildrenWithId( form , "ArticleCategory" )[0];
	form.actions.sw = getChildrenWithId( form.actions, "switch" )[0];
	form.actions.sw.onclick = function() {
		form.actions.changeElementsState();
		//TODO	czy to return się sprawdza ?
		return;
		if( form.actions.allChildrenEmpty() ) form.actions.changeElementsState();
		else this.checked = true;
	};
	form.actions.sw.ondblclick = function() {
		this.onclick();
	}
	form.actions.allChildrenEmpty = function( root ) {
		if( ! root ) root = this;
		for( var i = 0 ; i < root.childNodes.length ; i++ ) {
			if( root.childNodes[i].nodeType == 1 && root.childNodes[i].childNodes.length > 0 && ! this.allChildrenEmpty( root.childNodes[i] ) ) return false;
		else if( root.childNodes[i].tagName == "INPUT" && root.childNodes[i].type == "text" && root.childNodes[i].value != "" ) return false;
		}
		return true;
	}
	form.actions.changeElementsState = function( root ) {
		if( ! root ) root = this;
		for( var i = 0 ; i < root.childNodes.length ; i++ )
			if( root.childNodes[i].nodeType == 1 && root.childNodes[i].childNodes.length > 0 ) this.changeElementsState( root.childNodes[i] );
			else if( root.childNodes[i].tagName == "INPUT" && root.childNodes[i].type == "text" ) {
				root.childNodes[i].disabled = ! this.sw.checked;
			}
	}
	if( form.actions.allChildrenEmpty() ) { form.actions.changeElementsState(); form.actions.sw.checked = false; }
	else form.actions.sw.checked = true;

	var imageRelatedFieldsFunction = function() {
		form[imageWidthFieldName].disabled = this.value != "true";
		form[imageHeightFieldName].disabled = this.value != "true";
		form[imageFitTypeFieldName].disabled = this.value != "true";
	}
	var thumbnailRelatedFieldsFunction = function() { 
		form[thumbnailWidthFieldName].disabled = this.value != "true";
		form[thumbnailHeightFieldName].disabled = this.value != "true";
		form[thumbnailFitTypeFieldName].disabled = this.value != "true";
	}
	/**
	 *	Check if hasImageFieldName points to group of radio buttons or select field
	 */
	if( form[hasImageFieldName] && ! form[hasImageFieldName].tagName ) {
		form[hasImageFieldName][0].onclick = imageRelatedFieldsFunction;
		form[hasImageFieldName][1].onclick = imageRelatedFieldsFunction;
	} else form[hasImageFieldName].onchange = imageRelatedFieldsFunction;
	if( form[hasThumbnailFieldName] && ! form[hasThumbnailFieldName].tagName ) {
		form[hasThumbnailFieldName][0].onclick = thumbnailRelatedFieldsFunction;
		form[hasThumbnailFieldName][1].onclick = thumbnailRelatedFieldsFunction;
	} else form[hasThumbnailFieldName].onchange = thumbnailRelatedFieldsFunction;
}
