


var inst = -1;
function notifyfocus(editor_id, body, doc){
	alert("notifyfocus"); //jos tätä ei tuu niin tämä funktio voidaan poistaa.


	//inst = editor_id;

	inst   = tinyMCE.getInstanceById("mce_editor_"+editor_id);

	//alert("editor_id="+editor_id+"\ninst="+inst);
	//window.setTimeout( notifyfocus, 5000 )
}
//kissa=true;
function _toggle_toolbars (selectedInstance){

    for (var n in tinyMCE.instances) {
		if (document.getElementById(n+"_toolbar")){
	        if (tinyMCE.instances[n].editorId == selectedInstance.editorId)
	        {
				document.getElementById(n+"_toolbar").style.display = "block";
	        }
	        else {
				document.getElementById(n+"_toolbar").style.display = "none";
	        }
		}
    }
}

function dhtmlLoadScript(url)
{
	alert("dhtmlLoadScript"); //jos tätä ei tuu niin tämä funktio voidaan poistaa.
	var e = document.createElement("script");
	e.src = url;
	e.type="text/javascript";
	document.getElementsByTagName("head")[0].appendChild(e);
}


function createToolbarHolderLayer(id){
	alert("createToolbarHolderLayer"); //jos tätä ei tuu niin tämä funktio voidaan poistaa.
	toolbarHolderLayer = document.createElement("DIV");
	toolbarHolderLayer.id="toolbarHolderLayer";
	toolbarHolderLayer.className = "toolbarHolderLayer";

	Body=document.getElementsByTagName("body").item(0);

	Body.insertBefore(toolbarHolderLayer,Body.firstChild);
}

function createSpacerLayer(id){
alert("createSpacerLayer"); //jos tätä ei tuu niin tämä funktio voidaan poistaa.
	spacerLayer = document.createElement("DIV");
	spacerLayer.id=id
	spacerLayer.className = id;

	Body=document.getElementsByTagName("body").item(0);

	Body.insertBefore(spacerLayer,Body.firstChild);
}

function CA_ResizeHeight(editor_id, body, doc) {
alert("CA_ResizeHeight"); //jos tätä ei tuu niin tämä funktio voidaan poistaa.
	// All params as String and as Object

	sCA_edID   = "'" + editor_id + "'";

	sCA_inst   = "tinyMCE.getInstanceById( " + sCA_edID + " )";
	sCA_frame  = sCA_inst + ".iframeElement";
	sCA_doc    = sCA_inst + ".getDoc()";
	sCA_body   = sCA_inst + ".getBody()";

	oCA_frame  = eval ( sCA_frame );
	oCA_doc    = eval ( sCA_doc );
	oCA_body   = eval ( sCA_body );

	iCA_height = tinyMCE.settings['height'];

	if (iCA_height < 30) iCA_height = 30;


	if ( tinyMCE.isMSIE ) {
		// Auto resize in IE made very simple and stable
		oCA_frame.style.setExpression( "height", sCA_body + ".scrollHeight" );

	} else {

		oCA_doc.documentElement.style.height = iCA_height + "px";
		oCA_frame.style.height = iCA_height + "px";

		// Mozilla Firefox 1.5 doesn't change the body height for the first time

		if( oCA_body.offsetHeight != iCA_height ) {
			sCA_func = "CA_ResizeHeight( " + sCA_edID + ", " + sCA_body + ", " + sCA_doc + " );"
			window.setTimeout( sCA_func, 40 );
			return;
		}
	}
}

var verticalpos="fromtop";
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function JSFX_FloatDiv(id, sx, sy)
{
	//console.debug("testing testing ...", [id, sx, sy]);
	var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
	var px = document.layers ? "" : "px";
	window[id + "_obj"] = el;
	if(d.layers)el.style=el;
	el.cx = el.sx = sx;el.cy = el.sy = sy;
	el.sP=function(x,y){this.style.left=x+px;this.style.top=y+px;};

	el.floatIt=function()
	{
		var pX, pY;
		pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
		document.documentElement && document.documentElement.clientWidth ?
		document.documentElement.clientWidth : document.body.clientWidth;
		pY = ns ? pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop;
		if(this.sy<0)
		pY += ns ? innerHeight : document.documentElement && document.documentElement.clientHeight ?
		document.documentElement.clientHeight : document.body.clientHeight;
		this.cx += (pX + this.sx - this.cx)/2;this.cy += (pY + this.sy - this.cy)/2;
		this.sP(this.cx, this.cy);
		setTimeout(this.id + "_obj.floatIt()", 40);
	}
	return el;
}

