var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
var alreadyStarted=false;

function showEditor(editType, editName) {
	if ( editType == 'CMSBOX' ) boxName = 'editboxcms'; else boxName = 'editboxupload';
	var crossobj=iebrowser? iebrowser[boxName] : document.getElementById(boxName);
	if ( crossobj ) {
		if ( crossobj.style.display == 'block' ) {
			crossobj.style.display = 'none';
			crossobj.style.visibility = 'hidden';
			if ( editType == 'CMSBOX' ) {
				xinha_editors.editdata.deactivateEditor();
			}
		} else {
			crossobj.style.display = 'block';
			crossobj.style.visibility = 'visible';
			if ( editType == 'CMSBOX' ) {
				document.editboxformcms.editname.value=editName;
				var crossobj=iebrowser? iebrowser[editName] : document.getElementById(editName);
				if ( ! alreadyStarted ) {
					if ( crossobj )	document.editboxformcms.editdata.value = crossobj.innerHTML;
					Xinha.startEditors(xinha_editors);
					alreadyStarted = true;
				} else {
					xinha_editors.editdata.activateEditor();
					if (crossobj) {
						xinha_editors.editdata.setHTML(xinha_editors.editdata.inwardHtml(crossobj.innerHTML));
						xinha_editors.editdata.outwardHtml(xinha_editors.editdata.getHTML());
					}
				}
			} else
				document.editboxformupload.editname.value=editName;
		}
	}
	return false;
}
function hideEditor(editType, divName) {
        var crossobj=iebrowser? iebrowser[divName] : document.getElementById(divName);
        if ( crossobj ) {
		if ( editType == 'CMSBOX' ) {
			xinha_editors.editdata.deactivateEditor();
		}
		crossobj.style.display = 'none';
		crossobj.style.visibility = 'hidden';
	}
}
