// =============================================================================
// edit-on(R) Pro by RealObjects
// Version 4.3.134.19, 2007-02-05
// Copyright (c) 2000-2006, RealObjects GmbH. All rights reserved.
// Visit http://www.realobjects.com for more information.
// =============================================================================

// =============================================================================
// Main constructor
// =============================================================================

var eopInstances = new Array();
var eopInstance = 0;

function editOnPro(width, height, appletName, id, eopobj) {
    // Enable/disable debug mode
    this.debug = false;
    
    // use the OBJECT tag
    this.OBJECT_TAG = 0;
    // use the APPLET tag
    this.APPLET_TAG = 1;
    
    // defines wether the applet tag or object tag should be used
    this.tagStyle = this.OBJECT_TAG;
    
    // Determines whether caching should be active or not. Default is true.
    this.caching = true;
    // edit-on Pro version to be cached
    this.cacheVersion = "4.3.134.19b";
    this.archive = "edit-on-pro-4.jar";
    this.cacheArchive = this.archive+";"+this.cacheVersion;
    
    // Basic applet configuration
    this.width = width;
    this.height = height;
    this.appletName = appletName;
    
    // Name of the editOnPro object
    this.eopobj = eopobj;
    // Event handler
    this.handler = this.eopobj+".pumpEvents";
    // Enable auto-download of the JRE by default
    this.isJREAutoDownloadEnabled = true;
    
    // Applet id is set to the applet's name if no id was specified
    if(id) {
		this.id = id;
    } else {
		this.id = this.appletName;
    }
    
    // The applet's codebase atribute
    this.codebase = "";
    
    // The applet's code attribute
    this.code = "com.realobjects.eop.japplet.SwingEditorApplet";
    
    // Applet params are set using the setParam() method
    this.params = "";
    this.attribs = "";
    
    // Browser detection variables
    this.browser = navigator.userAgent;
    this.isIE52 = false;
    this.errorMsg = "";
    this.isMSIE = false;
    this.isMac = false;
    this.isSafari = false;
    this.isOpera = false;
    
    // enable / disable debug mode
    this.enableDebug = EOP_enableDebug;
    
    // sets the type of tag to use for the applet
    this.setTagStyle = EOP_setTagStyle;
    
    // Javascript API methods
    this.getCurrentElement = EOP_getCurrentElement;
    this.getCurrentElementContent = EOP_getCurrentElementContent;
    this.getHeadElementContent = EOP_getHeadElementContent;
    this.getHTMLData = EOP_getHTMLData;
    this.getPlainText = EOP_getPlainText;
    this.getSelectedHTMLData = EOP_getSelectedHTMLData;
    this.getStyleSheet = EOP_getStyleSheet;
    this.getCustomField = EOP_getCustomField;
    this.getEncoding = EOP_getEncoding;
    this.getGetErrorTarget = EOP_getGetErrorTarget;
    this.getGetErrorURL = EOP_getGetErrorURL;
    this.getGetHTMLDataURL = EOP_getGetHTMLDataURL;
    this.getGetOKTarget = EOP_getGetOKTarget;
    this.getGetOKURL = EOP_getGetOKURL;
    this.getExportAsNumerical = EOP_getExportAsNumerical;
    this.getLocaleCode = EOP_getLocaleCode;
    this.getLocaleURL = EOP_getLocaleURL;
    this.getNewDocumentDialog = EOP_getNewDocumentDialog;
    this.getSourceView = EOP_getSourceView;
    this.getSetErrorTarget = EOP_getSetErrorTarget;
    this.getSetErrorURL = EOP_getSetErrorURL;
    this.getSetOKTarget = EOP_getSetOKTarget;
    this.getSetOKURL = EOP_getSetOKURL;
    this.getImageBase = EOP_getImageBase;
    this.getCharWithSpacesStatistic = EOP_getCharWithSpacesStatistic;
    this.getCharNoSpacesStatistic = EOP_getCharNoSpacesStatistic;
    this.getWordsStatistic = EOP_getWordsStatistic;
    this.getImagesStatistic = EOP_getImagesStatistic;
    this.getLinesStatistic = EOP_getLinesStatistic;
    this.getParagraphsStatistic = EOP_getParagraphsStatistic;
    this.getStatistics = EOP_getStatistics;
    this.getReadOnly = EOP_getReadOnly;
    this.getDTDBase = EOP_getDTDBase;
    this.getActiveSpellChecker = EOP_getActiveSpellChecker;
    this.getStandAloneMode = EOP_getStandAloneMode;
    this.getBase = EOP_getBase;
    this.getBlockElementAttributes = EOP_getBlockElementAttributes;
    this.getWebDAVCookieString = EOP_getWebDAVCookieString;
    this.getUserPreferences = EOP_getUserPreferences;
    
    this.insertCustomTag = EOP_insertCustomTag;
    this.insertImage = EOP_insertImage;
    this.insertHTMLData = EOP_insertHTMLData;
    this.insertHTMLDataFromURL = EOP_insertHTMLDataFromURL;
    this.uploadImages = EOP_uploadImages;
    this.uploadToRepository = EOP_uploadToRepository;
    
    this.addStyleSheet = EOP_addStyleSheet;
    this.cleanStyleSheet = EOP_cleanStyleSheet;
    this.clear = EOP_clear;
    this.decode = EOP_decode;
    this.encode = EOP_encode;
    this.hasContentChanged = EOP_hasContentChanged;
    this.postDocumentToServer = EOP_postDocumentToServer;
    
    this.invokeAction = EOP_invokeAction;
    
    this.setCurrentElementContent = EOP_setCurrentElementContent;
    this.setHeadElementContent = EOP_setHeadElementContent;
    this.setHTMLData = EOP_setHTMLData;
    this.setHTMLDataFromURL = EOP_setHTMLDataFromURL;
    this.setStyleSheet = EOP_setStyleSheet;
    this.setStyleSheetURL = EOP_setStyleSheetURL;
    this.showWYSIWYGAreaOnly = EOP_showWYSIWYGAreaOnly;
    this.setLookAndFeel = EOP_setLookAndFeel;
    this.setTemplate = EOP_setTemplate;
    this.setTemplateURL = EOP_setTemplateURL;
    this.setEncoding = EOP_setEncoding;
    this.setGetErrorTarget = EOP_setGetErrorTarget;
    this.setGetErrorURL = EOP_setGetErrorURL;
    this.setGetHTMLDataURL = EOP_setGetHTMLDataURL;
    this.setGetOKTarget = EOP_setGetOKTarget;
    this.setGetOKURL = EOP_setGetOKURL;
    this.setExportAsNumerical = EOP_setExportAsNumerical;
    this.setLocaleCode = EOP_setLocaleCode;
    this.setLocaleURL = EOP_setLocaleURL;
    this.setNewDocumentDialog = EOP_setNewDocumentDialog;
    this.setSourceView = EOP_setSourceView;
    this.setSetErrorTarget = EOP_setSetErrorTarget;
    this.setSetErrorURL = EOP_setSetErrorURL;
    this.setSetOKTarget = EOP_setSetOKTarget;
    this.setSetOKURL = EOP_setSetOKURL;
    this.setStartUpScreenBackgroundColor = EOP_setStartUpScreenBackgroundColor;
    this.setStartUpScreenTextColor = EOP_setStartUpScreenTextColor;
    this.setConfigURL = EOP_setConfigURL;
    this.setUIConfigURL = EOP_setUIConfigURL;
    this.setOnEditorLoaded = EOP_setOnEditorLoaded;
    this.setImageBase = EOP_setImageBase;
    this.setStandAloneMode = EOP_setStandAloneMode;
    this.setLicenseKey = EOP_setLicenseKey;
    this.setOnDataLoaded = EOP_setOnDataLoaded;
    this.setOnDataPosted = EOP_setOnDataPosted;
    this.setOnDataPostedError = EOP_setOnDataPostedError;
    this.setCaretAtDocumentStart = EOP_setCaretAtDocumentStart;
    this.setCustomField = EOP_setCustomField;
    this.setElementAttributes = EOP_setElementAttributes;
    this.setReadOnly = EOP_setReadOnly;
    this.setConfig = EOP_setConfig;
    this.setUIConfig = EOP_setUIConfig;
    this.setCookie = EOP_setCookie;
    this.setHeartBeatURL = EOP_setHeartBeatURL;
    this.setHeartBeatInterval = EOP_setHeartBeatInterval;
    this.setDTDBase = EOP_setDTDBase;
    this.setActiveSpellChecker = EOP_setActiveSpellChecker;
    this.setCaretAfterNextBookmark = EOP_setCaretAfterNextBookmark;
    this.setNextBookmarkWrapAroundEnabled = EOP_setNextBookmarkWrapAroundEnabled;
    this.setCaretAfterPreviousBookmark = EOP_setCaretAfterPreviousBookmark;
    this.setPreviousBookmarkWrapAroundEnabled = EOP_setPreviousBookmarkWrapAroundEnabled;
    this.setBase = EOP_setBase;
    this.setOnEditorFocused = EOP_setOnEditorFocused;
    this.setBodyOnly = EOP_setBodyOnly;
    this.setStandAloneWidth = EOP_setStandAloneWidth;
    this.setStandAloneHeight = EOP_setStandAloneHeight;
    this.setBlockElementAttributes = EOP_setBlockElementAttributes;
    this.setWebDAVCookieString = EOP_setWebDAVCookieString;
    this.setUserPreferences = EOP_setUserPreferences;
    
    // Configuration of the auto-download of the JRE in Win IE
    this.setJREAutoDownloadURL = EOP_setJREAutoDownloadURL;
    this.setJREAutoDownload = EOP_setJREAutoDownload;
    this.jreAutoDownloadURL = "https://java.sun.com/update/1.5.0/jinstall-1_5-windows-i586.cab";
    this.jreMinVersion = "#Version=1,4,2,0";
    this.setJREMinVersion = EOP_setJREMinVersion;
    
    // Adds an archive to the archives to be loaded
    this.addArchive = EOP_addArchive;
    // Add an applet param
    this.setParam = EOP_setParam;
    // Add an atrribute
    this.addAttribute = EOP_addAttribute;
    // Load the applet
    this.loadEditor = EOP_loadEditor;
    // Set the applet's codebase attribute
    this.setCodebase = EOP_setCodebase;
    // Disable caching
    this.disableCaching = EOP_disableCaching;
    // Object containing the editor
    this.obj = "";
    // Set the object containing the editor
    this.setObj = EOP_setObj;
    
    // General Helper functions used within this script
    this.getOSInfo = EOP_getOSInfo;
    this.getAppletElement = EOP_getAppletElement;
    this.getPreloadAppletElement = EOP_getPreloadAppletElement;
    this.getArchive = EOP_getArchive;
    this.getLocaleFromBrowser = EOP_getLocaleFromBrowser;
    
    // Determines whether the browser/OS config is supported
    this.getOSInfo();
                                                                     
    this.started = false;
    this.initialized = false;
    this.registerMethod = EOP_registerMethod;
    this.unReg = EOP_unReg;
    this.pumpEvents = EOP_pumpEvents;
    this.initializeJS = EOP_initializeJS;
    
    this.sequence = new Array();
    this.args = new Array();
    this.seq = 0;
    
    this.doSetStyleSheet = EOP_doSetStyleSheet;
    this.doInsertHTMLData = EOP_doInsertHTMLData;
    this.doInsertHTMLDataFromURL = EOP_doInsertHTMLDataFromURL;
    this.doSetHTMLDataFromURL = EOP_doSetHTMLDataFromURL;
    this.doSetHTMLData = EOP_doSetHTMLData;
    this.doPostDocumentToServer = EOP_doPostDocumentToServer;
    this.doInsertImage = EOP_doInsertImage;
    this.doClear = EOP_doClear;
    this.doInsertCustomTag = EOP_doInsertCustomTag;
    this.doAddStyleSheet = EOP_doAddStyleSheet;
    this.doSetStyleSheetURL = EOP_doSetStyleSheetURL;
    this.doCleanStyleSheet = EOP_doCleanStyleSheet;
    this.doSetCurrentElementContent = EOP_doSetCurrentElementContent;
    this.doSetHeadElementContent = EOP_doSetHeadElementContent;
    this.doShowWYSIWYGAreaOnly = EOP_doShowWYSIWYGAreaOnly;
    this.doSetLookAndFeel = EOP_doSetLookAndFeel;
    this.doSetTemplate = EOP_doSetTemplate;
    this.doSetTemplateURL = EOP_doSetTemplateURL;
    this.doSetCustomField = EOP_doSetCustomField;
    this.doSetEncoding = EOP_doSetEncoding;
    this.doSetGetErrorTarget = EOP_doSetGetErrorTarget;
    this.doSetGetErrorURL = EOP_doSetGetErrorURL;
    this.doSetGetHTMLDataURL = EOP_doSetGetHTMLDataURL;
    this.doSetGetOKTarget = EOP_doSetGetOKTarget;
    this.doSetGetOKURL = EOP_doSetGetOKURL;
    this.doSetSourceView = EOP_doSetSourceView;
    this.doSetSetErrorTarget = EOP_doSetSetErrorTarget;
    this.doSetSetErrorURL = EOP_doSetSetErrorURL;
    this.doSetSetOKTarget = EOP_doSetSetOKTarget;
    this.doSetSetOKURL = EOP_doSetSetOKURL;
    this.doSetImageBase = EOP_doSetImageBase;
    this.doSetStandAloneMode = EOP_doSetStandAloneMode;
    this.doUploadImages = EOP_doUploadImages;
    this.doSetCaretAtDocumentStart = EOP_doSetCaretAtDocumentStart;
    this.doSetElementAttributes = EOP_doSetElementAttributes;
    this.doSetReadOnly = EOP_doSetReadOnly;
    this.doSetCookie = EOP_doSetCookie;
    this.doSetDTDBase = EOP_doSetDTDBase;
    this.doSetActiveSpellChecker = EOP_doSetActiveSpellChecker;
    this.doUploadToRepository = EOP_doUploadToRepository;
    this.doSetCaretAfterNextBookmark = EOP_doSetCaretAfterNextBookmark;
    this.doSetNextBookmarkWrapAroundEnabled = EOP_doSetNextBookmarkWrapAroundEnabled;
    this.doSetCaretAfterPreviousBookmark = EOP_doSetCaretAfterPreviousBookmark;
    this.doSetPreviousBookmarkWrapAroundEnabled = EOP_doSetPreviousBookmarkWrapAroundEnabled;
    this.doSetBase = EOP_doSetBase;
    this.doInvokeAction = EOP_doInvokeAction;
    this.doSetBodyOnly = EOP_doSetBodyOnly;
    this.doSetBlockElementAttributes = EOP_doSetBlockElementAttributes;
    this.doSetWebDAVCookieString = EOP_doSetWebDAVCookieString;
    this.doSetUserPreferences = EOP_doSetUserPreferences;
    
    //getElementAttributes
    this.getElementAttributes = EOP_getElementAttributes;
    
    // event which may be thrown when using an unsupported browser / OS combo
    this.unsupportedEvent = "";
    this.setUnsupportedBrowserEvent = EOP_setUnsupportedBrowserEvent;
}

