/*** Editor Script Wrapper ***/
var oScripts=document.getElementsByTagName("script");	
var sEditorPath;
for(var i=0;i<oScripts.length;i++)
	{
	var sSrc=oScripts[i].src.toLowerCase();
	if(sSrc.indexOf("scripts/innovaeditor.js")!=-1) sEditorPath=oScripts[i].src.replace(/innovaeditor.js/,"");
	}

if(navigator.appName.indexOf('Microsoft')!=-1 && navigator.platform.indexOf('in32')!=-1)
	document.write("<scr"+"ipt src='"+sEditorPath+"editor.js'></scr"+"ipt>");
else
	document.write("<scr"+"ipt src='"+sEditorPath+"moz/editor.js'></scr"+"ipt>");
	

// comment the following out if you want to continue using the old editor
// this code will enable simple one textarea pages using the "plaza_editor_generate()" fucntion call to work unchanged.
// if you use other old wywiwyg functsion eg editor_generate() or style_generate() then create copies of this section.

	
function plaza_editor_generate(field){
	var oEdit1 = new InnovaEditor("oEdit1");
	// oEdit1.btnSpellCheck=true;
	// similar lines can be used to produce customized version of the editor
	oEdit1.REPLACE(field);
}

// link picking script here:
/* ---------------------------------------------------------------------- *\
  Function    : doPlazaURL
  Description : called when plaza link wanted to be picked up in link field
                will call editor.js to execute the action
  Arguments   : objname - ID of input field to replace
\* ---------------------------------------------------------------------- */
function doPlazaURL(objname){
if(navigator.appName.indexOf('Microsoft')!=-1 && navigator.platform.indexOf('in32')!=-1)
{
	var vargs = "huu";
var newValue = window.showModalDialog("/Resource.phx/innova/scripts/plaza_insert_hyperlink_pick.html","finnish",
		"dialogWidth:"+"540"+"px;dialogHeight:"+"580"+"px;edge:Raised;center:Yes;help:No;Resizable:Yes;Maximize:Yes");


if (newValue)
{
   document.getElementById(objname).value = newValue;
}
}
else
	window.open("/Resource.phx/innova/scripts/moz/plaza_insert_hyperlink_pick.html?" + objname,"","width=540,height=580");
	

// if (newValue != "undefined") 
   // myElement.value = newValue;
}
