/*

    Copyright 2003-2007 Purdue University. 

    Developed by: Peter Turbek, Department of Mathematics, Computer Science, and Statistics, Purdue University Calumet.


    This file is part of CaluMath.

    CaluMath is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    CaluMath is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

//Comment: This file has two parts. The first deals with getting and setting properties of created objects. The main part of the file contains the commands that writes the Html code for the html documents created by the CaluMath Page Maker. It also contains the Html code written to the Edit and Cut and Paste window.//


//COMMENT: FUNCTIONS DEALING WITH GETTING AND SETTING A CaluMath.PM.PAGEMAKEROBJECT SETTING

//Comment: Each CaluMath.PM.PageMakerObject has a cm_optionsarray and a cm_requiredarray property. For example, for a set of axes it might have xstart=-10 and xfinish=20. This returns the value of the setting or the empty string if the CaluMath.PM.PageMakerObject does not have that setting. For example CaluMath.PM.PageMakerObject(object, "xstart") returns -10 in the above example, but returns "" if there were no setting for "xstart". 

//Comment: A PageMakerObject object's cm_optionsarray and cm_requiredarray consists of [name, value] pairs. This allows the name part to be searched and its value replaced. 

CaluMath.PM.GetPageMakerObjectSetting=function(){
   var tempobject=arguments[0];
   if(tempobject==null){
      return ;
   };
   var wantedsetting=arguments[1];
   //Comment: Early versions of CaluMath used something called a settings array for text objects. This subsequently was divided into a cm_required array and a cm_options array, corresponding to the selections made in the required and options tables respectively, which is used for all objects. If there is a settings array, then this is a text node and there will not be a cm_optionsarray or cm_requiredarray.
   //Comment: Because of this, the if statment below may never be satisfied anymore. 
   if(tempobject.settings != undefined){
      var settings=tempobject.settings;
      var tempreturn="";
      var settingslength=settings.length;
      settingsloop:
      for(var i=0; i<settingslength; i++){
         if(settings[i][0] ==wantedsetting){
            var tempreturn=settings[i][1];
            break settingsloop;
         };
      };
      if(tempreturn==null){
         tempreturn="";
      };
      return tempreturn;
   }
   else{
      //Comment: This is the way CaluMath currently works now. Each object has a cm_optionsarray and cm_requiredarray. Note that the cm_optionsarray is searched first and then the cm_requiredarray is searched.//  
      var settings=tempobject.cm_optionsarray;
      var tempreturn="";
      if(settings != null){
         var settingslength=settings.length;
         optionsloop:
         for(var i=0; i<settingslength; i++){
            if(settings[i][0] ==wantedsetting){
               var tempreturn=settings[i][1];
               break optionsloop;
            };
         };
      };
      if(tempreturn==null){
         tempreturn="";
      };
      if(tempreturn.match(/\S/)){
         return tempreturn;
      };
    
      var settings=tempobject.cm_requiredarray;
      var tempreturn="";
      if(settings != null){
         var settingslength=settings.length;
         requiredloop:
         for(var i=0; i<settingslength; i++){
            if(settings[i][0] ==wantedsetting){
               var tempreturn=settings[i][1];
               break requiredloop;
            };
         };
      };
      if(tempreturn==null){
         tempreturn="";
      };
      return tempreturn;
   };
};


//Comment: This should be obsolete, since the settings property has been changed into the cm_requiredarray and the cm_optionsarray. However, I have found out it is still used in Import Page. 

CaluMath.PM.SetPageMakerObjectSetting=function(){ //alerttest("Using the CaluMath.PM.SetPageMakerObjectSetting");
  var tempobject=arguments[0];
  var wantedsetting=arguments[1];
  var wantedvalue=arguments[2];

  var settings=tempobject.settings;
  var tempreturn="";
  if(settings != null){
     var settingslength=settings.length;
     var settingfound=false;
     smallloop:
     for(var i=0; i<settingslength; i++){
        if(settings[i][0] ==wantedsetting){
           settings[i][1]=wantedvalue;
           settingfound=true;
           break smallloop;
        };
     };
     if(settingfound==false){
        tempobject.settings.push([wantedsetting, wantedvalue]);
     };
  }
  else{
        tempobject.settings=[[wantedsetting, wantedvalue]];
  };
  return tempobject.settings;
};

//Comment: A PageMakerObject object's cm_optionsarray and cm_requiredarray consists of [name, value] pairs. CaluMath.PM.SetPageMakerObjectOption searches the name part  and replaces its value. If the name part is not found, then a new name value pair is created.

CaluMath.PM.SetPageMakerObjectOption=function(){
  var tempobject=arguments[0];
  var wantedsetting=arguments[1];
  var wantedvalue=arguments[2];

  var settings=tempobject.cm_optionsarray;
  var tempreturn="";
  if(settings != null){
     var settingslength=settings.length;
     var settingfound=false;
     smallloop:
     for(var i=0; i<settingslength; i++){
        if(settings[i][0] ==wantedsetting){
           settings[i][1]=wantedvalue;
           settingfound=true;
           break smallloop;
        };
     };
     if(settingfound==false){
        tempobject.cm_optionsarray.push([wantedsetting, wantedvalue]);
     };
  }
  else{
        tempobject.cm_optionsarray=[[wantedsetting, wantedvalue]];
  };
  return tempobject.options;
};

CaluMath.PM.SetPageMakerObjectRequired=function(){
  var tempobject=arguments[0];
  var wantedsetting=arguments[1];
  var wantedvalue=arguments[2];

  var settings=tempobject.cm_requiredarray;
  var tempreturn="";
  if(settings != null){
     var settingslength=settings.length;
     var settingfound=false;
     smallloop:
     for(var i=0; i<settingslength; i++){
        if(settings[i][0] ==wantedsetting){
           settings[i][1]=wantedvalue;
           settingfound=true;
           break smallloop;
        };
     };
     if(settingfound==false){
        tempobject.cm_requiredarray.push([wantedsetting, wantedvalue]);
     };
  }
  else{
        tempobject.cm_requiredarray=[[wantedsetting, wantedvalue]];
  };
  return tempobject.required;
};

//Comment: We should check if the object below is used at all. I don't believe it is. 

CaluMath.PM.ReplacePageMakerObjectSetting=function(){ 
  var tempobject=arguments[0];
  var wantedsetting=arguments[1];
  var replacement=arguments[2];
  var settings=tempobject.settings;
  var indexmatch=-1;
  if(settings != null){
     var settingslength=settings.length;
     smallloop:
     for(var i=0; i<settingslength; i++){
        if(settings[i][0] ==wantedsetting){
           var indexmatch=i;
        };
     };
  };
  if(indexmatch != -1){
     return tempobject.settings[indexmatch]=replacement;
  };
};

//COMMENT: EVERYTHING IN THE REST OF THIS FILE IS ENCLOSED INSIDE A TOPWINDOW==WINDOW CONDITIONAL
//COMMENT: MORE TOPWINDOW==WINDOW THINGS. WE DEFINE THE MAIN OBJECT, CaluMath.PM.PAGEMAKEROBJECTCREATOR AND THE FUNCTION USED TO CREATE THESE OBJECTS. THIS IS ONLY DEFINED IN TOPWINDOW. SECONDARY WINDOWS USE THIS IN THE TOP WINDOW TO ENSURE THAT THE OBJECTS ARE CONSTRUCTED IN THE TOPWINDOW.
if(CM_TopWindow==window){
 
CaluMath.PM.EveryObjectArray=new Array();

//Comment: CaluMath.PM.PageMakerObjectCreator is the constructor for the class we shall refer to as PageMakerObjects; these are the objects the user constructs using the CaluMath Page Maker. For example, a set of axes, a point, text etc. are all PageMakerObjects.
//Comment: Note that each object is given an html name. Also a reference to the object (indexed by the html name) is placed in the CaluMath.PM.PageMakerObjectParent object. When an Edit or Cut and Paste window is created, the entries in the lists that represent the object are given this html name in the created window. When a user clicks on the object, the onclick function looks up the htmlname in the CaluMath.PM.PageMakerObjectParent and thus is able to know what PageMakerObject should be activated (in terms of making the tables to edit it, for example). 
//Comment: Note that CaluMath.PM.PageMakerObjectCreator is never called directly. In the cm_initialization file, the CaluMath.PM.PageMakerObject function is actually used to create these objects. It invokes the CaluMath.PM.PageMakerObjectCreator and then adds additional properties. 

CaluMath.PM.PageMakerObjectCreator= function(){ 
   this.type=arguments[0];
   if(arguments[0] != "CM_MainWindow"){
      this.htmlname="htmlelement"+CaluMath.PM.HTMLElementIndex++;
      CaluMath.PM.PageMakerObjectParent[this.htmlname]=this;
   };
};

CaluMath.PM.PageMakerTextObjectCreator= function(){ alert("Using CaluMath.PM.PageMakerTextObjectCreator. I want to know if this ever occurs");
   this.type=arguments[0];
   if(arguments[0] != "CM_MainWindow"){
      this.htmlname="htmlelement"+CaluMath.PM.HTMLElementIndex++;
      CaluMath.PM.PageMakerObjectParent[this.htmlname]=this;
   };
};

//Comment: The CaluMath.PM.PageMakerObjectCreator function defines a class of objects. Below we define methods for this class.

CaluMath.PM.PageMakerObjectCreator.prototype.defaultobject=function(){
   //Comment: This returns the default object for the object on which it is invoked. The default object has methods that creates the required and options tables that the user makes selections from in the creation of objects. 
   return CM_TopWindow["CaluMath"]["PM"]["PageMaker"+this.type+"Default"];
};

CaluMath.PM.PageMakerObjectCreator.prototype.listarray=function(){
   return this.defaultobject().ListArray;
};


CaluMath.PM.PageMakerObjectCreator.prototype.toString=function(){
   return this.type;
};
CaluMath.PM.PageMakerObjectCreator.prototype.cm_getsetting=function(){
   var args= arguments;
   return CaluMath.PM.GetPageMakerObjectSetting(this, args[0], args[1]);
};

//Comment: This is probably deprecated.
CaluMath.PM.PageMakerTextObjectCreator.prototype.cm_getsetting=CaluMath.PM.PageMakerObjectCreator.prototype.cm_getsetting;


CaluMath.PM.PageMakerObjectCreator.prototype.cm_setoption=function(){
   var args= arguments;
   return CaluMath.PM.SetPageMakerObjectOption(this, args[0], args[1], args[2]);
};
CaluMath.PM.PageMakerObjectCreator.prototype.cm_setrequired=function(){
   var args= arguments;
   return CaluMath.PM.SetPageMakerObjectRequired(this, args[0], args[1], args[2]);
};

CaluMath.PM.PageMakerTextObjectCreator.prototype.cm_setoption=function(){ alerttest("I want to see if CaluMath.PM.PageMakerTextObjectCreator.prototype.cm_setoption is ever used.");
   var args= arguments;
   if(args[0]!="inserttarget"){
      CaluMath.PM.SetPageMakerObjectSetting(this, args[0], args[1]); 
   }
   else{
      var tempoldinserttarget=this.cm_getsetting("inserttarget");
      CaluMath.PM.SetPageMakerObjectSetting(this, args[0], args[1]); 
      var newinserttarget= args[1];
      var oldreg = new RegExp("insertin="+tempoldinserttarget,"g")
      this.endstring=this.endstring.replace(oldreg,"insertin="+newinserttarget);
      var oldreg = new RegExp("insertbefore="+tempoldinserttarget,"g")
      this.endstring=this.endstring.replace(oldreg,"insertbefore="+newinserttarget);
      var oldreg = new RegExp("insertafter="+tempoldinserttarget,"g")
      this.endstring=this.endstring.replace(oldreg,"insertafter="+newinserttarget);
   };
};

CaluMath.PM.PageMakerObjectCreator.prototype.cm_setrequiredoroption= function(){

  var tempobject=this;
  var wantedsetting=arguments[0];
  var wantedvalue=arguments[1];

  var settings=tempobject.cm_requiredarray;
  var tempreturn="";
  if(settings != null){
     var settingslength=settings.length;
     var settingfound=false;
     smallloop:
     for(var i=0; i<settingslength; i++){
        if(settings[i][0] ==wantedsetting){
           settings[i][1]=wantedvalue;
           settingfound=true;
           break smallloop;
        };
     };
  };

  if(settingfound==false){
     var settings=tempobject.cm_optionsarray;
     var tempreturn="";
     if(settings != null){
        var settingslength=settings.length;
        var settingfound=false;
        smallloop2:
        for(var i=0; i<settingslength; i++){
           if(settings[i][0] ==wantedsetting){
              settings[i][1]=wantedvalue;
              settingfound=true;
              break smallloop2;
           };
        };
     };
  };
  return tempobject.settings;
};


//Comment: Certain items require special things to be written at the beginning of their Html. CaluMath.PM.PageMakerObjectCreator.prototype.cm_openingtag accomplishes this. 

CaluMath.PM.PageMakerObjectCreator.prototype.cm_openingtag=function(){
   var tempbranchtype;
   CaluMath.PM.SetWriteTag(this);

   if(this.cm_getsetting("cm_onlyforlists")=="yes"){
      return "";
   };
   if( CaluMath.PM.DetermineAncestor(this, "type","newwindow")==false  && this.cm_getsetting("writetag")=="yes" && this.type != "htmltext" &&  this.type != "text" && this.type != "coordinates"){
      var tempreturn = '\n ';
   }
   else{
      var tempreturn = ' ';
   };
   if(this.type=="buttonaction"){
      tempreturn= tempreturn +'eval("'+this.cm_getsetting("button")+'".cm_javascript()).'+this.cm_getsetting("type")+'(function(){';

   }
   if(this.type=="forloop"){
      var increment= this.cm_getsetting("cm_increment");
      var variable= this.cm_getsetting("cm_variable");
      if(increment== null || increment=="" || increment==1){
         var returnincrement= variable+"++";
         tempreturn= tempreturn +' for( '+this.cm_getsetting("cm_variable")+'='+this.cm_getsetting("cm_begin")+'\; '+this.cm_getsetting("cm_variable") +'< '+this.cm_getsetting("cm_end")+' \; '+returnincrement+'){';
      }
      else if(increment==-1){
         var returnincrement= variable+"--";
         tempreturn= tempreturn +' for( '+this.cm_getsetting("cm_variable")+'='+this.cm_getsetting("cm_begin")+'\; '+this.cm_getsetting("cm_variable") +'> '+this.cm_getsetting("cm_end")+' \; '+returnincrement+'){';
      }
      else if(1*increment >0){
         var returnincrement= variable+"=" +variable +"+"+increment;
         tempreturn= tempreturn +' for( '+this.cm_getsetting("cm_variable")+'='+this.cm_getsetting("cm_begin")+'\; '+this.cm_getsetting("cm_variable") +'< '+this.cm_getsetting("cm_end")+' \; '+returnincrement+'){';
      }
      else{
         var returnincrement= variable+"=" +variable +"-"+(-1*increment);
         tempreturn= tempreturn +' for( '+this.cm_getsetting("cm_variable")+'='+this.cm_getsetting("cm_begin")+'\; '+this.cm_getsetting("cm_variable") +'> '+this.cm_getsetting("cm_end")+' \; '+returnincrement+'){';
      };
//      tempreturn= tempreturn +' for( '+this.cm_getsetting("cm_variable")+'='+this.cm_getsetting("cm_begin")+'\; '+this.cm_getsetting("cm_variable") +'< '+this.cm_getsetting("cm_end")+' \; '+this.cm_getsetting("cm_variable") +'\+\+){';
   }
   else if(this.type=="cm_alert"){
      tempreturn= tempreturn +this.cm_getsetting("alerttype")+'("';
   }
   else if(this.type=="iframe"){
      if(this.parent.type =="iframecontainer" || this.parent.type =="table" || this.parent.type =="tablerow" || this.parent.type =="tablecell"   ){  
         tempreturn= ''
      }
      else if(this.parent.type =="newwindow"){
         return 'CM_NewWindowHtml';
      }
      else{
         tempreturn= '<\/script>';
      };
   }
   else if(this.type=="table"){

      var temprequiredborder = CaluMath.PM.GetPageMakerObjectSetting(this,"border");
      var temprequiredborderspacing = CaluMath.PM.GetPageMakerObjectSetting(this,"borderspacing");
      var temprequiredbackgroundcolor = CaluMath.PM.GetPageMakerObjectSetting(this,"backgroundcolor");
      var temprequireddisplay = CaluMath.PM.GetPageMakerObjectSetting(this,"display");
      var temprequiredcolor = CaluMath.PM.GetPageMakerObjectSetting(this,"color");
      var temprequiredtextalign = CaluMath.PM.GetPageMakerObjectSetting(this,"text-align");
      var temprequiredfontsize = CaluMath.PM.GetPageMakerObjectSetting(this,"font-size");
      var temprequiredwidth = CaluMath.PM.GetPageMakerObjectSetting(this,"width");
      var temprequiredname = CaluMath.PM.GetPageMakerObjectSetting(this,"name");
      var stylestring='style="';

      if(temprequiredborderspacing != "n/a" && temprequiredborderspacing != ""){
         stylestring= stylestring+'border-spacing:'+temprequiredborderspacing+'\;' 
      };
      if(temprequiredbackgroundcolor!= "n/a" && temprequiredbackgroundcolor != ""){
         stylestring= stylestring+'background-color:'+temprequiredbackgroundcolor+'\;' 
      };
      if(temprequiredcolor!= "n/a" && temprequiredcolor != ""){
         stylestring= stylestring+'color:'+temprequiredcolor+'\;' 
      };
      if(temprequiredtextalign!= "n/a" && temprequiredtextalign != ""){
         stylestring= stylestring+'text-align:'+temprequiredtextalign+'\;' 
      };
      if(temprequiredfontsize!= "n/a" && temprequiredfontsize != ""){
         stylestring= stylestring+'font-size:'+temprequiredfontsize+'\;' 
      };
      if(temprequireddisplay!= "n/a" && temprequireddisplay != ""){
         stylestring= stylestring+'display:'+temprequireddisplay+'\;' 
      };
      if(temprequiredwidth!= "n/a" && temprequiredwidth != ""){
         stylestring= stylestring+'width:'+temprequiredwidth+'\;' 
      };

      if(stylestring=='style="'){
         stylestring="";
      }
      else{
         stylestring=stylestring+'" ';
      };
 
      if(temprequiredborder != "n/a" && temprequiredborder != ""){
         var borderstring= 'border="'+temprequiredborder+'"';
      }
      else{
         var borderstring="";
      };


         //Comment: Most style properties will be blank. This gets rid of the blank entries. 

      var numberofrows= this.cm_getsetting("rows"); 
      var numberofcolumns= this.cm_getsetting("columns"); 
      if(CaluMath.PM.GetPageMakerObjectSetting(this,"border").length >0){
         var border= 'border="' + CaluMath.PM.GetPageMakerObjectSetting(this,"border")+'px"';
      }
      else{
          var border='';
      };

      if(CaluMath.PM.GetPageMakerObjectSetting(this,"dynamic")=="no"){
//         alert(["Here is this.parent", this.parent, this.parent.cm_getsetting ? this.parent.cm_getsetting("dynamic"): "no setting" ]);
         CaluMath.PM.AssignParents();
         if(this.parent =="newwindow"){
            return 'CM_NewWindowHtml<table id="'+temprequiredname+'" '+border+' '+stylestring+' ><tbody>';
         }
         else if(this.parent=="iframecontainer" || this.parent=="iframe" ){
            return '<table id="'+temprequiredname+'" '+border+' '+stylestring+' ><tbody>';
         }
         else if(this.parent != null && this.parent != null && this.parent.type=="tablecell" ){
alert("You have nested a non-dynamic table inside another non-dynamic table. This will cause an error");
            return '<table id="'+temprequiredname+'" '+border+' '+stylestring+' ><tbody>';
         }
         else{
            return '<\/script><table id="'+temprequiredname+'" '+border+' '+stylestring+' ><tbody>';
         };
      }
      else{
          return ' \'<table id=CM_SINGLEQUOTE'+temprequiredname+'CM_SINGLEQUOTE border=CM_SINGLEQUOTE'+CaluMath.PM.GetPageMakerObjectSetting(this,"border")+'pxCM_SINGLEQUOTE '+stylestring+' ><tbody>';
      };
   }
   else if(this.type=="tablerow"){

      var temprequiredborderstyle = this.cm_getsetting("borderstyle");
      var temprequiredborderwidth = this.cm_getsetting("borderwidth");
      var temprequiredbordercolor = this.cm_getsetting("bordercolor");
      var temprequiredbackgroundcolor = this.cm_getsetting("backgroundcolor");
      var temprequiredtextalign = this.cm_getsetting("textalign");
      var temprequiredverticalalign = this.cm_getsetting("verticalalign");

            var stylestring= ''
      if(temprequiredborderstyle != "n/a"  != null && temprequiredborderstyle != "n/a"  && temprequiredborderstyle.length >0 ){
         stylestring=stylestring+'border-style:'+temprequiredborderstyle+'\; ';
      };
      if(temprequiredborderwidth != null && temprequiredborderwidth != "n/a" && temprequiredborderwidth.length >0 ){
         stylestring=stylestring+'border-width:'+temprequiredborderwidth+'\; ';
      };
      if(temprequiredbordercolor != null && temprequiredbordercolor != "n/a" && temprequiredbordercolor.length >0 ){
         stylestring=stylestring+'border-color:'+temprequiredbordercolor+'\; ';
      };
      if(temprequiredbackgroundcolor != null && temprequiredbackgroundcolor != "n/a" && temprequiredbackgroundcolor.length >0){
         stylestring=stylestring+'background-color:'+temprequiredbackgroundcolor+'\; ';
      };
      if(temprequiredtextalign != null && temprequiredtextalign != "n/a" && temprequiredtextalign.length >0){
         stylestring=stylestring+'text-align:'+temprequiredtextalign+'\; ';
      };
      if(temprequiredverticalalign != null && temprequiredverticalalign != "n/a" && temprequiredverticalalign.length >0){
         stylestring=stylestring+'vertical-align:'+temprequiredverticalalign+'\; ';
      };

      if(stylestring.length >0){
         stylestring= 'style="'+stylestring+'"';
      };

            //Comment: Most style properties will be blank. This gets rid of the blank entries. 

            CaluMath.PM.AssignParents();
            if(CaluMath.PM.GetPageMakerObjectSetting(this.parent, "dynamic")=="yes"){
               stylestring=stylestring.replace(/\"/g,"CM_SINGLEQUOTE");
            }; 
            return '<tr '+stylestring+'>'; 
  }
   else if(this.type=="tablecell"){
      var temprequiredborderstyle = this.cm_getsetting("borderstyle");
      var temprequiredborderwidth = this.cm_getsetting("borderwidth");
      var temprequiredbordercolor = this.cm_getsetting("bordercolor");
      var temprequiredbackgroundcolor = this.cm_getsetting("backgroundcolor");
      var temprequiredwidth = this.cm_getsetting("width");
      var temprequiredtextalign = this.cm_getsetting("textalign");
      var temprequiredverticalalign = this.cm_getsetting("verticalalign");

      var stylestring= ''
      if(temprequiredborderstyle != "n/a"  != null && temprequiredborderstyle != "n/a"  && temprequiredborderstyle.length >0 ){
         stylestring=stylestring+'border-style:'+temprequiredborderstyle+'\; ';
      };
      if(temprequiredborderwidth != null && temprequiredborderwidth != "n/a" && temprequiredborderwidth.length >0 ){
         stylestring=stylestring+'border-width:'+temprequiredborderwidth+'\; ';
      };
      if(temprequiredbordercolor != null && temprequiredbordercolor != "n/a" && temprequiredbordercolor.length >0 ){
         stylestring=stylestring+'border-color:'+temprequiredbordercolor+'\; ';
      };
      if(temprequiredbackgroundcolor != null && temprequiredbackgroundcolor != "n/a" && temprequiredbackgroundcolor.length >0){
         stylestring=stylestring+'background-color:'+temprequiredbackgroundcolor+'\; ';
      };
      if(temprequiredwidth != null && temprequiredwidth != "n/a" && temprequiredwidth.length >0){
         stylestring=stylestring+'width:'+temprequiredwidth+'\; ';
      };
      if(temprequiredtextalign != null && temprequiredtextalign != "n/a" && temprequiredtextalign.length >0){
         stylestring=stylestring+'text-align:'+temprequiredtextalign+'\; ';
      };
      if(temprequiredverticalalign != null && temprequiredverticalalign != "n/a" && temprequiredverticalalign.length >0){
         stylestring=stylestring+'vertical-align:'+temprequiredverticalalign+'\; ';
      };

      if(stylestring.length >0){
         stylestring= 'style="'+stylestring+'"';
      };


      //Comment: Most style properties will be blank. This gets rid of the blank entries. 

      CaluMath.PM.AssignParents();
      if(CaluMath.PM.GetPageMakerObjectSetting(this.parent.parent, "dynamic")=="yes"){
         stylestring=stylestring.replace(/\"/g,"CM_SINGLEQUOTE");
      }; 
      return '<td '+stylestring+'>'; 
  }
   else if(this.type=="list"){

      var temprequiredtype = CaluMath.PM.GetPageMakerObjectSetting(this,"type");
      var temprequiredposition = CaluMath.PM.GetPageMakerObjectSetting(this,"position");
      var temprequireddisplay = CaluMath.PM.GetPageMakerObjectSetting(this,"display");

      var temprequiredname = CaluMath.PM.GetPageMakerObjectSetting(this,"name");
      var temprequiredordered = CaluMath.PM.GetPageMakerObjectSetting(this,"listtype");
      var stylestring='style=CM_DOUBLEQUOTE';
      if(temprequiredtype != "n/a"){
         stylestring=stylestring+'list-style-type:'+temprequiredtype+'\; ';
      }
      if(temprequiredposition != "n/a"){
         stylestring=stylestring+'list-style-position:'+temprequiredposition+'\; ';
      }
      if(temprequireddisplay == "none"){
         stylestring=stylestring+' display:none\;'; 
      }
      if(stylestring != 'style=CM_DOUBLEQUOTE'){
         stylestring=stylestring+'CM_DOUBLEQUOTE';
      }
      else{
         stylestring='';
      };

      return ' "<'+temprequiredordered+' id=CM_SINGLEQUOTE'+temprequiredname+'CM_SINGLEQUOTE '+stylestring+' >';
   }
   else if(this.type=="listitem"){

      var temprequiredbackgroundcolor = this.cm_getsetting("backgroundcolor");
      var temprequiredtextalign = this.cm_getsetting("textalign");
      var temprequiredverticalalign = this.cm_getsetting("verticalalign");

            var stylestring= 'style="'
            if(temprequiredbackgroundcolor != "n/a"){
               stylestring=stylestring+'background-color:'+temprequiredbackgroundcolor+'\; ';
            };
            stylestring=stylestring+'text-align:'+temprequiredtextalign+'\; ';
            stylestring=stylestring+'vertical-align:'+temprequiredverticalalign+'\; ';
            stylestring=stylestring+'"';
            stylestring=stylestring.replace(/\"/g,"CM_SINGLEQUOTE");

            return '<li '+stylestring+'>'; 

   }
   else if(this.type=="definitionlisttitle"){
       return '<dt>';
   }
   else if(this.type=="definitionlistdata"){
       return '<dd>';
   }
   else if(this.type=="conditional"){
      var tempbranchtype= this.cm_getsetting("branchtype");
      if(tempbranchtype == "else"){
         tempreturn = ''+tempbranchtype+'{';  
      }
      else if(tempbranchtype == "if"){
         if(this.parent==CaluMath.PM.PageMakerObjectArray){
            tempreturn =' '+tempbranchtype+'(';   
         }
         else{
            tempreturn =tempbranchtype+'(';   
         };
      }
      else if(tempbranchtype == "if only"){
         if(this.parent==CaluMath.PM.PageMakerObjectArray){
           tempreturn ='  if(';   
         }
         else{
            tempreturn='if(';   
         };
      }
      else{
         tempreturn =''+tempbranchtype+'(';   
      };
   }
   else if(this.type=="routine"){
      tempreturn = tempreturn+' '+this.cm_getsetting("name")+' = function(){';
   }
   else if(this.type=="newwindow"){
      tempreturn = tempreturn +' CaluMath.Html.NewWindow("'+this.cm_getsetting("name")+'", [';
   }
   else if(this.type=="htmltext"){
      var optionsarray= this.cm_optionsarray;
      var optionsarraylength=optionsarray.length;
      var optionsstring ='style="'
      for(var i=0; i< optionsarraylength; i++){
         if(optionsarray[i][0].match(/^style/) && optionsarray[i][1].cm_constructorname == "String" && optionsarray[i][1].match(/\w/)){
            optionsstring=optionsstring+optionsarray[i][0].replace(/^style/,"").replace(/SELECT$/, "").replace(/([A-Z])/,"-$1").toLowerCase()+':'+optionsarray[i][1]+'\;';
         };
      };
      if(optionsstring =='style="'){
         optionsstring='';
      }
      else{
         optionsstring=optionsstring+'"'; 
      };
//      if(this.cm_getsetting("caswindow").length>0){
      if(this.parent.type == null || this.parent.type != "htmltext" ){
         var tempreturn = tempreturn +  '(\'CM_OpeningTagSymbol'+this.cm_getsetting("tag")+' id="'+this.cm_getsetting("name")+'" '+optionsstring +'  >';
      }
      else{
         var tempreturn = '<'+this.cm_getsetting("tag")+'  id="'+this.cm_getsetting("name")+'" '+optionsstring +'  >';
      };
   }
   else if(this.type=="text"){
      tempreturn = '';
   }
   else if(this.type=="iframecontainer"){
      if(this.parent.type =="iframecontainer" || this.parent.type =="tablecell"){  
         tempreturn= '<div id="'+this.cm_getsetting("name")+'"  style="display:'+this.cm_getsetting("visibility")+'" >';
      }
      else if(this.parent.type =="newwindow"){  
         tempreturn= 'CM_NewWindowHtml<div id="'+this.cm_getsetting("name")+'"  style="display:'+this.cm_getsetting("visibility")+'" >';
      }
      else{
         tempreturn= '<\/script><div id="'+this.cm_getsetting("name")+'"  style="display:'+this.cm_getsetting("visibility")+'" >';
      }
   }
   else if(this.type=="newplot"){

      var tempname = this.cm_getsetting("name");
 
      var tempstatic = CaluMath.PM.IsEntirelyInStaticObjects(this);
      var isinnewwindow = CaluMath.PM.IsContainedInANewWindow(this);

      var tempcaswindow= this.cm_getsetting("cm_caswindow");
      var tempinsertoption= this.cm_getsetting("insertoption");
      if(this.parent != null && this.parent.type =="iframecontainer"){
//            tempreturn = '<iframe src="'+CaluMath.PM.DotsInPathToCaluMathFolder+'cm_library/cm_blank.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
            tempreturn = '<iframe src="place_this_in_folder_with_web_pages.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
      }
      else if(this.parent != null && this.parent.type =="iframe"){
            tempreturn = '\n'+CM_ScriptTag+'>';
      }
      else if(tempstatic=="yes"){
         if(this.parent != null && this.parent.type=="newwindow"){
//            tempreturn = 'CM_NewWindowHtml<iframe src="'+CaluMath.PM.DotsInPathToCaluMathFolder+'cm_library/cm_blank.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"><CM_FORWARDSLASHiframe>'+CM_ScriptTag+'>';
            tempreturn = 'CM_NewWindowHtml<iframe src="place_this_in_folder_with_web_pages.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"><CM_FORWARDSLASHiframe>'+CM_ScriptTag+'>';
         }
         else if(this.parent != null && (this.parent.type=="iframecontainer" || this.parent.type=="tablecell") ){
            if(isinnewwindow =="yes"){
//               tempreturn = '<iframe src="'+CaluMath.PM.DotsInPathToCaluMathFolder+'cm_library/cm_blank.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
               tempreturn = '<iframe src="place_this_in_folder_with_web_pages.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
            }
            else{
//               tempreturn = '<iframe src="'+CaluMath.PM.DotsInPathToCaluMathFolder+'cm_library/cm_blank.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
               tempreturn = '<iframe src="place_this_in_folder_with_web_pages.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
            };
         }
         else{
//            tempreturn = '<\/script><iframe src="'+CaluMath.PM.DotsInPathToCaluMathFolder+'cm_library/cm_blank.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
            tempreturn = '<\/script><iframe src="place_this_in_folder_with_web_pages.html" class="cm_iframe"  name="cm_iframefor'+tempname+'" scrolling="no"  frameborder="0" marginheight="1px" marginwidth="1px" width="300" height="300"></iframe>'+CM_ScriptTag+'>';
         };
      };
   }     
   return tempreturn;
}; 

//Comment: I am not sure if this is used. This is what I thought: Occasionally an item the user creates needs to be displayed temporarily in the CM_PageMaker. This occurs, for example, when creating special inserted text. CaluMath.PM.PageMakerObjectCreator.prototype.cm_inpageopeningtag takes care of anything that needs to be written at the beginning of the Html for the object.
CaluMath.PM.PageMakerObjectCreator.prototype.cm_inpageopeningtag=function(){ 
   var tempreturn='';
   if(this.type=="htmltext"){
      var optionsarray= this.cm_optionsarray;
      var optionsarraylength=optionsarray.length;
      var optionsstring ='style="'
      for(var i=0; i< optionsarraylength; i++){
         if(optionsarray[i][0].match(/^style/) && optionsarray[i][1].cm_constructorname == "String" && optionsarray[i][1].match(/\w/)){
            optionsstring=optionsstring+optionsarray[i][0].replace(/^style/,"").replace(/SELECT$/, "").replace(/([A-Z])/,"-$1").toLowerCase()+':'+optionsarray[i][1]+'\;';
         };
      };
      if(optionsstring =='style="'){
         optionsstring='';
      }
      else{
         optionsstring=optionsstring+'"'; 
      };
//         tempreturn = '<'+this.cm_getsetting("tag")+'  id="'+this.cm_getsetting("name")+'" '+optionsstring +'  >';
         tempreturn = '<'+this.cm_getsetting("tag")+'  id="'+this.cm_getsetting("name")+'" '+optionsstring +'  >';
   }
   return tempreturn;
};

//Comment: Certain items require special things to be written at the end of their Html. CaluMath.PM.PageMakerObjectCreator.prototype.cm_closingtag accomplishes this. 

CaluMath.PM.PageMakerObjectCreator.prototype.cm_closingtag=function(){
   var tempbranchtype
   if(this.cm_getsetting("cm_onlyforlists")=="yes"){
      return "";
   };

   if( CaluMath.PM.DetermineAncestor(this, "type","newwindow")==false &&   this.cm_getsetting("writetag")=="yes" && this.type != "htmltext" &&  this.type != "text" && this.type != "coordinates"){
//      var tempreturn ='\n</\script> ';
      var tempreturn ='\n ';
   }
   else{
      var tempreturn = '';
   };

   if(this.type=="buttonaction"){
      tempreturn ='})\; '+tempreturn;   
   }
   if(this.type=="forloop"){
      tempreturn ='}\; '+tempreturn;   
   }
   else if(this.type=="cm_alert"){
      tempreturn ='".cm_unescapequotes().cm_javascript().cm_unicode())\; '+tempreturn;   
   }
   else if(this.type=="iframe"){
      if(this.parent.type =="iframecontainer" || this.parent.type =="table" || this.parent.type =="tablerow" || this.parent.type =="tablecell" || this.parent.type =="newwindow"){  
         tempreturn ='';
      }
      else{
         tempreturn =''+CM_ScriptTag+'>';
      };
   }   
   else if(this.type=="table"){

      var numberofrows= this.cm_getsetting("rows"); 
      var numberofcolumns= this.cm_getsetting("columns"); 

      var tempname = this.cm_getsetting("name");
      tempstring= ' var temptable = document.getElementById("'+tempname+'");  ';
      for(var i=0; i< numberofrows; i++){
         tempstring= tempstring+' '+tempname +'R'+i+'=temptable.rows['+i+']; '; 
         for(var j=0; j< numberofcolumns; j++){
            tempstring= tempstring+' '+tempname +'R'+i+'C'+j+'=temptable.rows['+i+'].cells['+j+']; '; 
         };
      };
      tempstring= tempstring+'\; ';

  
      if(CaluMath.PM.GetPageMakerObjectSetting(this,"dynamic")=="no"){

         if(this.parent =="newwindow"){
            return '<CM_FORWARDSLASHtbody><CM_FORWARDSLASHtable>'+CM_ScriptTag+'>'+tempstring+'<CM_FORWARDSLASHscript> ';  
         }
         else if(this.parent=="iframecontainer" || this.parent=="iframe" ){
            return  '<\/tbody><\/table>'+CM_ScriptTag+'>'+tempstring+'  <\/script>';  
         }
         else{
            return  '<\/tbody><\/table>'+CM_ScriptTag+'>'+tempstring+'  ';  
         };
      }
      else{
         if(this.cm_getsetting("cm_insertoption") != "n/a"){
            return '<CM_FORWARDSLASHtbody><CM_FORWARDSLASHtable>\'.cm_escapequotes().cm_escapebackslashes().cm_html("name='+tempname+','+this.cm_getsetting("cm_insertoption")+'='+this.cm_getsetting("cm_inserttarget")+'")\; if(cm_onloadbegun != "yes"){cm_onloadarray=cm_onloadarray.concat(function(){'+tempstring+'})} else{ '+tempstring+ '}\; '
         }
         else{
            return '<CM_FORWARDSLASHtbody><CM_FORWARDSLASHtable>\'.cm_escapequotes().cm_escapebackslashes().cm_html("name='+tempname+'")\; '+tempstring+' ';  
         };
      };
   }
   else if(this.type=="tablerow"){
      if(this.parent.cm_getsetting("cm_caswindow")=="CM_MainWindow" && this.parent.cm_getsetting("dynamic")=="no"){
         var endoftagsymbol="\/";
      }
      else{
         var endoftagsymbol="CM_FORWARDSLASH"; 
      };

       return "<"+endoftagsymbol+"tr>";
   }
   else if(this.type=="tablecell"){
      if(this.parent.parent.cm_getsetting("cm_caswindow")=="CM_MainWindow" && this.parent.parent.cm_getsetting("dynamic")=="no"){
         var endoftagsymbol="\/";
      }
      else{
         var endoftagsymbol="CM_FORWARDSLASH"; 
      };

       return "<"+endoftagsymbol+"td>";
   }
   else if(this.type=="list"){

      var numberofitems= this.cm_getsetting("items"); 
      var ordered= this.cm_getsetting("listtype"); 

      var tempname = this.cm_getsetting("name");


      tempstring= tempname+'.cm_namelistitems()\;  ';

   
         if(this.cm_getsetting("cm_insertoption") != "n/a" && this.cm_getsetting("cm_inserttarget") != "n/a"){
            return '<CM_FORWARDSLASH'+ordered+'>".cm_unescapesinglequotes().cm_html("name='+tempname+',cm_caswindow='+this.cm_getsetting("cm_caswindow")+','+this.cm_getsetting("cm_insertoption")+'='+this.cm_getsetting("cm_inserttarget")+'")\; if(cm_onloadbegun != "yes"){cm_onloadarray=cm_onloadarray.concat(function(){'+tempstring+'})} else{ '+tempstring+ '}\; '
         }
         else{
            return '<CM_FORWARDSLASH'+ordered+'>".cm_unescapesinglequotes().cm_html("name='+tempname+',cm_caswindow='+this.cm_getsetting("cm_caswindow")+'")\; '+tempstring+' ';  
         };
   }
   else if(this.type=="listitem"){
       return '<CM_FORWARDSLASHli>';
   }
   else if(this.type=="definitionlisttitle"){
       return '<CM_FORWARDSLASHdt>';
   }
   else if(this.type=="definitionlistdata"){
       return '<CM_FORWARDSLASHdd>';
   }
   else if(this.type=="tablerow"){
      if(this.parent.cm_getsetting("cm_caswindow")=="CM_MainWindow"){
         var endoftagsymbol="\/";
      }
      else{
         var endoftagsymbol="CM_FORWARDSLASH"; 
      };

       return "<"+endoftagsymbol+"tr>";
   }
   else if(this.type=="conditional"){
      var tempbranchtype=this.cm_getsetting("branchtype"); 
      if(tempbranchtype == "else"){
         if(this.parent==CaluMath.PM.PageMakerObjectArray){
            tempreturn='}';
         }
         else{
            tempreturn='}';
         };
      }
      else if(tempbranchtype == "if"){
         tempreturn ='}'; 
      }
      else if(tempbranchtype == "if only"){
         if(this.parent==CaluMath.PM.PageMakerObjectArray){
            tempreturn ='}'; 
         }
         else{
           tempreturn ='}'; 
         };
      }
      else{
         tempreturn ='}'; 
      };
   }
   else if(this.type=="routine"){
      tempreturn = ' }\; '+tempreturn;
   }
   else if(this.type=="newwindow"){
      tempreturn ='], "title='+this.cm_getsetting("title")+'")\; '+ tempreturn; 
   }
   else if(this.type=="htmltext"){

      if(this.parent.type == null || this.parent.type != "htmltext" ){
         if(this.cm_getsetting("cm_insertoption").length >0 && this.cm_getsetting("cm_insertoption") !="n/a" && this.cm_getsetting("cm_inserttarget") != "n/a"){
            if(this.cm_getsetting("name").length >0){
               tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_getsetting("cm_caswindow")+', cm_insertoption='+this.cm_getsetting("cm_insertoption")+', cm_inserttarget='+this.cm_getsetting("cm_inserttarget")+',name= '+this.cm_getsetting("name")+'")\;' + tempreturn;
            }
            else{
               tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_getsetting("cm_caswindow")+', cm_insertoption='+this.cm_getsetting("cm_insertoption")+', cm_inserttarget='+this.cm_getsetting("cm_inserttarget")+'")\;' + tempreturn;
            };
         }
         else{  
            if(this.cm_getsetting("cm_caswindow").length>0){ 
               if(this.cm_getsetting("name").length >0){
                  tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_getsetting("cm_caswindow")+',name= '+this.cm_getsetting("name")+'")\;'+tempreturn;
               }
               else{
                  tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_getsetting("cm_caswindow")+'")\;'+tempreturn;
               };
            }
            else if(this.cm_caswindow != null && this.caswindow.length >0 ){ 
               if(this.cm_getsetting("name").length >0){
                  tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_caswindow+',name= '+this.cm_getsetting("name")+'")\;'+tempreturn;
               }
               else{
                  tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_caswindow+'")\;'+tempreturn;
               };
            }
            else{ 
               //Comment: In this case the object probably has been moved to a place it wasn't normally. We default to setting the caswindow property to be the main window.
               this.cm_setoption("cm_caswindow", "CM_MainWindow");
//alerttest(["Doing setting of caswindow property", this.cm_getsetting("name"), this.cm_getsetting("caswindow")]);
               if(this.cm_getsetting("name").length >0){
                  tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_getsetting("cm_caswindow")+',name= '+this.cm_getsetting("name")+'")\;'+tempreturn;
               }
               else{
                  tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>\').cm_html("cm_caswindow='+this.cm_getsetting("cm_caswindow")+'")\;'+tempreturn;
               };
            };
         };
      }
      else{
           tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>';
      };
   }
   else if(this.type=="text"){
      tempreturn = '';
   }
   else if(this.type=="iframecontainer"){
      if(this.parent.type =="iframecontainer" || this.parent.type =="tablecell"){  
//         tempreturn= '</div><script type="text/javascript" >'+this.cm_getsetting("name")+' = document.getElementById("'+this.cm_getsetting("name")+'")\;<\/script> ';
         tempreturn= '</div>';
      }
      else if(this.parent.type =="newwindow"){
         tempreturn= '</div>';
      }
      else{
         tempreturn= '</div><script type="text/javascript" >'; 
      }
   }
   else if(this.type=="newplot"){
      var tempcaswindow= this.cm_getsetting("cm_caswindow");
      var tempstatic = CaluMath.PM.IsEntirelyInStaticObjects(this);
      var isinnewwindow = CaluMath.PM.IsContainedInANewWindow(this);

      if(this.parent != null && (this.parent.type=="iframecontainer" || this.parent.type=="iframe" || this.parent.type=="tablecell" )){
         if(isinnewwindow == "yes"){
           tempreturn= '<CM_FORWARDSLASHscript>';
         }
         else{
            tempreturn= '<\/script>';
         };
      }
      else if(tempstatic =="yes"){
         if(this.parent != null && this.parent.type =="newwindow"){ 
            tempreturn= '<CM_FORWARDSLASHscript>';
         };

//         if(tempcaswindow !="CM_MainWindow"){ 
//            tempreturn= '<CM_FORWARDSLASHscript>';
//         };
      };
   }     
   return tempreturn;
}; 

//Comment: I am not sure if this is used. This is what I thought: Occasionally an item the user creates needs to be displayed temporarily in the CM_PageMaker. This occurs, for example, when creating special inserted text. CaluMath.PM.PageMakerObjectCreator.prototype.cm_inpageclosingtag takes care of anything that needs to be written at the end of the Html for the object.

CaluMath.PM.PageMakerObjectCreator.prototype.cm_inpageclosingtag=function(){
   var tempreturn='';
   if(this.type=="htmltext"){
      tempreturn = '<CM_FORWARDSLASH'+this.cm_getsetting("tag")+'>';
   };
   return tempreturn;
};



CaluMath.PM.PageMakerObjectCreator.prototype.cm_optionsstring= function(){
   var optionsarray=this.cm_optionsarray;
   var optionsarraylength= optionsarray.length;
   var newoptionsarray= new Array();
   for(var i=0; i<optionsarraylength; i++){
      var temprightside= optionsarray[i][1].replace(/\s/g,'');
      if(temprightside != '' && temprightside != 'default' && temprightside != 'auto'){  
         newoptionsarray.push(optionsarray[i]);  
      };
   }
   return newoptionsarray.join("CM_COMMAREPLACEMENT").replace(/\/\,/g,"CM_ESCAPECOMMAREPLACEMENT").replace(/\,/g,"=").replace(/CM_ESCAPECOMMAREPLACEMENT/g,"/,").replace(/CM_COMMAREPLACEMENT/g,",").cm_unescapedoublequotes().cm_1escapedoublequotes().cm_unescapebackslashes().cm_unescapequotes().replace(/alternatecolor/g, "color").replace(/alternateColor/g, "Color");
};


//Comment: These two methods are used in writing the CaluMath.PM.PageMakerObject info for at the end of the HTML page. 
CaluMath.PM.PageMakerObjectCreator.prototype.cm_optionsarraytostring=function(){
      var optionsarray= this.cm_optionsarray;
      var optionsarraylength= optionsarray.length;
      var optionsstring='[';
      if(optionsarraylength >0){
         var optionsarraylengthminus1= optionsarraylength-1;
         for(var j=0; j<optionsarraylengthminus1; j++){
            optionsstring=optionsstring+'["'+optionsarray[j][0]+'","'+optionsarray[j][1].replace(/\\/g,"\\\\").cm_adjustquotes('"')+'"],';  
         };
         optionsstring=optionsstring+'["'+optionsarray[optionsarraylengthminus1][0]+'","'+optionsarray[optionsarraylengthminus1][1].replace(/\\/g,"\\\\").cm_adjustquotes('"')+'"]]';  
      }
      else{
         optionsstring=optionsstring+']';
      };
      return optionsstring;
};

CaluMath.PM.PageMakerObjectCreator.prototype.cm_requiredarraytostring=function(){
         var requiredarray= this.cm_requiredarray;
         var requiredarraylength= requiredarray.length;
         var requiredstring='[';
         if(requiredarraylength >0){
            var requiredarraylengthminus1= requiredarraylength-1;
            for(var j=0; j<requiredarraylengthminus1; j++){
               if(requiredarray[j][1] != null){
                  requiredstring=requiredstring+'["'+requiredarray[j][0]+'","'+requiredarray[j][1].replace(/\\/g,"\\\\").cm_adjustquotes('"')+'"],';  
               };
            };
            if(requiredarray[requiredarraylengthminus1][1] != null){
               requiredstring=requiredstring+'["'+requiredarray[requiredarraylengthminus1][0]+'","'+requiredarray[requiredarraylengthminus1][1].replace(/\\/g,"\\\\").cm_adjustquotes('"')+'"]]';  
            };
         }
         else{
            requiredstring=requiredstring+']';
         };
         return requiredstring;
};

CaluMath.PM.OnlyForListsEditString='<span style="color:magenta">Only For Lists: <\/span> ';

//Comment: This produces the Html code for the Edit and Cut and Paste window for each CM_PageMakerObject that is constructed. 

CaluMath.PM.PageMakerObjectCreator.prototype.cm_writeedithtml=function(){
   var thistype=this.type;
   if(this.cm_getsetting("cm_onlyforlists")=="yes"){
      var onlyforlistsstring=CaluMath.PM.OnlyForListsEditString;
   }
   else{
      var onlyforlistsstring="";
   };

   if(thistype=="definedfunction"){
   return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+"("+this.cm_getsetting("cm_variable")+") := "+this.cm_getsetting("definition").cm_unescapequotes().cm_unescapebackslashes()+'<\/span>.<\/div>';
   }
   else if(thistype=="rescaleaxes"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> Rescale the axes '+this.cm_getsetting("newplot")+'<\/span>.<\/div>';
   }
   else if(thistype=="functionplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("definedfunction")+'<\/span> axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="discretefunctionplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("definedfunction")+'<\/span> axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="updatablefunctionplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="updatefunctionplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span> axes '+this.cm_getsetting("newplot")+' updated to '+this.cm_getsetting("definedfunction")+'.<\/div>';
   }
   else if(thistype=="updateareabetweenfunctionsplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span> axes '+this.cm_getsetting("newplot")+' updated to area between '+this.cm_getsetting("definedfunction")+' and '+this.cm_getsetting("definedfunction1")+'.<\/div>';
   }
   else if(thistype=="updateblanksegments"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span> axes '+this.cm_getsetting("newplot")+' updated blank segments at  '+this.cm_getsetting("cm_segment1")+' '+this.cm_getsetting("cm_segment2")+' '+this.cm_getsetting("cm_segment3")+' '+this.cm_getsetting("cm_segment4")+' '+this.cm_getsetting("cm_segment5")+'.<\/div>';
   }
   else if(thistype=="updatetangentplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span> axes '+this.cm_getsetting("newplot")+' updated to a tangent of '+this.cm_getsetting("definedfunction")+' at the point '+this.cm_getsetting("cm_point")+'.<\/div>';
   }
   else if(thistype=="arcplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="labelvertex"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> axes '+this.cm_getsetting("newplot")+', line '+this.cm_getsetting("graph")+'.<\/div>';
   }
   else if(thistype=="labelallvertices"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> axes '+this.cm_getsetting("newplot")+', line '+this.cm_getsetting("graph")+'.<\/div>';
   }
   else if(thistype=="definedconstant"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'='+this.cm_getsetting("definition").cm_unescapequotes().cm_unescapebackslashes()+'.<\/span><\/div>';
   }
   else if(thistype=="variablename"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'='+this.cm_getsetting("definition").cm_unescapequotes().cm_unescapebackslashes()+'.<\/span><\/div>';
   }
   else if(thistype=="tangent"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, axes '+this.cm_getsetting("newplot")+' graph '+this.cm_getsetting("graph")+' at x= '+this.cm_getsetting("cm_xcoordinate")+'.<\/div>';
   }
   else if(thistype=="highlight"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, axes '+this.cm_getsetting("newplot")+' graph '+this.cm_getsetting("graph")+' at x= '+this.cm_getsetting("cm_xcoordinate")+'.<\/div>';
   }
   else if(thistype=="rectangleplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, axes '+this.cm_getsetting("newplot")+' corners ('+this.cm_getsetting("cm_x1coordinate")+','+this.cm_getsetting("cm_y1coordinate")+') and ('+this.cm_getsetting("cm_x2coordinate")+','+this.cm_getsetting("cm_y2coordinate")+') .<\/div>';
   }
   else if(thistype=="moverectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span>, in axes '+this.cm_getsetting("newplot")+' to corners ('+this.cm_getsetting("cm_x1coordinate")+','+this.cm_getsetting("cm_y1coordinate")+') and ('+this.cm_getsetting("cm_x2coordinate")+','+this.cm_getsetting("cm_y2coordinate")+') .<\/div>';
   }
   else if(thistype=="activatedragrectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("cm_rectangleslist")+'<\/span>, in axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="deactivatedragrectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span> in the axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="activatestretchrectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("cm_rectangleslist")+'<\/span>, in axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="deactivatestretchrectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span> in the axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="activateviewrectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+' <\/span>, in axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="deactivateviewrectangle"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span>, in axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="pointplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, axes '+this.cm_getsetting("newplot")+' coordinates ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') .<\/div>';
   }
   else if(thistype=="movepoint"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span>, in axes '+this.cm_getsetting("newplot")+' to coordinates ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') .<\/div>';
   }
   else if(thistype=="movetextplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span>, in axes '+this.cm_getsetting("newplot")+' to coordinates ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') .<\/div>';
   }
   else if(thistype=="activatedragpoint"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("cm_pointslist")+'<\/span>, in axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="deactivatedragpoint"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span> in the axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="deactivateclickableaxes"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span> in the axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="activatecapturedragpath"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("cm_pointslist")+'<\/span>, in axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="deactivatecapturedragpath"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span> in the axes '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="activateslidingscale"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("slidingscale")+'<\/span>.<\/div>';
   }
   else if(thistype=="deactivateslidingscale"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("slidingscale")+'<\/span>.<\/div>';
   }
   else if(thistype=="dragroutine"){
       var tempplot=this.cm_getsetting("newplot");
 
       if(tempplot !=null || tempplot.match(/CM_ParentObject/)){
         return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+tempplot.replace(/CM_ParentObject\./,"")+' with this routine: ' +this.cm_getsetting("routine")+'<\/span> .<\/div>';
      }
      else{
         return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname">  in axes '+this.cm_getsetting("newplot")+', with this routine: ' +this.cm_getsetting("routine")+'<\/span> .<\/div>';
      };
   }
   else if(thistype=="animationroutine"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("animationplot")+' in axes '+this.cm_getsetting("newplot")+', with this routine: ' +this.cm_getsetting("routine")+'<\/span> .<\/div>';
   }
   else if(thistype=="slidingscale"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="textplot"){
      if(this.cm_getsetting("graph")=="none"){
         return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, axes '+this.cm_getsetting("newplot")+' coordinates ('+this.cm_getsetting("cm_xcoordinate")+' , '+this.cm_getsetting("cm_ycoordinate")+'). <\/div>';
      }
      else{
         return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, axes '+this.cm_getsetting("newplot")+' on graph '+this.cm_getsetting("graph")+' at x= '+this.cm_getsetting("cm_xcoordinate")+'. <\/div>';
      };
   }
   else if(thistype=="linearplot"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>,  axes '+this.cm_getsetting("newplot")+' with points '+this.cm_getsetting("pointslist")+ '.<\/div>' 
   }
   else if(thistype=="addlinearplotsegment"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+'<\/span>,  axes '+this.cm_getsetting("newplot")+' with points '+this.cm_getsetting("pointslist")+ '.<\/div>' 
   }
   else if(thistype=="buttonaction"){
   var type=CaluMath.PM.GetPageMakerObjectSetting(this,"type");
   if(type=="cm_add"){
      var tempname="Button Action";
//      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+tempname+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("button")+'_ButtonAction<\/span>  for '+this.cm_getsetting("button")+'.<\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- '+this.cm_getsetting("button")+'_ButtonAction --" style="display:none" ><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus"  type="button" value="+ '+this.cm_getsetting("button")+'_ButtonAction +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script><\div id="'+this.htmlname+'" class="cm_editentry"  style="display:none"><span class="cm_editentrytype">'+tempname+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("button")+'_ClickAction<\/span>  for '+this.cm_getsetting("button")+'.<\/div> ';
   }
   else{
      var tempname="Click Button Action";
//      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+tempname+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("button")+'_ClickAction<\/span>  for '+this.cm_getsetting("button")+'.<\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- '+this.cm_getsetting("button")+'_ClickAction --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ '+this.cm_getsetting("button")+'_ClickAction +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script><\div id="'+this.htmlname+'" class="cm_editentry" style="display:none"><span class="cm_editentrytype">'+tempname+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("button")+'_ClickAction<\/span>  for '+this.cm_getsetting("button")+'.<\/div> ';
   };
   }
   else if(thistype=="forloop"){
//      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">For Loop: <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, with variable '+this.cm_getsetting("cm_variable")+' from '+this.cm_getsetting("cm_begin")+' until '+this.cm_getsetting("cm_end")+'.<\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- For Loop: '+this.cm_getsetting("name")+' --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ For Loop: '+this.cm_getsetting("name")+' +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script>' +
             '<\div id="'+this.htmlname+'" class="cm_editentry" style="display:none" ><span class="cm_editentrytype">For Loop: <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, with variable '+this.cm_getsetting("cm_variable")+' from '+this.cm_getsetting("cm_begin")+' until '+this.cm_getsetting("cm_end")+'.<\/div>';
   }
   else if(thistype=="buttonactionnext"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><\/div>';
   }
   else if(thistype=="cm_alert"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span>'+this.cm_getsetting("text")+'<\/div>';
   }
   else if(thistype=="iframe"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("cm_caswindow")+'<\/span> with source '+this.cm_getsetting("src")+ '.<\/div>';
   }
   else if(thistype=="labelplot"){
      return '<\div id="'+this.htmlname+'"  class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, at '+this.cm_getsetting("labelat")+' on the axis '+this.cm_getsetting("axis")+' in the plot '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(thistype=="gettextboxvalue"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, from  '+this.cm_getsetting("textbox").replace(/^\.node/, '')+'. <\/div>';
   }
   else if(thistype=="puttextboxvalue"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("value")+'<\/span>, in '+this.cm_getsetting("textbox").replace(/^\.node/, '')+'. <\/div>';
   }
   else if(thistype=="getboxindex"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, from  '+this.cm_getsetting("box").replace(/^\.node/, '')+'. <\/div>';
   }
   else if(thistype=="putboxindex"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("index")+'<\/span>, in '+this.cm_getsetting("box").replace(/^\.node/, '')+'. <\/div>';
   }
   else if(thistype=="tangentclickbutton" || thistype=="highlightclickbutton" || thistype=="pointclickbutton" || thistype=="removeclickbutton" || thistype=="endremoveclickbutton" || thistype=="calculatorbutton" || thistype=="javascriptbutton" || thistype=="enterbutton" || thistype=="input" || thistype=="output" || thistype=="select" || thistype=="inputtext" || thistype=="inputarea" || thistype=="button"  || thistype=="clickbutton" || thistype=="boxes" || thistype=="dropdownmenu"  ){
      var selectedlabel=CaluMath.PM.PageMakerObjectLabelName(this);
      if(thistype=="tangentclickbutton" || thistype=="highlightclickbutton" || thistype=="pointclickbutton" || thistype=="removeclickbutton" || thistype=="endremoveclickbutton" || thistype=="calculatorbutton" || thistype=="javascriptbutton" || thistype=="enterbutton" || thistype=="button"  || thistype=="clickbutton" ){
         var tempstringnameforobject="Button";
      }
      else if(thistype=="input" || thistype=="output" ||thistype=="inputtext" || thistype=="inputarea"){
         var tempstringnameforobject="Text Area";
      }
      else if( thistype=="select" ){
         var tempstringnameforobject="Dropdown Menu";
      }
      else if( thistype=="boxes" ){
         var tempstringnameforobject="Boxes";
      }
      else if( thistype=="dropdownmenu" ){
         var tempstringnameforobject="Drop Down Menu";
      };
      if(this.cm_getsetting("graph").match(/\S/)){
          return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> for axes '+this.cm_getsetting("newplot")+' and graph '+this.cm_getsetting("graph")+'.<\/div>';
      }
      else{
          return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> for axes '+this.cm_getsetting("newplot")+'.<\/div>';
      };
   }
   else if(thistype=="addtoboxordropdown"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+'Added the options '+this.cm_getsetting("cm_choices")+' to the Box or Drop Down menu '+this.cm_getsetting("box")+'<\/span>.<\/div>';
   }
   else if(thistype=="linebreak"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>.<\/div>';
   }
   else if(thistype=="image"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> ' +'Here is '+this.cm_getsetting("name")+'<\/span>, a Image of the file: <b><i>'+this.cm_getsetting("address")+'</b></i>.<\/div>';
   }
   else if(thistype=="link"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>, to the file: <b><i>'+this.cm_getsetting("address").cm_unescapebackslashes()+'</i></b>.<\/div>';
   }
   else if(thistype=="webpagename"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name").cm_unescapequotes().cm_unescapebackslashes()+'<\/span>.<\/div>';
//       return '<\div id="'+this.htmlname+'" class="cm_editentry" >' +'Main Web Page is named'+this.cm_getsetting("name").cm_unescapequotes().cm_unescapebackslashes()+'.<\/div>';
   }
   else if(thistype=="textstylesheet"){
       var temptag = this.cm_getsetting("htmltype");
       if(temptag=="h1"){
          var tempstring="Title";
       }
       else if(temptag=="h2"){
          var tempstring="Section Head";
       }
       if(temptag=="p"){
          var tempstring="Paragraph";
       }
       if(temptag=="body"){
          var tempstring="Body";
       }
       if(temptag=="div"){
          var tempstring="Container";
       }
       if(temptag=="span"){
          var tempstring="Text";
       }
       if(temptag=="ol"){
          var tempstring="Ordered List";
       }
       if(temptag=="ul"){
          var tempstring="Unordered List";
       }
       if(temptag=="li"){
          var tempstring="List Item";
       }
       if(temptag=="dl"){
          var tempstring="Definition List";
       }
       if(temptag=="dt"){
          var tempstring="Definition List Title";
       }
       if(temptag=="dd"){
          var tempstring="Definition List Data";
       }

       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': for<\/span><span class="cm_editentryname"> '+tempstring+'<\/span><\/div>';
   }
   else if(thistype=="arrow"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with tip at ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') in the plot '+this.cm_getsetting("newplot")+'.<\/div>'; 
   }
   else if(thistype=="bracket"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>  with points at  ('+this.cm_getsetting("cm_x1coordinate")+','+this.cm_getsetting("cm_y1coordinate")+') and ('+this.cm_getsetting("cm_x2coordinate")+','+this.cm_getsetting("cm_y2coordinate")+') in the plot '+this.cm_getsetting("newplot")+'.<\/div>'; 
   }
   if(thistype=="splitfunction"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   if(thistype=="discretefunctionfrompointsarray"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+' with this points array: '+this.cm_getsetting("cm_pointsarray")+'.<\/span><\/div>';
   }
   else if(thistype=="hideandunhide"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("hidetarget")+' '+this.cm_getsetting("display")+'<\/span>.<\/div>';
   }
   else if(thistype=="removegraph"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graphfullname")+'.<\/span><\/div>';
   }
   else if(thistype=="hideandunhidegraph"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("graph")+' '+this.cm_getsetting("display")+'.<\/span><\/div>';
   }
   else if(thistype=="removehtml"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("hidetarget")+'.<\/span><\/div>';
   }
   else if(thistype=="search"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+' with axes '+this.cm_getsetting("newplot")+' and graph '+this.cm_getsetting("graph")+'.<\/span><\/div>';
   }
   else if(thistype=="nameclickedpoint"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="nameanimationvalue"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="namedraggedvalue"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="comparison"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span> named <span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> <br>  First Comparison: '+this.cm_getsetting("first1").cm_unescapequotes().cm_unescapebackslashes() +' '+ this.cm_getsetting("comparison1")+' '+this.cm_getsetting("second1").cm_unescapequotes().cm_unescapebackslashes()+' with precision '+this.cm_getsetting("precision1")+ '<br> Second Comparison '+this.cm_getsetting("andor1")+ '  '+ this.cm_getsetting("first2").cm_unescapequotes().cm_unescapebackslashes()+' '+this.cm_getsetting("comparison2")+' '+this.cm_getsetting("second2").cm_unescapequotes().cm_unescapebackslashes()+' with precision '+this.cm_getsetting("precision2")+'<br> Third Comparison: '+ this.cm_getsetting("andor2")+'  '+ this.cm_getsetting("first3").cm_unescapequotes().cm_unescapebackslashes()+' '+this.cm_getsetting("comparison3")+' '+this.cm_getsetting("second3").cm_unescapequotes().cm_unescapebackslashes()+' with precision '+this.cm_getsetting("precision3")+' <br> Fourth Comparison: '+'  '+this.cm_getsetting("andor3")+' '+ this.cm_getsetting("first4").cm_unescapequotes().cm_unescapebackslashes()+' '+ this.cm_getsetting("comparison4")+' '+this.cm_getsetting("second4").cm_unescapequotes().cm_unescapebackslashes()+' with precision '+' '+ this.cm_getsetting("precision4")+'. <br> The parentheses are '+this.cm_getsetting("parentheses")+'<\/div>';
   }
   else if(thistype=="conditional"){
//       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with branching '+this.cm_getsetting("branchtype")+'.<\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- Conditional: '+this.cm_getsetting("name")+' --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ Conditional: '+this.cm_getsetting("name")+' +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script>' +
      '<\div id="'+this.htmlname+'" class="cm_editentry" style="display:none"><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with branching '+this.cm_getsetting("branchtype")+'.<\/div>';
   }
   else if(thistype=="routine"){
//       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- Routine: '+this.cm_getsetting("name")+' --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ Routine: '+this.cm_getsetting("name")+' +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script>' +
      '<\div id="'+this.htmlname+'" class="cm_editentry" style="display:none"><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="executeroutine"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("routine")+ '<\/span> with arguments '+this.cm_getsetting("parameters").cm_unescapequotes()+'.<\/div>';
   }
   else if(thistype=="newwindow"){
//       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- New Window: '+this.cm_getsetting("name")+' --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ New Window: '+this.cm_getsetting("name")+' +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script>' +
       '<\div id="'+this.htmlname+'" class="cm_editentry" style="display:none"><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="newplot"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+',<\/span> from '+this.cm_getsetting("cm_xstart")+' to '+this.cm_getsetting("cm_xfinish")+' in the x direction and '+this.cm_getsetting("cm_ystart")+' to '+this.cm_getsetting("cm_yfinish")+' in the y direction.<\/div>';
   }
   else if(thistype=="htmltext"){
       var temptag = this.cm_getsetting("tag");
       if(temptag=="h1"){
          var tempstring="Title";
       }
       else if(temptag=="h2"){
          var tempstring="Section Head";
       }
       if(temptag=="p"){
          var tempstring="Paragraph";
       }
       if(temptag=="div"){
          var tempstring="Container";
       }
       if(temptag=="span"){
          var tempstring="Text";
       }
       if(this.childarray != null && this.childarray[0] != null && this.childarray[0].cm_getsetting("text") != null){
          return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+tempstring+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+':  '+this.childarray[0].cm_getsetting("text").replace(/CM_NEWLINEREPLACEMENT/g,"")+'.<\/span><\/div>';
       }
       else{
          return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+tempstring+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
       };
   }
   else if(thistype=="text"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="focusobject"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(thistype=="putfocus"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("target")+'.<\/span><\/div>';
   }
   else if(thistype=="iframecontainer"){
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(this.type=="pointbrackets3"){      
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with points at ('+this.cm_getsetting("cm_xcenter")+','+this.cm_getsetting("cm_ycenter")+') and ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') in the plot '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(this.type=="pointbrackets2"){      
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with points at ('+this.cm_getsetting("cm_xcenter")+','+this.cm_getsetting("cm_ycenter")+') and ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') in the plot '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(this.type=="pointbrackets1"){      
       return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with points at ('+this.cm_getsetting("cm_xcenter")+','+this.cm_getsetting("cm_ycenter")+') and ('+this.cm_getsetting("cm_xcoordinate")+','+this.cm_getsetting("cm_ycoordinate")+') in the plot '+this.cm_getsetting("newplot")+'.<\/div>';
   }
   else if(this.type=="animationplot"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> in the plot '+this.cm_getsetting("newplot")+'<\/div>';
   }
   else if(this.type=="changedirectionbutton" ||  this.type=="startbutton" || this.type =="stopbutton" || this.type =="resetbutton" || this.type =="stepbutton" || this.type =="increasespeedbutton" ||  this.type =="decreasespeedbutton"){
//      return '<\div id="'+this.htmlname+'" class="cm_editentry" >  Here is the '+this.type.replace(/speed/," speed").replace(/button/," button")+ ' for the Animation Plot '+this.cm_getsetting("animationplot")+'.<\/div>';
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"><\/span> for '+this.cm_getsetting("animationplot")+'.<\/div>';
   }
   else if(this.type=="animationoutput"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> for '+this.cm_getsetting("animationplot")+'.<\/div>';
   }
   else if(this.type=="functiontable"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.cm_getsetting("rows")+' rows.<\/div>';
   }
   else if(this.type=="tablefromdata"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span> <\/div>';
   }
   else if(this.type=="discretefunctionconstructiontable"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span> <\/div>';
   }
   else if(this.type=="table"){      
//      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.cm_getsetting("rows")+' rows and '+this.cm_getsetting("columns")+' columns.<\/div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- Table: '+this.cm_getsetting("name")+' --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ Table: '+this.cm_getsetting("name")+' +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script>' +
             '<\div id="'+this.htmlname+'" class="cm_editentry" style="display:none"><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.cm_getsetting("rows")+' rows and '+this.cm_getsetting("columns")+' columns.<\/div>';
   }
   else if(this.type=="tablerow"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span>.<\/div>';
   }
   else if(this.type=="tablecell"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.parent.cm_getsetting("name")+'<\/span>.<\/div>';
   }
   else if(this.type=="list"){      
//      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.cm_getsetting("items")+' items. </div>';
      return '<\input id="'+this.htmlname+'buttonminus" type="button" value="-- List: '+this.cm_getsetting("name")+' --" style="display:none"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonminus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display="none"\; document.getElementById("'+this.htmlname+'orderedlist").style.display="none"\;  document.getElementById("'+this.htmlname+'buttonminus").style.display="none"\; document.getElementById("'+this.htmlname+'buttonplus").style.display=""\;}<\/script><\input id="'+this.htmlname+'buttonplus" type="button" value="+ List: '+this.cm_getsetting("name")+' +"><\script type="text/javascript" > document.getElementById("'+this.htmlname+'buttonplus").onclick=function(){document.getElementById("'+this.htmlname+'").style.display=""\; document.getElementById("'+this.htmlname+'orderedlist").style.display=""\;  document.getElementById("'+this.htmlname+'buttonminus").style.display=""\; document.getElementById("'+this.htmlname+'buttonplus").style.display="none"\;}<\/script>' +
         '<\div id="'+this.htmlname+'" class="cm_editentry" style="display:none"><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.cm_getsetting("items")+' items. </div>';
   }
   else if(this.type=="listitem"){      
      return '<\div id="'+this.htmlname+'"class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.parent.cm_getsetting("items")+' items. </div>';
   }
   else if(this.type=="definitionlisttitle"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> with '+this.parent.cm_getsetting("items")+' items. </div>';
   }
   else if(this.type=="definitionlistdata"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.parent.cm_getsetting("name")+'<\/span> with '+this.parent.cm_getsetting("items")+' items. </div>';
   }
   else if(this.type=="tablerow"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'.<\/span><\/div>';
   }
   else if(this.type=="compositeanimation"){      
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> '+this.cm_getsetting("name")+'<\/span> for '+this.cm_getsetting("animationplot")+'.<\/div>';
   }
   else if(this.type=="javascript"){
      return '<\div id="'+this.htmlname+'" class="cm_editentry" ><span class="cm_editentrytype">'+onlyforlistsstring+CaluMath.PM.PageMakerObjectLabelName(this)+': <\/span><span class="cm_editentryname"> <\/span><\/div>';
   }
   else if(this.type=="comment"){
      return '<\div id="'+this.htmlname+'" style="font-size:16px;"><b> <span style="color:red">COMMENT:</span> '+this.cm_getsetting("comment").replace(/CM_NEWLINEREPLACEMENT/g,"<br>").cm_unescapequotes()+'</b><\/div>';
   }
   else if(this.type=="addhtml"){
      return '<\div id="'+this.htmlname+'" style="font-size:20px;"><b> Html Added Here. </b><\/div>';
   }
   else if(this.type=="headhtml"){
      return '<\div id="'+this.htmlname+'" style="font-size:20px;"><b> Head Html Added Here. </b><\/div>';
   }
   else if(this.type=="clipboard"){
      return '<\div id="'+this.htmlname+'" style="font-size:24px;"><b> This is the ClipBoard</b><\/div>';
   }
   else if(this.type=="clipboardplaceholder"){
      return '<\div id="'+this.htmlname+'" style="font-size:24px;"><b> This is the Inside of the ClipBoard</b><\/div>';
   }
   else{
      return '';
   };
};

//Comment: This produces the Html code for each CM_PageMakerObject that is constructed. The Html code is written to when the View Page action item is clicked. 

CaluMath.PM.PageMakerObjectCreator.prototype.cm_writehtml=function(){
   if(this.cm_getsetting("cm_onlyforlists")=="yes"){
      return "";
   };

   var thistype=this.type;
   if(thistype=="definedfunction"){
//      return '"'+this.cm_getsetting("name")+'('+this.cm_getsetting("cm_variable")+') := '+this.cm_getsetting("definition").cm_escapequotes()+'".cm_unescapequotes().cm_javascript().cm_parsefunction("'+this.cm_optionsstring()+'");';
//      return '"'+this.cm_getsetting("name")+'('+this.cm_getsetting("cm_variable")+') := '+this.cm_getsetting("definition").cm_unescapebackslashes().cm_unescapequotes().cm_escapequotes().cm_escapebackslashes()+'".cm_unescapequotes().cm_escapequotes().cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_parsefunction("'+this.cm_optionsstring()+'");';
      return '"'+this.cm_getsetting("name")+'('+this.cm_getsetting("cm_variable")+') := '+this.cm_getsetting("definition").cm_unescapequotes().cm_unescapebackslashes().cm_escapequotes().cm_escapebackslashes()+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_parsefunction("'+this.cm_optionsstring()+'");';
   }
   else if(thistype=="rescaleaxes"){
      return ' '+this.cm_getsetting("newplot")+'.cm_rescaleaxes("'+this.cm_getsetting("width")+'","'+this.cm_getsetting("height")+'","'+this.cm_getsetting("cm_xstart")+'","'+this.cm_getsetting("cm_xfinish")+'","'+this.cm_getsetting("cm_ystart")+'","'+this.cm_getsetting("cm_yfinish")+'","'+this.cm_getsetting("cm_yaxisat")+'","'+this.cm_getsetting("cm_xaxisat")+'")\;'; 
   }
   else if(thistype=="functionplot"){
      return ' '+this.cm_getsetting("newplot")+'.cm_functionplot("'+this.cm_getsetting("definedfunction")+'".cm_javascript(),"'+this.cm_getsetting("cm_xstart")+'","'+this.cm_getsetting("cm_xfinish")+'","'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="discretefunctionplot"){
      return ' '+this.cm_getsetting("newplot")+'.cm_discreteplot("'+this.cm_getsetting("discretefunction")+'".cm_javascript(),"'+this.cm_getsetting("cm_xstart")+'","'+this.cm_getsetting("cm_xfinish")+'","'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="updatablefunctionplot"){
      return ' '+this.cm_getsetting("newplot")+'.cm_updatablefunctionplot("'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="updatefunctionplot"){
//      return ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_movegraph("'+this.cm_getsetting("definedfunction")+'".cm_javascript(),"'+this.cm_optionsstring()+'")\;'; 
      return ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_movegraph("'+this.cm_getsetting("definedfunction")+'".cm_javascript(),"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="updateareabetweenfunctionsplot"){
      return ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_fillareabetweencurves("'+this.cm_getsetting("definedfunction")+'".cm_javascript(),"'+this.cm_getsetting("definedfunction1")+'".cm_javascript(),"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="updateblanksegments"){
      if(this.cm_getsetting("cm_segment1").length==0){
         var tempsegments='';
      }
      else{
         var tempsegmentsarray=this.cm_getsetting("cm_segment1").replace(/^\[/,"").replace(/\]$/,"").split(/\,/);
         var tempsegments='["'+tempsegmentsarray[0]+'".cm_evalmath(),"'+tempsegmentsarray[1]+'".cm_evalmath()]';
         segmentloop:
         for(var i=2; i<=5; i++){
            if(this.cm_getsetting("cm_segment"+i).length >0){
               var tempsegmentsarray=this.cm_getsetting("cm_segment"+i).replace(/^\[/,"").replace(/\]$/,"").split(/\,/);
               tempsegments=tempsegments+',["'+tempsegmentsarray[0]+'".cm_evalmath(),"'+tempsegmentsarray[1]+'".cm_evalmath()]';
//               tempsegments=tempsegments+','+this.cm_getsetting("cm_segment"+i);
            }
            else{
               break segmentloop;
            };
         };
      };
      return ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_hidegraph('+tempsegments+')\;'; 
   }
   else if(thistype=="updatetangentplot"){
      return ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_movetangent("'+this.cm_getsetting("definedfunction")+'".cm_javascript(),"'+this.cm_getsetting("cm_point")+'".cm_javascript(),"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="arcplot"){
      return ' '+this.cm_getsetting("newplot")+'.cm_arcplot("'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_getsetting("cm_xcenter")+'","'+this.cm_getsetting("cm_ycenter")+'","'+this.cm_getsetting("cm_radius")+'","'+this.cm_getsetting("cm_beginning")+'","'+this.cm_getsetting("cm_ending")+'","'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="labelvertex"){
//      return ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_labelvertex("'+this.cm_getsetting("cm_vertex")+'","'+this.cm_getsetting("cm_radius")+'","'+this.cm_getsetting("cm_text").cm_unescapequotes().cm_unescapebackslashes()+'","'+this.cm_optionsstring()+'")\;'; 
      return ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_labelvertex("'+this.cm_getsetting("cm_vertex")+'","'+this.cm_getsetting("cm_radius")+'",'+('"'+this.cm_getsetting("cm_text").cm_unescapedoublequotes().cm_1escapedoublequotes()+'"').cm_unescapequotes().cm_unescapebackslashes()+',"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="labelallvertices"){
      return ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_labelallvertices("'+this.cm_getsetting("cm_radius")+'",("'+this.cm_getsetting("cm_text")+'").cm_unescapequotes().cm_unescapebackslashes(),"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="textstylesheet"){
       var temptag = this.cm_getsetting("htmltype");
       var tempoptionsarray=this.cm_optionsarray;
       var tempoptionsarraylength=tempoptionsarray.length;
       var tempreturnstring='';
//aleert(this.cm_optionsarray.cm_display());
       for(var i=1; i<tempoptionsarraylength; i++){
//alerttest(tempoptionsarray[i]);
          if(tempoptionsarray[i]!= null && tempoptionsarray[i][1] != null && tempoptionsarray[i][1] != '' && tempoptionsarray[i][1] != "n/a" && tempoptionsarray[i][1] != "auto"){
             tempreturnstring=tempreturnstring+tempoptionsarray[i][0]+":"+tempoptionsarray[i][1]+"\;";
          };
       };
       tempreturnstring=tempreturnstring.replace(/alternatecolor/g,"color").replace(/alternateColor/g,"Color");
       if(tempreturnstring != ''){
          return ''+temptag+'{'+tempreturnstring+'}';
       };
   }
   else if(thistype=="definedconstant"){
      return 'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_getsetting("definition")+'",'+this.cm_getsetting("cm_precision")+')\; ';
   }
   else if(thistype=="variablename"){
//      return 'eval(\'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",'+this.cm_getsetting("definition")+', "no")\'.cm_unescapequotes().cm_javascript())\;';
//      return 'eval(\'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",'+this.cm_getsetting("definition").cm_unescapequotes().cm_unescapebackslashes()+', "no")\'.cm_javascript())\;';
      return 'eval(\'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",'+this.cm_getsetting("definition").cm_unescapequotes().cm_unescapebackslashes().cm_escapequotes().cm_escapebackslashes()+', "no")\'.cm_unescapequotes().cm_unescapebackslashes().cm_javascript())\;';
   }
   else if(thistype =="tangent"){
      if(this.cm_getsetting("cm_functionindex").length >0 && this.cm_getsetting("cm_functionindex") != "n/a"){
         return  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_tangent("'+this.cm_getsetting("cm_xcoordinate")+'","name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'",' +this.cm_getsetting("cm_functionindex")+')\;'; 
      }
      else{
         return  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_tangent("'+this.cm_getsetting("cm_xcoordinate")+'","name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\;'; 
      };
   }
   else if(thistype=="highlight"){ 
      if(this.cm_getsetting("cm_functionindex").length >0 && this.cm_getsetting("cm_functionindex") != "n/a"){
         return  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_highlight("'+this.cm_getsetting("cm_xcoordinate")+'","name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'",' +this.cm_getsetting("cm_functionindex")+')\;';
      }
      else{
         return  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_highlight("'+this.cm_getsetting("cm_xcoordinate")+'","name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\;';
      }
   }
   else if(thistype=="rectangleplot"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_rectangleplot(["'+this.cm_getsetting("cm_x1coordinate")+'".cm_javascript(),"'+this.cm_getsetting("cm_y1coordinate")+'".cm_javascript()], ["'+this.cm_getsetting("cm_x2coordinate")+'".cm_javascript(),"'+this.cm_getsetting("cm_y2coordinate")+'".cm_javascript()],"name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="moverectangle"){
//      return  ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_movegraph(["'+this.cm_getsetting("cm_x1coordinate")+'".cm_javascript(),"'+this.cm_getsetting("cm_y1coordinate")+'".cm_javascript()], ["'+this.cm_getsetting("cm_x2coordinate")+'".cm_javascript(),"'+this.cm_getsetting("cm_y2coordinate")+'".cm_javascript()],"'+this.cm_optionsstring()+'")\;'; 
      return  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_movegraph(["'+this.cm_getsetting("cm_x1coordinate")+'".cm_javascript(),"'+this.cm_getsetting("cm_y1coordinate")+'".cm_javascript()], ["'+this.cm_getsetting("cm_x2coordinate")+'".cm_javascript(),"'+this.cm_getsetting("cm_y2coordinate")+'".cm_javascript()],"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="activatedragrectangle"){
//      return  ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_ondragprepfunction("'+this.cm_optionsstring()+'")\;'; 
      if(this.cm_getsetting("cm_rectangleslist")=="all" || this.cm_getsetting("cm_rectangleslist").length ==0){
         return  ' '+this.cm_getsetting("newplot")+'.cm_rectangleondragprepfunction("'+this.cm_optionsstring()+'")\;'; 
      }
      else{
//         var temprectangleslist= this.cm_getsetting("cm_rectangleslist").replace(/\s*\,\s*/g, '","').replace(/^\s*/,"").replace(/\s*$/,"");
         var temprectangleslist= this.cm_getsetting("cm_rectangleslist").replace(/\s*\,\s*/g, '".cm_javascript(),"').replace(/^\s*/,"").replace(/\s*$/,"");

         return  ' '+this.cm_getsetting("newplot")+'.cm_rectangleondragprepfunction(["'+temprectangleslist+'".cm_javascript()],"'+this.cm_optionsstring()+'")\;'; 
      };
   }
   else if(thistype=="deactivatedragrectangle"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_cancelrectangleondragprepfunction("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="activatestretchrectangle"){
//      return  ' '+this.cm_getsetting("newplot")+'.cm_onstretchprepfunction("'+this.cm_optionsstring()+'")\;'; 
      if(this.cm_getsetting("cm_rectangleslist")=="all" || this.cm_getsetting("cm_rectangleslist").length ==0){
         return  ' '+this.cm_getsetting("newplot")+'.cm_rectangleonstretchprepfunction("'+this.cm_optionsstring()+'")\;'; 
      }
      else{
//         var temprectangleslist= this.cm_getsetting("cm_rectangleslist").replace(/\s*\,\s*/g, '","').replace(/^\s*/,"").replace(/\s*$/,"");
         var temprectangleslist= this.cm_getsetting("cm_rectangleslist").replace(/\s*\,\s*/g, '".cm_javascript(),"').replace(/^\s*/,"").replace(/\s*$/,"");
         return  ' '+this.cm_getsetting("newplot")+'.cm_rectangleonstretchprepfunction(["'+temprectangleslist+'".cm_javascript()],"'+this.cm_optionsstring()+'")\;'; 
      };
   }
   else if(thistype=="deactivatestretchrectangle"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_cancelrectangleonstretchprepfunction("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="activateviewrectangle"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_beginviewrectangle("name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="deactivateviewrectangle"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_endviewrectangle("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="pointplot"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_pointplot(["'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_getsetting("cm_ycoordinate")+'"],"name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="movepoint"){
      return  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_movegraph(["'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_getsetting("cm_ycoordinate")+'"],"'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="activatedragpoint"){
      var tempoptions = this.cm_optionsstring();
      var cm_createtimefunction= tempoptions.cm_getpropertyvalue("cm_createtimefunction"); 
      if(cm_createtimefunction[0] != null){
         var tempstring=this.cm_getsetting("newplot")+'.cm_createtimefunction="'+cm_createtimefunction[0]+'"\; ';
         tempoptions= cm_createtimefunction[1];
      }
      else{
         var tempstring="";
      };


      if(this.cm_getsetting("cm_pointslist")=="all" || this.cm_getsetting("cm_pointslist").length ==0){
         return  tempstring+this.cm_getsetting("newplot")+'.cm_pointondragprepfunction("'+this.cm_optionsstring()+'")\;'; 
      }
      else{
         var temppointslist= this.cm_getsetting("cm_pointslist").replace(/\s*\,\s*/g, '".cm_javascript(),"').replace(/^\s*/,"").replace(/\s*$/,"");
         return  tempstring+this.cm_getsetting("newplot")+'.cm_pointondragprepfunction(["'+temppointslist+'".cm_javascript()],"'+this.cm_optionsstring()+'")\;'; 
      };
   }
   else if(thistype=="deactivatedragpoint"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_cancelpointondragprepfunction("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="deactivateclickableaxes"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_cancelclickable()\;'; 
   }
   else if(thistype=="activatecapturedragpath"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_capturedragpathprepfunction("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="deactivatecapturedragpath"){
      return  ' '+this.cm_getsetting("newplot")+'.cm_cancelcapturedragpathprepfunction("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="dragroutine"){
       var tempplot=this.cm_getsetting("newplot");
 
//       if(tempplot==null || tempplot.length ==0 || this.cm_getsetting("cm_isslidingscale")=="yes" ){
       if(tempplot !=null && tempplot.match(/CM_ParentObject/)){ 
          tempplot = 'CM_ParentObject["'+tempplot.replace(/CM_ParentObject\./, "")+'".cm_javascript()]';
       };
      if(this.cm_getsetting("cm_whentoexectue")=="continuous"){
         return  ' '+tempplot+'.cm_dragfunctioncontinuous='+this.cm_getsetting("routine")+'\;'; 
      }
      else if(this.cm_getsetting("cm_whentoexectue")=="notcontinuous"){
         return  ' '+tempplot+'.cm_dragfunction='+this.cm_getsetting("routine")+'\;'; 
      }
      else{
         return  ' '+tempplot+'.cm_dragfunctiononmousedown='+this.cm_getsetting("routine")+'\;'; 
      };




/*
       if(this.cm_getsetting("newplot")=="CM_ParentObject" || this.cm_getsetting("cm_isslidingscale")=="yes" ){
          var thisname="."+this.cm_getsetting("graph");
       }
       else{
          var thisname="";
       };
      if(this.cm_getsetting("cm_whentoexectue")=="continuous"){
         return  ' '+this.cm_getsetting("newplot")+thisname+'.cm_dragfunctioncontinuous='+this.cm_getsetting("routine")+'\;'; 
      }
      else{
         return  ' '+this.cm_getsetting("newplot")+thisname+'.cm_dragfunction='+this.cm_getsetting("routine")+'\;'; 
      };
*/


   }
   else if(thistype=="animationroutine"){
//      return  ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("animationplot")+'.cm_associatedfunction='+this.cm_getsetting("routine")+'\;'; 
      return  ' '+this.cm_getsetting("animationplot")+'.cm_associatedfunction='+this.cm_getsetting("routine")+'\;'; 
   }
   else if(thistype=="slidingscale"){ 
         return  'CM_ParentObject.cm_makeslidingscale("'+this.cm_getsetting("cm_width")+'".cm_javascript(),"'+this.cm_getsetting("cm_height")+'".cm_javascript(),"'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_optionsstring()+'")\;';
   }
   else if(thistype=="activateslidingscale"){
//      return  ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("slidingscale")+'.cm_activateslidingscale("'+this.cm_optionsstring()+'")\;'; 
       var tempslidingscale= this.cm_getsetting("slidingscale");
       if(tempslidingscale !=null && tempslidingscale.match(/CM_ParentObject/)){ 
          tempslidingscale = 'CM_ParentObject["'+tempslidingscale.replace(/CM_ParentObject\./, "")+'".cm_javascript()]';
       };
//      return  'CM_ParentObject["'+this.cm_getsetting("slidingscale")+'".cm_javascript()].cm_activateslidingscale("'+this.cm_optionsstring()+'")\;'; 
      return  tempslidingscale+'.cm_activateslidingscale("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="deactivateslidingscale"){
//      return  'CM_ParentObject["'+this.cm_getsetting("slidingscale")+'".cm_javascript()].cm_deactivateslidingscale("'+this.cm_optionsstring()+'")\;'; 
       var tempslidingscale= this.cm_getsetting("slidingscale");
       if(tempslidingscale !=null && tempslidingscale.match(/CM_ParentObject/)){ 
          tempslidingscale = 'CM_ParentObject["'+tempslidingscale.replace(/CM_ParentObject\./, "")+'".cm_javascript()]';
       };
      return  tempslidingscale+'.cm_deactivateslidingscale("'+this.cm_optionsstring()+'")\;'; 
   }
   else if(thistype=="textplot"){
      if(this.cm_getsetting("graph")=="none"){
         return ' '+this.cm_getsetting("newplot")+'.cm_textplot("'+this.cm_getsetting("name")+'".cm_javascript(),"'+('<span >'+this.cm_getsetting("cm_textinput")).cm_escapequotes()+'CM_OpeningTagSymbol/span>".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),["'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_getsetting("cm_ycoordinate")+'"],"'+this.cm_optionsstring()+',html=yes")\;'; 
      }
      else{
         return ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_textplot("'+this.cm_getsetting("name")+'".cm_javascript(),"'+('<span>'+this.cm_getsetting("cm_textinput")).cm_escapequotes()+'CM_OpeningTagSymbol/span>".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),"'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_optionsstring()+',html=yes")\;';
      };
   }
   else if(thistype=="movetextplot"){
//      if(this.cm_getsetting("graph")=="none"){
//         return ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_movegraph("'+('<span >'+this.cm_getsetting("cm_textinput")).cm_escapequotes()+'CM_OpeningTagSymbol/span>".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),["'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_getsetting("cm_ycoordinate")+'"],"'+this.cm_optionsstring()+',html=yes")\;'; 
         return ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_movegraph("'+('<span >'+this.cm_getsetting("cm_textinput")).cm_escapequotes()+'CM_OpeningTagSymbol/span>".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),["'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_getsetting("cm_ycoordinate")+'"],"'+this.cm_optionsstring()+',html=yes")\;'; 
//      }
//      else{
//         return ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].'+this.cm_getsetting("name")+'.cm_movegraph("'+('<span>'+this.cm_getsetting("cm_textinput")).cm_escapequotes()+'CM_OpeningTagSymbol/span>".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),"'+this.cm_getsetting("cm_xcoordinate")+'","'+this.cm_optionsstring()+',html=yes")\;';
//      };
   }
   else if(thistype=="linearplot"){
      //Comment: When CaluMath.PM.CreateSettingsAndOptionString is called, it checks whether the object is placed normally, or whether it is inside something like a button action. In the latter case, it sets CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=true, so as not to check for the validity of values that have not been created yet. However, CaluMath.PM.CreateSettingsAndOptionString sets CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=false upon its completion. In linearplot, this means that CaluMath.PM.IsListOfPoints is invoked with CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=true for button actions. However, CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks is then set to false at the end of CaluMath.PM.CreateSettingsAndOptionString. When we now call CaluMath.PM.IsListOfPoints below, we want to make sure that CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks is set to true. After we call CaluMath.PM.IsListOfPoints, we set it back to false. This will not affect linearplots which are not in buttonactions, since the check would have been done above in CaluMath.PM.CreateSettingsAndOptionString already; a failure there would not let us get to this current line.
      CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=true;

      var tempoptions= ''+this.cm_optionsstring().split(/position/)[0]+'';
      var templabelsoptions= '"position'+this.cm_optionsstring().split(/position/)[1].replace(/textcolor/,"color")+'';

      var temparrows= tempoptions.cm_getpropertyvalue("cm_arrows"); 
      if(temparrows[0] != null){
         tempoptions='"cm_arrows='+temparrows[0].replace(/\s*/g,"")+','+temparrows[1]+'"';
      }
      else{
         tempoptions='"'+tempoptions+'"';
      };


      var tempmargin = this.cm_getsetting("margin");
      if(tempmargin.length >0 && tempmargin !="n/a"){
         templabelsoptions=templabelsoptions+',cm_bottommargin='+tempmargin+',cm_topmargin='+tempmargin+',cm_leftmargin='+tempmargin+',cm_rightmargin='+tempmargin+'"';
      }
      else{
         templabelsoptions=templabelsoptions+'"';
      };   

      if(this.cm_getsetting("labels").length >0){
         if(this.cm_getsetting("cm_pointsasarraytype")=="singlearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'.cm_linearplot("'+this.cm_getsetting("name")+'".cm_javascript(),'+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+',["'+this.cm_getsetting("labels").replace(/\,/g,'","').replace(/CM_DOUBLEQUOTE/g,'\\"').cm_unescapequotes().cm_unescapebackslashes()+'",'+templabelsoptions+'],'+tempoptions+')\;'; 
         }
         else if(this.cm_getsetting("cm_pointsasarraytype")=="doublearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'.cm_linearplot("'+this.cm_getsetting("name")+'".cm_javascript(),'+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+'.cm_convertdoublearraytosinglearray(),["'+this.cm_getsetting("labels").replace(/\,/g,'","').replace(/CM_DOUBLEQUOTE/g,'\\"').cm_unescapequotes().cm_unescapebackslashes()+'",'+templabelsoptions+'],'+tempoptions+')\;'; 
         }
         else{ 
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'.cm_linearplot("'+this.cm_getsetting("name")+'".cm_javascript(),['+CaluMath.PM.IsListOfPoints(this.cm_getsetting("pointslist").cm_javascript())+'],["'+this.cm_getsetting("labels").replace(/\,/g,'","').replace(/CM_DOUBLEQUOTE/g,'\\"').cm_unescapequotes().cm_unescapebackslashes()+'",'+templabelsoptions+'],'+tempoptions+')\;'; 
         };
      }
      else{
         if(this.cm_getsetting("cm_pointsasarraytype")=="singlearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'.cm_linearplot("'+this.cm_getsetting("name")+'".cm_javascript(),'+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+','+tempoptions+')\;'; 
         }
         else if(this.cm_getsetting("cm_pointsasarraytype")=="doublearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'.cm_linearplot("'+this.cm_getsetting("name")+'".cm_javascript(),'+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+'.cm_convertdoublearraytosinglearray(),'+tempoptions+')\;'; 
         }
         else{
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'.cm_linearplot("'+this.cm_getsetting("name")+'".cm_javascript(),['+CaluMath.PM.IsListOfPoints(this.cm_getsetting("pointslist").cm_javascript())+'],'+tempoptions+')\;'; 
         };
      };
      CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=false;
      return tempreturn; 
   }
   else if(thistype=="addlinearplotsegment"){
      CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=true;

      var tempoptions= ''+this.cm_optionsstring().split(/position/)[0]+'';
      var templabelsoptions= '"position'+this.cm_optionsstring().split(/position/)[1].replace(/textcolor/,"color")+'';

      var temparrows= tempoptions.cm_getpropertyvalue("cm_arrows"); 
      if(temparrows[0] != null){
         tempoptions='"cm_arrows='+temparrows[0].replace(/\s*/g,"")+','+temparrows[1]+'"';
      }
      else{
         tempoptions='"'+tempoptions+'"';
      };
      var cm_continuefrompreviouspoint= tempoptions.cm_getpropertyvalue("cm_continuefrompreviouspoint"); 
      if(cm_continuefrompreviouspoint[0] != null){
         tempoptions='"cm_continuefrompreviouspoint='+cm_continuefrompreviouspoint[0]+','+temparrows[1]+'"';
      };

      var tempmargin = this.cm_getsetting("margin");
      if(tempmargin.length >0 && tempmargin !="n/a"){
         templabelsoptions=templabelsoptions+',cm_bottommargin='+tempmargin+',cm_topmargin='+tempmargin+',cm_leftmargin='+tempmargin+',cm_rightmargin='+tempmargin+'"';
      }
      else{
         templabelsoptions=templabelsoptions+'"';
      };   

      if(this.cm_getsetting("labels").length >0){
         if(this.cm_getsetting("cm_pointsasarraytype")=="singlearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_addsegments('+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+',["'+this.cm_getsetting("labels").replace(/\,/g,'","').replace(/CM_DOUBLEQUOTE/g,'\\"').cm_unescapequotes().cm_unescapebackslashes()+'",'+templabelsoptions+'],'+tempoptions+')\;'; 
         }
         else if(this.cm_getsetting("cm_pointsasarraytype")=="doublearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_addsegments('+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+'.cm_convertdoublearraytosinglearray(),["'+this.cm_getsetting("labels").replace(/\,/g,'","').replace(/CM_DOUBLEQUOTE/g,'\\"').cm_unescapequotes().cm_unescapebackslashes()+'",'+templabelsoptions+'],'+tempoptions+')\;'; 
         }
         else{ 
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_addsegments(['+CaluMath.PM.IsListOfPoints(this.cm_getsetting("pointslist").cm_javascript())+'],["'+this.cm_getsetting("labels").replace(/\,/g,'","').replace(/CM_DOUBLEQUOTE/g,'\\"').cm_unescapequotes().cm_unescapebackslashes()+'",'+templabelsoptions+'],'+tempoptions+')\;'; 
         };
      }
      else{
         if(this.cm_getsetting("cm_pointsasarraytype")=="singlearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_addsegments('+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+','+tempoptions+')\;'; 
         }
         else if(this.cm_getsetting("cm_pointsasarraytype")=="doublearray"){
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_addsegments('+CaluMath.PM.ConvertArrayEntriesToStringElements(this.cm_getsetting("pointslist"))+'.cm_convertdoublearraytosinglearray(),'+tempoptions+')\;'; 
         }
         else{
            var tempreturn =  ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_addsegments(['+CaluMath.PM.IsListOfPoints(this.cm_getsetting("pointslist").cm_javascript())+'],'+tempoptions+')\;'; 
         };
      };
      CM_TopWindow.CaluMath.PM.IgnoreMathInputChecks=false;
      return tempreturn; 
   }
   else if(thistype=="buttonactionnext"){
      return  '}, \'next\' , function(){ ';
   }
   else if(thistype=="cm_alert"){
      //Comment: The entry is automatically considered to be text, so it does not need to be enclosed in quotes of any kind. Single and Double Quotes can be used in any fashion in the entry without causing an error. 
      return  this.cm_getsetting("text").cm_escapedoublequotes(); 
   }
   else if(thistype=="iframe"){
      if(this.cm_getsetting("cm_caswindow")=="CM_MainWindow"){
         return '<iframe class="cm_iframe" name="'+this.cm_getsetting("name")+'" src="'+this.cm_getsetting("src")+'" scrolling="'+this.cm_getsetting("scrolling")+'"  marginheight="1px" marginwidth="1px" frameborder="'+this.cm_getsetting("frameborder")+'" width="'+this.cm_getsetting("width")+'" height="'+this.cm_getsetting("height")+'"></iframe>';
      }
      else{
         if(this.cm_getsetting("insertoption") =="n/a"){
            return 'CM_NewWindowHtml<iframe class="cm_iframe" name="'+this.cm_getsetting("name")+'" src="'+this.cm_getsetting("src")+'" scrolling="'+this.cm_getsetting("scrolling")+'"  marginheight="1px" marginwidth="1px" frameborder="'+this.cm_getsetting("frameborder")+'" width="'+this.cm_getsetting("width")+'" height="'+this.cm_getsetting("height")+'"><CM_FORWARDSLASHiframe>';
         }
         else{
            return '<iframe class="cm_iframe" name="'+this.cm_getsetting("name")+'" src="'+this.cm_getsetting("src")+'" scrolling="'+this.cm_getsetting("scrolling")+'"  marginheight="1px" marginwidth="1px" frameborder="'+this.cm_getsetting("frameborder")+'" width="'+this.cm_getsetting("width")+'" height="'+this.cm_getsetting("height")+'"><CM_FORWARDSLASHiframe>';
         };
      };
   }
   else if(thistype=="labelplot"){
      return ' '+this.cm_getsetting("newplot")+'.cm_write'+this.cm_getsetting("cm_axis")+'label("'+this.cm_getsetting("cm_labelat")+'","name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\;';
   }
   else if(thistype=="gettextboxvalue"){ 
      var cm_spacesoption=this.cm_getsetting("cm_spacesoption");
      var cm_blankoption=this.cm_getsetting("cm_blankoption");
      var casesoption= this.cm_getsetting("cm_upperlowercase");
      if(casesoption==null || casesoption.length==0 || casesoption=="n/a"){
         casesoption="";
      }
      else{
         casesoption="."+casesoption+"()"
      };
      if(cm_spacesoption==null || cm_spacesoption.length==0 ||  cm_spacesoption=="leavespaces"){
         if(cm_blankoption=="no"){
            return 'if(CaluMath.Html.IsEmptyString(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value)=="yes"){ return alert("You cannot leave the box blank. Please enter something in the box.");}; window["'+this.cm_getsetting("name")+'".cm_javascript()]=eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value'+casesoption+' \; ';
         }
         else{
            return 'window["'+this.cm_getsetting("name")+'".cm_javascript()]=eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value'+casesoption+' \; ';
         };
      }
      else if(cm_spacesoption=="isevalmath"){
         var cm_precision=this.cm_getsetting("cm_precision");
         //Comment: We define cm_precision if it is null because older CaluMath pages may not have the precision defined. 
         if(cm_precision==null || cm_precision.length==0 ){
            cm_precision=10;
         };
         if(cm_blankoption=="no"){
            return 'if(CaluMath.Html.IsEvalMath(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value)  == "no"){ return alert("You must enter a number or a mathematical expression that evaluates to a number in the box.");} else{ window["'+this.cm_getsetting("name")+'".cm_javascript()]=CaluMath.Html.Round((eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value), '+cm_precision+'); }\; ';
         }
         else{
            return 'if(CaluMath.Html.IsEmptyString(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value) !="yes" && CaluMath.Html.IsEvalMath(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value)  == "no"){ return alert("You must leave the box blank or enter a number or a mathematical expression that evaluates to a number.");} else{ window["'+this.cm_getsetting("name")+'".cm_javascript()]=CaluMath.Html.Round((eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value), '+cm_precision+'); }\; ';
         };
      }
      else if(cm_spacesoption=="isparsefunction"){
         var cm_precision=this.cm_getsetting("cm_precision");
         //Comment: We define cm_precision if it is null because older CaluMath pages may not have the precision defined. 
         if(cm_precision==null || cm_precision.length==0 ){
            cm_precision=10;
         };
         if(cm_blankoption=="no"){
            return 'if(CaluMath.Html.IsParseFunction(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value.cm_addsemicolon(), "cm_precision='+cm_precision+'")  == "no"){ return alert("You must define a function in the box.");} else{ window["'+this.cm_getsetting("name")+'".cm_javascript()]=eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value.cm_addsemicolon().cm_parsefunction("cm_precision='+cm_precision+'").cm_map\; }\; ';
         }
         else{
            return 'if(CaluMath.Html.IsEmptyString(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value) =="yes"){'+this.cm_getsetting("name")+'=undefined\;}else if(CaluMath.Html.IsParseFunction(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value.cm_addsemicolon(), "cm_precision='+cm_precision+'")  == "no"){ return alert("You must leave the box blank or define a function in the box.");}else{ window["'+this.cm_getsetting("name")+'".cm_javascript()]=eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value.cm_addsemicolon().cm_parsefunction("cm_precision='+cm_precision+'").cm_map; }\; ';
         };
      }
      else{
         if(cm_blankoption=="no"){
            return 'if(CaluMath.Html.IsEmptyString(eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value)=="yes"){ return alert("You cannot leave the box blank. Please enter something in the box.");}; window["'+this.cm_getsetting("name")+'".cm_javascript()]=eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value.'+cm_spacesoption+'()'+casesoption+' \; ';
         }
         else{
            return 'window["'+this.cm_getsetting("name")+'".cm_javascript()]=eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value.'+cm_spacesoption+'()'+casesoption+' \; ';
         };
      };
   }
   else if(thistype=="puttextboxvalue"){ 
        return 'eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_puttext("'+this.cm_getsetting("value")+'".cm_escapedoublequotes().cm_adjustquotes("\'").cm_unescapebackslashes().cm_unescapequotes().cm_javascript().cm_unicode())\; ';
//     if(this.parent==CaluMath.PM.PageMakerObjectArray){
//        return 'cm_onloadarray[cm_onloadarray.length]= function(){eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value="'+this.cm_getsetting("value").cm_escapequotes().cm_adjustquotes('"').cm_adjustquotes("'")+'".cm_unescapequotes().cm_javascript().cm_unicode()\;} \; ';
//     }
//     else{
//        return 'eval("'+this.cm_getsetting("textbox")+'".cm_javascript()).cm_node.value="'+this.cm_getsetting("value").cm_escapedoublequotes().cm_adjustquotes("'")+'".cm_unescapequotes().cm_javascript().cm_unicode()\; ';
//     };
   }
   else if(thistype=="getboxindex"){ 
      //Comment: Note that getcheck is a CAS function designed for textboxes that works on the CAS object, not on the node. So we must have CaluMath.PM.PlotlistObject.boxeslist[tempselectedindex][0] with index 0 and not 1 in this section. This is different from drop down menus, since For these we use standard JavaScripts commands for getting indices. 
      if(this.cm_getsetting("cm_checktype")=="label"){
         return this.cm_getsetting("name")+'=eval("'+this.cm_getsetting("box").replace(/\.node$/, "")+'".cm_javascript()).cm_getlabel() \; ';
      }
      else{ 
         return this.cm_getsetting("name")+'=eval("'+this.cm_getsetting("box").replace(/\.node$/, "")+'".cm_javascript()).cm_getcheck() \; ';
      }
   }
   else if(thistype=="putboxindex"){ 
        return 'eval("'+this.cm_getsetting("box")+'".cm_javascript().replace(/\.node$/, "")).cm_putcheck("'+this.cm_getsetting("index")+'".cm_javascript())\;  ';
   }
   else if(thistype=="tangentclickbutton" || thistype=="highlightclickbutton" || thistype=="pointclickbutton" || thistype=="removeclickbutton" || thistype=="endremoveclickbutton" || thistype=="calculatorbutton" || thistype=="javascriptbutton" || thistype=="enterbutton" || thistype=="input" || thistype=="output" || thistype=="select" || thistype=="inputtext" || thistype=="inputarea" || thistype=="button"  || thistype=="clickbutton" || thistype=="boxes" || thistype=="dropdownmenu"  ){

      var tempstring=this.cm_optionsstring()+'"';
      if(thistype=="inputarea"){
         var buttontype= "inputtext";
         tempstring=",type=textarea,"+tempstring;
      }
      else if(thistype=="button"){
         var buttontype= "button";
      }
      else if(thistype=="clickbutton"){
         var buttontype= "clickbutton";
      }
      else if(thistype=="boxes"){
         var buttontype= "boxes";
      }
      else if(thistype=="dropdownmenu"){
         var buttontype= "dropdownmenu";
      }
      else{
         var buttontype= this.cm_getsetting("buttontype");
      };

            if(thistype=="endremoveclickbutton" || thistype=="calculatorbutton" || thistype=="javascriptbutton" || thistype=="enterbutton"){
               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_write'+this.cm_getsetting("buttontype")+'("' +tempstring+')\; '; 
               }
               else{
                  var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_write'+this.cm_getsetting("buttontype")+'("'+tempstring+')\; '; 
               };
            }
            else if(buttontype.match("input")==null && buttontype.match("output")==null  && buttontype.match("select")==null && buttontype != "button" && buttontype != "clickbutton" && buttontype != "boxes"  && thistype !="dropdownmenu" ){
               var tempstring1=tempstring.replace(/\"$/,'');
               var tempsecondargument='';
               var tempcolor= tempstring1.cm_getpropertyvalue("color") 
               if(tempcolor[0] != null){
                  tempsecondargument=tempsecondargument+"color="+tempcolor[0]+",";
                  tempstring1=tempcolor[1];
               };
               var highlightwidth= tempstring1.cm_getpropertyvalue("cm_highlightwidth") 
               if(highlightwidth[0] != null){
                  tempsecondargument=tempsecondargument+"cm_highlightwidth="+highlightwidth[0]+",";
                  tempstring1=highlightwidth[1];
               };
               var highlightheight= tempstring1.cm_getpropertyvalue("cm_highlightheight") 
               if(highlightheight[0] != null){
                  tempsecondargument=tempsecondargument+"cm_highlightheight="+highlightheight[0]+",";
                  tempstring1=highlightheight[1];
               };
               var pointstyle= tempstring1.cm_getpropertyvalue("cm_pointstyle") 
               if(pointstyle[0] != null){
                  tempsecondargument=tempsecondargument+"cm_pointstyle="+pointstyle[0]+",";
                  tempstring1=pointstyle[1];
               };
               var option= tempstring1.cm_getpropertyvalue("cm_option") 
               if(option[0] != null){
                  tempsecondargument=tempsecondargument+"cm_option="+option[0]+",";
                  tempstring1=option[1];
               };
               var equation= tempstring1.cm_getpropertyvalue("cm_equation") 
               if(equation[0] != null){
                  tempsecondargument=tempsecondargument+"cm_equation="+equation[0]+",";
                  tempstring1=equation[1];
               };
               var highlightequation= tempstring1.cm_getpropertyvalue("cm_highlightequation") 
               if(highlightequation[0] != null){
                  tempsecondargument=tempsecondargument+"cm_highlightequation="+highlightequation[0]+",";
                  tempstring1=highlightequation[1];
               };
               var cm_equationreplacement= tempstring1.cm_getpropertyvalue("cm_equationreplacement") 
               if(cm_equationreplacement[0] != null){
                  tempsecondargument=tempsecondargument+"cm_equationreplacement="+cm_equationreplacement[0]+",";
                  tempstring1=cm_equationreplacement[1];
               };
               var cm_clickyprecision= tempstring1.cm_getpropertyvalue("cm_clickyprecision") 
               if(cm_clickyprecision[0] != null){
                  tempsecondargument=tempsecondargument+"cm_clickyprecision="+cm_clickyprecision[0]+",";
                  //Comment: We comment out the line below becase we want cm_clickyprecsion to remain part of the options that go to the button and to the object created by the button. 
                  //tempstring1=cm_clickyprecision[1];
               };
//               var displaycoordinates= tempstring1.cm_getpropertyvalue("cm_displaycoordinates") 
//               if(displaycoordinates[0] != null){
//                  tempsecondargument=tempsecondargument+"cm_displaycoordinates="+displaycoordinates[0]+",";
//                  tempstring1=displaycoordinates[1];
//               };

               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  if(tempsecondargument.length ==0){
                     var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_write'+this.cm_getsetting("buttontype")+'("'+this.cm_getsetting("cm_numberofclicks")+'",["' +tempstring+',""])\; '; 
                  }
                  else{
                     var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_write'+this.cm_getsetting("buttontype")+'("'+this.cm_getsetting("cm_numberofclicks")+'",["' +tempstring1+'","'+tempsecondargument+'"] )\; '; 
                  };
               }
               else{
                  if(tempsecondargument.length ==0){
                     var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_write'+this.cm_getsetting("buttontype")+'("'+this.cm_getsetting("cm_numberofclicks")+'",["' +tempstring+',""])\; '; 
                  }
                  else{
                     var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_write'+this.cm_getsetting("buttontype")+'("'+this.cm_getsetting("cm_numberofclicks")+'",["' +tempstring1+'","'+tempsecondargument+'"] )\; ';
                  };
               };
            }
            else if( buttontype =="button"){ //alerttest(["writing button",this.cm_getsetting("newplot")]);
               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_button("'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_getsetting("value")+'".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),"'+tempstring+')\; '; 
               }
               else{
                  var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_button("'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_getsetting("value")+'".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),"'+tempstring+')\; '; 
               };
            }
            else if( buttontype =="clickbutton"){
               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_clickbutton("'+this.cm_getsetting("name")+'".cm_javascript(),"'+this.cm_getsetting("value")+'".cm_javascript().cm_unescapequotes().cm_unescapebackslashes(),"'+this.cm_getsetting("cm_numberofclicks")+'","'+tempstring+')\; '; 
               }
               else{
                  var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_clickbutton("'+this.cm_getsetting("name")+'","'+this.cm_getsetting("value")+'".cm_unescapequotes().cm_unescapebackslashes(),"'+this.cm_getsetting("cm_numberofclicks")+'","'+tempstring+')\; '; 
               }
            }
            else if( buttontype =="boxes"){ //alerttest(["boxes", this.cm_getsetting("buttontype")]);
               var choices=this.cm_getsetting("cm_choices").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,/g,'".cm_unescapequotes().cm_unescapebackslashes(),"').replace(/CM_COMMAREPLACEMENT/g,',');
               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_writeboxes("'+this.cm_getsetting("name")+'".cm_javascript(),"' +tempstring+')\;'; 
                  tempplot= tempplot+' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("name")+'".cm_javascript()].cm_addboxes("'+choices+'".cm_unescapequotes().cm_unescapebackslashes())\; ';
               }
               else{
                  var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_writeboxes("'+this.cm_getsetting("name")+'","' +tempstring+')\;'; 
                  tempplot= tempplot+' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()]["'+this.cm_getsetting("name")+'".cm_javascript()].cm_addboxes("'+choices+'".cm_unescapequotes().cm_unescapebackslashes())\; ';
               };
            }
            else if( buttontype =="dropdownmenu"){ 
               var choices=this.cm_getsetting("cm_choices").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,/g,'".cm_unescapequotes().cm_unescapebackslashes(),"').replace(/CM_COMMAREPLACEMENT/g,',');
               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_writeselectmenu("'+this.cm_getsetting("name")+'".cm_javascript(),"' +tempstring+')\;'; 
                  tempplot= tempplot+' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("name")+'".cm_javascript()].cm_addoptions("'+choices+'".cm_unescapequotes().cm_unescapebackslashes())\; ';
               }
               else{
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_writeselectmenu("'+this.cm_getsetting("name")+'".cm_javascript(),"' +tempstring+')\;'; 
                  tempplot= tempplot+' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()]["'+this.cm_getsetting("name")+'".cm_javascript()].cm_addoptions("'+choices+'".cm_unescapequotes().cm_unescapebackslashes())\; ';
               };
            }
            else if(buttontype=="inputarea" || buttontype=="inputtext"){ 
               if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                  var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_write'+buttontype+'("name='+this.cm_getsetting("name")+','+tempstring+')\; '; 
               }
               else{
                  var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_write'+buttontype+'("name='+this.cm_getsetting("name")+','+tempstring+')\; '; 
               };
            }
            else{
               if(this.cm_getsetting("name").length >0){
                  if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                     var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_write'+buttontype+'("name='+this.cm_getsetting("name")+','+tempstring+')\; '; 
                  }
                  else{
                     var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_write'+buttontype+'("name='+this.cm_getsetting("name")+','+tempstring+')\; '; 
                  };
               }
               else{
                  if(this.cm_getsetting("graph")==null || this.cm_getsetting("graph").length==0 || this.cm_getsetting("graph")=="none"){
                     var tempplot= ' '+this.cm_getsetting("newplot")+'.cm_write'+buttontype+'("'+tempstring+')\; '; 
                  }
                  else{
                     var tempplot= ' '+this.cm_getsetting("newplot")+'["'+this.cm_getsetting("graph")+'".cm_javascript()].cm_write'+buttontype+'("'+tempstring+')\; '; 
                  };
               }
            };
            return tempplot;
   }
   else if(thistype=="addtoboxordropdown"){
      var choices=this.cm_getsetting("cm_choices").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,/g,'".cm_unescapequotes().cm_unescapebackslashes(),"').replace(/CM_COMMAREPLACEMENT/g,',');
      return 'eval("'+this.cm_getsetting("box")+'".cm_javascript()).cm_addboxes("'+choices+'".cm_unescapequotes().cm_unescapebackslashes())\; ';
   }
   else if(thistype=="linebreak"){
      var nameinput= this.cm_getsetting("name");
      if(nameinput != null && nameinput.match(/\w/)){
         var tempstring=this.cm_optionsstring()+ ',name='+nameinput;
      }
      else{
         var tempstring=this.cm_optionsstring();;
      };
      return '"<br>".cm_html("'+tempstring+'"); ';
   }
   else if(thistype=="image"){
      if(this.cm_getsetting("exactaddress") != "yes"){
         return  '\'<img src=CM_DOUBLEQUOTE'+CaluMath.PM.DotsInPathToCaluMathFolder+this.cm_getsetting("address")+'CM_DOUBLEQUOTE CM_FORWARDSLASH >\'.cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_html("name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\; ';
      }
      else{
         return  '\'<img src=CM_DOUBLEQUOTE'+this.cm_getsetting("address")+'CM_DOUBLEQUOTE CM_FORWARDSLASH >\'.cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_html("name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\; ';
      }; 
   }
   else if(thistype=="link"){
      if(this.cm_getsetting("exactaddress") != "yes"){
         if(this.cm_getsetting("address").replace(/\s*/g,"") != "reload"){
            return  '(\'<a href=CM_DOUBLEQUOTE\'+CaluMath.PM.DotsInPathToCaluMathFolder+\''+this.cm_getsetting("address")+'CM_DOUBLEQUOTE>'+this.cm_getsetting("description")+'<CM_FORWARDSLASHa>\').cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_html("name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\; ';
         }
         else{
            return  '(\'<a href=CM_DOUBLEQUOTE\'+this.location+\'CM_DOUBLEQUOTE>'+this.cm_getsetting("description")+'<CM_FORWARDSLASHa>\').cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_html("name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\; ';
         };
      }
      else{
         return  '\'<a href=CM_DOUBLEQUOTE'+this.cm_getsetting("address")+'CM_DOUBLEQUOTE>'+this.cm_getsetting("description")+'<CM_FORWARDSLASHa>\'.cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_html("name='+this.cm_getsetting("name")+','+this.cm_optionsstring()+'")\; ';
      };
   }
   else if(thistype=="addhtml"){
//       return  '<\/script> '+this.cm_getsetting("addhtml").cm_unescapequotes().cm_unescapebackslashes().replace(/CM_NEWLINE/g,"\n")+'<script type="text/javascript" > '; 
       return  '<\/script> '+this.cm_getsetting("addhtml").cm_unescapequotes().cm_unescapebackslashes().replace(/CM_HTMLOPENINGTAGREPLACEMENT/g,"<").replace(/CM_NEWLINEREPLACEMENT/g,"\n")+'<script type="text/javascript"> '; 
   }
   else if(thistype=="headhtml"){
//       return  ''+this.cm_getsetting("headhtml").cm_unescapequotes().cm_unescapebackslashes().replace(/CM_NEWLINE/g,"\n")+''; 
       return  ''+this.cm_getsetting("headhtml").cm_unescapequotes().cm_unescapebackslashes().replace(/CM_HTMLOPENINGTAGREPLACEMENT/g,"<").replace(/CM_NEWLINEREPLACEMENT/g,"\n")+''; 
   }
   else if(thistype=="webpagename"){
       return  ''+this.cm_getsetting("name").cm_unescapequotes().cm_unescapebackslashes();
   }
   else if(thistype=="arrow"){
      var tempoptions= this.cm_optionsstring().slice(0).split(/style=fontSize/);
      var lineoptions=tempoptions[0];
      var textoptions=("style=fontSize"+tempoptions[1]).replace(/\,cm_fontcolor/, ";color").replace(/\,backgroundColor/, ";backgroundColor").replace(/\,width=auto/,"").replace(/\,width/,";width");
      textoptions=textoptions+",html=yes";
      return ' '+this.cm_getsetting("newplot")+'.cm_arrow(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath()],"'+this.cm_getsetting("cm_xoffset")+'".cm_evalmath(),"'+this.cm_getsetting("cm_yoffset")+'".cm_evalmath(),["'+this.cm_getsetting("cm_text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+textoptions+'"],"'+lineoptions+'")\; ';
//      return ' '+this.cm_getsetting("newplot")+'.cm_arrow(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath()],"'+this.cm_getsetting("cm_xoffset")+'".cm_evalmath(),"'+this.cm_getsetting("cm_yoffset")+'".cm_evalmath(),["<span>'+this.cm_getsetting("cm_text")+'</span>".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+textoptions+'"],"'+lineoptions+'")\; ';
   }
   else if(thistype=="bracket"){
      var tempoptions= this.cm_optionsstring().slice(0).split(/style=fontSize/);
      var bracketoptions=tempoptions[0];
      var textoptions=("style=fontSize"+tempoptions[1]).replace(/\,cm_textcolor/, ";color").replace(/\,/g,";").replace(/\;cm_textposition/, ",position").replace(/\;width=auto/, "").replace(/\;$/,"");
      textoptions=textoptions+",html=yes";
      var tempoptions=bracketoptions+""+textoptions;
//      return ' '+this.cm_getsetting("newplot")+'.cm_bracket("'+this.cm_getsetting("cm_x1coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_y1coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_x2coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_y2coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_text").cm_escapequotes()+'".cm_unescapequotes().cm_javascript(),"'+tempoptions+'")\; ';
      return ' '+this.cm_getsetting("newplot")+'.cm_bracket("'+this.cm_getsetting("cm_x1coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_y1coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_x2coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_y2coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+tempoptions+'")\; ';
//      return ' '+this.cm_getsetting("newplot")+'.cm_bracket("'+this.cm_getsetting("cm_x1coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_y1coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_x2coordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_y2coordinate")+'".cm_evalmath(),"<span>'+this.cm_getsetting("cm_text")+'</span>".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+tempoptions+'")\; ';
   }
   else if(thistype=="splitfunction"){
            var nameinput= this.cm_getsetting("name");
            var variableinput= this.cm_getsetting("cm_variable");
       if(this.cm_getsetting("cm_inputarray") == null || this.cm_getsetting("cm_inputarray").length==0){


            var splitfunctiondefinitionstring = "";
            var splitconditionstring = "";
            makesplitfunctiondefinitionloop:
            for(var i=1; i<7; i++){
               if(this.cm_getsetting("definition"+i).length != 0){
//                  splitfunctiondefinitionstring= splitfunctiondefinitionstring+","+this.cm_getsetting("definition"+i);
                  splitfunctiondefinitionstring= splitfunctiondefinitionstring+","+this.cm_getsetting("definition"+i).cm_unescapequotes();
                  if(this.cm_getsetting("condition"+i).length != 0){
                     splitfunctiondefinitionstring= splitfunctiondefinitionstring+","+this.cm_getsetting("condition"+i);
                     splitconditionstring= splitconditionstring + "( "+this.cm_getsetting("condition"+i)+ " ) || "
                  }
                  else{
                     if(splitconditionstring.length == 0){
                        splitfunctiondefinitionstring= splitfunctiondefinitionstring+", 0==0";
                     }
                     else{
                        splitfunctiondefinitionstring= splitfunctiondefinitionstring+", !(" + splitconditionstring.replace(/\|\|\s*$/,"")+")";
                     }
                      break makesplitfunctiondefinitionloop;
                  };
               }
               else{
                  break makesplitfunctiondefinitionloop;
               };
            };
            splitfunctiondefinitionstring=splitfunctiondefinitionstring.replace(/\,\s*$/,"");
            splitfunctiondefinitionstring=splitfunctiondefinitionstring.replace(/^\s*\,/,"");
/*
            try{
//               var tempfunction= (nameinput+"("+variableinput+") := splitfunction("+splitfunctiondefinitionstring+")").cm_parsefunction(); 
               var tempfunction= (nameinput+"("+variableinput+") := splitfunction("+splitfunctiondefinitionstring.cm_unescapequotes().cm_unescapebackslashes().cm_escapequotes().cm_escapebackslashes()+")").cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_parsefunction(); 
               eval(tempfunction);
            }
            catch(e){
               return cm_alert("There is a problem with your input");
            };
*/
            //Comment: We need to keep all of the above to make sure that the splitfunction is entered without an error. This is all repeated when the splitfunction is written to with cm_writehtml.

//            return '"'+nameinput+'('+variableinput+') := splitfunction('+splitfunctiondefinitionstring.cm_escapequotes()+')".cm_unescapequotes().cm_javascript().cm_parsefunction("'+tempstring+'");';
            return '"'+nameinput+'('+variableinput+') := splitfunction('+splitfunctiondefinitionstring.cm_unescapequotes().cm_unescapebackslashes().cm_escapequotes().cm_escapebackslashes()+')".cm_unescapequotes().cm_unescapebackslashes().cm_javascript().cm_parsefunction("'+tempstring+'");';
       }
       else{
         if(this.cm_getsetting("cm_variable").length >0){
            return this.cm_getsetting("cm_inputarray")+'.cm_parsepiecewiselinearfunction("'+this.cm_getsetting("name")+'","cm_variable='+this.cm_getsetting("cm_variable")+','+this.cm_optionsstring()+'" )\; ';;
         }
         else{
            return this.cm_getsetting("cm_inputarray")+'.cm_parsepiecewiselinearfunction("'+this.cm_getsetting("name")+'","'+this.cm_optionsstring()+'" )\; ';;
         };
       };

   }
   else if(thistype=="discretefunctionfrompointsarray"){
      var cm_pointsarray=this.cm_getsetting("cm_pointsarray");
      var name= this.cm_getsetting("name");
      
      if(this.cm_getsetting("cm_variable").length >0){
//      return ''+cm_pointsarray.cm_unescapequotes()+'.cm_parsediscretefunction("'+name+'","'+this.cm_getsetting("cm_variable")+'",'+ this.cm_getsetting("cm_precision")+')\; ';
         return ''+cm_pointsarray.cm_unescapequotes()+'.cm_parsediscretefunction("'+name+'",'+ this.cm_getsetting("cm_precision")+',"'+this.cm_getsetting("cm_variable")+'")\; ';
      }
      else{
         return ''+cm_pointsarray.cm_unescapequotes()+'.cm_parsediscretefunction("'+name+'",'+ this.cm_getsetting("cm_precision")+')\; ';
      };
   }
   else if(thistype=="hideandunhide"){

      var tempcaswindow= this.cm_getsetting("cm_caswindow");
      var hideandunhidetarget=this.cm_getsetting("hidetarget");
      var hideandunhidetargettype=this.cm_getsetting("hidetargettype");
      var dynamic=this.cm_getsetting("dynamic");
      if(hideandunhidetargettype=="iframecontainer" || (hideandunhidetargettype=="table" && dynamic=="no")  ){
         //Comment: In the html document, this is a string to which the hide or unhide method is applied. If the string doesn't represent a node, undefined (not an error) is returned.
         return '"'+tempcaswindow+'.document.getElementById(CM_SINGLEQUOTE'+ hideandunhidetarget+'CM_SINGLEQUOTE)".cm_unescapequotes().cm_javascript().'+this.cm_getsetting("display")+'()\;  ';  
      }
      else{
         //Comment: In the html document, the hide or unhide method actually is applied to a node that should exist. Therefore we first have the document check whether the node exists.
//         return tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")+'.'+this.cm_getsetting("display")+'()\;  ';
//         return (tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")).cm_checkexistencestring()+tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")+'.'+this.cm_getsetting("display")+'()}\;  ';
//         return (tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")).cm_checkexistencestring(".hide()"); 
//            return (tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")).cm_checkexistencestring(['.hide','.hide()'],['.style', '.style.display', '.style.display="none"']); 
         if(this.cm_getsetting("display")=="hide"){
            return (tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")).cm_checkexistencestring(['.hide','.hide()'],['.style', '.style.display', '.style.display="none"']); 
         }
         else{
            return (tempcaswindow+'.'+ hideandunhidetarget.replace(/\.node\s*$/,"").replace(/\.node\[\d\]\s*$/,"")).cm_checkexistencestring(['.unhide','.unhide()'],['.style', '.style.display', '.style.display=""']); 
         };
      };            
   }
   else if(thistype=="hideandunhidegraph"){
      if(this.cm_getsetting("graph").match(/cm_eval/)){
         //Comment: In the html document, the hide or unhide method actually is applied to a node that should exist. Therefore we first have the document check whether the node exists.
//         var tempreturnstring='eval("'+this.cm_getsetting("graph")+'".cm_javascript()).'+this.cm_getsetting("display")+'()\; '; 
//         var tempreturnstring='eval(  "'+this.cm_getsetting("graph")+'".cm_javascript().cm_checkexistencestring() + \' eval("'+this.cm_getsetting("graph")+'".cm_javascript()).'+this.cm_getsetting("display")+'()}\')';   // != null){ eval("'+this.cm_getsetting("graph")+'".cm_javascript()).'+this.cm_getsetting("display")+'()}\; '; 
         var tempreturnstring='eval(  "'+this.cm_getsetting("graph")+'".cm_javascript().cm_checkexistencestring([".'+this.cm_getsetting("display")+'",".'+this.cm_getsetting("display")+'()"]))'; 
      }
      else{
         //Comment: In the html document, the hide or unhide method actually is applied to a node that should exist. Therefore we first have the document check whether the node exists.
//         var tempreturnstring=this.cm_getsetting("graph")+'.'+this.cm_getsetting("display")+'()\; '; 
//         var tempreturnstring='if( '+this.cm_getsetting("graph")+' != null){'+this.cm_getsetting("graph")+'.'+this.cm_getsetting("display")+'()}\;  '; 
//         var tempreturnstring=this.cm_getsetting("graph").cm_checkexistencestring()+this.cm_getsetting("graph")+'.'+this.cm_getsetting("display")+'()}\;  '; 
         var tempreturnstring=this.cm_getsetting("graph").cm_checkexistencestring(['.'+this.cm_getsetting("display"),'.'+this.cm_getsetting("display")+'()']);
      };
//      return 'if(cm_onloadbegun != "yes"){cm_onloadarray=cm_onloadarray.concat(function(){'+tempreturnstring+'})} else{ '+tempreturnstring+ '}\;';
      return tempreturnstring;
   }
   else if(thistype=="removehtml"){
      //Comment: In the html document, the hide or unhide method actually is applied to a node that should exist. Therefore we first have the document check whether the node exists.
      var tempcaswindow= this.cm_getsetting("cm_caswindow");
      var hideandunhidetarget=this.cm_getsetting("hidetarget");
      var hideandunhidetargettype=this.cm_getsetting("hidetargettype");
//      return 'if('+tempcaswindow+'.'+ hideandunhidetarget+' != null){'+tempcaswindow+'.'+ hideandunhidetarget+'.remove()}\; '; 
//      return (tempcaswindow+'.'+ hideandunhidetarget).cm_checkexistencestring()+tempcaswindow+'.'+ hideandunhidetarget+'.remove()}\; '; 
      return (tempcaswindow+'.'+ hideandunhidetarget).cm_checkexistencestring(['.remove', '.remove()']);
   }
   else if(thistype=="removegraph"){
      //Comment: Note that the required array setting "graphfullname" is created when the removegraph is created and is added to the cm_requiredarray. It is not created by CaluMath.PM.PageMakerremovegraphDefault. Therefore this is one object that is not truly dynamic, in terms of being able to  be written when the graph has changed. 
      //Comment: In the html document, the hide or unhide method actually is applied to a node that should exist. Therefore we first have the document check whether the node exists.
      if(this.cm_getsetting("graphfullname").match(/cm_eval/)){
//         return 'eval("'+this.cm_getsetting("graphfullname")+'".cm_javascript()).remove()\; '; 
//         return 'eval( "'+this.cm_getsetting("graphfullname")+'".cm_javascript().cm_checkexistencestring() + \' eval("'+this.cm_getsetting("graphfullname")+'".cm_javascript()).remove()}\')\; '; 
         return 'eval( "'+this.cm_getsetting("graphfullname")+'".cm_javascript().cm_checkexistencestring([".remove",".remove()"]))';
      }
      else{
//         return this.cm_getsetting("graphfullname")+'.remove()\; '; 
//         return 'if('+this.cm_getsetting("graphfullname")+' != null){'+this.cm_getsetting("graphfullname")+'.remove()}\; '; 
//         return this.cm_getsetting("graphfullname").cm_checkexistencestring() +this.cm_getsetting("graphfullname")+'.remove()}\; '; 
         return this.cm_getsetting("graphfullname").cm_checkexistencestring(['.remove','.remove()']);
      };
   }
   else if(thistype=="putfocus"){ 
     if(this.parent==CaluMath.PM.PageMakerObjectArray){
        return 'cm_onloadarray[cm_onloadarray.length]= function(){setTimeout("CaluMath.Html.Focus('+this.cm_getsetting("target")+', '+this.cm_getsetting("cm_caswindow")+')",500)\;} \; ';
     }
     else{
        return 'setTimeout("CaluMath.Html.Focus('+this.cm_getsetting("target")+', '+this.cm_getsetting("cm_caswindow")+')",500)\; ';
     };
   }
   else if(thistype=="focusobject"){ 
      var tempname= this.cm_getsetting("name");
//      return ' CM_ParentObject.cm_writefocusobject("name='+ tempname+'")\; ';
      return ' CM_ParentObject.cm_writefocusobject("name='+ tempname+','+this.cm_optionsstring()+'")\; ';
   }
   else if(thistype=="nameclickedpoint"){
      return 'eval(\'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no")\'.cm_unescapequotes().cm_javascript())\;  '+this.cm_getsetting("name")+'.x=arguments[0][0]\; '+this.cm_getsetting("name")+'.y=arguments[0][1]\; '+this.cm_getsetting("name")+'.cm_xcoordinate=arguments[0][0]\; '+this.cm_getsetting("name")+'.cm_ycoordinate=arguments[0][1]\;  ';
//      return 'eval("'+this.cm_getsetting("name")+'=arguments[0]"); '+this.cm_getsetting("name")+'.x=arguments[0][0]\; '+this.cm_getsetting("name")+'.y=arguments[0][1]\; '+this.cm_getsetting("name")+'.cm_xcoordinate=arguments[0][0]\; '+this.cm_getsetting("name")+'.cm_ycoordinate=arguments[0][1]\;  ';
   }
   else if(thistype=="namedraggedvalue"){
      if(this.cm_getsetting("cm_valuetype")=="cm_draggedpoint"){
         return 'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no");  '+this.cm_getsetting("name")+'.point=this.name\; '+this.cm_getsetting("name")+'.x=arguments[0][0]\; '+this.cm_getsetting("name")+'.y=arguments[0][1]\; '+this.cm_getsetting("name")+'.cm_xcoordinate=arguments[0][0]\; '+this.cm_getsetting("name")+'.cm_ycoordinate=arguments[0][1]\;  ';
      }
      else if(this.cm_getsetting("cm_valuetype")=="cm_draggedrectangle"){
         //Comment: For cm_draggedrectangle, the this in this.cm_draggingrectangle, refers to the dragged rectangle.  
         return 'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no");  '+this.cm_getsetting("name")+'.rectangle=this.name\; '+this.cm_getsetting("name")+'.x1=arguments[0][0][0]\; '+this.cm_getsetting("name")+'.y1=arguments[0][0][1]\; '+this.cm_getsetting("name")+'.x2=arguments[0][1][0]\; '+this.cm_getsetting("name")+'.y2=arguments[0][1][1]\; '+this.cm_getsetting("name")+'.x3=arguments[0][2][0]\; '+this.cm_getsetting("name")+'.y3=arguments[0][2][1]\; '+this.cm_getsetting("name")+'.x4=arguments[0][3][0]\; '+this.cm_getsetting("name")+'.y4=arguments[0][3][1]\; ';
      }
      else if(this.cm_getsetting("cm_valuetype")=="cm_viewrectangle"){
         //Comment: For cm_viewrectangle, the this in this.cm_draggingrectangle, this refers to the CaluMath.Html.Plot.  
         return 'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no");  '+this.cm_getsetting("name")+'.rectangle=this.cm_draggingrectangle\; '+this.cm_getsetting("name")+'.x1=arguments[0][0][0]\; '+this.cm_getsetting("name")+'.y1=arguments[0][0][1]\; '+this.cm_getsetting("name")+'.x2=arguments[0][1][0]\; '+this.cm_getsetting("name")+'.y2=arguments[0][1][1]\; '+this.cm_getsetting("name")+'.x3=arguments[0][2][0]\; '+this.cm_getsetting("name")+'.y3=arguments[0][2][1]\; '+this.cm_getsetting("name")+'.x4=arguments[0][3][0]\; '+this.cm_getsetting("name")+'.y4=arguments[0][3][1]\; ';
      }
      else if(this.cm_getsetting("cm_valuetype")=="cm_draggedslidingscale"){
         return 'eval(\'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no")\'.cm_unescapequotes().cm_javascript())\;  eval(\'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'_ratio",arguments[1], "no")\'.cm_unescapequotes().cm_javascript())\;  ';
      }
      else if(this.cm_getsetting("cm_valuetype")=="cm_capturedragpath"){
         return 'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no");  '+this.cm_getsetting("name")+'_array=arguments[1] \; ';
      };

   }
   else if(thistype=="nameanimationvalue"){
      return 'CaluMath.Html.DefinedConstant("'+this.cm_getsetting("name")+'",arguments[0], "no"); \;  ';
   }
   else if(thistype=="comparison"){
      var tempstring=this.cm_optionsstring();
      var temprequired=CaluMath.Html.MakeTempObject(this);


            if(this.cm_getsetting("name") !="none" && this.cm_getsetting("name").length>0){
               var namestring=this.cm_getsetting("name") + '=';
               var nameinputstring=this.cm_getsetting("name");
            }
            else{
               var namestring='';
               var nameinputstring='';
            };
//            temprequired.first1= this.cm_getsetting("first1");
//            temprequired.second1= this.cm_getsetting("second1");
//            temprequired.first2= this.cm_getsetting("first2");
//            temprequired.second2= this.cm_getsetting("second2");
//            temprequired.first3= this.cm_getsetting("first3");
//            temprequired.second3= this.cm_getsetting("second3");
//            temprequired.first4= this.cm_getsetting("first4");
//            temprequired.second4= this.cm_getsetting("second4");

            temprequired.first1= this.cm_getsetting("first1").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.second1= this.cm_getsetting("second1").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.first2= this.cm_getsetting("first2").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.second2= this.cm_getsetting("second2").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.first3= this.cm_getsetting("first3").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.second3= this.cm_getsetting("second3").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.first4= this.cm_getsetting("first4").cm_unescapequotes().cm_unescapebackslashes();
            temprequired.second4= this.cm_getsetting("second4").cm_unescapequotes().cm_unescapebackslashes();


            if(this.cm_getsetting("comparison1") !="e" && this.cm_getsetting("comparison1") !="ne" && this.cm_getsetting("comparison1") != "in" && this.cm_getsetting("comparison1") !="notin"){
               temprequired.first1='("'+temprequired.first1+'").cm_evalmath()';
               temprequired.second1='("'+temprequired.second1+'").cm_evalmath()';
            };

            if(this.cm_getsetting("andor1") !="n/a" && this.cm_getsetting("comparison2") !="e" && this.cm_getsetting("comparison2") !="ne" && this.cm_getsetting("comparison2") !="in" && this.cm_getsetting("comparison2") !="notin"){
               temprequired.first2='("'+temprequired.first2+'").cm_evalmath()';
               temprequired.second2='("'+temprequired.second2+'").cm_evalmath()';
            };

            if(this.cm_getsetting("andor2") !="n/a" && this.cm_getsetting("comparison3") !="e" && this.cm_getsetting("comparison3") !="ne" && this.cm_getsetting("comparison3") !="in" && this.cm_getsetting("comparison3") !="notin"){
               temprequired.first3='("'+temprequired.first3+'").cm_evalmath()';
               temprequired.second3='("'+temprequired.second3+'").cm_evalmath()';
            };

            if(this.cm_getsetting("andor3") !="n/a" && this.cm_getsetting("comparison4") !="e" && this.cm_getsetting("comparison4") !="ne" && this.cm_getsetting("comparison4") !="in" && this.cm_getsetting("comparison4") !="notin"){
               temprequired.first4='("'+temprequired.first4+'").cm_evalmath()';
               temprequired.second4='("'+temprequired.second4+'").cm_evalmath()';
            };

            if(this.cm_getsetting("andor1")=="n/a"){
               if(this.cm_getsetting("precision1").match(/\S/)==null){
                  var tempobjectsecondchildwritestring= namestring+ 'CaluMath.Html.ComparisonOneTerm('+temprequired.first1 +',"'+ this.cm_getsetting("comparison1")+'",'+ temprequired.second1+')';
               }
               else{
                  var tempobjectsecondchildwritestring= namestring+ 'CaluMath.Html.ComparisonOneTerm('+temprequired.first1 +',"'+ this.cm_getsetting("comparison1") +'",'+ temprequired.second1 +','+ this.cm_getsetting("precision1")+')';
               };
            }
            else{
               if(this.cm_getsetting("precision1")=="n/a" && this.cm_getsetting("precision2").match(/\S/)==null){
                  var tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+ temprequired.first1 +',"'+ this.cm_getsetting("comparison1") +'",'+ temprequired.second1+'],['+temprequired.first2 +',"'+ this.cm_getsetting("comparison2") +'",'+ temprequired.second2+']], "'+ this.cm_getsetting("andor1")+'")';
               }
               else if(this.cm_getsetting("precision1").match(/\S/)==null && this.cm_getsetting("precision2").match(/\S/)!=null){
                  var tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+ temprequired.first1 +',"'+  this.cm_getsetting("comparison1") +'",'+  temprequired.second1+'],['+temprequired.first2 +',"'+  this.cm_getsetting("comparison2") +'",'+  temprequired.second2 +','+ this.cm_getsetting("precision2")+']], "'+this.cm_getsetting("andor1")+'")';
               }
               else if(this.cm_getsetting("precision1") !="n/a" && this.cm_getsetting("precision2").match(/\S/)==null){
                  var tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+temprequired.first1 +',"'+ this.cm_getsetting("comparison1") +'",'+ temprequired.second1 +','+ this.cm_getsetting("precision1")+'],['+temprequired.first2 +',"'+ this.cm_getsetting("comparison2") +'",'+ temprequired.second2+']], "'+this.cm_getsetting("andor1")+'")';
               }
               else{
                  var tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+temprequired.first1 +',"'+ this.cm_getsetting("comparison1") +'",'+ temprequired.second1 +','+ this.cm_getsetting("precision1")+'],['+temprequired.first2 +',"'+ this.cm_getsetting("comparison2") +'",'+ temprequired.second2 +','+ this.cm_getsetting("precision2")+']], "'+this.cm_getsetting("andor1")+'")';
               };

               if(this.cm_getsetting("andor2") =="n/a"){
                  var tempobjectsecondchildwritestring = namestring+' '+tempfirstcomparisonstring;
               }
               else if(this.cm_getsetting("andor3") =="n/a" || temprequired.parentheses=="((AB)C)D"){
                  if(this.cm_getsetting("precision3").match(/\S/)==null){
                     tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+ tempfirstcomparisonstring+',"e","yes"],['+temprequired.first3 +',"'+ this.cm_getsetting("comparison3") +'",'+ temprequired.second3+']], "'+ this.cm_getsetting("andor2")+'")';
                  }
                  else if(this.cm_getsetting("precision3").match(/\S/)!=null){
                     tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+ tempfirstcomparisonstring+',"e","yes"],['+temprequired.first3 +',"'+  this.cm_getsetting("comparison3") +'",'+  temprequired.second3 +','+ this.cm_getsetting("precision3")+']], "'+this.cm_getsetting("andor2")+'")';
                  }
                  else if( this.cm_getsetting("precision3").match(/\S/)==null){
                     tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+tempfirstcomparisonstring+',"e","yes"],['+temprequired.first3 +',"'+ this.cm_getsetting("comparison3") +'",'+ temprequired.second3+']], "'+this.cm_getsetting("andor2")+'")';
                  }
                  else{
                     tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+tempfirstcomparisonstring+',"e","yes"],['+temprequired.first3 +',"'+ this.cm_getsetting("comparison3") +'",'+ temprequired.second3 +','+ this.cm_getsetting("precision3")+']], "'+this.cm_getsetting("andor2")+'")';
                  };
                  if(this.cm_getsetting("andor3") =="n/a"){
                     var tempobjectsecondchildwritestring = namestring+' '+tempfirstcomparisonstring;
                  }
                  else{  
                     //Comment: This means there are four statements with parentheses from left to right. 
                     if(this.cm_getsetting("precision3").match(/\S/)==null){
                        tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+ tempfirstcomparisonstring+',"e","yes"],['+temprequired.first4 +',"'+ this.cm_getsetting("comparison4") +'",'+ temprequired.second4+']], "'+ this.cm_getsetting("andor3")+'")';
                     }
                     else if(this.cm_getsetting("precision3").match(/\S/)!=null){
                        tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+ tempfirstcomparisonstring+',"e","yes"],['+temprequired.first4 +',"'+  this.cm_getsetting("comparison4") +'",'+  temprequired.second4 +','+ this.cm_getsetting("precision4")+']], "'+this.cm_getsetting("andor3")+'")';
                     }
                     else if( this.cm_getsetting("precision3").match(/\S/)==null){
                        tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+tempfirstcomparisonstring+',"e","yes"],['+temprequired.first4 +',"'+ this.cm_getsetting("comparison4") +'",'+ temprequired.second4+']], "'+this.cm_getsetting("andor4")+'")';
                     }
                     else{
                        tempfirstcomparisonstring= 'CaluMath.Html.Comparison([['+tempfirstcomparisonstring+',"e","yes"],['+temprequired.first4 +',"'+ this.cm_getsetting("comparison4") +'",'+ temprequired.second4 +','+ this.cm_getsetting("precision4")+']], "'+this.cm_getsetting("andor3")+'")';
                     };
                     var tempobjectsecondchildwritestring = namestring+' '+tempfirstcomparisonstring;
                  };              
               }
               else{  //This is for four   statements (AB)(CD) 
                  if(this.cm_getsetting("precision3")=="n/a" && this.cm_getsetting("precision4").match(/\S/)==null){
                     var tempsecondcomparisonstring= 'CaluMath.Html.Comparison([['+ temprequired.first3 +',"'+ this.cm_getsetting("comparison3") +'",'+ temprequired.second3+'],['+temprequired.first4 +',"'+ this.cm_getsetting("comparison4") +'",'+ temprequired.second4+']], "'+ this.cm_getsetting("andor3")+'")';
                  }
                  else if(this.cm_getsetting("precision3").match(/\S/)==null && this.cm_getsetting("precision4").match(/\S/)!=null){
                     var tempsecondcomparisonstring= 'CaluMath.Html.Comparison([['+ temprequired.first3 +',"'+  this.cm_getsetting("comparison3") +'",'+  temprequired.second3+'],['+temprequired.first4 +',"'+  this.cm_getsetting("comparison4") +'",'+  temprequired.second4 +','+ this.cm_getsetting("precision4")+']], "'+this.cm_getsetting("andor3")+'")';
                  }
                  else if(this.cm_getsetting("precision3") !="n/a" && this.cm_getsetting("precision4").match(/\S/)==null){
                     var tempsecondcomparisonstring= 'CaluMath.Html.Comparison([['+temprequired.first3 +',"'+ this.cm_getsetting("comparison3") +'",'+ temprequired.second3 +','+ this.cm_getsetting("precision3")+'],['+temprequired.first4 +',"'+ this.cm_getsetting("comparison4") +'",'+ temprequired.second4+']], "'+this.cm_getsetting("andor3")+'")';
                  }
                  else{
                     var tempsecondcomparisonstring= 'CaluMath.Html.Comparison([['+temprequired.first3 +',"'+ this.cm_getsetting("comparison3") +'",'+ temprequired.second3 +','+ this.cm_getsetting("precision3")+'],['+temprequired.first4 +',"'+ this.cm_getsetting("comparison4") +'",'+ temprequired.second4 +','+ this.cm_getsetting("precision4")+']], "'+this.cm_getsetting("andor3")+'")';
                  };
                     var tempobjectsecondchildwritestring = namestring+' CaluMath.Html.Comparison([['+tempfirstcomparisonstring+',"e","yes"],['+tempsecondcomparisonstring+',"e","yes"]],"'+this.cm_getsetting("andor2")+'")'; 
               }
            };

            //Comment: when checking comparisons with non numeric data, you must use the equals option instead of =. You also need to enclose the right hand side in quotes if it is a String. It does not appear that it matters which quotes are used. 

//            tempobject.childarray[0].writestring = "Here is the  comparison "+nameinputstring+ " "+tempobjectsecondchildwritestring;
///////////REPLACED lastscriptchildarray WITH lastobjectchildarray
            if(  this.parent != null && this.parent.type=="conditional" && this.parent.cm_getsetting("branchtype").match(/if/)){
//            if( (CM_TopWindow.CaluMath.PM.InsertionArray.lastobject() != null && CaluMath.PM.GetPageMakerObjectSetting(CM_TopWindow.CaluMath.PM.InsertionArray.lastobject(), "branchtype").match(/if/) && CM_TopWindow.CaluMath.PM.InsertionArray.lastscriptchildarray()[0]==tempobject) ||  (tempobject.parent != null && tempobject.parent.parent!= null && CaluMath.PM.GetPageMakerObjectSetting(tempobject.parent.parent, "branchtype") != null && CaluMath.PM.GetPageMakerObjectSetting(tempobject.parent.parent, "branchtype").match(/if/)) ){
               return tempobjectsecondchildwritestring+'=="yes"){';  
            }
            else{
               return tempobjectsecondchildwritestring+'\; ';
            };   }
   else if(thistype=="conditional"){
      //Comment: The only thing that needs to be written is the if{ ){ or else{ or else if{  ){ . These are written in the cm_openingtag(). 
      return '';
   }
   else if(thistype=="routine"){
       return ''; 
   }
   else if(thistype=="executeroutine"){
      if(this.cm_getsetting("parameters") != null && this.cm_getsetting("parameters").match(/\w/) ==null){
         var parameters = '()';
      }
//      else if(this.cm_getsetting("parameters") != null && this.cm_getsetting("parameters").match(/^\(/) !=null && this.cm_getsetting("parameters").match(/\w/) ==null){
//         var parameters = '()';
//      }
      else{
         var parameters = '('+this.cm_getsetting("parameters").cm_unescapequotes()+')';
      };
      if(this.cm_getsetting("cm_afterpageloads")=="yes"){
         if(this.cm_getsetting("routine").match(/^CM_MainWindow/)){
            return 'if(cm_onloadbegun != "yes"){cm_onloadarray=cm_onloadarray.concat(function(){'+this.cm_getsetting("routine")+''+parameters+'\;})} else{ '+this.cm_getsetting("routine")+''+parameters+'\; }\;';
         }
         else{
            return 'if(cm_onloadbegun != "yes"){cm_onloadarray=cm_onloadarray.concat(function(){CM_MainWindow.'+this.cm_getsetting("routine")+''+parameters+'\;})} else{ CM_MainWindow.'+this.cm_getsetting("routine")+''+parameters+'\; }\;';
         }
      }
      else{
         if( 1==1 || this.cm_getsetting("routine").match(/^CM_MainWindow/)){
         //Comment: This needs to be changed when we start assigning windows to routines. The 1==1 above always ensures this condition is satisfied. 
            if(this.cm_getsetting("cm_settimeoutamount").length == 0 || this.cm_getsetting("cm_settimeoutamount") == 0){
               return ''+this.cm_getsetting("routine")+''+parameters+'\; '; 
            }
            else{
               return 'setTimeout(\''+this.cm_getsetting("routine")+''+parameters+'\','+this.cm_getsetting("cm_settimeoutamount")+')\; '; 
            };
         }
         else{
            return 'setTimeout(\'CM_MainWindow.'+this.cm_getsetting("routine")+''+parameters+' \','+this.cm_getsetting("cm_settimeoutamount")+')\; ';
         }
      };
   }
   else if(this.type=="newwindow"){
      return '';
   }
   else if(this.type=="text"){
      return this.cm_getsetting("text").replace(/CM_BACKSLASHu/g, "\\u").replace(/CM_NEWLINEREPLACEMENT/g,"<br>");
//      return this.cm_getsetting("text").replace(/CM_BACKSLASHu/g, "\\u").replace(/\&lt\;i\&gt\;/g,"<i>").replace(/\&lt\;\/i\&gt\;/g,"</i>").replace(/\&lt\;b\&gt\;/g,"<b>").replace(/\&lt\;\/b\&gt\;/g,"</b>");
   }
   else if(this.type=="coordinates"){
//      return 'CM_OpeningTagSymbolspan class="cm_mathformula" id="'+this.cm_getsetting("name")+'"> cm_eval('+this.cm_getsetting("definedfunction")+'.'+this.cm_getsetting("type")+'("'+this.cm_getsetting("value")+'","'+this.cm_getsetting("evaluation")+'"))<CM_FORWARDSLASHspan>';
      //Comment: In both returns below, I have not idea why I have double commas replaced with a single comma surrounded by double quotes. I am replacing them in the current version.
      if(this.cm_getsetting("type") != "cm_graphical"){
//         return 'CM_OpeningTagSymbolspan style="white-space:nowrap" id="'+this.cm_getsetting("name")+'"> cm_eval('+this.cm_getsetting("definedfunction")+'.'+this.cm_getsetting("type")+'("'+this.cm_getsetting("value").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,\,/g, '","').replace(/\,/g, '","').replace(/CM_COMMAREPLACEMENT/g,',')+'","'+this.cm_getsetting("evaluation")+'"))<CM_FORWARDSLASHspan>';
         return 'CM_OpeningTagSymbolspan style="white-space:nowrap" id="'+this.cm_getsetting("name")+'"> cm_eval('+this.cm_getsetting("definedfunction")+'.'+this.cm_getsetting("type")+'("'+this.cm_getsetting("value").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,/g, '","').replace(/CM_COMMAREPLACEMENT/g,',')+'","'+this.cm_getsetting("evaluation")+'"))<CM_FORWARDSLASHspan>';
      }
      else{
//         return 'CM_OpeningTagSymbolspan style="white-space:nowrap" id="'+this.cm_getsetting("name")+'">'+this.cm_getsetting("yvalue").replace(/\,\,/g, '","')+'=cm_eval('+this.cm_getsetting("definedfunction")+'.cm_rhs("'+this.cm_getsetting("value").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,\,/g, '","').replace(/\,/g, '","').replace(/CM_COMMAREPLACEMENT/g,',')+'","'+this.cm_getsetting("evaluation")+'"))<CM_FORWARDSLASHspan>';
         return 'CM_OpeningTagSymbolspan style="white-space:nowrap" id="'+this.cm_getsetting("name")+'">'+this.cm_getsetting("yvalue").replace(/\,\,/g, '","')+'=cm_eval('+this.cm_getsetting("definedfunction")+'.cm_rhs("'+this.cm_getsetting("value").replace(/\/\,/g,'CM_COMMAREPLACEMENT').replace(/\,/g, '","').replace(/CM_COMMAREPLACEMENT/g,',')+'","'+this.cm_getsetting("evaluation")+'"))<CM_FORWARDSLASHspan>';
      }
   }
   else if(this.type=="iframecontainer"){
      return '';
   }
   else if(this.type=="newplot"){
      var tempname = this.cm_getsetting("name");
 
      var tempxaxislabel=this.cm_getsetting("cm_xaxislabel").cm_unescapequotes().cm_1escapedoublequotes().cm_unescapequotes().cm_unescapebackslashes();
      var tempyaxislabel=this.cm_getsetting("cm_yaxislabel").cm_unescapequotes().cm_1escapedoublequotes().cm_unescapequotes().cm_unescapebackslashes();
      var templabels = '';

      if(tempxaxislabel!= null && tempxaxislabel.length != 0){
         templabels= templabels+' '+tempname+'.cm_writexaxislabel("'+tempxaxislabel+'")\;';
      };
      if(tempyaxislabel!= null && tempyaxislabel.length != 0){
         templabels= templabels+' '+tempname+'.cm_writeyaxislabel("'+tempyaxislabel+'")\;';
      };


      var tempwidth= this.cm_getsetting("width"); 
      var tempheight =this.cm_getsetting("height"); 
      var tempxstart=this.cm_getsetting("cm_xstart"); 
      var tempxfinish=this.cm_getsetting("cm_xfinish"); 
      var tempystart=this.cm_getsetting("cm_ystart"); 
      var tempyfinish=this.cm_getsetting("cm_yfinish"); 
//      var templabels= this.cm_getsetting("labels"); 


      var tempstatic = CaluMath.PM.IsEntirelyInStaticObjects(this);
//      var tempdynamic= this.cm_getsetting("dynamic");
      var tempcaswindow= this.cm_getsetting("cm_caswindow");

            var tempstringend= ',plotcontainername='+this.cm_getsetting("name")+'"';
            tempstring=this.cm_optionsstring().split(/cm_caswindow/)[0]+ tempstringend;   

            if(tempstatic=="yes"){
               return  'CaluMath.Html.NewPlot("'+tempname+'","'+tempwidth+'","'+tempheight+'","XSTART'+tempxstart+'XSTART","XFINISH'+tempxfinish+'XFINISH","YSTART'+tempystart+'YSTART","YFINISH'+tempyfinish+'YFINISH","cm_caswindow=cm_iframefor'+tempname+', cm_controliframe=yes,'+tempstring+')\;' + templabels+' \;'; 
            }
            else{  
               return 'CaluMath.Html.NewPlot("'+tempname+'","'+tempwidth+'","'+tempheight+'","XSTART'+tempxstart+'XSTART","XFINISH'+tempxfinish+'XFINISH","YSTART'+tempystart+'YSTART","YFINISH'+tempyfinish+'YFINISH","cm_controliframe=yes, cm_caswindow='+tempcaswindow+', '+tempstring+')\;' + templabels+' \;';
            };
   }
   else if(this.type=="pointbrackets3"){
            var tempoptions= this.cm_optionsstring().slice(0).split(/style=fontSize/);
            var pointbrackets3options=tempoptions[0];
            var textoptions=("style=fontSize"+tempoptions[1]).replace(/\,cm_textcolor/, ";color").replace(/\,/g,";").replace(/\;cm_textposition/, ",position").replace(/\;width=auto/, "").replace(/\;$/,"");
            var tempoptions=pointbrackets3options+""+textoptions;
//            return ' '+this.cm_getsetting("newplot")+'.cm_pointbrackets3(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_xcenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycenter")+'".cm_evalmath()], ["'+this.cm_getsetting("cm_x1text")+'","'+this.cm_getsetting("cm_y1text")+'","'+this.cm_getsetting("cm_x2text")+'","'+this.cm_getsetting("cm_y2text")+'","'+this.cm_getsetting("cm_x3text")+'","'+this.cm_getsetting("cm_y3text")+'","'+this.cm_getsetting("cm_x4text")+'","'+this.cm_getsetting("cm_y4text")+'"],"'+tempoptions+'")\; ';
            return ' '+this.cm_getsetting("newplot")+'.cm_pointbrackets3(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_xcenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycenter")+'".cm_evalmath()], ["'+this.cm_getsetting("cm_x1text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_y1text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_x2text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_y2text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_x3text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_y3text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_x4text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_y4text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript()],"'+tempoptions+'")\; ';
   }
   else if(this.type=="pointbrackets2"){
            var tempoptions= this.cm_optionsstring().slice(0).split(/style=fontSize/);
            var pointbrackets2options=tempoptions[0];
            var textoptions=("style=fontSize"+tempoptions[1]).replace(/\,cm_textcolor/, ";color").replace(/\,/g,";").replace(/\;cm_textposition/, ",position").replace(/\;width=auto/, "").replace(/\;$/,"");
            var tempoptions=pointbrackets2options+""+textoptions;
//            return ' '+this.cm_getsetting("newplot")+'.cm_pointbrackets2(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_xcenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycenter")+'".cm_evalmath()], ["'+this.cm_getsetting("cm_yzero")+'","'+this.cm_getsetting("cm_xpos")+'","'+this.cm_getsetting("cm_xneg")+'","'+this.cm_getsetting("cm_xzero")+'","'+this.cm_getsetting("cm_ypos")+'","'+this.cm_getsetting("cm_yneg")+'"],"'+tempoptions+'")\; ';
//            return ' '+this.cm_getsetting("newplot")+'.cm_pointbrackets2(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_xcenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycenter")+'".cm_evalmath()], ["'+this.cm_getsetting("cm_yzero")+'","'+this.cm_getsetting("cm_xpos")+'","'+this.cm_getsetting("cm_xneg")+'","'+this.cm_getsetting("cm_xzero")+'","'+this.cm_getsetting("cm_ypos")+'","'+this.cm_getsetting("cm_yneg")+'"],"'+tempoptions+'")\; ';
            return ' '+this.cm_getsetting("newplot")+'.cm_pointbrackets2(["'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_xcenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycenter")+'".cm_evalmath()], ["'+this.cm_getsetting("cm_yzero")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_xpos")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_xneg")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_xzero")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_ypos")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+this.cm_getsetting("cm_yneg")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript()],"'+tempoptions+'")\; ';
   }
   else if(this.type=="pointbrackets1"){
            var tempoptions= this.cm_optionsstring().slice(0).split(/style=fontSize/);
            var lineoptions=tempoptions[0];
            var textoptions=("style=fontSize"+tempoptions[1]).replace(/\,cm_fontcolor/, ";color").replace(/cm_textposition/, "position").replace(/\;width=auto/, "").replace(/\;$/,"");
            var tempoptions=pointbrackets2options+""+textoptions;
            return ' '+this.cm_getsetting("newplot")+'.cm_pointbrackets1(["'+this.cm_getsetting("cm_xcenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycenter")+'".cm_evalmath(),"'+this.cm_getsetting("cm_xcoordinate")+'".cm_evalmath(),"'+this.cm_getsetting("cm_ycoordinate")+'".cm_evalmath()],"'+this.cm_getsetting("cm_xoffset")+'".cm_evalmath(),"'+this.cm_getsetting("cm_yoffset")+'".cm_evalmath(),["'+this.cm_getsetting("cm_text")+'".cm_unescapequotes().cm_unescapebackslashes().cm_javascript(),"'+textoptions+'"],"'+lineoptions+'")\; ';
   }
   else if(this.type=="animationplot"){
            var animationfunctionslist = new Array();
            var animationfigurelist = new Array();
            var offsetlist = new Array();
            animationloop:
            for(var i=1; i<6; i++){ 
               if(this.cm_getsetting("cm_definedfunction"+i+"x") != undefined    && this.cm_getsetting("cm_definedfunction"+i+"x") != "undefined"   && this.cm_getsetting("cm_definedfunction"+i+"x") != "n/a" ){
                  animationfunctionslist.push(['"' +this.cm_getsetting("cm_definedfunction"+i+"x") +'"' , '"'+this.cm_getsetting("cm_definedfunction"+i+"y") +'"']);
                  if(this.cm_getsetting("cm_figure"+i).match(/^\s*\[/)){
                     animationfigurelist.push(this.cm_getsetting("cm_figure"+i).replace(/^\s*\[/,'["').replace(/\,/g,'","').replace(/\]\s*$/,'"]'));
                  }
                  else{
                     animationfigurelist.push('"'+this.cm_getsetting("cm_figure"+i) +'"');
                  };
               }
               else{
                  break animationloop;
               };
            };
            for(var i=0; i<6; i++){ 
               if((this.cm_getsetting("cm_image"+i+"leftoffset") != "n/a" && this.cm_getsetting("cm_image"+i+"leftoffset") != "default") &&  this.cm_getsetting("cm_image"+i+"leftoffset").length >0){
                  offsetlist.push("cm_image"+i+"leftoffset="+this.cm_getsetting("cm_image"+i+"leftoffset")+",cm_image"+i+"leftoffset="+this.cm_getsetting("cm_image"+i+"leftoffset")+",cm_image"+i+"topoffset="+this.cm_getsetting("cm_image"+i+"topoffset")+",cm_image"+i+"topoffset="+this.cm_getsetting("cm_image"+i+"topoffset"));
               };
               if((this.cm_getsetting("cm_image"+i+"topoffset") != "n/a" && this.cm_getsetting("cm_image"+i+"topoffset") != "default") && this.cm_getsetting("cm_image"+i+"toptoffset").length >0 ){
                  offsetlist.push("cm_image"+i+"leftoffset="+this.cm_getsetting("cm_image"+i+"leftoffset")+",cm_image"+i+"leftoffset="+this.cm_getsetting("cm_image"+i+"leftoffset")+",cm_image"+i+"topoffset="+this.cm_getsetting("cm_image"+i+"topoffset")+",cm_image"+i+"topoffset="+this.cm_getsetting("cm_image"+i+"topoffset"));
               };
            };
               var tempstring= 'cm_animationlength='+this.cm_getsetting("cm_animationlength")+','+this.cm_optionsstring()+','+offsetlist.join(",");

            return  ' '+this.cm_getsetting("newplot")+'.cm_animationplot("'+this.cm_getsetting("name")+'","'+this.cm_getsetting("cm_xstart")+'","'+this.cm_getsetting("cm_xfinish")+'",'+animationfunctionslist.cm_display()+','+ animationfigurelist.cm_display()+',"'+tempstring+'")\;'; 
   }
   else if(this.type=="changedirectionbutton" || this.type=="startbutton" || this.type =="stopbutton" || this.type =="resetbutton" || this.type =="stepbutton" || this.type =="increasespeedbutton" ||  this.type =="decreasespeedbutton"){
      return ' '+this.cm_getsetting("animationplot")+'.cm_write'+this.type+'(["'+this.cm_optionsstring()+'"])\;'; 
   }
   else if(this.type=="animationoutput"){
      return ' '+this.cm_getsetting("animationplot")+'.cm_animationoutput("'+this.cm_getsetting("name")+'","'+this.cm_getsetting("definedfunction")+'", "'+this.cm_optionsstring()+'")\;'; 
   }
   else if(this.type=="compositeanimation"){
      var i=1; 
      var tempanimationlist= new Array();
      while(this.cm_getsetting("animationplot"+i) != "n/a" && i<6){
         tempanimationlist.push(this.cm_getsetting("animationplot"+i));
         i++;
      };
      return ' new CaluMath.Html.CompositeAnimationPlot("'+this.cm_getsetting("name")+'", ['+tempanimationlist+'])\;';
   }
   else if(this.type=="table"){
      return '';
   }
   else if(this.type=="tablefromdata"){
      var tempoptions=this.cm_optionsstring();
      var tempremainingoptions= tempoptions.split(/cm_caswindow/)[1];
      if(tempremainingoptions != null){
         tempremainingoptions= ",cm_caswindow"+tempremainingoptions;
      }
      else{
         tempremainingoptions= ""; 
      };

      var tempstylestring="cm_firstrowstyle=";
      var tempoption=this.cm_getsetting("cm_firstrowstylefontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstrowstylecolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstrowstyletextAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      tempstylestring=tempstylestring+",cm_firstcolumnstyle=";
      var tempoption=this.cm_getsetting("cm_firstcolumnstylefontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstcolumnstylecolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstcolumnstyletextAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      tempstylestring=tempstylestring+",cm_topleftstyle=";
      var tempoption=this.cm_getsetting("cm_topleftstylefontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_topleftstylecolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_topleftstyletextAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      tempstylestring=tempstylestring+",style=";
      var tempoption=this.cm_getsetting("fontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("color");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("textAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("borderspacing");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"borderSpacing="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("backgroundcolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"backgroundColor="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("borderstyle");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"borderStyle="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("bordercolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"borderColor="+tempoption+"\;";
      };

      var attributestring=",cm_attribute=";
      var temprequiredborder= this.cm_getsetting("border");
      if(temprequiredborder.length >0){
         attributestring= attributestring + ' border='+temprequiredborder+'\;' 
      };

      var usetheseoptions= tempstylestring+attributestring+tempremainingoptions;

      return 'new CaluMath.Html.Table(CM_ParentObject,"'+this.cm_getsetting("name")+'",'+this.cm_getsetting("cm_tabledata").cm_unescapequotes()+',"'+usetheseoptions+'")\;'; 
   }
   else if(this.type=="discretefunctionconstructiontable"){
      var tempoptions=this.cm_optionsstring();
      var tempremainingoptions= tempoptions.split(/cm_caswindow/)[1];
      if(tempremainingoptions != null){
         tempremainingoptions= ",cm_caswindow"+tempremainingoptions;
      }
      else{
         tempremainingoptions= ""; 
      };

      var tempstylestring="cm_firstrowstyle=";
      var tempoption=this.cm_getsetting("cm_firstrowstylefontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstrowstylecolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstrowstyletextAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      tempstylestring=tempstylestring+",cm_firstcolumnstyle=";
      var tempoption=this.cm_getsetting("cm_firstcolumnstylefontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstcolumnstylecolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_firstcolumnstyletextAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      tempstylestring=tempstylestring+",cm_topleftstyle=";
      var tempoption=this.cm_getsetting("cm_topleftstylefontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_topleftstylecolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("cm_topleftstyletextAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      tempstylestring=tempstylestring+",style=";
      var tempoption=this.cm_getsetting("fontSize");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"fontSize="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("color");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"color="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("textAlign");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"textAlign="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("borderspacing");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"borderSpacing="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("backgroundcolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"backgroundColor="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("borderstyle");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"borderStyle="+tempoption+"\;";
      };
      var tempoption=this.cm_getsetting("bordercolor");
      if(tempoption.length >0 && tempoption != "n/a"){
         tempstylestring=tempstylestring+"borderColor="+tempoption+"\;";
      };

      var attributestring=",cm_attribute=";
      var temprequiredborder= this.cm_getsetting("border");
      if(temprequiredborder.length >0){
         attributestring= attributestring + ' border='+temprequiredborder+'\;' 
      };

      var usetheseoptions= tempstylestring+attributestring+tempremainingoptions;
      return 'new CaluMath.Html.DiscreteFunctionCollection(CM_ParentObject, "'+this.cm_getsetting("name")+'DiscreteCollection", '+this.cm_getsetting("datatable")+',  '+this.cm_getsetting("cm_functionrulelabels").cm_unescapequotes()+', "cm_undefinedsymbol='+this.cm_getsetting("cm_undefinedsymbol")+'");  new CaluMath.Html.DiscreteFunctionConstructionTable("'+this.cm_getsetting("name")+'",'+this.cm_getsetting("name")+'DiscreteCollection, "'+usetheseoptions+'")\;';  
   }
   else if(this.type=="functiontable"){
      var rows=this.cm_getsetting("rows");
      var cols=this.cm_getsetting("cols");
      var tempdelta= '"'+this.cm_getsetting("cm_delta")+'".cm_evalmath()';
      var tempxvalue= '"'+this.cm_getsetting("cm_xvalue")+'".cm_evalmath()';
      var tempreturnarray= new Array(); 

      var tempborderstyle = CaluMath.PM.GetPageMakerObjectSetting(this,"borderstyle");
      var tempbordercolor = CaluMath.PM.GetPageMakerObjectSetting(this,"bordercolor");
      var tempborder = CaluMath.PM.GetPageMakerObjectSetting(this,"border");
      var tempborderspacing = CaluMath.PM.GetPageMakerObjectSetting(this,"borderspacing");
      var tempbackgroundcolor = CaluMath.PM.GetPageMakerObjectSetting(this,"backgroundcolor");
      var tempcolor = CaluMath.PM.GetPageMakerObjectSetting(this,"color");
      var tempfontsize = CaluMath.PM.GetPageMakerObjectSetting(this,"font-size");
      var tempheadbackgroundcolor = CaluMath.PM.GetPageMakerObjectSetting(this,"headbackgroundcolor");
      var tempheadcolor = CaluMath.PM.GetPageMakerObjectSetting(this,"headcolor");
      var tempheadfontsize = CaluMath.PM.GetPageMakerObjectSetting(this,"headfont-size");
      var tempdisplay = CaluMath.PM.GetPageMakerObjectSetting(this,"display");
      var temptextalign = CaluMath.PM.GetPageMakerObjectSetting(this,"text-align");
      var tempname = CaluMath.PM.GetPageMakerObjectSetting(this,"name");
      var stylestring='style="';
      var headstylestring='style="';

      if(tempbordercolor != "" && tempbordercolor != "n/a" ){
         stylestring= stylestring+'border-color:'+tempbordercolor+'\; ';
      };
      if(tempborderstyle != "" && tempborderstyle != "n/a" ){
         stylestring= stylestring+'border-style:'+tempborderstyle+'\; ';
      };
      if(tempborderspacing != "" && tempborderspacing != "n/a"){
         stylestring= stylestring+'border-spacing:'+tempborderspacing+'\; ';
      };
      if(tempbackgroundcolor != "" && tempbackgroundcolor != "n/a"){
         stylestring= stylestring+'background-color:'+tempbackgroundcolor+'\; ';
      };
      if(tempcolor != "" && tempcolor != "n/a"){
         stylestring= stylestring+'color:'+tempcolor+'\; ';
      };
      if(tempfontsize != "" && tempfontsize != "n/a"){
         stylestring= stylestring+'font-size:'+tempfontsize+'\; ';
      };
      if(temptextalign != "" && temptextalign != "n/a"){
         stylestring= stylestring+'text-align:'+temptextalign+'\; ';
      };
      if(tempdisplay != "" && tempdisplay != "n/a"){
         stylestring= stylestring+'display:'+tempdisplay+'\; ';
      };
      if(stylestring=='style="'){
         stylestring='';
      }
      else{
         stylestring=stylestring +'" ';
      };

      if(tempheadbackgroundcolor != "" && tempheadbackgroundcolor != "n/a"){
         headstylestring= headstylestring+'background-color:'+tempheadbackgroundcolor+'\; ';
      };
      if(tempheadcolor != "" && tempheadcolor != "n/a"){
         headstylestring= headstylestring+'color:'+tempheadcolor+'\; ';
      };
      if(tempheadfontsize != "" && tempheadfontsize != "n/a"){
         headstylestring= headstylestring+'font-size:'+tempheadfontsize+'\; ';
      };
      if(headstylestring=='style="'){
         headstylestring='';
      }
      else{
         headstylestring=headstylestring +'" ';
      };

      if(tempborder != "n/a"){
         var tempborder='border="'+tempborder+'" ';
      }
      else{
         var tempborder='';
      };

      var tempobject=this;
      var tempheadfunction=function(){
         var tempheadreturnarray= new Array();
         for(var i=1; i<=cols; i++){
            tempheadreturnarray[i]='<td>'+tempobject.cm_getsetting("cm_colheading"+i)+'<CM_FORWARDSLASHtd>';
         };
         return tempheadreturnarray.join("");
      };

      var evaluationarray=new Array();
      for(var i=1; i<=cols; i++){
         if(this.cm_getsetting("definedfunction"+i) != "x"){
            evaluationarray[i]='<td><span>\'+'+this.cm_getsetting("definedfunction"+i)+'.cm_rhs(1*('+tempxvalue+')+cm_temporaryvariable*(1*'+tempdelta+'),"'+this.cm_getsetting("evaluation"+i)+'","'+this.cm_getsetting("cm_precision"+i)+'")+\'<CM_FORWARDSLASHspan><CM_FORWARDSLASHtd>';
         }
         else{
            evaluationarray[i]='<td><span>\'+CaluMath.Html.Round(1*('+tempxvalue+')+cm_temporaryvariable*(1*'+tempdelta+'),"'+this.cm_getsetting("cm_precision"+i)+'")+\'<CM_FORWARDSLASHspan><CM_FORWARDSLASHtd>';
         };
      };
      evaluationarray='<tr>'+evaluationarray.join("")+'<CM_FORWARDSLASHtr>';



      for(var j=0; j<rows; j++){
         for(var i=1; i<=cols; i++){
         tempreturnarray[j]= evaluationarray.replace(/cm_temporaryvariable/g,j.toString());
         };
      };
      return '(\'<table '+tempborder+' '+stylestring+' ><thead '+headstylestring+' ><tr>'+tempheadfunction()+'<CM_FORWARDSLASHtr><CM_FORWARDSLASHthead><tbody>'+tempreturnarray.join("")+'<CM_FORWARDSLASHtbody><CM_FORWARDSLASHtable>\').cm_html("name='+tempname+', cm_caswindow='+this.cm_getsetting("cm_caswindow")+', cm_insertoption='+this.cm_getsetting("cm_insertoption")+', cm_inserttarget='+this.cm_getsetting("cm_inserttarget")+'")\; ';
   }
   else if(this.type=="javascript"){
      return this.cm_getsetting("command").replace(/CM_NEWLINEREPLACEMENT/g," ").cm_unescapequotes()+'\; ';
   }
   else if(this.type=="search"){
      var tempstring1='';
      var tempstring2='';
      var tempstring3='';
      var tempstring4='';
     
      var cm_convertarray= this.cm_getsetting("cm_convertarray");
      if(cm_convertarray == "yes"){
         var convertarraystring=".cm_convertgraphstopointsarray()";
      }
      else{
         var convertarraystring="";
      };


      var leftvalue1= this.cm_getsetting("leftvalue1");
      var leftrelation1= this.cm_getsetting("leftrelation1");
      var var1 = this.cm_getsetting("var1");
      var rightrelation1 = this.cm_getsetting("rightrelation1");
      var rightvalue1 = this.cm_getsetting("rightvalue1");
      var precision1 = this.cm_getsetting("precision1");
      var andor1 = this.cm_getsetting("andor1");

      var leftvalue2= this.cm_getsetting("leftvalue2");
      var leftrelation2= this.cm_getsetting("leftrelation2");
      var var2 = this.cm_getsetting("var2");
      var rightrelation2 = this.cm_getsetting("rightrelation2");
      var rightvalue2 = this.cm_getsetting("rightvalue2");
      var precision2 = this.cm_getsetting("precision2");
      var andor2 = this.cm_getsetting("andor2");

      var leftvalue3= this.cm_getsetting("leftvalue3");
      var leftrelation3= this.cm_getsetting("leftrelation3");
      var var3 = this.cm_getsetting("var3");
      var rightrelation3 = this.cm_getsetting("rightrelation3");
      var rightvalue3 = this.cm_getsetting("rightvalue3");
      var precision3 = this.cm_getsetting("precision3");
      var andor3 = this.cm_getsetting("andor3");

      var leftvalue4= this.cm_getsetting("leftvalue4");
      var leftrelation4= this.cm_getsetting("leftrelation4");
      var var4 = this.cm_getsetting("var4");
      var rightrelation4 = this.cm_getsetting("rightrelation4");
      var rightvalue4 = this.cm_getsetting("rightvalue4");
      var precision4 = this.cm_getsetting("precision4");
      var andor4 = this.cm_getsetting("andor4");

      var pixels = this.cm_getsetting("pixels");

      if(pixels =="yes" && precision1.length >0){
         precision1= precision1+'/('+this.cm_getsetting("newplot")+'.cm_pixelsper'+var1.charAt(4)+')';
      };

      if(pixels =="yes" && precision2.length >0){
         precision2= precision2+'/('+this.cm_getsetting("newplot")+'.cm_pixelsper'+var2.charAt(4)+')';
      };

      if(pixels =="yes" && precision3.length >0){
         precision3= precision3+'/('+this.cm_getsetting("newplot")+'.cm_pixelsper'+var3.charAt(4)+')';
      };

      if(pixels =="yes" && precision4.length >0){
         precision4= precision4+'/('+this.cm_getsetting("newplot")+'.cm_pixelsper'+var4.charAt(4)+')';
      };
      
      //Comment: Note that we leave the first and last square bracket off of each of these in case we want to combine them with another tempstring below somewhere.
      if(leftvalue1.length >0 && leftrelation1 != "n/a" && rightrelation1 != "n/a" && rightvalue1.length>0 ){
         if(precision1.length >0){
            tempstring1= '["'+var1+'", "'+leftrelation1+'","'+ leftvalue1+'","'+precision1+'"],["'+var1+'","'+rightrelation1+'","'+rightvalue1+'","'+precision1+'"]';  
         }
         else{
            tempstring1= '["'+var1+'", "'+leftrelation1+'","'+ leftvalue1+'"],["'+var1+'","'+rightrelation1+'","'+rightvalue1+'"]';  
         }
      }
      else if(leftvalue1.length >0 && leftrelation1 != "n/a"){
         if(precision1.length >0){
            tempstring1= '["'+var1+'", "'+leftrelation1+'","'+ leftvalue1+'","'+precision1+'"]';  
         }
         else{
            tempstring1= '["'+var1+'", "'+leftrelation1+'","'+ leftvalue1+'"]';  
         }
      }
      else if(rightrelation1 != "n/a" && rightvalue1.length>0 ){
         if(precision1.length >0){
            tempstring1= '["'+var1+'","'+rightrelation1+'","'+rightvalue1+'","'+precision1+'"]';  
         }
         else{
            tempstring1= '["'+var1+'","'+rightrelation1+'","'+rightvalue1+'"]';  
         }
      };

      if(leftvalue2.length >0 && leftrelation2 != "n/a" && rightrelation2 != "n/a" && rightvalue2.length>0 ){
         if(precision2.length >0){
            tempstring2= '["'+var2+'", "'+leftrelation2+'","'+ leftvalue2+'","'+precision2+'"],["'+var2+'","'+rightrelation2+'","'+rightvalue2+'","'+precision2+'"]';  
         }
         else{
            tempstring2= '["'+var2+'", "'+leftrelation2+'","'+ leftvalue2+'"],["'+var2+'","'+rightrelation2+'","'+rightvalue2+'"]';  
         }
      }
      else if(leftvalue2.length >0 && leftrelation2 != "n/a"){
         if(precision2.length >0){
            tempstring2= '["'+var2+'", "'+leftrelation2+'","'+ leftvalue2+'","'+precision2+'"]';  
         }
         else{
            tempstring2= '["'+var2+'", "'+leftrelation2+'","'+ leftvalue2+'"]';  
         }
      }
      else if(rightrelation2 != "n/a" && rightvalue2.length>0 ){
         if(precision2.length >0){
            tempstring2= '["'+var2+'","'+rightrelation2+'","'+rightvalue2+'","'+precision2+'"]';  
         }
         else{
            tempstring2= '["'+var2+'","'+rightrelation2+'","'+rightvalue2+'"]';  
         }
      };

      if(leftvalue3.length >0 && leftrelation3 != "n/a" && rightrelation3 != "n/a" && rightvalue3.length>0 ){
         if(precision3.length >0){
            tempstring3= '["'+var3+'", "'+leftrelation3+'","'+ leftvalue3+'","'+precision3+'"],["'+var3+'","'+rightrelation3+'","'+rightvalue3+'","'+precision3+'"]';  
         }
         else{
            tempstring3= '["'+var3+'", "'+leftrelation3+'","'+ leftvalue3+'"],["'+var3+'","'+rightrelation3+'","'+rightvalue3+'"]';  
         }
      }
      else if(leftvalue3.length >0 && leftrelation3 != "n/a"){
         if(precision3.length >0){
            tempstring3= '["'+var3+'", "'+leftrelation3+'","'+ leftvalue3+'","'+precision3+'"]';  
         }
         else{
            tempstring3= '["'+var3+'", "'+leftrelation3+'","'+ leftvalue3+'"]';  
         }
      }
      else if(rightrelation3 != "n/a" && rightvalue3.length>0 ){
         if(precision3.length >0){
            tempstring3= '["'+var3+'","'+rightrelation3+'","'+rightvalue3+'","'+precision3+'"]';  
         }
         else{
            tempstring3= '["'+var3+'","'+rightrelation3+'","'+rightvalue3+'"]';  
         }
      };

      if(leftvalue4.length >0 && leftrelation4 != "n/a" && rightrelation4 != "n/a" && rightvalue4.length>0 ){
         if(precision4.length >0){
            tempstring4= '["'+var4+'", "'+leftrelation4+'","'+ leftvalue4+'","'+precision4+'"],["'+var4+'","'+rightrelation4+'","'+rightvalue4+'","'+precision4+'"]';  
         }
         else{
            tempstring4= '["'+var4+'", "'+leftrelation4+'","'+ leftvalue4+'"],["'+var4+'","'+rightrelation4+'","'+rightvalue4+'"]';  
         }
      }
      else if(leftvalue4.length >0 && leftrelation4 != "n/a"){
         if(precision4.length >0){
            tempstring4= '["'+var4+'", "'+leftrelation4+'","'+ leftvalue4+'","'+precision4+'"]';  
         }
         else{
            tempstring4= '["'+var4+'", "'+leftrelation4+'","'+ leftvalue4+'"]';  
         }
      }
      else if(rightrelation4 != "n/a" && rightvalue4.length>0 ){
         if(precision4.length >0){
            tempstring4= '["'+var4+'","'+rightrelation4+'","'+rightvalue4+'","'+precision4+'"]';  
         }
         else{
            tempstring4= '["'+var4+'","'+rightrelation4+'","'+rightvalue4+'"]';  
         }
      };

      if(this.cm_getsetting("cm_array").length >0){
         var objecttobesearched=this.cm_getsetting("cm_array");
      }
      else{
         if(this.cm_getsetting("cm_search")=="point"){
            var objecttobesearched=this.cm_getsetting("newplot")+'.cm_get'+this.cm_getsetting("cm_search")+'s()';
         }
         else{
            var objecttobesearched=this.cm_getsetting("newplot")+'.'+this.cm_getsetting("graph")+'.cm_get'+this.cm_getsetting("cm_search")+'s()';
         };
      };



      var tempreturn1 ='';
      var tempreturn2 ='';
      var tempreturn3 ='';
      var tempreturn4 ='';

      if(tempstring1.length>0 && tempstring2.length>0 ==0){
         return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch(['+tempstring1+'],"and")'+convertarraystring+'\; ';
      }
      else if( tempstring2.length>0 && tempstring3.length==0){

         if(andor1=="and"){
            return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch(['+tempstring1+','+tempstring2+'],"and")'+convertarraystring+'\; ';
         }
         else if(andor1=="or"){
            return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([['+tempstring1+'], "and"],[['+tempstring2+'], "and"], "or")'+convertarraystring+'\; ';
         };
      }
      else if(tempstring1.length>0 && tempstring2.length>0 &&  tempstring3.length>0 && tempstring4.length==0){

         if(andor1=="and" && andor2=="and"  ){
            return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch(['+tempstring1+','+tempstring2+','+tempstring3+'],"and")'+convertarraystring+'\; ';
         }
         else if(andor1=="and" && andor2=="or"  ){
            return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([['+tempstring1+','+tempstring2+'],"and"], [['+tempstring3+'], "and"], "or")'+convertarraystring+'\; ';
         }
         else if(andor1=="or" && andor2=="and"  ){
            return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'],"and"], [['+tempstring2+'],"and"], "or"],[['+tempstring3+'],"and"],"and")'+convertarraystring+'\; ';
         }
         else if(andor1=="or" && andor2=="or"  ){
            return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'],"and"], [['+tempstring2+'], "and"], "or"],[['+tempstring3+'],"and"],"or")'+convertarraystring+'\; ';
         };
      }
      else if(tempstring1.length>0 && tempstring2.length>0 &&  tempstring3.length>0 &&  tempstring4.length > 0){

         if(this.cm_getsetting("parentheses") !="(AB)(CD)"){ 
            if(andor1=="and" && andor2=="and" && andor3=="and"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch(['+tempstring1+','+tempstring2+','+tempstring3+','+tempstring4+'],"and")'+convertarraystring+'\; ';
            }
            else if(andor1=="and" && andor2=="or" && andor3=="and" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+','+tempstring2+'],"and"], [['+tempstring3+'], "and"], "or"],[['+tempstring4+'], "and"], "or" )'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor2=="and" && andor3=="and" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[[['+tempstring1+'],"and"], [['+tempstring2+'],"and"], "or"],[['+tempstring3+'],"and"],"and"],[['+tempstring4+'],"and"],"and" )'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor2=="or" && andor3=="and" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[[['+tempstring1+'],"and"], [['+tempstring2+'], "and"], "or"],[['+tempstring3+'],"and"],"or"],[['+tempstring4+'],"and"],"and" )'+convertarraystring+'\; ';
            }

            else if(andor1=="and" && andor2=="and" && andor3=="or" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([['+tempstring1+','+tempstring2+','+tempstring3+'],"and"], [['+tempstring4+'], "and"], "or" )'+convertarraystring+'\; ';
            }
            else if(andor1=="and" && andor2=="or" && andor3=="or" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+','+tempstring2+'],"and"], [['+tempstring3+'], "and"], "or"], [['+tempstring4+'], "and"], "or"  )'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor2=="and" && andor3=="or" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[[['+tempstring1+'],"and"], [['+tempstring2+'],"and"], "or"],[['+tempstring3+'],"and"],"and"], [['+tempstring4+'], "and"], "or" )'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor2=="or" && andor3=="or" ){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[[['+tempstring1+'],"and"], [['+tempstring2+'], "and"], "or"],[['+tempstring3+'],"and"],"or"], [['+tempstring4+'], "and"], "or")'+convertarraystring+'\; ';
            }
         }
         else{
            if(andor1=="and" && andor3=="and" && andor2=="and"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch(['+tempstring1+','+tempstring2+','+tempstring3+','+tempstring4+'],"and")'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor3=="and" && andor2=="and"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'], "and"],[['+tempstring2+'], "and"], "or"], [[['+tempstring3+'], "and"],[['+tempstring4+'], "and"], "and"], "and")'+convertarraystring+'\; ';
            }

            if(andor1=="and" && andor3=="or" && andor2=="and"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'], "and"],[['+tempstring2+'], "and"], "and"], [[['+tempstring3+'], "and"],[['+tempstring4+'], "and"], "or"], "and")'+convertarraystring+'\; ';
            }
            else if(andor1=="or"&&  andor3=="or" && andor2=="and"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'], "and"],[['+tempstring2+'], "and"], "or"], [[['+tempstring3+'], "and"],[['+tempstring4+'], "and"], "or"], "and")'+convertarraystring+'\; ';
            }

            else if(andor1=="and" && andor3=="and" && andor2=="or"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([['+tempstring1+','+tempstring2+'],"and"], [['+tempstring3+','+tempstring4+'],"and"],"or")'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor3=="and" && andor2=="or"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'], "and"],[['+tempstring2+'], "and"], "or"], [[['+tempstring3+'], "and"],[['+tempstring4+'], "and"], "and"], "or")'+convertarraystring+'\; ';
            }

            if(andor1=="and" && andor3=="or" && andor2=="or"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([['+tempstring1+','+tempstring2+'],"and"], [[['+tempstring3+'], "and"],[['+tempstring4+'], "and"], "or"], "or")'+convertarraystring+'\; ';
            }
            else if(andor1=="or" && andor3=="or" && andor2=="or"){
               return  this.cm_getsetting("name")+ '= '+objecttobesearched+'.cm_generalsearch([[['+tempstring1+'], "and"],[['+tempstring2+'], "and"], "or"], [[['+tempstring3+'], "and"],[['+tempstring4+'], "and"], "or"], "or")'+convertarraystring+'\; ';
            }
         };
      };

         tempreturn2 = this.cm_getsetting("name")+ '= '+this.cm_getsetting("newplot")+'.cm_get'+this.cm_getsetting("cm_search")+'s().cm_search('+tempstring1+')'+convertarraystring+'\; ';

      if(tempstring3.length>0){
         tempreturn3 = this.cm_getsetting("name")+ '= '+this.cm_getsetting("newplot")+'.cm_get'+this.cm_getsetting("cm_search")+'s().cm_search('+tempstring1+')'+convertarraystring+'\; ';
      };

      if(tempstring4.length>0){
         tempreturn4 = this.cm_getsetting("name")+ '= '+this.cm_getsetting("newplot")+'.cm_get'+this.cm_getsetting("cm_search")+'s().cm_search('+tempstring1+')'+convertarraystring+'\; ';
      };

      if(tempstring3.length ==0 && andor1=="and"){
          return tempreturn1+'.cm_and('+tempreturn2+')\; ';
      }
      else if(tempstring3.length ==0 && andor1=="or"){
          return tempreturn1+'.cm_or('+tempreturn2+')\; ';
      };
   }
   else{
      return '';
   };
};




}; //Comment: This is the closing bracket for the entire page.