// =============================================================================
// Public methods
// =============================================================================

// Load additional archives. They will also be cached by the JRE.
function EOP_addArchive(sArc,sVer) {
	this.cacheArchive = this.cacheArchive+", "+sArc+";"+sVer;
	this.archive = this.archive+", "+sArc;
    this.cacheVersion = this.cacheVersion+", "+sVer;
}

// Determines which params to use to load the applet
function EOP_getArchive() {
	if(this.caching) {
        if(!this.isOpera) {
            this.setParam("cache_archive_ex",this.cacheArchive);
            this.setParam("cache_option","plugin");
        } else {
            this.setParam("cache_archive",this.archive);
            this.setParam("cache_version",this.cacheVersion);
        }
	} else {
		this.setParam("archive",this.archive);
	}
}

// Loads the applet
function EOP_loadEditor() {
	// Determines whether to enable caching or not
	this.getArchive();
   	// Enables the JRE progress bar
   	this.setParam("progressbar","true");
   	this.setParam("boxmessage","");
	// Builds the applet tag
	this.getAppletElement();
}

// Adds a param to the applet tag
function EOP_setParam(name, value) {
	this.params += '<param name="'+name+'" value="'+value+'" />\n';
}

// Adds an attribute to the applet tag
function EOP_addAttribute(sName, sVal) {
	this.attribs += ' '+sName+'="'+sVal+'"';
}

