// +----------------------------------------------------------------------+
// | Source file version 1.0                                              |
// +----------------------------------------------------------------------+
// | Copyright (c) 2002 - 2003 OÜ HansaNet (http://www.hansanet.ee)       |
// +----------------------------------------------------------------------+
// | This source file is property of OÜ HansaNet. Modifying and           |
// | distribution of any kind is prohibited without written permission    |
// | from OÜ HansaNet.                                                    |
// +----------------------------------------------------------------------+
// | Authors: Reio Piller <reio@hansanet.ee>                              |
// +----------------------------------------------------------------------+

function getObjectById(obj) {
	if (document.getElementById != null) {
		return document.getElementById(obj);
	}
	if (document.all != null) {
		return document.all[obj];
	}
	return document[obj];
}

function moveObject(obj, x, y) {
	if (navigator.family == "nn4" || navigator.family == "gecko") {
		x = window.pageXOffset + x;
		y = window.pageYOffset + y;
	}
	else {
		x = document.body.scrollLeft + x;
		y = document.body.scrollTop + y;
	}
	if (navigator.family == "nn4") {
		obj.moveTo(x, y);
	}
	else {
		obj.style.left = x;
		obj.style.top = y;
	}
}

function showObject(obj) {
	if (navigator.family == "nn4") {
		if (obj.visibility == "show") {
			return;
		}
		obj.visibility = "show";
	} 
	else { 
		if (obj.style.visibility == "visible") {
			return;
		}
		obj.style.visibility = "visible";
		obj.style.display = "";
	} 
}

function hideObject(obj) {
	if (navigator.family == "nn4") {
		if (obj.visibility == "hide") {
			return;
		}
		obj.visibility = "hide";
	}
	else {
		if (obj.style.visibility == "hidden") {
			return;
		}
		obj.style.visibility = "hidden";
		obj.style.display = "none";
	} 
}
var fck_counter=0;

function switchEditors(oNode,sType) {
	if(typeof(FCKeditorAPI) == "undefined") FCKeditorAPI=false;
	var i=0;
	for (i=0;i<oNode.childNodes.length;i++) {
		childNode = oNode.childNodes.item(i);
		if ((fck_counter < 1) && FCKeditorAPI) {
			editor = FCKeditorAPI.GetInstance(childNode.name);
			if (editor && editor.EditorDocument && editor.EditMode == FCK_EDITMODE_WYSIWYG) {
				editor.SwitchEditMode();
				editor.SwitchEditMode();
				fck_counter++;
			}
			switchEditors(childNode,sType);
		}
	}
}
