SiriusPhil
asked on
URGENT: CFFORM validation failing because of another javascript.
I have an HTML page (below) that is not validating when using CFFORM and EditLive (an onliine editor). Â I have narrowed the problem down to a conflict with the external Javascript file that EditLive uses and the external javascript files that CFForm Uses. Â If I remove the link to the EditLive javascript file, the form validation works fine i I.E, Firefox and Safari. Â When I put it back in there, I get the following error for IR and FireFox (safari is fine): "obj has no properties" which refers to the cfform.js file that CFFORM inserts when the page is rendered. Â Firefox indicates that the error is occuring in the following function wiithin the cfform.js file. Â 500 points and a years worth of thanks if you can help me fix the problem. Â I'm really stuck.
Example 1: Function Error
Example 2: HTML Page error is occuring on
Example 3: Editlive.JS file that is causing the conflict.
===========1. Function Error=============
function _CF_hasValue(obj, obj_type, obj_trim)
{
     Â
      if (obj_type == "TEXT" || obj_type == "FILE" ||obj_type == "PASSWORD" || obj_type == "CFTEXTAREA" || obj_type == "TEXTAREA" || obj_type == "CFTEXTINPUT")
      {
           if (obj.value.length == 0)
                  return false;
           else
                 if( obj_trim )
                 {
                   //trim whitespace - for backward compatability this is optional
                      str = obj.value.replace(/^\s+/,' ').replace (/\s+$/,'' );
                      if (str.length == 0)
                      { return false; }
                 }
                  return true;
      }
      else if (obj_type == "SELECT")
      {
           for (i=0; i < obj.length; i++)
           {
                 if (obj.options[i].selected)
                      return true;
           }
             return false;     Â
      }
      else if (obj_type == "SINGLE_VALUE_RADIO" || obj_type == "SINGLE_VALUE_CHECKBOX")
      {
           if (obj.checked)
                 return true;
           else
                  return false;     Â
      }
      else if (obj_type == "RADIO" || obj_type == "CHECKBOX")
      {
           if( obj.length == undefined && obj.checked )
           {
                 return true;
           }else{
                 for (i=0; i < obj.length; i++)
                 {
                      if (obj[i].checked)
                            return true;
                 }
           }
             return false;     Â
      }else if( obj_type == "CFTREE"){
        if( obj['value'].length > 0 )
        {
          return true;
    }else{
      return false;
    }
      }else{
        return true;
      }
}
============== 2. Here is the page==================
 Â
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<script src='/common/editlivejava/ editliveja va.js'></s cript><scr ipt type="text/javascript" src="/CFIDE/scripts/cfform .js"></scr ipt>
<script type="text/javascript" src="/CFIDE/scripts/masks. js"></scri pt>
<script type="text/javascript">
<!--
  function  _CF_checkform1(_CF_this)
  {
    //reset on submit
    _CF_error_exists = false;
    _CF_error_messages = new Array();
    _CF_error_fields = new Object();
    _CF_FirstErrorField = null;
    //display error messages and return success
    if( _CF_error_exists )
    {
      if( _CF_error_messages.length > 0 )
      {
        // show alert() message
        _CF_onErrorAlert(_CF_error _messages) ;
        // set focus to first form error, if the field supports js focus().
        if( _CF_this[_CF_FirstErrorFie ld].type == "text" )
        { _CF_this[_CF_FirstErrorFie ld].focus( ); }
      }
      return false;
    }else {
      return true;
    }
  }
//-->
</script>
</head>
<body> Â Â Â Â Â Â Â Â
<form name="form1" id="form1" action="editor.cfm" method="post" preloader="no" onsubmit="return _CF_checkform1(this)"> Â
<script language="JavaScript">
var ELJApplet1_js;
ELJApplet1_js = new EditLiveJava("tbody", "100%", "300");
ELJApplet1_js.setDownloadD irectory(" /common/ed itlivejava ");
ELJApplet1_js.setConfigura tionText(" abbriviate d for demo");
ELJApplet1_js.setBody("");
ELJApplet1_js.setLocalDepl oyment(fal se);
ELJApplet1_js.setAutoSubmi t(true);
ELJApplet1_js.setDebugLeve l("info");
ELJApplet1_js.setReturnBod yOnly("fal se");
ELJApplet1_js.setShowSyste mRequireme ntsError(t rue);
ELJApplet1_js.show();
</script>
<input type="submit" name="Submit" value="Submit"/>
</form>
========3. Here is the EditLive Javascript In Question ==========
/*
 *
 * Ephox EditLive! JavaScript Library
 * Copyright (c) 1999-2003 Ephox Corp. All rights reserved.
 * This software is provided "AS IS," without a warranty of any kind.
 *
 */
var eljUseWebDAV = false;
var eljUseMathML = false;
var eljUseLiveConnect = false;
/** The designer class provides a simple API for setting parameters on the designer and
 * instantiating it.
 */