// Sets the applet's codebase
function EOP_setCodebase(sCodebase) {
	this.codebase  = sCodebase;
}

// Disable applet caching
function EOP_disableCaching() {
	this.caching = false;
}

// Sets the background color displayed while the applet is loading
function EOP_setStartUpScreenBackgroundColor(strColor) {
	this.setParam("startupscreenbackgroundcolor",strColor);
	this.setParam("boxbgcolor",strColor);
}

// Sets the foreground and text color displayed while the applet is loading
function EOP_setStartUpScreenTextColor(strColor) {
	this.setParam("startupscreentextcolor",strColor);
	this.setParam("boxfgcolor",strColor);
}

// Used to synchronize the Javascript API calls made to the applet
function EOP_pumpEvents() {
    // If the applet is started...
	if(this.initialized) {
        // ... call the first function in the queue
		for(var prop in this.sequence) {
			if(this.sequence[prop]!=null) {
				this.sequence[prop](this,prop);
				return null;
			}
		}
        // Once the event queue is finished, call the method to be called when
        // the editor has finished its loading event (if any)
		if(this.oneditorloaded!=null) {
			eval(this.oneditorloaded+'(this)');
			this.oneditorloaded = null;
			return null;
		}
	}
}

function EOP_setJREAutoDownload(bAutoDL) {
	this.isJREAutoDownloadEnabled = bAutoDL;
}

function EOP_setJREAutoDownloadURL(sURL) {
	this.jreAutoDownloadURL = sURL;
}

function EOP_setJREMinVersion(sVer) {
	this.jreMinVersion = "#Version="+sVer;
}

function EOP_setTagStyle(style) {
    // either this.APPLET_TAG or this.OBJECT_TAG
    this.tagStyle = style;
}

// =============================================================================
// Private methods
// =============================================================================

// Set the object containing the editor
function EOP_setObj() {
	// Object containing the editor
	if(this.isSafari) {
        this.obj = document.applets[this.appletName];
    } else {
        this.obj = document.getElementById(this.id);
    }
}

// Builds the applet tag
function EOP_getAppletElement() {
	apEl = "";
	if(this.errorMsg=="") {
        // Generating required attributes
        if(this.isMSIE) {
            if (this.tagStyle==this.OBJECT_TAG) {
                this.addAttribute("classid","clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
            }
            if(this.isJREAutoDownloadEnabled) {
                this.addAttribute("codebase",this.jreAutoDownloadURL+this.jreMinVersion);
            }
        } else {
            if(this.tagStyle==this.OBJECT_TAG) {
                this.addAttribute("classid","java:"+this.code);
            } else {
                this.addAttribute("code",this.code);
            }
        }
        
        // Attributes and params common to all platforms
        this.addAttribute("width",this.width);
        this.addAttribute("height",this.height);
        this.addAttribute("id",this.id);
        this.addAttribute("name",this.appletName);

        this.setParam("jsobject",this.eopobj);
        this.setParam("oneditorloaded",this.eopobj+".initializeJS");
        
        // Specific Safari settings
        if (this.isMac) {
            this.tagStyle = this.APPLET_TAG;
            this.addAttribute("codebase",this.codebase);
            this.addAttribute("code",this.code);
            this.setParam("type","application/x-java-applet;jpi-version=1.5.0");
        } else {
            this.setParam("java_codebase",this.codebase);
            this.setParam("java_code",this.code);
            this.setParam("java_type","application/x-java-applet;jpi-version=1.5.0");
        }

        // Code specific to the object or applet tag
        var elem = "";
        if (this.tagStyle==this.OBJECT_TAG) {
            this.setParam("mayscript","true");
            this.setParam("scriptable","true");
            elem = "object";
        } else if (this.tagStyle==this.APPLET_TAG) {
            this.addAttribute("mayscript","true");
            this.addAttribute("scriptable","true");
            elem = "applet";
        }
        
        // Generate the object tag
        apEl += "<"+elem;
        apEl += this.attribs;
        apEl += ">\n";
        apEl += this.params;
        apEl += "</"+elem+">";
        
	} else if (this.unsupportedEvent!="") {
        eval(this.unsupportedEvent);
    } else {
		apEl+='<div name="'+this.appletDiv+'" align="center"><p>'+this.errorMsg+'</p></div>';
	}
    // Set the started variable to true to prevent the adding of further params
    this.started = true;
	// if debug mode is enabled write applet config in a texarea...
    if (this.debug) apEl += '<textarea name="dbgTxt" rows="12" cols="100">'+apEl+'</textarea>';
    // ... else write the applet tag
	document.write(apEl);
}

function EOP_enableDebug() {
    this.debug = true;
}

// Places a method in the event queue. It will then be handled by pumpEvents()
function EOP_registerMethod(sHandler,arrArgs) {
    // Event handler for the method
	this.sequence[this.seq] = sHandler;
    // The arguments passed to the method
	this.args[this.seq] = arrArgs;
    // Position in the sequence, determines in which order methods will be
    // called by pumpEvents
	this.seq++;
}

// Removes a method from the event queue
function EOP_unReg(seq) {
    this.sequence[seq] = null;
    this.args[seq] = null;
}

// Initializes the event queue and the editOnPro object once the editor has
// finished loading
function EOP_initializeJS() {
    this.initialized = true;
	this.setObj();
    this.pumpEvents();
}

// =============================================================================
// JavaScript API SET functions
// =============================================================================

function EOP_invokeAction() {
    this.registerMethod(
        this.doInvokeAction,
        EOP_invokeAction.arguments
    );
}

function EOP_doInvokeAction(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    if(tempSeq.length==0) {
        self.obj.invokeActionAsync(tempSeq[0], self.handler);
    } else {
        self.obj.invokeActionAsync(tempSeq[0], tempSeq[1], self.handler);
    }
}

function EOP_setUnsupportedBrowserEvent(sEvent) {
    this.unsupportedEvent = sEvent+"()";
}

function EOP_setStyleSheet(sStyles) {
	this.registerMethod(
        this.doSetStyleSheet,
        EOP_setStyleSheet.arguments
    );
}

function EOP_doSetStyleSheet(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setStyleSheetAsync(tempSeq[0], self.handler);
}

function EOP_insertHTMLData(sData) {
	this.registerMethod(
        this.doInsertHTMLData,
        EOP_insertHTMLData.arguments
    );
}

function EOP_doInsertHTMLData(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.insertHTMLDataAsync(tempSeq[0], self.handler);
}

function EOP_setHTMLDataFromURL(sURL) {
	this.registerMethod(
        this.doSetHTMLDataFromURL,
        EOP_setHTMLDataFromURL.arguments
    );
}

function EOP_doSetHTMLDataFromURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setHTMLDataFromURLAsync(tempSeq[0], self.handler);
}

function EOP_setHTMLData(sData) {
	this.registerMethod(
        this.doSetHTMLData,
        EOP_setHTMLData.arguments
    );
}

function EOP_doSetHTMLData(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setHTMLDataAsync(tempSeq[0], self.handler);
}

function EOP_postDocumentToServer() {
	this.registerMethod(
        this.doPostDocumentToServer,
        EOP_postDocumentToServer.arguments
    );
}

function EOP_doPostDocumentToServer(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.postDocumentToServerAsync(self.handler);
}

function EOP_insertHTMLDataFromURL(sURL) {
	this.registerMethod(
        this.doInsertHTMLDataFromURL,
        EOP_insertHTMLDataFromURL.arguments
    );
}

function EOP_doInsertHTMLDataFromURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.insertHTMLDataFromURLAsync(tempSeq[0], self.handler);
}

function EOP_insertImage(sURL, sWidth, sHeight, sBorder, sAlt) {
	this.registerMethod(
        this.doInsertImage,
        EOP_insertImage.arguments
    );
}

function EOP_doInsertImage(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.insertImageAsync(
        tempSeq[0],
        tempSeq[1],
        tempSeq[2],
        tempSeq[3],
        tempSeq[4],
        self.handler
    );
}

function EOP_clear() {
	this.registerMethod(
        this.doClear,
        EOP_clear.arguments
    );
}

function EOP_doClear(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.clearAsync(self.handler);
}

function EOP_insertCustomTag(sTagName, sEmpty, sAttributes) {
	this.registerMethod(
        this.doInsertCustomTag,
        EOP_insertCustomTag.arguments
    );
}

function EOP_doInsertCustomTag(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.insertCustomTagAsync(
        tempSeq[0],
        tempSeq[1],
        tempSeq[2],
        self.handler
    );
}

function EOP_addStyleSheet(sStyles) {
	this.registerMethod(
        this.doAddStyleSheet,
        EOP_addStyleSheet.arguments
    );
}

function EOP_doAddStyleSheet(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.addStyleSheetAsync(tempSeq[0], self.handler);
}

function EOP_setStyleSheetURL(sURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetStyleSheetURL,
            EOP_setStyleSheetURL.arguments
        );
	} else {
		this.setParam("stylesheeturl",sURL);
	}
}

function EOP_doSetStyleSheetURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setStyleSheetURLAsync(tempSeq[0], self.handler);
}

function EOP_cleanStyleSheet() {
	this.registerMethod(
        this.doCleanStyleSheet,
        EOP_cleanStyleSheet.arguments
    );
}

function EOP_doCleanStyleSheet(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.cleanStyleSheetAsync(self.handler);
}

function EOP_setCurrentElementContent(sCon) {
	this.registerMethod(
        this.doSetCurrentElementContent,
        EOP_setCurrentElementContent.arguments
    );
}