function EditLiveJava(name, width, height) {
      EditLiveCommonStatic_detec tBrowser() ;
     Â
      this.paramNames = new Array();
      this.paramValues = new Array();
     Â
      this.width = width;
      this.height = height;
      this.name = name;
      this.borderStyle = "";
      this.bAutoSubmit = true;
     Â
      this.setDownloadDirectory = EditLiveCommon_setDownload Directory;
      this.setConfigurationFile = EditLiveCommon_setXMLURL;
      this.setXMLURL = EditLiveCommon_setXMLURL;
      this.setDebugLevel = EditLiveCommon_setDebugLev el;
      this.setLogger = EditLiveCommon_setLogger;
      this.setConfigurationText = EditLiveCommon_setXML;
      this.setXML      = EditLiveCommon_setXML;
      this.setMinimumJREVersion =  EditLiveCommon_setMinimumJ REVersion;
      this.setJREDownloadURL = EditLiveCommon_setJREDownl oadURL;
      this.setShowSystemRequirem entsError = EditLiveCommon_setShowSyst emRequirem entsError;
      this.setCookie = EditLiveCommon_setCookie;
      this.setLocalDeployment = EditLiveCommon_setLocalDep loyment;
      this.InsertHTMLAtCursor = EditLiveCommon_InsertHTMLA tCursor;
      this.InsertHyperlinkAtCurs or = EditLiveCommon_InsertHyper linkAtCurs or;
      this.ScrollTo = EditLiveCommon_ScrollTo;
      this.setAutoSubmit = EditLiveCommon_setAutoSubm it;
      this.UploadFiles = EditLiveCommon_UploadFiles ;
      this.UploadImages = EditLiveCommon_UploadFiles ;
      this.setDownloadingMessage = EditLiveCommon_setDownload ingMessage ;
      this.setLocale = EditLiveCommon_setLocale;
      this.setBorderStyle = EditLiveCommon_setBorderSt yle;
      this.show = EditLiveCommon_show;
      this.setShowButtonText = EditLiveCommon_setShowButt onText;
      this.setShowButtonIconURL = EditLiveCommon_setShowButt onIconURL;
      this.setHideButtonText = EditLiveCommon_setHideButt onText;
      this.setHideButtonIconURL = EditLiveCommon_setHideButt onIconURL;
      this.showAsButton = EditLiveCommon_showAsButto n;
     Â
      this.setDocument = EditLiveJava_setDocument;
      this.setBody = EditLiveJava_setBody;
      this.setStyles = EditLiveJava_setStyles;
      this.setXSD = EditLiveJava_setXSD;
      this.addXSDAsString = EditLiveJava_addXSDAsStrin g;
      this.setReturnBodyOnly = EditLiveJava_setReturnBody Only;
      this.GetDocument = EditLiveJava_GetDocument;
      this.GetBody = EditLiveJava_GetBody;
      this.GetSelectedText = EditLiveJava_GetSelectedTe xt;
      this.GetWordAtCursor = EditLiveJava_GetWordAtCurs or;
      this.GetHyperlinkAtCursor = EditLiveJava_GetHyperlinkA tCursor;
      this.SetDocument = EditLiveJava_setDocument;
      this.SetBody = EditLiveJava_setBody;
      this.GetStyles = EditLiveJava_GetStyles;
      this.GetWordCount = EditLiveJava_GetWordCount;
      this.GetCharCount = EditLiveJava_GetCharCount;
      this.IsDirty = EditLiveJava_IsDirty;
      this.SetProperties = EditLiveJava_SetProperties ;
      this.PostDocument = EditLiveJava_PostDocument;
      this.addView = EditLiveJava_addView;
      this.addViewWithString = EditLiveJava_addViewWithSt ring
      this.setUseTextarea = EditLiveJava_setUseTextare a;
      this.setTextareaRows = EditLiveJava_setTextareaRo ws;
      this.setTextareaCols = EditLiveJava_setTextareaCo ls;
      this.setPreload = EditLiveJava_setPreload;
      this.setOnInitComplete = EditLiveJava_setPreload;
      this.setHead = EditLiveJava_setHead;
      this.setBaseURL = EditLiveJava_setBaseURL;
      this.GetCurrentDocumentURL = EditLiveJava_GetCurrentDoc umentURL;
      this.setOutputCharset = EditLiveJava_setOutputChar set;
      this.setCommentTemplate = EditLiveJava_setCommentTem plate;
      this.addJar = EditLiveJava_addJar;
      this.setPreserveInputStruc ture = EditLiveJava_setPreserveIn putStructu re;
      this.setHttpLayerManager = EditLiveJava_setHttpLayerM anager;
      this.addParam = EditLiveJava_addParam;
     Â
      // WebDAV Properties
      this.setUseWebDAV = EditLiveJava_setUseWebDAV;
      // MathML Properties
      this.setUseMathML = EditLiveJava_setUseMathML;
     Â
      // LiveConnect
      this.setUseLiveConnect = EditLiveCommonStatic_setUs eLiveConne ct;
      this.started = false;
     Â
      this.getAppletHTML = EditLiveJava_getAppletHTML ;
      this.getHiddenFields = EditLiveJava_getHiddenFiel ds;
     Â
      this.started = false;
      this.editXML = false;
      this.views = new Array();
      this.xsds = new Array();
      this.extraJars = new Array();
      this.classNames = "";
      this.preload = false;
}
function EditLiveCommonStatic_setUs eLiveConne ct(val) {
      eljUseLiveConnect = val;
}
function EditLiveJava_setCommentTem plate(val) {
      if (this.started) {
           return false;
      }
      var index = this.paramNames.length
      this.paramNames[index] = "commentTemplate";
      this.paramValues[index] = val;
      return true;
}
function EditLiveJava_addJar(jarUrl , className) {
      this.extraJars[this.extraJ ars.length ] = jarUrl;
      this.classNames += className + " ";
}
function EditLiveJava_addParam(name , value) {
      if (this.started) {
           return false;
      }
      var index = this.paramNames.length
      this.paramNames[index] = name;
      this.paramValues[index] = value;
      return true;
}
function EditLiveJava_getAppletHTML () {
      if (!this.cookie) {
           this.setCookie(document.co okie);
      }
     Â
      // Determine the applet class to use.
      var appletClass;
      if (IsMac) {
           appletClass = "com.ephox.editlive.osx.Ed itLiveJava ";
      } else if (IsLinux) {
           appletClass = "com.ephox.editlive.linux. EditLiveJa va";
      } else if (IsSolaris) {
           appletClass = "com.ephox.editlive.solari s.EditLive Java";
      } else {
           appletClass = "com.ephox.editlive.win.Ed itLiveJava ";
      }
     Â
      // Determine the classpath.
      var needXML = false;
      jarList = this.downloadDirectory + "editlivejava.jar";
      if (eljUseWebDAV) {
           needXML = true;
      }
      if (eljUseMathML) {
           jarList += "," + this.downloadDirectory + "WebEQEphox.jar";
      }
      if ((IsMac && IsMSIE) || sMinimumJREVersion == "1.3.1") {
           jarList += "," + this.downloadDirectory + "xml-apis.jar";
      }
      if (this.editXML) {
           needXML = false;
           if ((IsMac && IsMSIE) || sMinimumJREVersion == "1.3.1") {
                 jarList += "," + this.downloadDirectory + "crimson.jar";
           }
      } else if (needXML) {
           if ((IsMac && IsMSIE) || sMinimumJREVersion == "1.3.1") {
                 jarList += "," + this.downloadDirectory + "crimson.jar";
           }
      }
     Â
      var urlCounter;
      for (urlCounter = 0; urlCounter < this.extraJars.length; urlCounter++) {
           jarList += "," + this.extraJars[urlCounter] ;
      }
     Â
      var paramLength = this.paramNames.length;
      this.paramNames[paramLengt h] = "BeanListenerClasses";
      this.paramValues[paramLeng th] = this.classNames;
     Â
      classpath = jarList;
      var appletName = this.name + "_elj";
      hiddenName = this.name;
      if (this.editXML) {
           var i = 0;
           var nameParam = "";
           var valueParam = "";
           var isUrlParam = "";
           for (i = 0; i < this.views.length; i++) {
                 var view = this.views[i];
                 nameParam += escape(view[0]) + ":";
                 valueParam += escape(view[1]) + ":";
                 isUrlParam += view[2] + ":";
           }
           var propLength = this.paramNames.length;
           this.paramNames[propLength ] = "viewNames";
           this.paramValues[propLengt h] = nameParam;
           propLength++;
           this.paramNames[propLength ] = "viewValues";
           this.paramValues[propLengt h] = valueParam;
           propLength++;
           this.paramNames[propLength ] = "viewIsURLs";
           this.paramValues[propLengt h] = isUrlParam;
           propLength++;
           var xsdParam = "";
           for (i = 0; i < this.xsds.length; i++) {
                 xsdParam += this.xsds[i];
           }
           this.paramNames[propLength ] = "XSDString";
           this.paramValues[propLengt h] = xsdParam;
      }
     Â
      var appletTag = EditLiveCommonStatic_gener ateAppletT ag(this.wi dth, this.height, appletName, classpath,
           appletClass, this.paramNames, this.paramValues, this.preload);
      if (appletTag == '' && this.preload) {
           for (var i = 0; i < this.paramNames.length; i++) {
                 if (this.paramNames[i] == 'setPreload') {
                   setTimeout(this.paramValue s[i] + "()", 20);
                 }
           }
      }
      var result = EditLiveCommonStatic_getEd itorLayout (appletTag , this.borderStyle, this.width, this.height);
      return result;
}
function EditLiveJava_getHiddenFiel ds() {
      var fields = new Array();
      fields[0] = this.name;
      fields[1] = this.name + "_styles";
      return fields;
}
function EditLiveJava_setUseWebDAV( bValue){
      if (this.started == true){
           return false;
      }
      dalert("Use WebDAV: " + bValue);
      eljUseWebDAV = bValue;
}
function EditLiveJava_setUseMathML( bValue) {
      if (this.started == true) {
           return false;
      }
      dalert("Use MathML: " + bValue);
      eljUseMathML = bValue;
}
function EditLiveJava_setOutputChar set(charse t) {
      if (this.started == true) {
           return false;
      }
      dalert("Output Charset: " + charset);
      var index = this.paramNames.length;
      this.paramNames[index] = "outputCharset";
      this.paramValues[index] = charset;
}
function EditLiveJava_setDocument(s rc){
      if(this.started == true){
           EditLiveCommonStatic_Custo mAction("s etdocument ", src, this.name + "_elj");
      } else {
           dalert("Document   " + src);
           var index = this.paramNames.length
           this.paramNames[index] = "Document";
           this.paramValues[index] = src;
      }
} //setDocument
function EditLiveJava_setBody(src){
      if(this.started == true){
           EditLiveCommonStatic_Custo mAction("s etbody", src, this.name + "_elj");
      } else {
           dalert("Body   " + src);
           var index = this.paramNames.length
           this.paramNames[index] = "Body";
           this.paramValues[index] = src;
      }
} //setBody
function EditLiveJava_setStyles(src ){
      if(this.started == true){
           return false;
      }//end if
      dalert("Styles  "+src);
      var index = this.paramNames.length
      this.paramNames[index] = "Styles";
      this.paramValues[index] = src;
}//setStyles
function EditLiveJava_setReturnBody Only(bValu e){
      if(this.started == true){
           return false;
      } //end if
      dalert("ReturnBodyOnly   " + bValue);
      var index = this.paramNames.length
      this.paramNames[index] = "setReturnBodyOnly";
      this.paramValues[index] = bValue;
} //setReturnBodyOnly
function EditLiveJava_setPreserveIn putStructu re(bValue) {
      if(this.started == true){
           return false;
      }
      dalert("PreserveInputStruc ture   " + bValue);
      var index = this.paramNames.length
      this.paramNames[index] = "setPreserveInputStructure ";
      this.paramValues[index] = bValue;
}
function EditLiveJava_setXSD(val) {
      if (this.started == true) {
           return false;
      }
      var index = this.paramNames.length;
      this.paramNames[index] = "XSD";
      this.paramValues[index] = val;
}
function EditLiveJava_addXSDAsStrin g(val) {
      if (this.started == true) {
           return false;
      }
      this.xsds[this.xsds.length ] = val;
}
function EditLiveJava_GetDocument() {
      if(arguments.length == 1) {
           EditLiveCommonStatic_Custo mAction("g etdocument ", arguments[0], this.name + "_elj");
      } else if(arguments.length == 2) {
           var sArgs = arguments[0];
           EditLiveCommonStatic_Custo mAction("g etdocument ", arguments[0] + "##ephox##" + arguments[1], this.name + "_elj");
      }
} //EditLiveJava_GetDocument
function EditLiveJava_GetBody(){
      if(arguments.length == 1) {
           EditLiveCommonStatic_Custo mAction("g etbody", arguments[0], this.name + "_elj");
      } else if(arguments.length == 2) {
           var sArgs = arguments[0];
           EditLiveCommonStatic_Custo mAction("g etbody", arguments[0] + "##ephox##" + arguments[1], this.name + "_elj");
      }
} //EditLiveJava_GetBody
function EditLiveJava_GetSelectedTe xt(){
      EditLiveCommonStatic_Custo mAction("g etselected text", arguments[0], this.name + "_elj");
} //EditLiveJava_GetSelected Text
function EditLiveJava_GetWordAtCurs or(){
      EditLiveCommonStatic_Custo mAction("g etwordatcu rsor", arguments[0], this.name + "_elj");
} //EditLiveJava_GetWordAtCu rsor
function EditLiveJava_GetHyperlinkA tCursor(){
      EditLiveCommonStatic_Custo mAction("g ethyperlin katcursor" , arguments[0], this.name + "_elj");
} //EditLiveJava_GetHyperlin kAtCursor
function EditLiveJava_GetCurrentDoc umentURL(s ActionValu e){
      EditLiveCommonStatic_Custo mAction("g etcurrentf ile", sActionValue, this.name + "_elj");
} //EditLiveJava_GetCurrentD ocumentURL
function EditLiveJava_GetStyles(sAc tionValue) {
      EditLiveCommonStatic_Custo mAction("g etstyles", sActionValue, this.name + "_elj");
} //EditLiveJava_GetStyles
function EditLiveJava_GetWordCount( sActionVal ue){
      EditLiveCommonStatic_Custo mAction("g etwordcoun t", sActionValue, this.name + "_elj");
} //EditLiveJava_GetStyles
function EditLiveJava_GetCharCount( sActionVal ue){
      EditLiveCommonStatic_Custo mAction("g etcharcoun t", sActionValue, this.name + "_elj");
} //EditLiveJava_GetStyles
function EditLiveJava_SetProperties (sActionVa lue) {
      EditLiveCommonStatic_Custo mAction("s etproperti es", sActionValue, this.name + "_elj");
}
function EditLiveJava_setHttpLayerM anager(val ue) {
      if(this.started == true){
           EditLiveCommonStatic_Custo mAction("s ethttplaye r", sActionValue, this.name + "_elj");
      } else {
   Â
           dalert("HttpLayer   " + value);
           var index = this.paramNames.length
           this.paramNames[index] = "HttpLayer";
           this.paramValues[index] = value;
      }
}
function EditLiveJava_IsDirty(sActi onValue){
      EditLiveCommonStatic_Custo mAction("i sdirty", sActionValue, this.name + "_elj");
} //EditLiveJava_IsDirty
function EditLiveJava_PostDocument( ) {
      var val = "";
      var argPosition;
      for (argPosition = 0; argPosition < arguments.length; argPosition++) {
           val += arguments[argPosition];
           if (argPosition + 1 < arguments.length) {
                 val += "##ephox##";
           }
      }
      EditLiveCommonStatic_Custo mAction("p ostdocumen t", val, this.name + "_elj");
}
function EditLiveJava_addViewWithSt ring(name, value) {
      if (this.started == true) {
           return false;
      }
      dalert("Add view: " + name + " - " + value);
      var view = new Array();
      view[0] = name;
      view[1] = value;
      view[2] = "false";
      this.views[this.views.leng th] = view;
}
function EditLiveJava_addView(name, value) {
      if (this.started == true) {
           return false;
      }
      dalert("Add view: " + name + " - " + value);
      var view = new Array();
      view[0] = name;
      view[1] = value;
      view[2] = "true";
      this.views[this.views.leng th] = view;
}
function EditLiveJava_Print(html) {
      var newWin;
      newWin = window.open("", "", "toolbar=no"); //, "toolbar=no,location=no,me nu=no")
      newWin.document.open();
      newWin.document.write('<ht ml><head>< title>Prin t Preview</title></head><fra meset rows="60, *"><frame name="Print"><frame name="content"></frameset> </html>');
      newWin.document.close();
      newWin['Print'].document.o pen();
      newWin['Print'].document.w rite('<htm l><body><f orm><input type="button" value="Print" onclick="parent[\'content\ '].focus() ;parent[\' content\'] .print();" ><input type="button" value="Close" onclick="parent.close();"> </form></b ody></html >');
      newWin['Print'].document.c lose();
      newWin['content'].document .open();
      newWin['content'].document .write(htm l);
      newWin['content'].document .close();
     Â
}
// BEGIN SHARED SECTION
// Script below here must be identical in each of the javascript files.
var DEBUG = false;
var bOnsubmit = false;
var bGetContent = false;
var hiddenName;
var sDebugLevel = "off";
var sLogger = "console";
var bLocalDeploy = false;
var sJREDownloadURL = "";
var sMinimumJREVersion = "";
var bShowErrorMessage = "true";
var eljLoadingMessage = "Updating components and initializing...";
var createdDiv = false;
var bUseTextArea = false;
var bForceUseTextArea = false;
var iTARows = 17;
var iTACols = 55;
var cookie = false;
// The classpath for applets.
var classpath;
// The Path to the EditLive download directory.
var downloadPath;
// The original onsubmit function.
var fOnSubmit;
// The new window opened for submitting on Netscape 4.
var wNewWindow;
// True if we are in Netscape.
var IsNetscape = false;
// True if we are on windows.
var IsWindows = false;
// True if we are on mac.
var IsMac = false;
// True if this is Mac OS X.
var IsOSX = false;
// True if we are on Solaris.
var IsSolaris = false;
// True if we are on linux.
var IsLinux = false;
// True if we are in IE.
var IsMSIE = false;
// True if we are in safari.
var IsSafari = false;
// True is we are in Opera
var IsOpera = false;
// True if we are in the IE DHTML control.
var IsMSIEDHTML = false;
// The PageID
var iPageID = 0;
var AllowMacNetscape = true;
function setAllowNetscapeOnMac(valu e) {
      AllowMacNetscape = value;
}
/************************* ********** ********** ********** *
 Globals
************************** ********** ********** ********** */
function EditLiveCommon_safariSubmi t(url) {
      var win = window.open("", "eljSubmit", "toolbar=no,location=no,di rectories= no,status= no,menubar =no,scroll bars=no,re sizable=no ,width=1,h eight=1");
      win.location = url;
}
function EditLiveCommon_setDownload ingMessage (message) {
      eljLoadingMessage = message;
}
function EditLiveCommon_setDownload Directory( sDir)
{
      combineDownloadURL(sDir);
      if(sDir.charAt(sDir.length - 1) != "/"){
           sDir += "/";
      } //end if
      downloadPath = sDir;
      this.downloadDirectory = sDir;
}
function EditLiveCommon_setLocalDep loyment(bD eploy)
{
      bLocalDeploy = bDeploy;
}
function EditLiveCommon_setAutoSubm it(val)
{
      this.bAutoSubmit = val;
}
function EditLiveCommon_setMinimumJ REVersion( val)
{
      if(val == "1.3.1" || val == "1.4.1" || val == "1.4.2"){
           sMinimumJREVersion = val;
      }
}
function EditLiveCommon_setJREDownl oadURL(val ) {
      sJREDownloadURL = val;
}
function EditLiveCommon_setShowSyst emRequirem entsError( val) {
      bShowErrorMessage = val;
}
function EditLiveCommon_setDebugLev el(val) {
      sDebugLevel = val;
}
function EditLiveCommon_setLogger(v al) {
      sLogger = val;
}
//************************ ******
function EditLiveCommon_setXMLURL(s trXMLURL){
      if(this.started == true){
           return false;
      } //end if
      var index = this.paramNames.length
      this.paramNames[index] = "setXMLURL";
      this.paramValues[index] = strXMLURL;
} //setXMLURL
function EditLiveCommon_setXML(strX ML) {
      if(this.started == true){
           return false;
      } //end if
      var index = this.paramNames.length
      this.paramNames[index] = "setXML";
      this.paramValues[index] = strXML;
} //setXML
function EditLiveCommon_setCookie(c ookie_) {
      dalert("in setCookie");
      if(this.started == true)
           return false;
      if(cookie_ != "") {
           dalert("Cookie:   " + cookie_);
           this.cookie = true;
           var index = this.paramNames.length
           this.paramNames[index] = "Cookie";
           this.paramValues[index] = cookie_;
      }
}
function EditLiveCommon_setLocale(s trLocale) {
      if (this.started == true) {
           return false;
      } //end if
      var index = this.paramNames.length
      this.paramNames[index] = "setLocale";
      this.paramValues[index] = strLocale;
}
function EditLiveJava_setUseTextare a(bUseText ) {
      bForceUseTextArea = bUseText;
}
function EditLiveJava_setTextareaRo ws(iRows) {
      iTARows = iRows;
}
function EditLiveJava_setTextareaCo ls(iCols) {
      iTACols = iCols;
}
function EditLiveJava_setPreload(sP reload){
      if(this.started == true){
           return false;
      }
      this.preload = true;
      var index = this.paramNames.length
      dalert("Preload:  " + sPreload);
      this.paramNames[index] = "setPreload";
      this.paramValues[index] = sPreload;
}
function EditLiveJava_setHead(src){
      if(this.started == true){
           return false;
      }
      dalert("Head   " + src);
      var index = this.paramNames.length
      this.paramNames[index] = "Head";
      this.paramValues[index] = src;
} //setHead
function EditLiveJava_setBaseURL(ur l){
      if(this.started == true){
           return false;
      }
      dalert("Base   " + url);
      var index = this.paramNames.length
      this.paramNames[index] = "EphoxBaseURL";
      this.paramValues[index] = url;
} //setHead
//************************ ****** JavaScript API Routines ************************** ****
function EditLiveCommon_InsertHTMLA tCursor(sA ctionValue ){
      EditLiveCommonStatic_Custo mAction("i nserthtmla tcursor", sActionValue, this.name + "_elj");
}
function EditLiveCommon_InsertHyper linkAtCurs or(){
      if(arguments.length == 1) {
           EditLiveCommonStatic_Custo mAction("i nserthyper linkatcurs or", arguments[0], this.name + "_elj");
      } else {
           var i = 1;
           var sHyperlinkString = arguments[0];
           for(i = 1; i < arguments.length; i++) {
                 sHyperlinkString += "##ephox##";
                 sHyperlinkString += arguments[i];
           }
           EditLiveCommonStatic_Custo mAction("i nserthyper linkatcurs or", sHyperlinkString, this.name + "_elj");
      }
}
function EditLiveCommon_ScrollTo() {
      var val;
      if (arguments.length == 1) {
           val = arguments[0];
      } else {
           val = arguments[0] + ":" + arguments[1];
      }
      EditLiveCommonStatic_Custo mAction("s crollto", val, this.name + "_elj");
}
function EditLiveCommon_UploadFiles (sActionVa lue){
      EditLiveCommonStatic_Custo mAction("u ploadImage s", sActionValue, this.name + "_elj");
}
function EditLiveCommonStatic_DoCus tomAction( ) {
      if (eljUseLiveConnect) {
           var applet = EditLiveCommonStatic_GetAp pletWithNa me(ephoxGN ame);
           if (applet && ((IsWindows && IsMSIE) || applet.performCustomAction )) {
                 applet.performCustomAction LiveConnec t("customa ction:" + ephoxGAction + ":" + ephoxGValue);
                 return;
           }
      }
     Â
      var paramNames = new Array();
      var paramValues = new Array();
     Â
      paramNames[0] = "CustomAction";
      paramValues[0] = "customaction:" + ephoxGAction + ":" + ephoxGValue;
      paramNames[1] = "CustomActionTarget";
      paramValues[1] = ephoxGName;
     Â
      EditLiveCommonStatic_runPo stApplet(p aramNames, paramValues);
}
var ephoxGAction;
var ephoxGValue;
var ephoxGName;
function EditLiveCommonStatic_Custo mAction(ac tion, value, name) {
      ephoxGAction = action;
      ephoxGValue = value;
      ephoxGName = name;
      setTimeout("EditLiveCommon Static_DoC ustomActio n()", 10);
}
function EditLiveCommonStatic_GetAp pletWithNa me(name) {
      if (document.getElementById) {
           return document.getElementById(na me);
      }
}
//************************ ********** ********** ********** ********** ********** ********** **
function EditLiveCommonStatic_detec tBrowser() {
      var version = navigator.appVersion;
      if (version != "") {
           var iParen = version.indexOf("(", 0);
           var sUsrAgent = new String(navigator.userAgent );
           sUsrAgent = sUsrAgent.toLowerCase();
           navigator.clientVersion = version.substring(0, iParen - 1);
           if (sUsrAgent.indexOf("msie", 0) > 0) {
                 IsMSIE = true;
                 if (navigator.clientVersion.s ubstring(0 , 1) >= 4) {
                      IsMSIEDHTML = true;
                 }
           } else if (sUsrAgent.indexOf("safari ", 0) >= 0) {
                 IsSafari = true;
           }else if (sUsrAgent.indexOf("mozill a", 0) >= 0) {
                 IsNetscape = true;
           } else if (sUsrAgent.indexOf("opera" , 0) >= 0) {
                 IsMSIE = true;
                 IsOpera = true;
           }
           if (sUsrAgent.indexOf("win", 0) > 0) {
            IsWindows = true;
           } else if (sUsrAgent.indexOf("mac", 0) > 0){
             IsMac = true;
             if (IsSafari || IsNetscape) {
                   IsOSX = true;
             } else {
                      for(i = 0; i < navigator.plugins.length; i++){
                            if(navigator.plugins[i].na me == "Default Plugin Carbon.cfm") {
                                 IsOSX = true;
                            }
                            if (navigator.plugins[i].name .indexOf(" OS X") > -1) {
                                 IsOSX = true;
                            }
                      }
                 }
           } else if (sUsrAgent.indexOf("sunos" , 0) > 0){
             IsSolaris = true;
           } else if (sUsrAgent.indexOf("linux" , 0) > 0){
             IsLinux = true;
           }
      }
}
// Determines whether or not the current browser is supported.
function EditLiveCommonStatic_isSup portedBrow ser() {
      if (IsWindows) {
           return IsMSIE || IsNetscape;
      } else if (IsOSX) {
           return IsSafari || (IsNetscape && AllowMacNetscape);
      } else if (IsSolaris) {
           return IsNetscape;
      } else if (IsLinux) {
           return IsNetscape;
      } else {
           return false;
      }
}
function getEphoxPageID() {
      if(iPageID == 0) {
           var dTemp = new Date();
           iPageID = dTemp.getTime();
      }
      return iPageID;
}
function EditLiveCommonStatic_gener ateAppletT ag(width, height, name, classpath, applet, paramNames, paramValues, preload) {
      getEphoxPageID();
      // Set the JRE download URL if it hasn't already been set.
      if (sJREDownloadURL == "") {
           sJREDownloadURL = downloadPath + "j2re-1_4_2_05-windows-i58 6-p.exe";
      }
     Â
      var str = "";
      var index = paramNames.length
      var bUpgradeOSXError = false;
      var bLinuxError = false;
     Â
      if (IsWindows == true) {
           if(IsMSIE == true) {
                 //OBJECT start tag
                 str += '<object';
                 str += ' classid="clsid:8AD9C840-04 4E-11D1-B3 E9-00805F4 99D93"';
                 str += ' width="' + width +'"';
                 str += ' height="' + height +'"';
                 str += ' name="' + name + '"';
                Â
                 if(bLocalDeploy) {
                      if(sMinimumJREVersion == "1.4.2"){
                             str += ' codebase="' + sJREDownloadURL + '#Version=1,4,2"'
                        } else       if(sMinimumJREVersion == "1.4.1"){
                             str += ' codebase="' + sJREDownloadURL + '#Version=1,4,1"'
                        } else {
                             str += ' codebase="' + sJREDownloadURL + '#Version=1,4,0"'
                        }                      Â
                 } else {
                      if(sMinimumJREVersion == "1.3.1"){
                            str += ' codebase="https://java.sun.com/products/plugin/autodl/jinstall-1_3_1_01-win.cab#Version=1,3,1,01"'
                      } else if(sMinimumJREVersion == "1.4.2"){
                             str += ' codebase="https://java.sun.com/update/1.4.2/jinstall-1_4_2_05-windows-i586.cab#Version=1,4,2,50"'
                        } else if(sMinimumJREVersion == "1.4.1"){
                            str += ' codebase="https://java.sun.com/products/plugin/autodl/jinstall-1_4_1_01-windows-i586.cab#version=1,4,1"'
                      } else {
                            str += ' codebase="https://java.sun.com/update/1.4.2/jinstall-1_4_2_05-windows-i586.cab#Version=1,4,0"'
                      }
                 }
                 str += '>';
                 //Standard PARAM elements
                 str += '<param name="code" value="' + applet + '" >';
                 str += '<param name="codebase" value="' + getURLbase() + '" >';
                 if(sMinimumJREVersion == "1.3.1"){
                      str += '<param name="type" value="application/x-java- applet;ver sion=1.3"> ';
                 } else if(sMinimumJREVersion == "1.4.2"){
                        str += '<param name="type" value="application/x-java- applet;ver sion=1.4.2 ">';
                 } else if(sMinimumJREVersion == "1.4.1"){
                      str += '<param name="type" value="application/x-java- applet;ver sion=1.4.1 ">';
                 } else {
                      str += '<param name="type" value="application/x-java- applet;ver sion=1.4"> ';
                 }
                 str += '<param name="archive" value="' + classpath + '" >';
                 str += '<param name="cache_option" value="Plugin" >';
                 str += '<param name="cache_archive" value="' + classpath + '" >';
                 str += '<param name="name" value="' + name + '" >';
                 if(IsOpera) {
                      str += '<param name="scriptable" value="true">';
                 } else {
                      str += '<param name="scriptable" value="false">';
                 }
                 str += '<param name="MAYSCRIPT" value="true">';
                 str += '<param name="progressbar" value="true">';
                 str += '<param name="boxmessage" value="' + eljLoadingMessage + '">';
                 str += '<param name="UserAgent" value="' + escape(navigator.userAgent ) +'">';
                 str += '<param name="DebugLevel" value="' + sDebugLevel + '">';
                 str += '<param name="Logger" value="' + sLogger + '">';
                 str += '<param name="PageID" value="' + iPageID + '">';
                Â
                 //Custom PARAM elements
                 var index = 0;
                 while(index < paramNames.length) {
                      str += '<param';
                      str += ' name="' + paramNames[index] + '"';
                      str += ' value="' + paramValues[index] + '"'
                      str += '>';
                      index++;
                 } //end while
                 //OBJECT end tag
                 str += '</object>';
           } else if (IsNetscape == true) {
                 //Start of EMBED start tag
                 str += '<EMBED';
                 //Standard attributes
                 if(sMinimumJREVersion == "1.3.1"){
                      str += ' type="application/x-java-a pplet;vers ion=1.3"';
                 } else if(sMinimumJREVersion == "1.4.2"){
                      str += ' type="application/x-java-a pplet;vers ion=1.4.2" ';
                 } else if(sMinimumJREVersion == "1.4.1"){
                      str += ' type="application/x-java-a pplet;vers ion=1.4.1" ';
                 } else {
                      str += ' type="application/x-java-a pplet;vers ion=1.4"';
                 }
                 str += ' code="' + applet + '" ';
                 str += ' codebase="' + getURLbase() + '"';
                 str += ' cache_archive="' + classpath + '"';
                 str += ' archive="' + classpath + '"';
                 str += ' cache_option="Plugin"';
                 str += ' name="' + name + '"';
                 str += ' width="' + width + '"';
                 str += ' height="' + height + '"';
                 str += ' scriptable="true" ';
                 str += ' MAYSCRIPT=true ';
                Â
                 str += ' UserAgent="' + escape(navigator.userAgent ) +'"';
                 str += ' DebugLevel="' + sDebugLevel + '"';
                 str += ' Logger="' + sLogger + '"';
                 str += ' PageID="' + iPageID + '" ';
                Â
                 //Custom attributes
                 var index = 0;
                 while(index < paramNames.length){
                      //Attribute name
                      str += paramNames[index];
                      //Attribute value
                      str += '="' + paramValues[index] + '" ';
                      index++;
                 } //end while
                 //Java plug-in install instructions for Netscape
                 str += ' pluginspage="' + getURLbase() + downloadPath + 'plugin-install.html"';
                 //End of EMBED start tag
                 str += '>';
                 //NOEMBED element
                 str += '<NOEMBED>';
                 str += '</NOEMBED>';
                 //EMBED end tag
                 str += '</EMBED>';
                Â
           } else {
                 // Unknown windows browser.
                 str = '';
           }
      } else if (IsMac == true) {
           if(IsOSX) {
                 if (IsSafari == true || (AllowMacNetscape && IsNetscape)) {
                      //Start APPLET start tag
                      str += '<applet';
                      //Standard attributes
                      str += ' code="' + applet + '"';
                     Â
                      str += ' cache_archive="' + classpath + '"';
                      str += ' cache_option="Plugin"';
                      str += ' archive="' + classpath + '"';
                      str += ' codebase="' + getURLbase() + '"';
                      str += ' name="' + name + '"';
                      str += ' width="' + width + '"';
                      str += ' height="' + height + '"';
                      //End APPLET start tag
                      str += ' MAYSCRIPT>';
                      //Custom PARAM elements
                      var index = 0;
                      while(index < paramNames.length) {
                            str += '<param';
                            str += ' name="' + paramNames[index] + '" ';
                            str += ' value="' + paramValues[index] + '"';
                            str += '>';
                            index++;
                      } //end while
                     Â
                      str += '<param name="UserAgent" value="' + escape(navigator.userAgent ) +'">';
                      str += '<param name="DebugLevel" value="' + sDebugLevel + '">';
                      str += '<param name="Logger" value="' + sLogger + '">';
                      str += '<param name="progressbar" value="true">';
                      str += '<param name="boxmessage" value="' + eljLoadingMessage + '">';
                      str += '<param name="PageID" value="' + iPageID + '">';
                     Â
                      //write out window loc
                      var sFrameLoc = "";
                      var sTemp = ".";
                      var wCurrent = self;
                      var wParent = self.parent;
                      while (wParent != wCurrent) {
                           Â
                            for (i = 0; i < wParent.length; i++) {
                                 if (wParent.frames[i] == wCurrent) {
                                       sTemp = (".frames[" + i + "]") + sTemp;
                                 }
                            }
                            wCurrent = wParent;
                            wParent = wParent.parent;
                      }
                      sTemp = "window" + sTemp;
                      if (window.parent != self) {
                            sFrameLoc = sTemp;
                      }
                     Â
                      str += '<param name="JSWindowLoc" ';
                      str += ' value="' + sFrameLoc + '"';
                      str += '>';
                      //APPLET end tag
                      str +='</applet>';
                 } else {
                      str = '';
                 }
           } else {
                 str = '';
           }
      } else if(IsSolaris == true) {
           if(IsNetscape == true) {
                 //Start of EMBED start tag
                 str += '<EMBED';
                 //Standard attributes
                 str += ' type="application/x-java-a pplet;vers ion=1.4"';
                 str += ' code="' + applet + '" ';
                 str += ' codebase="' + getURLbase() + '"';
                 str += ' cache_archive="' + classpath + '"';
                 str += ' archive="' + classpath + '"';
                 str += ' cache_option="Plugin"';
                 str += ' name="' + name + '"';
                 str += ' width="' + width + '"';
                 str += ' height="' + height + '"';
                 str += ' scriptable="true" ';
                 str += ' MAYSCRIPT=true ';
                 str += ' UserAgent="' + escape(navigator.userAgent ) +'"';
                 str += ' DebugLevel="' + sDebugLevel + '"';
                 str += ' Logger="' + sLogger + '"';
                 str += ' PageID="' + iPageID + '"';
                 //Custom attributes
                 var index = 0;
                 while(index < paramNames.length) {
                      //Attribute name
                      str += paramNames[index];
                      //Attribute value
                      str += '="' + paramValues[index] + '" ';
                      index++;
                 } //end while
                 //Java plug-in install instructions for Netscape
                 str += ' pluginspage="https://java.sun.com/products/plugin/index.html#download"';
                 //End of EMBED start tag
                 str += '>';
                 //NOEMBED element
                 str += '<NOEMBED>';
                 str += '</NOEMBED>';
                 //EMBED end tag
                 str += '</EMBED>';
           } else {
                 // Unsupported browser.
                 str = '';
           }
      } else if (IsLinux == true) {
                 if (IsNetscape == true) {
                      //Start of EMBED start tag
                      str += '<EMBED';
     Â
                      //Standard attributes
                      str += ' type="application/x-java-a pplet;vers ion=1.4"';
                      str += ' code="' + applet + '" ';
                      str += ' codebase="' + getURLbase() + '"';
                      str += ' cache_archive="' + classpath + '"';
                      str += ' archive="' + classpath + '"';
                      str += ' cache_option="Plugin"';
                      str += ' name="' + name + '"';
                      str += ' width="' + width + '"';
                      str += ' height="' + height + '"';
                      str += ' scriptable="true" ';
                      str += ' MAYSCRIPT=true ';
                      str += ' UserAgent="' + escape(navigator.userAgent ) +'"';
                      str += ' DebugLevel="' + sDebugLevel + '"';
                      str += ' Logger="' + sLogger + '"';
                      str += ' PageID="' + iPageID + '"';
     Â
     Â
                      //Custom attributes
                      var index = 0;
                      while (index < paramNames.length) {
                            //Attribute name
                            str += paramNames[index];
                            //Attribute value
                            str += '="' + paramValues[index] + '" ';
                            index++;
                      } //end while
     Â
                      //Java plug-in install instructions for Netscape
                      str += ' pluginspage="https://java.sun.com/products/plugin/index.html#download"';
     Â
                      //End of EMBED start tag
                      str += '>';
     Â
                      //NOEMBED element
                      str += '<NOEMBED>';
                      str += '</NOEMBED>';
     Â
                      //EMBED end tag
                      str += '</EMBED>';
                 } else {
                      // Unsupported browser.
                      str = '';
                 }
      } //end if
      if(bForceUseTextArea) {
           bUseTextArea = true;
           bForceUseTextArea = false;
           bUpgradeOSXError = false;
           bLinuxError = false;
           bShowErrorMessage = false;
           str = '';
      }
      if (str == '' && !preload) {
           if (bShowErrorMessage) {
                 if(IsMac && !IsOSX){
                      str += "<p>The minimum operating system required to run EditLive! for Java on Apple Macintosh is MacOS X Update 10.1.1.<br>EditLive! for Java only supports Safari. Please ensure you are using Safari to browse.</p>"
                 } else if(IsLinux){
                      str += "<p>EditLive! for Java only supports Netscape Navigator 7.1 or Mozilla 1.4 running JRE 1.4.2 on Linux. Please ensure you are using the correct browser and JRE.</p>"
                 } else {
                      str += "<p>This system does not meet the minimum requirements to run EditLive! for Java. Now using a textarea instead.</p>";
                 }
           }
           str += EditLiveCommonStatic_getTe xtArea(par amNames, paramValues);
      }
      return str;
}
function EditLiveCommonStatic_getTe xtArea(par amNames, paramValues) {
      var str = "";
      str += '<textarea name="'+hiddenName+'" rows='+ iTARows +' cols='+ iTACols +'>';
      var index = 0;
      while(index < paramNames.length) {
           if(paramNames[index] == "Body" || paramNames[index] == "Document"){
                 var docSource = paramValues[index];
                 str += unescape(docSource.replace (/\+/gi, "%20"));
           }
           index++;
      } //end while
      str += '</textarea>';
      bUseTextArea = true;
      return str;
}
function EditLiveCommonStatic_getAu xDiv() {
      if (!createdDiv) {
           createdDiv = true;
           return EditLiveCommonStatic_creat eDiv("eLAu xDiv");
      }
}
function EditLiveCommonStatic_creat eDiv(name) {
      var str = "";
      if(IsMSIE || IsSafari)
      {
           str += '<div id="' + name + '" name="' + name + '" width="1" height="1"></div>';
      }
      else
      {
           var version = navigator.appVersion;
           if(version.charAt(0) != "4") {
                 str += '<div id="' + name + '" name="' + name + '"></div>';
           } else {
                 //str += '<layer id="' + name + '" name="' + name + '"></layer>';
           } //end if
      } //end if
      return str;
}
function EditLiveCommonStatic_getEd itorLayout (appletTag , borderStyle, width, height) {
      var str = "";
      if (IsMac) {
           str = '<table border="0" width="';
           str += width;
           str += '" height="';
           str += height;
           str += '" ><tr><td>';
           str += '<div style="';
           str += borderStyle;
           str += '">';
           str += appletTag;
           str += '</div>';
           var auxDiv = EditLiveCommonStatic_getAu xDiv();
           if (auxDiv) {
                 str += '</td><td>';
                 str += auxDiv;
           }
           str += '</td></tr></table>';
      } else {
           str = '<div style="';
           str += borderStyle;
           str += '">';
           str += appletTag;
           str += '</div>';
           var auxDiv = EditLiveCommonStatic_getAu xDiv();
           if (auxDiv) {
                 str += auxDiv;
           }
      }
      return str;
}
function EditLiveCommon_setShowButt onText(tex t) {
      var index = this.paramNames.length;
      this.paramNames[index] = "showButtonText";
      this.paramValues[index] = text;
}
function EditLiveCommon_setShowButt onIconURL( url) {
      var index = this.paramNames.length;
      this.paramNames[index] = "showButtonIconURL";
      this.paramValues[index] = url;
}
function EditLiveCommon_setHideButt onText(tex t) {
      var index = this.paramNames.length;
      this.paramNames[index] = "hideButtonText";
      this.paramValues[index] = text;
}
function EditLiveCommon_setHideButt onIconURL( url) {
      var index = this.paramNames.length;
      this.paramNames[index] = "hideButtonIconURL";
      this.paramValues[index] = url;
}
function EditLiveCommon_showAsButto n(popout) {
      var index = this.paramNames.length;
      this.paramNames[index] = "showAsButton";
      this.paramValues[index] = "true";
      index++;
      this.paramNames[index] = "popout";
      this.paramValues[index] = popout;
      this.show();
}
function EditLiveCommon_show() {
      dalert("Show");
      document.write(this.getApp letHTML()) ;
      if (!bUseTextArea) {
           var fields = this.getHiddenFields();
           var i = 0;
           while (i < fields.length) {
                 document.write('<input name="' + fields[i] + '" type="hidden">');
                 i++;
           }
      }
      if (this.bAutoSubmit) {
           EditLiveCommonStatic_getOn Submit();
      }
      this.started = true;
      dalert("End Show");
}
/************************* ********** ********** ********** *
 Write to onSubmit
************************** ********** ********** ********** */
function EditLiveCommonStatic_getOn Submit(){
      var name = hiddenName;
      dalert("getOnSubmit: " + name);
     Â
      if(!bOnsubmit && EditLiveCommonStatic_isSup portedBrow ser()){
           var bFound = false;
           bOnsubmit = true;
           //find form where ELJ exists
           var sAppletName = name;
           for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
                 for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex] .elements. length; elementsIndex++){
                      if(document.forms[formsInd ex].elemen ts[element sIndex].na me == sAppletName){
                            //found the form
                            fOnSubmit = document.forms[formsIndex] .onsubmit;
                            document.forms[formsIndex] .onsubmit = EditLiveCommonStatic_GetCo ntent;
                            bFound = true;
                            dalert("Attached to onsubmit.");
                      }
                      if(bFound){
                            break;
                      }
                 } //end for
                 if(bFound){
                      break;
                 }
           } //end for
      } //end if
} //getOnSubmit
function EditLiveCommonStatic_getTh isForm() {
      var name = hiddenName;
      var bFound = false;
      bOnsubmit = true;
      //find form where ELJ exists
      var sAppletName = name;
      for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
           for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex] .elements. length; elementsIndex++){
                 if(document.forms[formsInd ex].elemen ts[element sIndex].na me == sAppletName){
                      //found the form
                      bFound = true;
                      return document.forms[formsIndex] ;
                 }
                 if(bFound){
                      break;
                 }
           } //end for
           if(bFound){
                 break;
           }
      } //end for
}
function EditLiveCommonStatic_submi tFunction( ) {
      setTimeout("EditLiveCommon Static_doS ubmit()", 100);
}
function EditLiveCommonStatic_doSub mit() {
      dalert("SubmitFunction");
      if(!IsMSIE && !IsSafari) {
           var version = navigator.appVersion;
           if(version.charAt(0) == "4") {
                 wNewWindow.close();
           } //end if
      } //end if
      var sAppletName = hiddenName;
      for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
           for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex] .elements. length; elementsIndex++){
                 if(document.forms[formsInd ex].elemen ts[element sIndex].na me == sAppletName){
                 //found the form
                      if(fOnSubmit == null) {
                            var submitIsObject;
                            if (IsNetscape) {
                                 submitIsObject = ((typeof document.forms[formsIndex] .submit) == "object");
                            } else {
                                 if ((document.forms[formsInde x].submit. id == 'submit') || (document.forms[formsIndex ].submit.n ame == 'submit')) {
                                       submitIsObject = true;
                                 } else {
                                       submitIsObject = false;
                                 }
                            }
                            if(submitIsObject){
                                 document.forms[formsIndex] .onsubmit= null;
                                 document.forms[formsIndex] .submit.cl ick();
                            } else {
                                 document.forms[formsIndex] .submit();
                            }
                            bGetContent = false;                           Â
                      } else {
                            var rVal = fOnSubmit();
                            if(rVal != false) {
                                 var submitIsObject = false;
                                 if (IsNetscape) {
                                       submitIsObject = ((typeof document.forms[formsIndex] .submit) == "object");
                                 } else {
                                       submitIsObject = ((document.forms[formsInde x].submit. id == 'submit') || (document.forms[formsIndex ].submit.n ame == 'submit'));
                                 }
                                 if(submitIsObject){
                                       document.forms[formsIndex] .onsubmit= null;
                                       document.forms[formsIndex] .submit.cl ick();
                                 } else {
                                       document.forms[formsIndex] .submit();
                                 }
                            } //end if
                            bGetContent = false;
                      }//end if
                     Â
                 } //end if
           } //end for
      } //end for
}
/************************* ********** ********** ********** *
 Form submitting functions
************************** ********** ********** ********** */
function EditLiveCommonStatic_runPo stApplet(p aramNames, paramValues) {
      if(IsMSIE)
      {
           document.all.item("eLAuxDi v").innerH TML = "";
      } //end if
      var appletName = 'POSTApplet';
      var appletClass = 'com.ephox.editlive.java2. POSTApplet .class';
      var appletWidth = 1;
      var appletHeight = 1;
      if (IsMac) {
           appletHeight = 90;
      }
     Â
     Â
      var appletTag = EditLiveCommonStatic_gener ateAppletT ag(appletW idth, appletHeight, appletName, classpath, appletClass,
                 paramNames, paramValues, downloadPath, false);
     Â
      if (IsWindows && IsMSIE) {
           var myDiv = document.getElementById("e LAuxDiv");
           myDiv.innerHTML = appletTag;
      } else if (IsMSIE) {
           document.all.item("eLAuxDi v").innerH TML = appletTag;
      } else {
           var version = navigator.appVersion;
           if(version.charAt(0) == "4" && !IsSafari) {
                 wNewWindow = window.open('','EditLive', 'width=' + 1 + ',height=' + 1 +',status=no,resizable=no, scrollbars =no,locati on=no,tool bar=no');
                 wNewWindow.document.open() ;
                 wNewWindow.document.write( appletTag) ;
                 wNewWindow.document.close( );
           } else {
                 var myDiv = document.getElementById("e LAuxDiv");
                 myDiv.innerHTML = appletTag;
           } //end if
      } //end if
}
function EditLiveCommonStatic_GetCo ntent() {
dalert("Get Content");
      if(bGetContent){
           dalert("Already getting content.");
           return false;
      } //end if
      bGetContent = true;
      if (eljUseLiveConnect) {
           var applet = EditLiveCommonStatic_GetAp pletWithNa me(hiddenN ame + "_elj");
           if (applet && ((IsWindows && IsMSIE) || applet.processSubmit)) {
                 applet.processSubmit(getEp hoxPageID( ));
                 return false;
           }
      }
      var paramNames = new Array();
      var paramValues = new Array();
      paramNames[0] = "GetContent";
      paramValues[0] = "true";
      EditLiveCommonStatic_runPo stApplet(p aramNames, paramValues);
      return false;
}
function EditLiveCommon_setBorderSt yle(style) {
      this.borderStyle = style;
}
//************************ **** Support Functions ***********************
//This function is a regular combineURL but to make life easier it uses window.location.href
// as the absolute URL so we can use things like window.location.hostname instead of writing
// those functions somewhere else.
function combineDownloadURL ( sDirectory ) {
      var relURL = sDirectory;
      //every other reference in this file assumes downloadDirectory has no
      // trailing "/".  Rather than try to fix everywhere else, we'll just
      // rip out the trailing "/" if it is there.
      if (relURL.charAt(relURL.leng th - 1) == "/") {
           relURL = relURL.substr(0, relURL.length - 1);
      }
      //if relURL is absolute, forget about combining
      if (relURL.indexOf("://") != -1) return relURL;
     Â
      //we only want the path of the URL
      var absURL = removeFilename(window.loca tion.href) ;
     Â
      //do the combining work
      switch(relURL.charAt(0)) {
     Â
           //relative to hostname
           case '/':
                 return window.location.protocol + "//" +
                      window.location.hostname + relURL;
                 break;
           //relative to absolute path
           case '.':
                 var sOldURL;
                 //cycle through relURL ripping directories off the absURL as we
                 // go up
                 while(relURL.substr(0,3) == "../") {
                      sOldURL = absURL;
                      absURL = absURL.substring(0, absURL.lastIndexOf('/'));
                      relURL = relURL.substr(relURL.index Of('/') + 1);
                      //if the final two chars are "//" then the relative
                      // URL goes back too many folders, undo the previous rip
                      if (absURL.charAt(absURL.last IndexOf('/ ') - 1) == ':') {
                            absURL = sOldURL
                      }
                 }
                 return absURL + "/" + relURL;
                 break;
                Â
           //is a subdir of the current dir
           default:
                 return absURL + "/" + relURL;
                 break;
      }
}
//get the main path of the URL, minus the xx.htm etc
function removeFilename ( sURL ) {
      if (sURL.lastIndexOf('.') > sURL.lastIndexOf('/')) {
           return sURL.substring(0, sURL.lastIndexOf('/'));
      } else {
           return sURL;
      }
}
//Set value for hidden form field
function setFormValue(sName, sValue) {
      dalert("Set form item: " + sName + " to " + sValue);
      for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
           for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex] .elements. length; elementsIndex++){
                 if(document.forms[formsInd ex].elemen ts[element sIndex].na me == sName){
                      document.forms[formsIndex] .elements[ elementsIn dex].value =sValue;
                 }
           } //end for
      } //end for
      return false;
} //setFormValue
function eljTransferFocus() {
      var myDiv;
      if(IsMSIE)
      {
           myDiv = document.all.item("eLAuxDi v");
      }
      else
      {
           var version = navigator.appVersion;
           if(version.charAt(0) == "4") {
                 myDiv = document.ids.eLAuxDiv;
           } else {
                 myDiv = document.getElementById("e LAuxDiv");
           } //end if
      }
     Â
      // Find the next element we can focus on.
      if (IsMSIE) {
           var parent = myDiv.parentElement;
           var num = myDiv.sourceIndex + 1;
           var nextElem = document.all[num];
           while (!isFocusable(nextElem)) {
                 num++;
                 nextElem = document.all[num];
           }
           nextElem.focus();
      } else {
           var parent = myDiv.parentNode;
           var foundFocusable = false;
           while (!foundFocusable) {
                 var i = 0;
                 var foundMyDiv = false;
                 var firstDivMatch = true;
                 while (i < parent.childNodes.length && !foundFocusable) {
                      var child = parent.childNodes[i];
                      if (child == myDiv) {
                            foundMyDiv = true;
                      }
                      if (foundMyDiv) {
                            if (firstDivMatch) {
                                 firstDivMatch = false;
                            } else {
                                 var focusable = eljSearchTree(child);
                                 if (focusable) {
                                       myDiv = focusable;
                                       foundFocusable = true;
                                       break;
                                 }
                            }
                      }
                      i++;
                 }
                 if (!foundFocusable) {
                      myDiv = parent;
                      parent = parent.parentNode;
                 }
           }
          Â
           //alert(myDiv.tagName);
           //var win2 = window.open('','EditLive', 'width=' + 1 + ',height=' + 1 +',status=no,resizable=no, scrollbars =no,locati on=no,tool bar=no');
           //win2.close();
           myDiv.focus();
      }
}
function getURLbase() {
      var src = window.location.href;
      var indLoc = src.lastIndexOf("/");
      var URLBase = src.substr(0, indLoc + 1);
      strPath = new String(document.location);
      strPath = strPath.substr(0, strPath.lastIndexOf("/") + 1);
      return URLBase;
}
function dalert(message) {
      if (DEBUG) {
           alert(message);
      }
}
Example 1: Function Error
Example 2: HTML Page error is occuring on
Example 3: Editlive.JS file that is causing the conflict.
===========1. Function Error=============
function _CF_hasValue(obj, obj_type, obj_trim)
{
     Â
      if (obj_type == "TEXT" || obj_type == "FILE" ||obj_type == "PASSWORD" || obj_type == "CFTEXTAREA" || obj_type == "TEXTAREA" || obj_type == "CFTEXTINPUT")
      {
           if (obj.value.length == 0)
                  return false;
           else
                 if( obj_trim )
                 {
                   //trim whitespace - for backward compatability this is optional
                      str = obj.value.replace(/^\s+/,'
                      if (str.length == 0)
                      { return false; }
                 }
                  return true;
      }
      else if (obj_type == "SELECT")
      {
           for (i=0; i < obj.length; i++)
           {
                 if (obj.options[i].selected)
                      return true;
           }
             return false;     Â
      }
      else if (obj_type == "SINGLE_VALUE_RADIO" || obj_type == "SINGLE_VALUE_CHECKBOX")
      {
           if (obj.checked)
                 return true;
           else
                  return false;     Â
      }
      else if (obj_type == "RADIO" || obj_type == "CHECKBOX")
      {
           if( obj.length == undefined && obj.checked )
           {
                 return true;
           }else{
                 for (i=0; i < obj.length; i++)
                 {
                      if (obj[i].checked)
                            return true;
                 }
           }
             return false;     Â
      }else if( obj_type == "CFTREE"){
        if( obj['value'].length > 0 )
        {
          return true;
    }else{
      return false;
    }
      }else{
        return true;
      }
}
============== 2. Here is the page==================
 Â
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Untitled Document</title>
<script src='/common/editlivejava/
<script type="text/javascript" src="/CFIDE/scripts/masks.
<script type="text/javascript">
<!--
  function  _CF_checkform1(_CF_this)
  {
    //reset on submit
    _CF_error_exists = false;
    _CF_error_messages = new Array();
    _CF_error_fields = new Object();
    _CF_FirstErrorField = null;
    //display error messages and return success
    if( _CF_error_exists )
    {
      if( _CF_error_messages.length > 0 )
      {
        // show alert() message
        _CF_onErrorAlert(_CF_error
        // set focus to first form error, if the field supports js focus().
        if( _CF_this[_CF_FirstErrorFie
        { _CF_this[_CF_FirstErrorFie
      }
      return false;
    }else {
      return true;
    }
  }
//-->
</script>
</head>
<body> Â Â Â Â Â Â Â Â
<form name="form1" id="form1" action="editor.cfm" method="post" preloader="no" onsubmit="return _CF_checkform1(this)"> Â
<script language="JavaScript">
var ELJApplet1_js;
ELJApplet1_js = new EditLiveJava("tbody", "100%", "300");
ELJApplet1_js.setDownloadD
ELJApplet1_js.setConfigura
ELJApplet1_js.setBody("");
ELJApplet1_js.setLocalDepl
ELJApplet1_js.setAutoSubmi
ELJApplet1_js.setDebugLeve
ELJApplet1_js.setReturnBod
ELJApplet1_js.setShowSyste
ELJApplet1_js.show();
</script>
<input type="submit" name="Submit" value="Submit"/>
</form>
========3. Here is the EditLive Javascript In Question ==========
/*
 *
 * Ephox EditLive! JavaScript Library
 * Copyright (c) 1999-2003 Ephox Corp. All rights reserved.
 * This software is provided "AS IS," without a warranty of any kind.
 *
 */
var eljUseWebDAV = false;
var eljUseMathML = false;
var eljUseLiveConnect = false;
/** The designer class provides a simple API for setting parameters on the designer and
 * instantiating it.
 */
function EditLiveJava(name, width, height) {
      EditLiveCommonStatic_detec
     Â
      this.paramNames = new Array();
      this.paramValues = new Array();
     Â
      this.width = width;
      this.height = height;
      this.name = name;
      this.borderStyle = "";
      this.bAutoSubmit = true;
     Â
      this.setDownloadDirectory = EditLiveCommon_setDownload
      this.setConfigurationFile = EditLiveCommon_setXMLURL;
      this.setXMLURL = EditLiveCommon_setXMLURL;
      this.setDebugLevel = EditLiveCommon_setDebugLev
      this.setLogger = EditLiveCommon_setLogger;
      this.setConfigurationText = EditLiveCommon_setXML;
      this.setXML      = EditLiveCommon_setXML;
      this.setMinimumJREVersion =  EditLiveCommon_setMinimumJ
      this.setJREDownloadURL = EditLiveCommon_setJREDownl
      this.setShowSystemRequirem
      this.setCookie = EditLiveCommon_setCookie;
      this.setLocalDeployment = EditLiveCommon_setLocalDep
      this.InsertHTMLAtCursor = EditLiveCommon_InsertHTMLA
      this.InsertHyperlinkAtCurs
      this.ScrollTo = EditLiveCommon_ScrollTo;
      this.setAutoSubmit = EditLiveCommon_setAutoSubm
      this.UploadFiles = EditLiveCommon_UploadFiles
      this.UploadImages = EditLiveCommon_UploadFiles
      this.setDownloadingMessage
      this.setLocale = EditLiveCommon_setLocale;
      this.setBorderStyle = EditLiveCommon_setBorderSt
      this.show = EditLiveCommon_show;
      this.setShowButtonText = EditLiveCommon_setShowButt
      this.setShowButtonIconURL = EditLiveCommon_setShowButt
      this.setHideButtonText = EditLiveCommon_setHideButt
      this.setHideButtonIconURL = EditLiveCommon_setHideButt
      this.showAsButton = EditLiveCommon_showAsButto
     Â
      this.setDocument = EditLiveJava_setDocument;
      this.setBody = EditLiveJava_setBody;
      this.setStyles = EditLiveJava_setStyles;
      this.setXSD = EditLiveJava_setXSD;
      this.addXSDAsString = EditLiveJava_addXSDAsStrin
      this.setReturnBodyOnly = EditLiveJava_setReturnBody
      this.GetDocument = EditLiveJava_GetDocument;
      this.GetBody = EditLiveJava_GetBody;
      this.GetSelectedText = EditLiveJava_GetSelectedTe
      this.GetWordAtCursor = EditLiveJava_GetWordAtCurs
      this.GetHyperlinkAtCursor = EditLiveJava_GetHyperlinkA
      this.SetDocument = EditLiveJava_setDocument;
      this.SetBody = EditLiveJava_setBody;
      this.GetStyles = EditLiveJava_GetStyles;
      this.GetWordCount = EditLiveJava_GetWordCount;
      this.GetCharCount = EditLiveJava_GetCharCount;
      this.IsDirty = EditLiveJava_IsDirty;
      this.SetProperties = EditLiveJava_SetProperties
      this.PostDocument = EditLiveJava_PostDocument;
      this.addView = EditLiveJava_addView;
      this.addViewWithString = EditLiveJava_addViewWithSt
      this.setUseTextarea = EditLiveJava_setUseTextare
      this.setTextareaRows = EditLiveJava_setTextareaRo
      this.setTextareaCols = EditLiveJava_setTextareaCo
      this.setPreload = EditLiveJava_setPreload;
      this.setOnInitComplete = EditLiveJava_setPreload;
      this.setHead = EditLiveJava_setHead;
      this.setBaseURL = EditLiveJava_setBaseURL;
      this.GetCurrentDocumentURL
      this.setOutputCharset = EditLiveJava_setOutputChar
      this.setCommentTemplate = EditLiveJava_setCommentTem
      this.addJar = EditLiveJava_addJar;
      this.setPreserveInputStruc
      this.setHttpLayerManager = EditLiveJava_setHttpLayerM
      this.addParam = EditLiveJava_addParam;
     Â
      // WebDAV Properties
      this.setUseWebDAV = EditLiveJava_setUseWebDAV;
      // MathML Properties
      this.setUseMathML = EditLiveJava_setUseMathML;
     Â
      // LiveConnect
      this.setUseLiveConnect = EditLiveCommonStatic_setUs
      this.started = false;
     Â
      this.getAppletHTML = EditLiveJava_getAppletHTML
      this.getHiddenFields = EditLiveJava_getHiddenFiel
     Â
      this.started = false;
      this.editXML = false;
      this.views = new Array();
      this.xsds = new Array();
      this.extraJars = new Array();
      this.classNames = "";
      this.preload = false;
}
function EditLiveCommonStatic_setUs
      eljUseLiveConnect = val;
}
function EditLiveJava_setCommentTem
      if (this.started) {
           return false;
      }
      var index = this.paramNames.length
      this.paramNames[index] = "commentTemplate";
      this.paramValues[index] = val;
      return true;
}
function EditLiveJava_addJar(jarUrl
      this.extraJars[this.extraJ
      this.classNames += className + " ";
}
function EditLiveJava_addParam(name
      if (this.started) {
           return false;
      }
      var index = this.paramNames.length
      this.paramNames[index] = name;
      this.paramValues[index] = value;
      return true;
}
function EditLiveJava_getAppletHTML
      if (!this.cookie) {
           this.setCookie(document.co
      }
     Â
      // Determine the applet class to use.
      var appletClass;
      if (IsMac) {
           appletClass = "com.ephox.editlive.osx.Ed
      } else if (IsLinux) {
           appletClass = "com.ephox.editlive.linux.
      } else if (IsSolaris) {
           appletClass = "com.ephox.editlive.solari
      } else {
           appletClass = "com.ephox.editlive.win.Ed
      }
     Â
      // Determine the classpath.
      var needXML = false;
      jarList = this.downloadDirectory + "editlivejava.jar";
      if (eljUseWebDAV) {
           needXML = true;
      }
      if (eljUseMathML) {
           jarList += "," + this.downloadDirectory + "WebEQEphox.jar";
      }
      if ((IsMac && IsMSIE) || sMinimumJREVersion == "1.3.1") {
           jarList += "," + this.downloadDirectory + "xml-apis.jar";
      }
      if (this.editXML) {
           needXML = false;
           if ((IsMac && IsMSIE) || sMinimumJREVersion == "1.3.1") {
                 jarList += "," + this.downloadDirectory + "crimson.jar";
           }
      } else if (needXML) {
           if ((IsMac && IsMSIE) || sMinimumJREVersion == "1.3.1") {
                 jarList += "," + this.downloadDirectory + "crimson.jar";
           }
      }
     Â
      var urlCounter;
      for (urlCounter = 0; urlCounter < this.extraJars.length; urlCounter++) {
           jarList += "," + this.extraJars[urlCounter]
      }
     Â
      var paramLength = this.paramNames.length;
      this.paramNames[paramLengt
      this.paramValues[paramLeng
     Â
      classpath = jarList;
      var appletName = this.name + "_elj";
      hiddenName = this.name;
      if (this.editXML) {
           var i = 0;
           var nameParam = "";
           var valueParam = "";
           var isUrlParam = "";
           for (i = 0; i < this.views.length; i++) {
                 var view = this.views[i];
                 nameParam += escape(view[0]) + ":";
                 valueParam += escape(view[1]) + ":";
                 isUrlParam += view[2] + ":";
           }
           var propLength = this.paramNames.length;
           this.paramNames[propLength
           this.paramValues[propLengt
           propLength++;
           this.paramNames[propLength
           this.paramValues[propLengt
           propLength++;
           this.paramNames[propLength
           this.paramValues[propLengt
           propLength++;
           var xsdParam = "";
           for (i = 0; i < this.xsds.length; i++) {
                 xsdParam += this.xsds[i];
           }
           this.paramNames[propLength
           this.paramValues[propLengt
      }
     Â
      var appletTag = EditLiveCommonStatic_gener
           appletClass, this.paramNames, this.paramValues, this.preload);
      if (appletTag == '' && this.preload) {
           for (var i = 0; i < this.paramNames.length; i++) {
                 if (this.paramNames[i] == 'setPreload') {
                   setTimeout(this.paramValue
                 }
           }
      }
      var result = EditLiveCommonStatic_getEd
      return result;
}
function EditLiveJava_getHiddenFiel
      var fields = new Array();
      fields[0] = this.name;
      fields[1] = this.name + "_styles";
      return fields;
}
function EditLiveJava_setUseWebDAV(
      if (this.started == true){
           return false;
      }
      dalert("Use WebDAV: " + bValue);
      eljUseWebDAV = bValue;
}
function EditLiveJava_setUseMathML(
      if (this.started == true) {
           return false;
      }
      dalert("Use MathML: " + bValue);
      eljUseMathML = bValue;
}
function EditLiveJava_setOutputChar
      if (this.started == true) {
           return false;
      }
      dalert("Output Charset: " + charset);
      var index = this.paramNames.length;
      this.paramNames[index] = "outputCharset";
      this.paramValues[index] = charset;
}
function EditLiveJava_setDocument(s
      if(this.started == true){
           EditLiveCommonStatic_Custo
      } else {
           dalert("Document   " + src);
           var index = this.paramNames.length
           this.paramNames[index] = "Document";
           this.paramValues[index] = src;
      }
} //setDocument
function EditLiveJava_setBody(src){
      if(this.started == true){
           EditLiveCommonStatic_Custo
      } else {
           dalert("Body   " + src);
           var index = this.paramNames.length
           this.paramNames[index] = "Body";
           this.paramValues[index] = src;
      }
} //setBody
function EditLiveJava_setStyles(src
      if(this.started == true){
           return false;
      }//end if
      dalert("Styles  "+src);
      var index = this.paramNames.length
      this.paramNames[index] = "Styles";
      this.paramValues[index] = src;
}//setStyles
function EditLiveJava_setReturnBody
      if(this.started == true){
           return false;
      } //end if
      dalert("ReturnBodyOnly   " + bValue);
      var index = this.paramNames.length
      this.paramNames[index] = "setReturnBodyOnly";
      this.paramValues[index] = bValue;
} //setReturnBodyOnly
function EditLiveJava_setPreserveIn
      if(this.started == true){
           return false;
      }
      dalert("PreserveInputStruc
      var index = this.paramNames.length
      this.paramNames[index] = "setPreserveInputStructure
      this.paramValues[index] = bValue;
}
function EditLiveJava_setXSD(val) {
      if (this.started == true) {
           return false;
      }
      var index = this.paramNames.length;
      this.paramNames[index] = "XSD";
      this.paramValues[index] = val;
}
function EditLiveJava_addXSDAsStrin
      if (this.started == true) {
           return false;
      }
      this.xsds[this.xsds.length
}
function EditLiveJava_GetDocument()
      if(arguments.length == 1) {
           EditLiveCommonStatic_Custo
      } else if(arguments.length == 2) {
           var sArgs = arguments[0];
           EditLiveCommonStatic_Custo
      }
} //EditLiveJava_GetDocument
function EditLiveJava_GetBody(){
      if(arguments.length == 1) {
           EditLiveCommonStatic_Custo
      } else if(arguments.length == 2) {
           var sArgs = arguments[0];
           EditLiveCommonStatic_Custo
      }
} //EditLiveJava_GetBody
function EditLiveJava_GetSelectedTe
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetSelected
function EditLiveJava_GetWordAtCurs
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetWordAtCu
function EditLiveJava_GetHyperlinkA
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetHyperlin
function EditLiveJava_GetCurrentDoc
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetCurrentD
function EditLiveJava_GetStyles(sAc
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetStyles
function EditLiveJava_GetWordCount(
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetStyles
function EditLiveJava_GetCharCount(
      EditLiveCommonStatic_Custo
} //EditLiveJava_GetStyles
function EditLiveJava_SetProperties
      EditLiveCommonStatic_Custo
}
function EditLiveJava_setHttpLayerM
      if(this.started == true){
           EditLiveCommonStatic_Custo
      } else {
   Â
           dalert("HttpLayer   " + value);
           var index = this.paramNames.length
           this.paramNames[index] = "HttpLayer";
           this.paramValues[index] = value;
      }
}
function EditLiveJava_IsDirty(sActi
      EditLiveCommonStatic_Custo
} //EditLiveJava_IsDirty
function EditLiveJava_PostDocument(
      var val = "";
      var argPosition;
      for (argPosition = 0; argPosition < arguments.length; argPosition++) {
           val += arguments[argPosition];
           if (argPosition + 1 < arguments.length) {
                 val += "##ephox##";
           }
      }
      EditLiveCommonStatic_Custo
}
function EditLiveJava_addViewWithSt
      if (this.started == true) {
           return false;
      }
      dalert("Add view: " + name + " - " + value);
      var view = new Array();
      view[0] = name;
      view[1] = value;
      view[2] = "false";
      this.views[this.views.leng
}
function EditLiveJava_addView(name,
      if (this.started == true) {
           return false;
      }
      dalert("Add view: " + name + " - " + value);
      var view = new Array();
      view[0] = name;
      view[1] = value;
      view[2] = "true";
      this.views[this.views.leng
}
function EditLiveJava_Print(html) {
      var newWin;
      newWin = window.open("", "", "toolbar=no"); //, "toolbar=no,location=no,me
      newWin.document.open();
      newWin.document.write('<ht
      newWin.document.close();
      newWin['Print'].document.o
      newWin['Print'].document.w
      newWin['Print'].document.c
      newWin['content'].document
      newWin['content'].document
      newWin['content'].document
     Â
}
// BEGIN SHARED SECTION
// Script below here must be identical in each of the javascript files.
var DEBUG = false;
var bOnsubmit = false;
var bGetContent = false;
var hiddenName;
var sDebugLevel = "off";
var sLogger = "console";
var bLocalDeploy = false;
var sJREDownloadURL = "";
var sMinimumJREVersion = "";
var bShowErrorMessage = "true";
var eljLoadingMessage = "Updating components and initializing...";
var createdDiv = false;
var bUseTextArea = false;
var bForceUseTextArea = false;
var iTARows = 17;
var iTACols = 55;
var cookie = false;
// The classpath for applets.
var classpath;
// The Path to the EditLive download directory.
var downloadPath;
// The original onsubmit function.
var fOnSubmit;
// The new window opened for submitting on Netscape 4.
var wNewWindow;
// True if we are in Netscape.
var IsNetscape = false;
// True if we are on windows.
var IsWindows = false;
// True if we are on mac.
var IsMac = false;
// True if this is Mac OS X.
var IsOSX = false;
// True if we are on Solaris.
var IsSolaris = false;
// True if we are on linux.
var IsLinux = false;
// True if we are in IE.
var IsMSIE = false;
// True if we are in safari.
var IsSafari = false;
// True is we are in Opera
var IsOpera = false;
// True if we are in the IE DHTML control.
var IsMSIEDHTML = false;
// The PageID
var iPageID = 0;
var AllowMacNetscape = true;
function setAllowNetscapeOnMac(valu
      AllowMacNetscape = value;
}
/*************************
 Globals
**************************
function EditLiveCommon_safariSubmi
      var win = window.open("", "eljSubmit", "toolbar=no,location=no,di
      win.location = url;
}
function EditLiveCommon_setDownload
      eljLoadingMessage = message;
}
function EditLiveCommon_setDownload
{
      combineDownloadURL(sDir);
      if(sDir.charAt(sDir.length
           sDir += "/";
      } //end if
      downloadPath = sDir;
      this.downloadDirectory = sDir;
}
function EditLiveCommon_setLocalDep
{
      bLocalDeploy = bDeploy;
}
function EditLiveCommon_setAutoSubm
{
      this.bAutoSubmit = val;
}
function EditLiveCommon_setMinimumJ
{
      if(val == "1.3.1" || val == "1.4.1" || val == "1.4.2"){
           sMinimumJREVersion = val;
      }
}
function EditLiveCommon_setJREDownl
      sJREDownloadURL = val;
}
function EditLiveCommon_setShowSyst
      bShowErrorMessage = val;
}
function EditLiveCommon_setDebugLev
      sDebugLevel = val;
}
function EditLiveCommon_setLogger(v
      sLogger = val;
}
//************************
function EditLiveCommon_setXMLURL(s
      if(this.started == true){
           return false;
      } //end if
      var index = this.paramNames.length
      this.paramNames[index] = "setXMLURL";
      this.paramValues[index] = strXMLURL;
} //setXMLURL
function EditLiveCommon_setXML(strX
      if(this.started == true){
           return false;
      } //end if
      var index = this.paramNames.length
      this.paramNames[index] = "setXML";
      this.paramValues[index] = strXML;
} //setXML
function EditLiveCommon_setCookie(c
      dalert("in setCookie");
      if(this.started == true)
           return false;
      if(cookie_ != "") {
           dalert("Cookie:   " + cookie_);
           this.cookie = true;
           var index = this.paramNames.length
           this.paramNames[index] = "Cookie";
           this.paramValues[index] = cookie_;
      }
}
function EditLiveCommon_setLocale(s
      if (this.started == true) {
           return false;
      } //end if
      var index = this.paramNames.length
      this.paramNames[index] = "setLocale";
      this.paramValues[index] = strLocale;
}
function EditLiveJava_setUseTextare
      bForceUseTextArea = bUseText;
}
function EditLiveJava_setTextareaRo
      iTARows = iRows;
}
function EditLiveJava_setTextareaCo
      iTACols = iCols;
}
function EditLiveJava_setPreload(sP
      if(this.started == true){
           return false;
      }
      this.preload = true;
      var index = this.paramNames.length
      dalert("Preload:  " + sPreload);
      this.paramNames[index] = "setPreload";
      this.paramValues[index] = sPreload;
}
function EditLiveJava_setHead(src){
      if(this.started == true){
           return false;
      }
      dalert("Head   " + src);
      var index = this.paramNames.length
      this.paramNames[index] = "Head";
      this.paramValues[index] = src;
} //setHead
function EditLiveJava_setBaseURL(ur
      if(this.started == true){
           return false;
      }
      dalert("Base   " + url);
      var index = this.paramNames.length
      this.paramNames[index] = "EphoxBaseURL";
      this.paramValues[index] = url;
} //setHead
//************************
function EditLiveCommon_InsertHTMLA
      EditLiveCommonStatic_Custo
}
function EditLiveCommon_InsertHyper
      if(arguments.length == 1) {
           EditLiveCommonStatic_Custo
      } else {
           var i = 1;
           var sHyperlinkString = arguments[0];
           for(i = 1; i < arguments.length; i++) {
                 sHyperlinkString += "##ephox##";
                 sHyperlinkString += arguments[i];
           }
           EditLiveCommonStatic_Custo
      }
}
function EditLiveCommon_ScrollTo() {
      var val;
      if (arguments.length == 1) {
           val = arguments[0];
      } else {
           val = arguments[0] + ":" + arguments[1];
      }
      EditLiveCommonStatic_Custo
}
function EditLiveCommon_UploadFiles
      EditLiveCommonStatic_Custo
}
function EditLiveCommonStatic_DoCus
      if (eljUseLiveConnect) {
           var applet = EditLiveCommonStatic_GetAp
           if (applet && ((IsWindows && IsMSIE) || applet.performCustomAction
                 applet.performCustomAction
                 return;
           }
      }
     Â
      var paramNames = new Array();
      var paramValues = new Array();
     Â
      paramNames[0] = "CustomAction";
      paramValues[0] = "customaction:" + ephoxGAction + ":" + ephoxGValue;
      paramNames[1] = "CustomActionTarget";
      paramValues[1] = ephoxGName;
     Â
      EditLiveCommonStatic_runPo
}
var ephoxGAction;
var ephoxGValue;
var ephoxGName;
function EditLiveCommonStatic_Custo
      ephoxGAction = action;
      ephoxGValue = value;
      ephoxGName = name;
      setTimeout("EditLiveCommon
}
function EditLiveCommonStatic_GetAp
      if (document.getElementById) {
           return document.getElementById(na
      }
}
//************************
function EditLiveCommonStatic_detec
      var version = navigator.appVersion;
      if (version != "") {
           var iParen = version.indexOf("(", 0);
           var sUsrAgent = new String(navigator.userAgent
           sUsrAgent = sUsrAgent.toLowerCase();
           navigator.clientVersion = version.substring(0, iParen - 1);
           if (sUsrAgent.indexOf("msie",
                 IsMSIE = true;
                 if (navigator.clientVersion.s
                      IsMSIEDHTML = true;
                 }
           } else if (sUsrAgent.indexOf("safari
                 IsSafari = true;
           }else if (sUsrAgent.indexOf("mozill
                 IsNetscape = true;
           } else if (sUsrAgent.indexOf("opera"
                 IsMSIE = true;
                 IsOpera = true;
           }
           if (sUsrAgent.indexOf("win", 0) > 0) {
            IsWindows = true;
           } else if (sUsrAgent.indexOf("mac", 0) > 0){
             IsMac = true;
             if (IsSafari || IsNetscape) {
                   IsOSX = true;
             } else {
                      for(i = 0; i < navigator.plugins.length; i++){
                            if(navigator.plugins[i].na
                                 IsOSX = true;
                            }
                            if (navigator.plugins[i].name
                                 IsOSX = true;
                            }
                      }
                 }
           } else if (sUsrAgent.indexOf("sunos"
             IsSolaris = true;
           } else if (sUsrAgent.indexOf("linux"
             IsLinux = true;
           }
      }
}
// Determines whether or not the current browser is supported.
function EditLiveCommonStatic_isSup
      if (IsWindows) {
           return IsMSIE || IsNetscape;
      } else if (IsOSX) {
           return IsSafari || (IsNetscape && AllowMacNetscape);
      } else if (IsSolaris) {
           return IsNetscape;
      } else if (IsLinux) {
           return IsNetscape;
      } else {
           return false;
      }
}
function getEphoxPageID() {
      if(iPageID == 0) {
           var dTemp = new Date();
           iPageID = dTemp.getTime();
      }
      return iPageID;
}
function EditLiveCommonStatic_gener
      getEphoxPageID();
      // Set the JRE download URL if it hasn't already been set.
      if (sJREDownloadURL == "") {
           sJREDownloadURL = downloadPath + "j2re-1_4_2_05-windows-i58
      }
     Â
      var str = "";
      var index = paramNames.length
      var bUpgradeOSXError = false;
      var bLinuxError = false;
     Â
      if (IsWindows == true) {
           if(IsMSIE == true) {
                 //OBJECT start tag
                 str += '<object';
                 str += ' classid="clsid:8AD9C840-04
                 str += ' width="' + width +'"';
                 str += ' height="' + height +'"';
                 str += ' name="' + name + '"';
                Â
                 if(bLocalDeploy) {
                      if(sMinimumJREVersion == "1.4.2"){
                             str += ' codebase="' + sJREDownloadURL + '#Version=1,4,2"'
                        } else       if(sMinimumJREVersion == "1.4.1"){
                             str += ' codebase="' + sJREDownloadURL + '#Version=1,4,1"'
                        } else {
                             str += ' codebase="' + sJREDownloadURL + '#Version=1,4,0"'
                        }                      Â
                 } else {
                      if(sMinimumJREVersion == "1.3.1"){
                            str += ' codebase="https://java.sun.com/products/plugin/autodl/jinstall-1_3_1_01-win.cab#Version=1,3,1,01"'
                      } else if(sMinimumJREVersion == "1.4.2"){
                             str += ' codebase="https://java.sun.com/update/1.4.2/jinstall-1_4_2_05-windows-i586.cab#Version=1,4,2,50"'
                        } else if(sMinimumJREVersion == "1.4.1"){
                            str += ' codebase="https://java.sun.com/products/plugin/autodl/jinstall-1_4_1_01-windows-i586.cab#version=1,4,1"'
                      } else {
                            str += ' codebase="https://java.sun.com/update/1.4.2/jinstall-1_4_2_05-windows-i586.cab#Version=1,4,0"'
                      }
                 }
                 str += '>';
                 //Standard PARAM elements
                 str += '<param name="code" value="' + applet + '" >';
                 str += '<param name="codebase" value="' + getURLbase() + '" >';
                 if(sMinimumJREVersion == "1.3.1"){
                      str += '<param name="type" value="application/x-java-
                 } else if(sMinimumJREVersion == "1.4.2"){
                        str += '<param name="type" value="application/x-java-
                 } else if(sMinimumJREVersion == "1.4.1"){
                      str += '<param name="type" value="application/x-java-
                 } else {
                      str += '<param name="type" value="application/x-java-
                 }
                 str += '<param name="archive" value="' + classpath + '" >';
                 str += '<param name="cache_option" value="Plugin" >';
                 str += '<param name="cache_archive" value="' + classpath + '" >';
                 str += '<param name="name" value="' + name + '" >';
                 if(IsOpera) {
                      str += '<param name="scriptable" value="true">';
                 } else {
                      str += '<param name="scriptable" value="false">';
                 }
                 str += '<param name="MAYSCRIPT" value="true">';
                 str += '<param name="progressbar" value="true">';
                 str += '<param name="boxmessage" value="' + eljLoadingMessage + '">';
                 str += '<param name="UserAgent" value="' + escape(navigator.userAgent
                 str += '<param name="DebugLevel" value="' + sDebugLevel + '">';
                 str += '<param name="Logger" value="' + sLogger + '">';
                 str += '<param name="PageID" value="' + iPageID + '">';
                Â
                 //Custom PARAM elements
                 var index = 0;
                 while(index < paramNames.length) {
                      str += '<param';
                      str += ' name="' + paramNames[index] + '"';
                      str += ' value="' + paramValues[index] + '"'
                      str += '>';
                      index++;
                 } //end while
                 //OBJECT end tag
                 str += '</object>';
           } else if (IsNetscape == true) {
                 //Start of EMBED start tag
                 str += '<EMBED';
                 //Standard attributes
                 if(sMinimumJREVersion == "1.3.1"){
                      str += ' type="application/x-java-a
                 } else if(sMinimumJREVersion == "1.4.2"){
                      str += ' type="application/x-java-a
                 } else if(sMinimumJREVersion == "1.4.1"){
                      str += ' type="application/x-java-a
                 } else {
                      str += ' type="application/x-java-a
                 }
                 str += ' code="' + applet + '" ';
                 str += ' codebase="' + getURLbase() + '"';
                 str += ' cache_archive="' + classpath + '"';
                 str += ' archive="' + classpath + '"';
                 str += ' cache_option="Plugin"';
                 str += ' name="' + name + '"';
                 str += ' width="' + width + '"';
                 str += ' height="' + height + '"';
                 str += ' scriptable="true" ';
                 str += ' MAYSCRIPT=true ';
                Â
                 str += ' UserAgent="' + escape(navigator.userAgent
                 str += ' DebugLevel="' + sDebugLevel + '"';
                 str += ' Logger="' + sLogger + '"';
                 str += ' PageID="' + iPageID + '" ';
                Â
                 //Custom attributes
                 var index = 0;
                 while(index < paramNames.length){
                      //Attribute name
                      str += paramNames[index];
                      //Attribute value
                      str += '="' + paramValues[index] + '" ';
                      index++;
                 } //end while
                 //Java plug-in install instructions for Netscape
                 str += ' pluginspage="' + getURLbase() + downloadPath + 'plugin-install.html"';
                 //End of EMBED start tag
                 str += '>';
                 //NOEMBED element
                 str += '<NOEMBED>';
                 str += '</NOEMBED>';
                 //EMBED end tag
                 str += '</EMBED>';
                Â
           } else {
                 // Unknown windows browser.
                 str = '';
           }
      } else if (IsMac == true) {
           if(IsOSX) {
                 if (IsSafari == true || (AllowMacNetscape && IsNetscape)) {
                      //Start APPLET start tag
                      str += '<applet';
                      //Standard attributes
                      str += ' code="' + applet + '"';
                     Â
                      str += ' cache_archive="' + classpath + '"';
                      str += ' cache_option="Plugin"';
                      str += ' archive="' + classpath + '"';
                      str += ' codebase="' + getURLbase() + '"';
                      str += ' name="' + name + '"';
                      str += ' width="' + width + '"';
                      str += ' height="' + height + '"';
                      //End APPLET start tag
                      str += ' MAYSCRIPT>';
                      //Custom PARAM elements
                      var index = 0;
                      while(index < paramNames.length) {
                            str += '<param';
                            str += ' name="' + paramNames[index] + '" ';
                            str += ' value="' + paramValues[index] + '"';
                            str += '>';
                            index++;
                      } //end while
                     Â
                      str += '<param name="UserAgent" value="' + escape(navigator.userAgent
                      str += '<param name="DebugLevel" value="' + sDebugLevel + '">';
                      str += '<param name="Logger" value="' + sLogger + '">';
                      str += '<param name="progressbar" value="true">';
                      str += '<param name="boxmessage" value="' + eljLoadingMessage + '">';
                      str += '<param name="PageID" value="' + iPageID + '">';
                     Â
                      //write out window loc
                      var sFrameLoc = "";
                      var sTemp = ".";
                      var wCurrent = self;
                      var wParent = self.parent;
                      while (wParent != wCurrent) {
                           Â
                            for (i = 0; i < wParent.length; i++) {
                                 if (wParent.frames[i] == wCurrent) {
                                       sTemp = (".frames[" + i + "]") + sTemp;
                                 }
                            }
                            wCurrent = wParent;
                            wParent = wParent.parent;
                      }
                      sTemp = "window" + sTemp;
                      if (window.parent != self) {
                            sFrameLoc = sTemp;
                      }
                     Â
                      str += '<param name="JSWindowLoc" ';
                      str += ' value="' + sFrameLoc + '"';
                      str += '>';
                      //APPLET end tag
                      str +='</applet>';
                 } else {
                      str = '';
                 }
           } else {
                 str = '';
           }
      } else if(IsSolaris == true) {
           if(IsNetscape == true) {
                 //Start of EMBED start tag
                 str += '<EMBED';
                 //Standard attributes
                 str += ' type="application/x-java-a
                 str += ' code="' + applet + '" ';
                 str += ' codebase="' + getURLbase() + '"';
                 str += ' cache_archive="' + classpath + '"';
                 str += ' archive="' + classpath + '"';
                 str += ' cache_option="Plugin"';
                 str += ' name="' + name + '"';
                 str += ' width="' + width + '"';
                 str += ' height="' + height + '"';
                 str += ' scriptable="true" ';
                 str += ' MAYSCRIPT=true ';
                 str += ' UserAgent="' + escape(navigator.userAgent
                 str += ' DebugLevel="' + sDebugLevel + '"';
                 str += ' Logger="' + sLogger + '"';
                 str += ' PageID="' + iPageID + '"';
                 //Custom attributes
                 var index = 0;
                 while(index < paramNames.length) {
                      //Attribute name
                      str += paramNames[index];
                      //Attribute value
                      str += '="' + paramValues[index] + '" ';
                      index++;
                 } //end while
                 //Java plug-in install instructions for Netscape
                 str += ' pluginspage="https://java.sun.com/products/plugin/index.html#download"';
                 //End of EMBED start tag
                 str += '>';
                 //NOEMBED element
                 str += '<NOEMBED>';
                 str += '</NOEMBED>';
                 //EMBED end tag
                 str += '</EMBED>';
           } else {
                 // Unsupported browser.
                 str = '';
           }
      } else if (IsLinux == true) {
                 if (IsNetscape == true) {
                      //Start of EMBED start tag
                      str += '<EMBED';
     Â
                      //Standard attributes
                      str += ' type="application/x-java-a
                      str += ' code="' + applet + '" ';
                      str += ' codebase="' + getURLbase() + '"';
                      str += ' cache_archive="' + classpath + '"';
                      str += ' archive="' + classpath + '"';
                      str += ' cache_option="Plugin"';
                      str += ' name="' + name + '"';
                      str += ' width="' + width + '"';
                      str += ' height="' + height + '"';
                      str += ' scriptable="true" ';
                      str += ' MAYSCRIPT=true ';
                      str += ' UserAgent="' + escape(navigator.userAgent
                      str += ' DebugLevel="' + sDebugLevel + '"';
                      str += ' Logger="' + sLogger + '"';
                      str += ' PageID="' + iPageID + '"';
     Â
     Â
                      //Custom attributes
                      var index = 0;
                      while (index < paramNames.length) {
                            //Attribute name
                            str += paramNames[index];
                            //Attribute value
                            str += '="' + paramValues[index] + '" ';
                            index++;
                      } //end while
     Â
                      //Java plug-in install instructions for Netscape
                      str += ' pluginspage="https://java.sun.com/products/plugin/index.html#download"';
     Â
                      //End of EMBED start tag
                      str += '>';
     Â
                      //NOEMBED element
                      str += '<NOEMBED>';
                      str += '</NOEMBED>';
     Â
                      //EMBED end tag
                      str += '</EMBED>';
                 } else {
                      // Unsupported browser.
                      str = '';
                 }
      } //end if
      if(bForceUseTextArea) {
           bUseTextArea = true;
           bForceUseTextArea = false;
           bUpgradeOSXError = false;
           bLinuxError = false;
           bShowErrorMessage = false;
           str = '';
      }
      if (str == '' && !preload) {
           if (bShowErrorMessage) {
                 if(IsMac && !IsOSX){
                      str += "<p>The minimum operating system required to run EditLive! for Java on Apple Macintosh is MacOS X Update 10.1.1.<br>EditLive! for Java only supports Safari. Please ensure you are using Safari to browse.</p>"
                 } else if(IsLinux){
                      str += "<p>EditLive! for Java only supports Netscape Navigator 7.1 or Mozilla 1.4 running JRE 1.4.2 on Linux. Please ensure you are using the correct browser and JRE.</p>"
                 } else {
                      str += "<p>This system does not meet the minimum requirements to run EditLive! for Java. Now using a textarea instead.</p>";
                 }
           }
           str += EditLiveCommonStatic_getTe
      }
      return str;
}
function EditLiveCommonStatic_getTe
      var str = "";
      str += '<textarea name="'+hiddenName+'" rows='+ iTARows +' cols='+ iTACols +'>';
      var index = 0;
      while(index < paramNames.length) {
           if(paramNames[index] == "Body" || paramNames[index] == "Document"){
                 var docSource = paramValues[index];
                 str += unescape(docSource.replace
           }
           index++;
      } //end while
      str += '</textarea>';
      bUseTextArea = true;
      return str;
}
function EditLiveCommonStatic_getAu
      if (!createdDiv) {
           createdDiv = true;
           return EditLiveCommonStatic_creat
      }
}
function EditLiveCommonStatic_creat
      var str = "";
      if(IsMSIE || IsSafari)
      {
           str += '<div id="' + name + '" name="' + name + '" width="1" height="1"></div>';
      }
      else
      {
           var version = navigator.appVersion;
           if(version.charAt(0) != "4") {
                 str += '<div id="' + name + '" name="' + name + '"></div>';
           } else {
                 //str += '<layer id="' + name + '" name="' + name + '"></layer>';
           } //end if
      } //end if
      return str;
}
function EditLiveCommonStatic_getEd
      var str = "";
      if (IsMac) {
           str = '<table border="0" width="';
           str += width;
           str += '" height="';
           str += height;
           str += '" ><tr><td>';
           str += '<div style="';
           str += borderStyle;
           str += '">';
           str += appletTag;
           str += '</div>';
           var auxDiv = EditLiveCommonStatic_getAu
           if (auxDiv) {
                 str += '</td><td>';
                 str += auxDiv;
           }
           str += '</td></tr></table>';
      } else {
           str = '<div style="';
           str += borderStyle;
           str += '">';
           str += appletTag;
           str += '</div>';
           var auxDiv = EditLiveCommonStatic_getAu
           if (auxDiv) {
                 str += auxDiv;
           }
      }
      return str;
}
function EditLiveCommon_setShowButt
      var index = this.paramNames.length;
      this.paramNames[index] = "showButtonText";
      this.paramValues[index] = text;
}
function EditLiveCommon_setShowButt
      var index = this.paramNames.length;
      this.paramNames[index] = "showButtonIconURL";
      this.paramValues[index] = url;
}
function EditLiveCommon_setHideButt
      var index = this.paramNames.length;
      this.paramNames[index] = "hideButtonText";
      this.paramValues[index] = text;
}
function EditLiveCommon_setHideButt
      var index = this.paramNames.length;
      this.paramNames[index] = "hideButtonIconURL";
      this.paramValues[index] = url;
}
function EditLiveCommon_showAsButto
      var index = this.paramNames.length;
      this.paramNames[index] = "showAsButton";
      this.paramValues[index] = "true";
      index++;
      this.paramNames[index] = "popout";
      this.paramValues[index] = popout;
      this.show();
}
function EditLiveCommon_show() {
      dalert("Show");
      document.write(this.getApp
      if (!bUseTextArea) {
           var fields = this.getHiddenFields();
           var i = 0;
           while (i < fields.length) {
                 document.write('<input name="' + fields[i] + '" type="hidden">');
                 i++;
           }
      }
      if (this.bAutoSubmit) {
           EditLiveCommonStatic_getOn
      }
      this.started = true;
      dalert("End Show");
}
/*************************
 Write to onSubmit
**************************
function EditLiveCommonStatic_getOn
      var name = hiddenName;
      dalert("getOnSubmit: " + name);
     Â
      if(!bOnsubmit && EditLiveCommonStatic_isSup
           var bFound = false;
           bOnsubmit = true;
           //find form where ELJ exists
           var sAppletName = name;
           for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
                 for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex]
                      if(document.forms[formsInd
                            //found the form
                            fOnSubmit = document.forms[formsIndex]
                            document.forms[formsIndex]
                            bFound = true;
                            dalert("Attached to onsubmit.");
                      }
                      if(bFound){
                            break;
                      }
                 } //end for
                 if(bFound){
                      break;
                 }
           } //end for
      } //end if
} //getOnSubmit
function EditLiveCommonStatic_getTh
      var name = hiddenName;
      var bFound = false;
      bOnsubmit = true;
      //find form where ELJ exists
      var sAppletName = name;
      for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
           for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex]
                 if(document.forms[formsInd
                      //found the form
                      bFound = true;
                      return document.forms[formsIndex]
                 }
                 if(bFound){
                      break;
                 }
           } //end for
           if(bFound){
                 break;
           }
      } //end for
}
function EditLiveCommonStatic_submi
      setTimeout("EditLiveCommon
}
function EditLiveCommonStatic_doSub
      dalert("SubmitFunction");
      if(!IsMSIE && !IsSafari) {
           var version = navigator.appVersion;
           if(version.charAt(0) == "4") {
                 wNewWindow.close();
           } //end if
      } //end if
      var sAppletName = hiddenName;
      for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
           for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex]
                 if(document.forms[formsInd
                 //found the form
                      if(fOnSubmit == null) {
                            var submitIsObject;
                            if (IsNetscape) {
                                 submitIsObject = ((typeof document.forms[formsIndex]
                            } else {
                                 if ((document.forms[formsInde
                                       submitIsObject = true;
                                 } else {
                                       submitIsObject = false;
                                 }
                            }
                            if(submitIsObject){
                                 document.forms[formsIndex]
                                 document.forms[formsIndex]
                            } else {
                                 document.forms[formsIndex]
                            }
                            bGetContent = false;                           Â
                      } else {
                            var rVal = fOnSubmit();
                            if(rVal != false) {
                                 var submitIsObject = false;
                                 if (IsNetscape) {
                                       submitIsObject = ((typeof document.forms[formsIndex]
                                 } else {
                                       submitIsObject = ((document.forms[formsInde
                                 }
                                 if(submitIsObject){
                                       document.forms[formsIndex]
                                       document.forms[formsIndex]
                                 } else {
                                       document.forms[formsIndex]
                                 }
                            } //end if
                            bGetContent = false;
                      }//end if
                     Â
                 } //end if
           } //end for
      } //end for
}
/*************************
 Form submitting functions
**************************
function EditLiveCommonStatic_runPo
      if(IsMSIE)
      {
           document.all.item("eLAuxDi
      } //end if
      var appletName = 'POSTApplet';
      var appletClass = 'com.ephox.editlive.java2.
      var appletWidth = 1;
      var appletHeight = 1;
      if (IsMac) {
           appletHeight = 90;
      }
     Â
     Â
      var appletTag = EditLiveCommonStatic_gener
                 paramNames, paramValues, downloadPath, false);
     Â
      if (IsWindows && IsMSIE) {
           var myDiv = document.getElementById("e
           myDiv.innerHTML = appletTag;
      } else if (IsMSIE) {
           document.all.item("eLAuxDi
      } else {
           var version = navigator.appVersion;
           if(version.charAt(0) == "4" && !IsSafari) {
                 wNewWindow = window.open('','EditLive',
                 wNewWindow.document.open()
                 wNewWindow.document.write(
                 wNewWindow.document.close(
           } else {
                 var myDiv = document.getElementById("e
                 myDiv.innerHTML = appletTag;
           } //end if
      } //end if
}
function EditLiveCommonStatic_GetCo
dalert("Get Content");
      if(bGetContent){
           dalert("Already getting content.");
           return false;
      } //end if
      bGetContent = true;
      if (eljUseLiveConnect) {
           var applet = EditLiveCommonStatic_GetAp
           if (applet && ((IsWindows && IsMSIE) || applet.processSubmit)) {
                 applet.processSubmit(getEp
                 return false;
           }
      }
      var paramNames = new Array();
      var paramValues = new Array();
      paramNames[0] = "GetContent";
      paramValues[0] = "true";
      EditLiveCommonStatic_runPo
      return false;
}
function EditLiveCommon_setBorderSt
      this.borderStyle = style;
}
//************************
//This function is a regular combineURL but to make life easier it uses window.location.href
// as the absolute URL so we can use things like window.location.hostname instead of writing
// those functions somewhere else.
function combineDownloadURL ( sDirectory ) {
      var relURL = sDirectory;
      //every other reference in this file assumes downloadDirectory has no
      // trailing "/".  Rather than try to fix everywhere else, we'll just
      // rip out the trailing "/" if it is there.
      if (relURL.charAt(relURL.leng
           relURL = relURL.substr(0, relURL.length - 1);
      }
      //if relURL is absolute, forget about combining
      if (relURL.indexOf("://") != -1) return relURL;
     Â
      //we only want the path of the URL
      var absURL = removeFilename(window.loca
     Â
      //do the combining work
      switch(relURL.charAt(0)) {
     Â
           //relative to hostname
           case '/':
                 return window.location.protocol + "//" +
                      window.location.hostname + relURL;
                 break;
           //relative to absolute path
           case '.':
                 var sOldURL;
                 //cycle through relURL ripping directories off the absURL as we
                 // go up
                 while(relURL.substr(0,3) == "../") {
                      sOldURL = absURL;
                      absURL = absURL.substring(0, absURL.lastIndexOf('/'));
                      relURL = relURL.substr(relURL.index
                      //if the final two chars are "//" then the relative
                      // URL goes back too many folders, undo the previous rip
                      if (absURL.charAt(absURL.last
                            absURL = sOldURL
                      }
                 }
                 return absURL + "/" + relURL;
                 break;
                Â
           //is a subdir of the current dir
           default:
                 return absURL + "/" + relURL;
                 break;
      }
}
//get the main path of the URL, minus the xx.htm etc
function removeFilename ( sURL ) {
      if (sURL.lastIndexOf('.') > sURL.lastIndexOf('/')) {
           return sURL.substring(0, sURL.lastIndexOf('/'));
      } else {
           return sURL;
      }
}
//Set value for hidden form field
function setFormValue(sName, sValue) {
      dalert("Set form item: " + sName + " to " + sValue);
      for(var formsIndex = 0; formsIndex < document.forms.length; formsIndex++){
           for(var elementsIndex = 0; elementsIndex < document.forms[formsIndex]
                 if(document.forms[formsInd
                      document.forms[formsIndex]
                 }
           } //end for
      } //end for
      return false;
} //setFormValue
function eljTransferFocus() {
      var myDiv;
      if(IsMSIE)
      {
           myDiv = document.all.item("eLAuxDi
      }
      else
      {
           var version = navigator.appVersion;
           if(version.charAt(0) == "4") {
                 myDiv = document.ids.eLAuxDiv;
           } else {
                 myDiv = document.getElementById("e
           } //end if
      }
     Â
      // Find the next element we can focus on.
      if (IsMSIE) {
           var parent = myDiv.parentElement;
           var num = myDiv.sourceIndex + 1;
           var nextElem = document.all[num];
           while (!isFocusable(nextElem)) {
                 num++;
                 nextElem = document.all[num];
           }
           nextElem.focus();
      } else {
           var parent = myDiv.parentNode;
           var foundFocusable = false;
           while (!foundFocusable) {
                 var i = 0;
                 var foundMyDiv = false;
                 var firstDivMatch = true;
                 while (i < parent.childNodes.length && !foundFocusable) {
                      var child = parent.childNodes[i];
                      if (child == myDiv) {
                            foundMyDiv = true;
                      }
                      if (foundMyDiv) {
                            if (firstDivMatch) {
                                 firstDivMatch = false;
                            } else {
                                 var focusable = eljSearchTree(child);
                                 if (focusable) {
                                       myDiv = focusable;
                                       foundFocusable = true;
                                       break;
                                 }
                            }
                      }
                      i++;
                 }
                 if (!foundFocusable) {
                      myDiv = parent;
                      parent = parent.parentNode;
                 }
           }
          Â
           //alert(myDiv.tagName);
           //var win2 = window.open('','EditLive',
           //win2.close();
           myDiv.focus();
      }
}
function getURLbase() {
      var src = window.location.href;
      var indLoc = src.lastIndexOf("/");
      var URLBase = src.substr(0, indLoc + 1);
      strPath = new String(document.location);
      strPath = strPath.substr(0, strPath.lastIndexOf("/") + 1);
      return URLBase;
}
function dalert(message) {
      if (DEBUG) {
           alert(message);
      }
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks mrichmon -
I already began rebuilding my without ANY cfform tags. Â Will probably never use them again. Â It's just too much trouble.!
Thanks again.
I already began rebuilding my without ANY cfform tags. Â Will probably never use them again. Â It's just too much trouble.!
Thanks again.
The only thing cfform has going for it is built-in validation,
but you can do better and more flexible validation on your own with a standard html form.
Create your own javascript for validation right on the page (you're basicly only limited by your javascript skill level) and use coldfusion logic on your form action page for validation to account for users who have disabled javascript.
good luck ...