function EOP_doSetCurrentElementContent(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setCurrentElementContentAsync(tempSeq[0], self.handler);
}

function EOP_setHeadElementContent(sContent) {
	this.registerMethod(
        this.doSetHeadElementContent,
        EOP_setHeadElementContent.arguments
    );
}

function EOP_doSetHeadElementContent(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setHeadElementContentAsync(tempSeq[0], self.handler);
}

function EOP_showWYSIWYGAreaOnly(bShow) {
	if(this.started) {
		this.registerMethod(
            this.doShowWYSIWYGAreaOnly,
            EOP_showWYSIWYGAreaOnly.arguments
        );
	} else {
		this.setParam("showwysiwygareaonly",bShow.toString());
	}
}

function EOP_doShowWYSIWYGAreaOnly(self,seq) {
  var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.showWYSIWYGAreaOnlyAsync(tempSeq[0], self.handler);
}

function EOP_setLookAndFeel(sLook) {
	if(this.started) {
		this.registerMethod(
            this.doSetLookAndFeel,
            EOP_setLookAndFeel.arguments
        );
	} else {
		this.setParam("lookandfeel",sLook);
	}
}

function EOP_doSetLookAndFeel(self,seq) {
  var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setLookAndFeelAsync(tempSeq[0], self.handler);
}

function EOP_setTemplate(sTempl) {
	this.registerMethod(
        this.doSetTemplate,
        EOP_setTemplate.arguments
    );
}

function EOP_doSetTemplate(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setTemplateAsync(tempSeq[0], self.handler);
}

function EOP_setTemplateURL(sURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetTemplateURL,
            EOP_setTemplateURL.arguments
        );
	} else {
		this.setParam("templateurl",sURL);
	}
}

function EOP_doSetTemplateURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setTemplateURLAsync(tempSeq[0], self.handler);
}

function EOP_setCustomField(strField) {
	if(this.started) {
		this.registerMethod(
            this.doSetCustomField,
            EOP_setCustomField.arguments
        );
	} else {
		this.setParam("customfield",strField);
	}
}

function EOP_doSetCustomField(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setCustomFieldAsync(tempSeq[0], self.handler);
}

function EOP_setEncoding(strEncoding) {
	if(this.started) {
		this.registerMethod(
            this.doSetEncoding,
            EOP_setEncoding.arguments
        );
	} else {
		this.setParam("encoding",strEncoding);
	}
}

function EOP_doSetEncoding(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setEncodingAsync(tempSeq[0], self.handler);
}

function EOP_setGetErrorTarget(strGetErrTarget) {
	if(this.started) {
		this.registerMethod(
            this.doSetGetErrorTarget,
            EOP_setGetErrorTarget.arguments
        );
	} else {
		this.setParam("get_error_target",strGetErrTarget);
	}
}

function EOP_doSetGetErrorTarget(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setGetErrorTargetAsync(tempSeq[0], self.handler);
}

function EOP_setGetErrorURL(strGetErrURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetGetErrorURL,
            EOP_setGetErrorURL.arguments
        );
	} else {
		this.setParam("get_error_url",strGetErrURL);
	}
}

function EOP_doSetGetErrorURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setGetErrorURLAsync(tempSeq[0], self.handler);
}

function EOP_setGetHTMLDataURL(strURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetGetHTMLDataURL,
            EOP_setGetHTMLDataURL.arguments
        );
	} else {
		this.setParam("gethtmldataurl",strURL);
	}
}

function EOP_doSetGetHTMLDataURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setGetHTMLDataURLAsync(tempSeq[0], self.handler);
}

function EOP_setGetOKTarget(strTarget) {
	if(this.started) {
		this.registerMethod(
            this.doSetGetOKTarget,
            EOP_setGetOKTarget.arguments
        );
	} else {
		this.setParam("get_ok_target",strTarget);
	}
}

function EOP_doSetGetOKTarget(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setGetOKTargetAsync(tempSeq[0], self.handler);
}

function EOP_setGetOKURL(strURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetGetOKURL,
            EOP_setGetOKURL.arguments
        );
	} else {
		this.setParam("get_ok_url",strURL);
	}
}

function EOP_doSetGetOKURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setGetOKURLAsync(tempSeq[0], self.handler);
}

function EOP_setSourceView(bView) {
	if(this.started) {
		this.registerMethod(
            this.doSetSourceView,
            EOP_setSourceView.arguments
        );
	} else {
		this.setParam("sourceview",bView.toString());
	}
}

function EOP_doSetSourceView(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setSourceViewAsync(tempSeq[0], self.handler);
}

function EOP_setSetErrorTarget(strErrTarget) {
	if(this.started) {
		this.registerMethod(
            this.doSetSetErrorTarget,
            EOP_setSetErrorTarget.arguments
        );
	} else {
		this.setParam("set_error_target",strErrTarget);
	}
}

function EOP_doSetSetErrorTarget(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setSetErrorTargetAsync(tempSeq[0], self.handler);
}

function EOP_setSetErrorURL(strURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetSetErrorURL,
            EOP_setSetErrorURL.arguments
        );
	} else {
		this.setParam("set_error_url",strURL);
	}
}

function EOP_doSetSetErrorURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setSetErrorURLAsync(tempSeq[0], self.handler);
}

function EOP_setSetOKTarget(strOKTarget) {
	if(this.started) {
		this.registerMethod(
            this.doSetSetOKTarget,
            EOP_setSetOKTarget.arguments
        );
	} else {
		this.setParam("set_ok_target",strOKTarget);
	}
}

function EOP_doSetSetOKTarget(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setSetOKTargetAsync(tempSeq[0], self.handler);
}

function EOP_setSetOKURL(strURL) {
	if(this.started) {
		this.registerMethod(
            this.doSetSetOKURL,
            EOP_setSetOKURL.arguments
        );
	} else {
		this.setParam("set_ok_url",strURL);
	}
}

function EOP_doSetSetOKURL(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setSetOKURLAsync(tempSeq[0], self.handler);
}

function EOP_setImageBase(sURL) {
	this.registerMethod(
        this.doSetImageBase,
        EOP_setImageBase.arguments
    );
}

function EOP_doSetImageBase(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setImageBaseAsync(tempSeq[0], self.handler);
}

function EOP_setBase(strBase) {
    this.registerMethod(
        this.doSetBase,
        EOP_setBase.arguments
    );
}

function EOP_doSetBase(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setBaseAsync(tempSeq[0], self.handler);
}

function EOP_uploadImages(sEvent) {
	this.registerMethod(
        this.doUploadImages,
        EOP_uploadImages.arguments
    );
}

function EOP_doUploadImages(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
    self.obj.uploadImagesAsync(tempSeq[0]);
}

function EOP_uploadToRepository(sAction,sEvent) {
    this.registerMethod(
        this.doUploadToRepository,
        EOP_uploadToRepository.arguments
    );
}

function EOP_doUploadToRepository(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.uploadToRepositoryAsync(tempSeq[0], tempSeq[1]);
}

function EOP_getImageBase() {
	return this.obj.getImageBase();
}

function EOP_setStandAloneMode(bMode) {
	this.registerMethod(
        this.doSetStandAloneMode,
        EOP_setStandAloneMode.arguments
    );
}

function EOP_doSetStandAloneMode(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setStandAloneModeAsync(tempSeq[0], self.handler);
}

function EOP_setCaretAtDocumentStart() {
	this.registerMethod(
        this.doSetCaretAtDocumentStart,
        EOP_setCaretAtDocumentStart.arguments
    );
}

function EOP_doSetCaretAtDocumentStart(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setCaretAtDocumentStartAsync(self.handler);
}

function EOP_setElementAttributes(arr) {
    this.registerMethod(
        this.doSetElementAttributes,
        EOP_setElementAttributes.arguments
    );
}

function EOP_doSetElementAttributes(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	arr = tempSeq[0];
	hash = self.obj.getHashtableWrapper();
	for (prop in arr) {
		hash.putValue(prop,arr[prop]);
	}
	self.obj.setElementAttributesAsync(hash, self.handler);
}

function EOP_setBlockElementAttributes(arr) {
    this.registerMethod(
        this.doSetBlockElementAttributes,
        EOP_setBlockElementAttributes.arguments
    );
}

function EOP_doSetBlockElementAttributes(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    arr = tempSeq[0];
    hash = self.obj.getHashtableWrapper();
    for (prop in arr) {
        hash.putValue(prop,arr[prop]);
    }
    self.obj.setBlockElementAttributesAsync(hash, self.handler);
}

function EOP_setReadOnly(bOnly) {
	this.registerMethod(
        this.doSetReadOnly,
        EOP_setReadOnly.arguments
    );
}

function EOP_doSetReadOnly(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setReadOnlyAsync(tempSeq[0],self.handler);
}

function EOP_setCookie(sCookie) {
	this.registerMethod(
        this.doSetCookie,
        EOP_setCookie.arguments
    );
}

function EOP_doSetCookie(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setCookieAsync(tempSeq[0],self.handler);
}

function EOP_setDTDBase(sBase) {
    if(this.started) {
        this.registerMethod(
            this.doSetDTDBase,
            EOP_setDTDBase.arguments
        );
    } else {
        this.setParam("dtdbase",sBase);
    }
}

function EOP_doSetDTDBase(self,seq) {
    var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setDTDBaseAsync(tempSeq[0],self.handler);
}

function EOP_setActiveSpellChecker(sAct) {
    this.registerMethod(
        this.doSetActiveSpellChecker,
        EOP_setActiveSpellChecker.arguments
    );
}

function EOP_doSetActiveSpellChecker(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setActiveSpellCheckerAsync(tempSeq[0],self.handler);
}

function EOP_setCaretAfterNextBookmark() {
    this.registerMethod(
        this.doSetCaretAfterNextBookmark,
        EOP_setCaretAfterNextBookmark.arguments
    );
}

function EOP_doSetCaretAfterNextBookmark(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setCaretAfterNextBookmarkAsync(self.handler);
}

function EOP_setNextBookmarkWrapAroundEnabled() {
    this.registerMethod(
        this.doSetNextBookmarkWrapAroundEnabled,
        EOP_setNextBookmarkWrapAroundEnabled.arguments
    );
}

function EOP_doSetNextBookmarkWrapAroundEnabled(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setNextBookmarkWrapAroundEnabledAsync(tempSeq[0],self.handler);
}

function EOP_setCaretAfterPreviousBookmark() {
    this.registerMethod(
        this.doSetCaretAfterPreviousBookmark,
        EOP_setCaretAfterPreviousBookmark.arguments
    );
}

function EOP_doSetCaretAfterPreviousBookmark(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setCaretAfterPreviousBookmarkAsync(self.handler);
}

function EOP_setPreviousBookmarkWrapAroundEnabled() {
    this.registerMethod(
        this.doSetPreviousBookmarkWrapAroundEnabled,
        EOP_setPreviousBookmarkWrapAroundEnabled.arguments
    );
}

function EOP_doSetPreviousBookmarkWrapAroundEnabled(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setPreviousBookmarkWrapAroundEnabledAsync(tempSeq[0],self.handler);
}

function EOP_setBodyOnly(bState) {
	this.registerMethod(
		this.doSetBodyOnly,
		EOP_setBodyOnly.arguments
	);
}

function EOP_doSetBodyOnly(self,seq) {
	var tempSeq=self.args[seq];
	self.unReg(seq);
	self.obj.setBodyOnlyAsync(tempSeq[0],self.handler);
}

function EOP_setWebDAVCookieString(strCookie) {
    this.registerMethod(
        this.doSetWebDAVCookie,
        EOP_setWebDAVCookieString.arguments
    );
}

function EOP_doSetWebDAVCookieString(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setWebDAVCookieStringAsync(tempSeq[0], self.handler);
}

function EOP_setUserPreferences(strPrefs) {
    this.registerMethod(
        this.doSetUserPreferences,
        EOP_setUserPreferences.arguments
    );
}

function EOP_doSetUserPreferences(self,seq) {
    var tempSeq=self.args[seq];
    self.unReg(seq);
    self.obj.setUserPreferencesAsync(tempSeq[0], self.handler);
}

function EOP_setExportAsNumerical(bExpAsNum) {
	this.setParam("exportasnumerical",bExpAsNum.toString());
}

function EOP_setLocaleCode(strLocale) {
	this.setParam("locale",strLocale);
}

function EOP_setLocaleURL(strURL) {
	this.setParam("localeurl",strURL);
}

function EOP_setNewDocumentDialog(bNewDocDlg) {
	this.setParam("newdocumentdialog",bNewDocDlg.toString());
}

function EOP_setConfigURL(sURL) {
	this.setParam("configurl",sURL);
}

function EOP_setUIConfigURL(sURL) {
	this.setParam("uiconfigurl",sURL);
}

function EOP_setOnEditorLoaded(sFunc) {
	this.oneditorloaded = sFunc;
}

function EOP_setLicenseKey(sLic) {
	this.setParam("licensekey",sLic);
}

function EOP_setOnDataLoaded(sFunc) {
	this.setParam("ondataloaded",sFunc);
}

function EOP_setOnEditorFocused(sFunc) {
    this.setParam("oneditorfocused",sFunc);
}

function EOP_setOnDataPosted(sFunc) {
	this.setParam("ondataposted",sFunc);
}

function EOP_setOnDataPostedError(sFunc) {
	this.setParam("ondatapostederror",sFunc);
}

function EOP_setConfig(sConf) {
	this.setParam("config",escape(sConf));
}

function EOP_setUIConfig(sConf) {
	this.setParam("uiconfig",escape(sConf));
}

function EOP_setHeartBeatURL(sURL) {
	this.setParam("heartbeaturl",sURL);
}

function EOP_setHeartBeatInterval(sInt) {
	this.setParam("heartbeatinterval",sInt);
}

function EOP_setDebug(bDbg) {
    this.setParam("debug",bDbg);
}

function EOP_setStandAloneWidth(sWidth) {
    this.setParam("standalonewidth",sWidth);
}

function EOP_setStandAloneHeight(sHeight) {
    this.setParam("standaloneheight",sHeight);
}

// =============================================================================
// Javascript API GET functions
// =============================================================================

function EOP_getHTMLData() {
	return this.obj.getHTMLData();
}

function EOP_getSelectedHTMLData() {
	return this.obj.getSelectedHTMLData();
}

function EOP_getPlainText() {
	return this.obj.getPlainText();
}

function EOP_hasContentChanged() {
    return this.obj.hasContentChanged();
}

function EOP_getStyleSheet() {
	return this.obj.getStyleSheet();
}

function EOP_getCurrentElement() {
	return this.obj.getCurrentElement();
}

function EOP_getCurrentElementContent() {
	return this.obj.getCurrentElementContent();
}

function EOP_getHeadElementContent() {
	return this.obj.getHeadElementContent();
}

function EOP_encode(sDec) {
	return this.obj.encode(sDec);
}

function EOP_decode(sEnc) {
	return this.obj.decode(sEnc);
}

function EOP_getCustomField() {
	return this.obj.getCustomField();
}

function EOP_getEncoding() {
	return this.obj.getEncoding();
}

function EOP_getGetErrorTarget() {
	return this.obj.getGetErrorTarget();
}

function EOP_getGetErrorURL() {
	return this.obj.getGetErrorURL();
}

function EOP_getGetHTMLDataURL() {
	return this.obj.getGetHTMLDataURL();
}

function EOP_getGetOKTarget() {
	return this.obj.getGetOKTarget();
}

function EOP_getGetOKURL() {
	return this.obj.getGetOKURL();
}

function EOP_getExportAsNumerical() {
	return this.obj.getExportAsNumerical();
}

function EOP_getLocaleCode() {
	return this.obj.getLocaleCode();
}

function EOP_getLocaleURL() {
	return this.obj.getLocaleURL();
}

function EOP_getNewDocumentDialog() {
	return this.obj.getNewDocumentDialog();
}

function EOP_getSourceView() {
	return this.obj.getSourceView();
}

function EOP_getSetErrorTarget() {
	return this.obj.getSetErrorTarget();
}

function EOP_getSetErrorURL() {
	return this.obj.getSetErrorURL();
}

function EOP_getSetOKTarget() {
	return this.obj.getSetOKTarget();
}

function EOP_getSetOKURL() {
	return this.obj.getSetOKURL();
}

function EOP_getCharWithSpacesStatistic() {
	return this.obj.getCharWithSpacesStatistic();
}

function EOP_getCharNoSpacesStatistic() {
	return this.obj.getCharNoSpacesStatistic();
}

function EOP_getWordsStatistic() {
	return this.obj.getWordsStatistic();
}

function EOP_getImagesStatistic() {
	return this.obj.getImagesStatistic();
}

function EOP_getLinesStatistic() {
	return this.obj.getLinesStatistic();
}

function EOP_getParagraphsStatistic() {
	return this.obj.getParagraphsStatistic();
}

function EOP_getWebDAVCookieString() {
	hash = this.obj.getWebDAVCookieStringJS();
	arr = new Array();
	for (i=0;i<hash.getSize();i++) {
		str = hash.getKey(i);
		arr[str] = hash.getValue(str);
	}
	return arr;
}

function EOP_getStatistics() {
	hash = this.obj.getStatisticsJS();
	arr = new Array();
	for (i=0;i<hash.getSize();i++) {
		str = hash.getKey(i);
		arr[str] = hash.getValue(str);
	}
	return arr;
}

function EOP_getElementAttributes() {
	hash = this.obj.getElementAttributesJS();
	arr = new Array();
	for (i=0;i<hash.getSize();i++) {
		str = hash.getKey(i);
		arr[str] = hash.getValue(str);
	}
	return arr;
}

function EOP_getBlockElementAttributes() {
    hash = this.obj.getBlockElementAttributesJS();
    arr = new Array();
    for (i=0;i<hash.getSize();i++) {
        str = hash.getKey(i);
        arr[str] = hash.getValue(str);
    }
    return arr;
}

function EOP_getReadOnly() {
	return this.obj.getReadOnly();
}

function EOP_getDTDBase() {
    return this.obj.getDTDBase();
}

function EOP_getActiveSpellChecker() {
    return this.obj.getActiveSpellChecker();
}

function EOP_getStandAloneMode() {
    return this.obj.getStandAloneMode();
}

function EOP_getBase() {
    return this.obj.getBase();
}

function EOP_getUserPreferences() {
	return this.obj.getUserPreferences();
}

// =============================================================================
// Helper functions
// =============================================================================

// Determines whether the browser/OS config is supported
function EOP_getOSInfo() {
    if(this.browser.indexOf("Mac")!=-1) this.isMac = true;
    // If we are on a Mac...
	if(this.isMac) {
        // ... verfify a recent version of Safari is used
		if(this.browser.indexOf("Safari")!=-1) {
            this.isSafari = true;
            num = this.browser;
            loc = num.lastIndexOf("/")+1;
            num = num.slice(loc,loc+3);
            num = parseInt(num);
			// if Safari < 1.2, it is not supported
            if(num<120) {
                this.errorMsg += "You are using a Safari version below version 1.2. Please upgrade to the latest version of Safari to use edit-on Pro 4.";
            }
        // if another browser than Safari is used it is not supported
		} else if(this.browser.indexOf("Firefox")!=-1) {
            // do nothing
        } else {
            this.errorMsg += "You are using an unsupported browser. Only the Safari and Firefox browsers are supported on Mac OS X.";
        }
	} else {
        // Are we using Opera?
        // Opera support is still experimental yet
        if(this.browser.indexOf("Opera")!=-1) {
            this.isOpera = true;
        // Are we using a supported version of Internet Explorer?
        } else if(this.browser.indexOf("MSIE")!=-1) {
			if(this.browser.indexOf("5.")!=-1||
               this.browser.indexOf("6.")!=-1) {
				this.isMSIE = true;
			} else {
				this.errorMsg += "You are using an old version of Internet Explorer which is not supported by edit-on Pro 4. Please upgrade to Internet Explorer 5 or better";
			}
		} else if(this.browser.indexOf("Netscape/8")!=-1||
            this.browser.indexOf("Netscape/7")!=-1||
            this.browser.indexOf("Netscape6")!=-1||
            this.browser.indexOf("Firefox")!=-1||
            this.browser.indexOf("SeaMonkey")!=-1) {
            // do nothing
		} else if (this.browser.indexOf("Mozilla/4.7")!=-1) {
			this.errorMsg += "You are using Netscape 4.7 which is not supported. Please contact your system administrator.";
		} else if(this.browser.indexOf("Mozilla/4.8")!=-1) {
			this.errorMsg += "You are using Netscape 4.8 which is not supported. Please contact your system administrator.";
		} else if(this.browser.indexOf("Gecko")!=-1) {
            if(this.browser.indexOf("0.")!=-1||
                this.browser.indexOf("1.0")!=-1||
                this.browser.indexOf("1.1")!=-1) {
                this.errorMsg += "You are using an unsupported browser. Please contact your system administrator.";
            }
		} else {
            this.errorMsg += "You are using an unsupported browser. Please contact your system administrator.";
		}
	}
}

function EOP_isCompatibleBrowser() {
	if (this.errorMsg == "")
        return true;
	return false;
}


// Returns the current locale code that can be used by EOP
function EOP_getLocaleFromBrowser() {
	var language = "";
	if(this.isMSIE) {
		language = navigator.browserLanguage;
	} else {
		language = navigator.language;
	}
	language = language.substr(0,2);
	switch (language) {
        case "de":  return "de_DE";
        case "fr":  return "fr_FR";
        case "es":  return "es_ES";
        default:    return "en_US";
    }
}

// Preloads the Java VM using a dummy applet
function preloadJVM(codebase) {
	pjvm = new editOnPro(10, 10, "pjvm_inst1", "p_id1", "pjvm");
	pjvm.getOSInfo();
	pjvm.getPreloadAppletElement(preloadJVM.arguments);
}

// Builds the applet tag for the dummy applet
function EOP_getPreloadAppletElement(args) {
	if(args[3]) {
		this.setJREMinVersion(args[3]);
	}

	apEl = "";
	if(this.isSafari) {
		// Generating required attributes
		this.addAttribute("code","com.realobjects.preloadJvm.class");
		this.addAttribute("width","0");
		this.addAttribute("height","0");
		this.addAttribute("name","preload");
		this.addAttribute("id","p_jvm");
		this.addAttribute("codebase",args[0]);

		this.setParam("archive","preload.jar");

		apEl += "<applet";
		apEl += this.attribs;
		apEl += ">\n";
		apEl += this.params;
		apEl += "</applet>";
	} else {
		// Generating required attributes
		if(this.isMSIE) {
			this.addAttribute("classid","clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
		} else {
			this.addAttribute("classid","java:"+"com.realobjects.preloadJvm");
		}

		if(args[1]) {
			if (args[2]) {
				this.addAttribute("codebase",args[2]+this.jreMinVersion);
			} else {
				this.addAttribute("codebase",this.jreAutoDownloadURL+this.jreMinVersion);
			}
		}

		this.addAttribute("width","4");
		this.addAttribute("height","4");
		this.addAttribute("id","p_jvm");

		// Generating required parameters
		this.setParam("java_codebase",args[0]);
		this.setParam("java_code","com.realobjects.preloadJvm");
		this.setParam("java_type","application/x-java-applet;jpi-version=1.4.2");
		this.setParam("name","p_jvm");
		this.setParam("archive","preload.jar");
		this.setParam("startupscreenbackgroundcolor","#EBF0FF");
		this.setParam("boxbgcolor","#EBF0FF");

		apEl += "<object";
		apEl += this.attribs;
		apEl += ">\n";
		apEl += this.params;
		apEl += "</object>";

	}
	// if debug mode is enabled write applet config in a texarea...
    if (this.debug) apEl = '<textarea name="dbgTxt" rows="12" cols="100">'+apEl+'</textarea>';
    // ... else write the applet tag
	document.write(apEl);
}

// Print debugging info
function dbg(sDbg) {
	if(debug) {
		alert(sDbg);
	}
}

function EOP_callEventHandler() {
    
    var func = null;
    var args = null;
    var needsResolution = null;
	var eopobj = null;
	
	len = EOP_callEventHandler.arguments.length;
	eopobj = EOP_callEventHandler.arguments[0];
    func = EOP_callEventHandler.arguments[1];

	// On Mac OS X, args will be undefined it is null
	if(len==3) {
		needsResolution = EOP_callEventHandler.arguments[2];
	} else if (len==4) {
		args = EOP_callEventHandler.arguments[2];
		needsResolution = EOP_callEventHandler.arguments[3];
	}
	
    if(func!=null&&String(func)!="false") {
        var needsArgs = false;

        str = "";
        if( args!=null && !Boolean(needsResolution) ) {
            args = EOP_resolveValueList( args );
            str = "("+eopobj+",args)";
            needsArgs = true;
        } else if ( args!=null && Boolean(needsResolution) ) {
			args = EOP_resolveValueList( args );
			str = "("+eopobj;
			for (i=0;i<args[0].length;i++) {
                str += ", \""+args[0][i]+"\"";
            }
            str += ")";
        } else {
           str = "("+eopobj+")";
        }
		
        sHandler = func + str;
		
        if (needsArgs) {
            if(args!=null) {
                eval(sHandler);
            }
        } else {
            eval(sHandler);
        }
    }
}

function EOP_resolveValueList(list) {
    if (list!=null) {
		values = list.getValuesLength();
		len = list.getListLength();
		
		outerarr = new Array();
		for (i=0;i<len;i++) {
			innerarr = new Array();
			for (j=0;j<values;j++) {
				innerarr[j] = list.getListValueAt(i,j);
			}
			outerarr[i] = innerarr;
		}
        return outerarr;
	} else {
        return false;
    }
}