TutorialWindow=frames[0]; 


GetThisButton= function(){
   templist=TutorialWindow.document.getElementsByTagName("input");
   if(arguments[1] != null && arguments[1] != "ignore"){
      var tempmatch=arguments[1].replace(/\s/g,"")+" "+TutorialWindow.CaluMath.PM.PageMakerObjectLabelName(arguments[0]);
   }
   else if(arguments[1] == "ignore"){
      var tempmatch=arguments[0].replace(/^\s*/,"").replace(/\s*$/,"");
   }
   else{
      tempmatch="Finish "+TutorialWindow.CaluMath.PM.PageMakerObjectLabelName(arguments[0]);
   };
   templistlength=templist.length;
   for(var i=templistlength-1; i>=0; i--){
      if(templist[i].type =="button" && templist[i].value==tempmatch){
         return templist[i];
      };
   };
};

GetThisTextBox= function(){
   templist=TutorialWindow.document.getElementsByTagName("input");
   if(arguments[1] != null){
      var tempvalue=arguments[1]
   }
   else{
      tempvalue="value";
   };
   templistlength=templist.length;
   for(var i=templistlength-1; i>=0; i--){
      if(templist[i].type == "text" && templist[i][tempvalue].replace(/^\s*/,"").replace(/\s*$/,"")==arguments[0]){
         return templist[i];
      };
   };
   templist=TutorialWindow.document.getElementsByTagName("textarea");
   templistlength=templist.length;
   for(var i=templistlength-1; i>=0; i--){
      if(templist[i][tempvalue].replace(/^\s*/,"").replace(/\s*$/,"")==arguments[0]){
         return templist[i];
      };
   };
};


GetThisSelectMenu= function(){
   templist=TutorialWindow.document.getElementsByTagName("select");
   if(arguments[1] != null){
      var tempindex=arguments[1]
   }
   else{
      tempindex=0;
   };
   templistlength=templist.length-1;
   for(var i=templistlength; i>=0; i--){
      if(templist[i].options != null && templist[i].options[tempindex] != null && (  ((templist[i].options[tempindex].value != null) && (templist[i].options[tempindex].value.replace(/^\s*/,"").replace(/\s*$/,"")==arguments[0])) || ((templist[i].options[tempindex].text!= null) && (templist[i].options[tempindex].text.replace(/^\s*/,"").replace(/\s*$/,"")==arguments[0]))) ){
         return templist[i];
      };
   };
};


CaluMath.PM.MainMenuTutorialOnclickWrong=function(){
   return alert("You did not select "+TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][0]+". Please do so and click the Continue button");
};

CaluMath.PM.MainMenuElementTutorialOnClickReplacement= function(){

//alert("Hi there");
//alert([window==window.TutorialWindow, window==window.top, TutorialWindow.CaluMath.PM.MainMenuElementOnClick]);
this.onclick= TutorialWindow.CaluMath.PM.MainMenuElementOnClick;
this.onclick();
CaluMath.CorrectClickFunction();
      CaluMath.Html.Focus(CM_ParentObject.RemoveFocus); 
};

CaluMath.PM.SubMenuTutorialOnclickWrong=function(){
alert("Please click on the "+TutorialWindow.CaluMath.PM[TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][1].replace(/SELECT/,"")+"LIST"][CorrectSubMenuEntry][0]+" entry");
};

CaluMath.PM.SubMenuElementTutorialOnClickReplacement= function(){
//alert("correct");
CaluMath.CorrectClickFunction();
//alert(this.parentNode.id.replace(/tablerow$/,""));
TutorialWindow.CaluMath.PM.MATHBUTTONFUNCTION(this.parentNode.id.replace(/tablerow$/,""));

BlahBlah();
};


   GettingToTables=function(){

      var CaluMathPMMainMenurowslength=TutorialWindow.CaluMath.PM.MainMenu.rows.length;
      TutorialWindowloop:
      for(var i=0; i< CaluMathPMMainMenurowslength; i++){
//         CaluMath.PM.MainMenuTutorialOnclickDoubleArray[i]= new Array();
         var specificmenu=TutorialWindow.document.getElementById(TutorialWindow.CaluMath.PM.MASTERLIST[i][1].replace(/SELECT/,"LIST")+"TABLE"); 
//         CaluMath.PM.MainMenuTutorialOnclickArray[i]=TutorialWindow.CaluMath.PM.MainMenu.rows[i].childNodes[0].onclick;
//         alert([CaluMath.PM.MainMenuTutorialOnclickArray]);
//         CaluMath.PM.MainMenuTutorialOnclickDoubleArray[i]=new Array();
//         specificmenuloop:
         for(var j=0; j< specificmenu.rows.length; j++){
//            CaluMath.PM.MainMenuTutorialOnclickDoubleArray[i][j]= specificmenu.rows[j].childNodes[0].onclick;
            if(specificmenu.rows[j].id.replace(/tablerow$/,"")==arguments[0]){
               var typeindex=i;
               var objectindex=j;
CorrectMainMenuEntry= i;
CorrectSubMenuEntry= j;
//               alerttest([CorrectMainMenuEntry, CorrectSubMenuEntry]);
//               break TutorialWindowloop;
               specificmenu.rows[j].childNodes[0].onclick=CaluMath.PM.SubMenuElementTutorialOnClickReplacement;
            }
            else{
               specificmenu.rows[j].childNodes[0].onclick=CaluMath.PM.SubMenuTutorialOnclickWrong;
            };
         };
         if(typeindex==i){
               TutorialWindow.CaluMath.PM.MainMenu.rows[i].childNodes[0].onclick=CaluMath.PM.MainMenuElementTutorialOnClickReplacement;
         }
         else{
               TutorialWindow.CaluMath.PM.MainMenu.rows[i].childNodes[0].onclick=CaluMath.PM.MainMenuTutorialOnclickWrong;
         };
      };
//alert(CaluMath.PM.MainMenuTutorialOnclickDoubleArray);
      var tempcurrentarray=arguments[1];
      var tempcurrentarrayindex= arguments[2];
//return ;

//      OldMASTERBUTTONonclick=TutorialWindow.CaluMath.PM.MainMenu.rows[MASTERBUTTON].onclick;
      RemoveText=('<p  class="attention" style="color:#dd0000; font-size:large">Please click the '+TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][0]+' entry from the table and then click the '+TutorialWindow.CaluMath.PM[TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][1].replace(/SELECT/,"")+"LIST"][CorrectSubMenuEntry][0]+' entry in the new table that will appear.<\/p>').cm_html("cm_caswindow=TutorialWindow, cm_insertoption=cm_insertafter,cm_inserttarget=menustable");
      CM_ParentObject.cm_writefocusobject("name= RemoveFocus,cm_caswindow=TutorialWindow, cm_insertoption=cm_insertafter,cm_inserttarget=RemoveText");
      CaluMath.Html.Focus(CM_ParentObject.RemoveFocus); 
//      TutorialWindow.MASTERBUTTON.onclick= function(){ 
         //Comment: This part has to do with the first drop down menu that deals with the category of object being created.
//         if(TutorialWindow.MASTERSELECT.options.selectedIndex !=typeindex){
//            return alert("You did not select "+TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][0]+". Please do so and click the Continue button");
//         }
CaluMath.CorrectClickFunction=function(){
         if(3==4){
         }
         else{


BlahBlah= function(){
               if( 3==4){
               }
               else{
//                  TutorialWindow.MASTERBUTTON.onclick=OldMASTERBUTTONonclick;
           
//                  TutorialWindow[TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][1].replace(/SELECT/,"")+"BUTTON"].onclick=OldObjectTypeButtonOnclick;
//                  OldObjectTypeButtonOnclick();
                  RemoveText.remove();
                  CM_ParentObject.RemoveFocus.remove();

//                  if(TutorialWindow[(""+TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][1].replace(/SELECT/,"")+"LIST")]!= null && !((""+TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][1].replace(/SELECT/,"")+"LIST")=="CaluMath.PM.HTMLLIST" &&  objectindex==0 ) ){
                  if(CorrectMainMenuEntry != 0){

                     //Comment: In this case we are not doing text.
//alert(TutorialWindow.CaluMath.PM[TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][1].replace(/SELECT/,"")+"LIST"][CorrectSubMenuEntry][1]);

                     FinishButton=GetThisButton(TutorialWindow.CaluMath.PM[TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][1].replace(/SELECT/,"")+"LIST"][CorrectSubMenuEntry][1]);
                     CancelButton=GetThisButton(TutorialWindow.CaluMath.PM[TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][1].replace(/SELECT/,"")+"LIST"][CorrectSubMenuEntry][1], "Cancel");
                     DeleteButton=GetThisButton(TutorialWindow.CaluMath.PM[TutorialWindow.CaluMath.PM.MASTERLIST[CorrectMainMenuEntry][1].replace(/SELECT/,"")+"LIST"][CorrectSubMenuEntry][1], "Delete");
                  OldFinishButtonOnclick=FinishButton.onclick;
                  OldCancelButtonOnclick=CancelButton.onclick;
                  OldDeleteButtonOnclick=DeleteButton.onclick;
                  }
                  else{
                     FinishButton=GetThisButton("Finish Text","ignore");
                     DeleteButton=GetThisButton("Delete Text", "ignore");
                     OldFinishButtonOnclick=FinishButton.onclick;
                     OldDeleteButtonOnclick=DeleteButton.onclick;
                  };

//CaluMath.PM.CreateSettingsArrays
//Comment: From Here until the marked off part below is what is the set up for the cancel and finish buttons for most objects. As of now, this is everything except for definedconstants. We need to modify for text and constants. 

                  var currentobjectbeingcreated=TutorialWindow.CaluMath.PM.EveryObjectArray[TutorialWindow.CaluMath.PM.EveryObjectArray.length-1];

                  var checkinputsarray= tempcurrentarray[tempcurrentarrayindex+1];
                  if(currentobjectbeingcreated.type != "definedconstant" || tempcurrentarray[tempcurrentarrayindex].cm_constructorname != "Array" || tempcurrentarray[tempcurrentarrayindex][0] != "random"){ 
                     var liststring='<ol>';
                     for(var listindex=0; listindex<tempcurrentarray[tempcurrentarrayindex+1].length; listindex++){
                        liststring=liststring+'<li><i>'+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[listindex][0], checkinputsarray[listindex][1]).replace(/</g, "&lt;").replace(/>/g, "&gt;")+'<\/i> in '+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[listindex][0])+'<\/li>';
                     };
                     liststring=liststring+'<\/ol>';
                     if(tempcurrentarray[tempcurrentarrayindex].cm_constructorname != "Array"){
                        RemoveText=('<p class="attention" style="color:#dd0000; font-size:large;">'+tempcurrentarray[tempcurrentarrayindex].replace(/CM_LABEL(\w*)/g,  'cm_eval(GetDefaultArrayEntryLabel("TutorialWindow.'+currentobjectbeingcreated.defaultobject()+'","$1"))')+' Please enter the following values: '+liststring+' Click the Finish '+TutorialWindow.CaluMath.PM.PageMakerObjectLabelName(currentobjectbeingcreated.type)+' button below when you are done.<\/p>').cm_html("cm_caswindow=TutorialWindow,cm_insertbefore=FinishButton");
                     }
                     else{
                        RemoveText=('<p class="attention" style="color:#dd0000; font-size:large">'+tempcurrentarray[tempcurrentarrayindex][0].replace(/CM_LABEL(\w*)/g,  'cm_eval(GetDefaultArrayEntryLabel("TutorialWindow.'+currentobjectbeingcreated.defaultobject()+'","$1"))')+' Please enter the following values: '+liststring+' '+tempcurrentarray[tempcurrentarrayindex][1].replace(/CM_LABEL(\w*)/g,  'cm_eval(GetDefaultArrayEntryLabel("TutorialWindow.'+currentobjectbeingcreated.defaultobject()+'","$1"))')+' Click the Finish '+TutorialWindow.CaluMath.PM.PageMakerObjectLabelName(currentobjectbeingcreated.type)+' button below when you are done.<\/p>').cm_html("cm_caswindow=TutorialWindow,cm_insertbefore=FinishButton");
                     };
                     TutorialWindow.scrollBy(0,5000)
                     FinishButton.onclick= function(){
                        if(window.TutorialDescriptionBoxParagraph != null){
                           TutorialDescriptionBoxParagraph.remove();
                        };
                        var currentobjectbeingcreated=TutorialWindow.CaluMath.PM.EveryObjectArray[TutorialWindow.CaluMath.PM.EveryObjectArray.length-1];
                        var checkinputsarray= tempcurrentarray[tempcurrentarrayindex+1];
                        if(checkinputsarray==null || checkinputsarray.cm_constructorname != "Array"){
                           alert("There is a mistake in the tutorial. There should be an array in position "+tempcurrentarrayindex+1+" of the array "+tempcurrentarray);
                        }
                        else{
                           if(currentobjectbeingcreated.defaultobject() != TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault){
                              TutorialWindow.CaluMath.PM.CreateSettingsArrays(currentobjectbeingcreated.type,currentobjectbeingcreated);
                              var oktoproceed="yes";
                              checkinputsarraylength=checkinputsarray.length;
                              checkinputloop:
                              for(var checki=0; checki<checkinputsarraylength; checki++){
                                 if((currentobjectbeingcreated.cm_getsetting(checkinputsarray[checki][0]) != checkinputsarray[checki][1]) && checkinputsarray[checki][2]==null ){
                                    oktoproceed="no";
                                     alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], currentobjectbeingcreated.cm_getsetting(checkinputsarray[checki][0])));
                                    break checkinputloop;
                                 };
                              };
                           }
                           else{
                              var oktoproceed="yes";
                              checkinputsarraylength=checkinputsarray.length;
                              checkinputloop:
                              for(var checki=0; checki<checkinputsarraylength; checki++){
                                 if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]] != null && checkinputsarray[checki][2]==null){
                                    if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu != null && TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options.selectedIndex].value  != checkinputsarray[checki][1]){
                                       oktoproceed="no";
                                       alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options.selectedIndex].label  );
                                       break checkinputloop;
                                    }
                                    else if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].input != null && TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].input.value.replace(/^\s*/,"").replace(/\s*$/,"") != checkinputsarray[checki][1]){
                                       oktoproceed="no";
                                       alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].input.value);
                                       break checkinputloop;
                                    }
                                 }
                                 else if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]] != null && checkinputsarray[checki][2]==null){
                                    if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options.selectedIndex].value  != checkinputsarray[checki][1]){
                                       oktoproceed="no";
                                           alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options.selectedIndex].value);
                                           break checkinputloop;
                                    };
                                 }
                                 else if(checkinputsarray[checki][0] == "text" && (GetThisTextBox(checkinputsarray[checki][1]) == null &&  checkinputsarray[checki][2]==null)){
                                    oktoproceed="no";
                                     alert("You did not enter "+checkinputsarray[checki][1]);
                                    break checkinputloop;
                                 };

                              };
  
                           };
                           if(oktoproceed== "yes"){
                              currentobjectbeingcreated.settings=null;
                              RemoveText.remove();
                              OldFinishButtonOnclick();
                              TutorialWindow.scrollTo(0,0);
                              window.scrollTo(0,0);
                              if(tempcurrentarray.length-1 !=tempcurrentarrayindex+2){
                                 CreateTutorialFunction(tempcurrentarray, tempcurrentarrayindex+2);
                              }
                              else{
                                 EndTutorialFunction(tempcurrentarray[tempcurrentarrayindex+2]);
                              };
                           };
                        };
                     };
//                     if(TutorialWindow[(""+TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][1].replace(/SELECT/,"")+"LIST")]!= null){
                     if(window.CancelButton != null){
                        CancelButton.onclick=function(){ 
                           return alert("Please follow the directions. You are not supposed to click the Cancel button.");
                        };
                     };
                     DeleteButton.onclick=function(){
                        return alert("Please follow the directions. You are not supposed to click the Delete button.");
                     };
                  }
//Comment: Above is for most objects. We need to modify for text and constants. 
                 else{
                    var RandomButton= GetThisButton("Create A Random Number","ignore");
                    DeleteButton.onclick=function(){
                       return alert("Please follow the directions. You are supposed to click the Create A Random Number button.");
                    };
                    FinishButton.onclick=DeleteButton.onclick;
                    CancelButton.onclick=DeleteButton.onclick;
                    RemoveText=('<p class="attention" style="color:#dd0000; font-size:large;">We are in the screen for the creation of constants. Please click on the Create A Random Number button.<\/p>').cm_html("cm_caswindow=TutorialWindow,cm_insertbefore=FinishButton");
                    var oldRandomButtononclick=RandomButton.onclick;
                    RandomButton.onclick=function(){
                       RemoveText.remove();
                       oldRandomButtononclick();
                       var RandomTypeMenu= GetThisSelectMenu("Random Integer");
                       RemoveText=('<p class="attention" style="color:#dd0000; font-size:large;">Please Select '+RandomTypeMenu.options[tempcurrentarray[tempcurrentarrayindex][1]].label+'. Since we want a random number between '+tempcurrentarray[tempcurrentarrayindex][2]+' and '+tempcurrentarray[tempcurrentarrayindex][3]+', enter '+tempcurrentarray[tempcurrentarrayindex][2]+' and '+tempcurrentarray[tempcurrentarrayindex][3]+' in the left and right boxes above. Then click the Create The Random Number button.<\/p>').cm_html("cm_caswindow=TutorialWindow,cm_insertbefore=FinishButton");
                       var CreateTheRandomButton= GetThisButton("Create The Random Number","ignore");
                       var oldCreateTheRandomButtononclick=CreateTheRandomButton.onclick;
//alert(CreateTheRandomButton);
                       CreateTheRandomButton.onclick=function(){
                          if(RandomTypeMenu.options.selectedIndex==tempcurrentarray[tempcurrentarrayindex][1] && GetThisTextBox(tempcurrentarray[tempcurrentarrayindex][2]) != null  && GetThisTextBox(tempcurrentarray[tempcurrentarrayindex][3]) != null){
                             RemoveText.remove();
                             oldCreateTheRandomButtononclick();
                             RandomButton.onclick=null;
//                  tempcurrentarrayindex++;
                  var checkinputsarray= tempcurrentarray[tempcurrentarrayindex+1];
                     var liststring='<ol>';
                     for(var listindex=0; listindex<tempcurrentarray[tempcurrentarrayindex+1].length; listindex++){
                        liststring=liststring+'<li><i>'+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[listindex][0], checkinputsarray[listindex][1]).replace(/</g, "&lt;").replace(/>/g, "&gt;")+'<\/i> in '+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[listindex][0])+'<\/li>';
                     };
                     liststring=liststring+'<\/ol>';
//alert(currentobjectbeingcreated.type);
                     RemoveText=('<p class="attention" style="color:#dd0000; font-size:large;"> Note that the random number information has been created in the Constant Definition box above. Please now enter the following values: '+liststring+' Click the Finish '+TutorialWindow.CaluMath.PM.PageMakerObjectLabelName(currentobjectbeingcreated.type)+' button below when you are done.<\/p>').cm_html("cm_caswindow=TutorialWindow,cm_insertbefore=FinishButton");
                     TutorialWindow.scrollBy(0,5000)
                     FinishButton.onclick= function(){
                        if(window.TutorialDescriptionBoxParagraph != null){
                           TutorialDescriptionBoxParagraph.remove();
                        };
                        var currentobjectbeingcreated=TutorialWindow.CaluMath.PM.EveryObjectArray[TutorialWindow.CaluMath.PM.EveryObjectArray.length-1];
                        var checkinputsarray= tempcurrentarray[tempcurrentarrayindex+1];
                        if(checkinputsarray==null || checkinputsarray.cm_constructorname != "Array"){
                           alert("There is a mistake in the tutorial. There should be an array in position "+tempcurrentarrayindex+1+" of the array "+tempcurrentarray);
                        }
                        else{
                           if(currentobjectbeingcreated.defaultobject() != TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault){
                              TutorialWindow.CaluMath.PM.CreateSettingsArrays(currentobjectbeingcreated.type,currentobjectbeingcreated);
                              var oktoproceed="yes";
                              checkinputsarraylength=checkinputsarray.length;
                              checkinputloop:
                              for(var checki=0; checki<checkinputsarraylength; checki++){
                                 if(currentobjectbeingcreated.cm_getsetting(checkinputsarray[checki][0]) != checkinputsarray[checki][1] && checkinputsarray[checki][2]==null){
                                    oktoproceed="no";
                                     alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], currentobjectbeingcreated.cm_getsetting(checkinputsarray[checki][0])));
                                    break checkinputloop;
                                 };
                              };
                           }
                           else{
                              var oktoproceed="yes";
                              checkinputsarraylength=checkinputsarray.length;
                              checkinputloop:
                              for(var checki=0; checki<checkinputsarraylength; checki++){
                                 if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]] != null  && checkinputsarray[checki][2]==null){
                                    if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu != null && TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options.selectedIndex].value  != checkinputsarray[checki][1]){
                                       oktoproceed="no";
                                       alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].menu.options.selectedIndex].label  );
                                       break checkinputloop;
                                    }
                                    else if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].input != null && TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].input.value.replace(/^\s*/,"").replace(/\s*$/,"") != checkinputsarray[checki][1]){
                                       oktoproceed="no";
                                       alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.required[checkinputsarray[checki][0]].input.value);
                                       break checkinputloop;
                                    }
                                 }
                                 else if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]] != null && checkinputsarray[checki][2]==null){
                                    if(TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options.selectedIndex].value  != checkinputsarray[checki][1]){
                                       oktoproceed="no";
                                           alert("The value in "+GetDefaultArrayEntryLabel(currentobjectbeingcreated, checkinputsarray[checki][0])+" should be "+GetDefaultArrayEntryOptionLabel(currentobjectbeingcreated, checkinputsarray[checki][0], checkinputsarray[checki][1])+" instead of " +TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options[TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault.options[checkinputsarray[checki][0]].menu.options.selectedIndex].value);
                                           break checkinputloop;
                                    };
                                 }
                                 else if(checkinputsarray[checki][0] == "text" && GetThisTextBox(checkinputsarray[checki][1]) == null && checkinputsarray[checki][2]==null){
                                    oktoproceed="no";
                                     alert("You did not enter "+checkinputsarray[checki][1]);
                                    break checkinputloop;
                                 };

                              };
  
                           };
                           if(oktoproceed== "yes"){
                              currentobjectbeingcreated.settings=null;
                              RemoveText.remove();
                              OldFinishButtonOnclick();
                              TutorialWindow.scrollTo(0,0);
                              window.scrollTo(0,0);
                              if(tempcurrentarray.length-1 !=tempcurrentarrayindex+2){
                                 CreateTutorialFunction(tempcurrentarray, tempcurrentarrayindex+2);
                              }
                              else{
                                 EndTutorialFunction(tempcurrentarray[tempcurrentarrayindex+2]);
                              };
                           };
                        };
                     };
//                     if(TutorialWindow[(""+TutorialWindow.CaluMath.PM.MASTERLIST[typeindex][1].replace(/SELECT/,"")+"LIST")]!= null){
                     if(window.CancelButton != null){
                        CancelButton.onclick=function(){ 
                           return alert("Please follow the directions. You are not supposed to click the Cancel button.");
                        };
                     };
                     DeleteButton.onclick=function(){
                        return alert("Please follow the directions. You are not supposed to click the Delete button.");
                     };





                          }
                          else{
                             return alert('Either you did not select '+RandomTypeMenu.options[tempcurrentarray[tempcurrentarrayindex][1]].label+' or enter '+tempcurrentarray[tempcurrentarrayindex][2]+' and '+tempcurrentarray[tempcurrentarrayindex][3]+' in the boxes above');
                          };
                       }; 
                    };                   
                 };  

              };
            };

         };
      };

};

EndTutorialFunction=function(){
      RemoveText= ('<p class="attention" style="color:#dd0000; font-size:large;">'+arguments[0]+'<\/p>').cm_html("cm_insertafter=tutorialinstructionbox");
//      CM_ParentObject.cm_writefocusobject("name= RemoveFocus, cm_caswindow=TutorialWindow, cm_insertoption=cm_insertafter,cm_inserttarget=tutorialinstructionbox");
      CM_ParentObject.cm_writefocusobject("name= RemoveFocus,cm_caswindow=TutorialWindow, cm_insertoption=cm_insertbefore,cm_inserttarget=menustable");
      CaluMath.Html.Focus(CM_ParentObject.RemoveFocus); 

};


GetDefaultArrayEntryLabel=function(){
   var tempobject=arguments[0];
   var matchingentry=arguments[1];
//   if(tempobject.defaultobject() != null){
//      var tempobjectdefaultobject =tempobject.defaultobject() ;
//   }
//   else{
//     tempobjectdefaultobject=TutorialWindow.CaluMath.PM.PageMakerhtmltextDefault;
//   };

   if(tempobject.defaultobject != null){
      var tempobjectdefaultobject =tempobject.defaultobject() ;
   }
   else{
     if(arguments[0].cm_constructorname != "String"){
        tempobjectdefaultobject=arguments[0];
     }
     else{
        tempobjectdefaultobject=eval(arguments[0]);
     };
   };

   temprequiredarray=tempobjectdefaultobject.requiredarray;
   tempoptionsarray=tempobjectdefaultobject.optionsarray;
   
   if(temprequiredarray != null){
      for(var i=0; i< temprequiredarray.length; i++){
         if(temprequiredarray[i][0]==matchingentry){
            var thisentry=temprequiredarray[i][4];
            if(thisentry.cm_constructorname=="Array"){
               return thisentry[0][0];
            }
            else{
               return thisentry;
            };
         };
      };
   };
   if(tempoptionsarray != null){
      for(var i=0; i< tempoptionsarray.length; i++){
         if(tempoptionsarray[i][0]==matchingentry){
            var thisentry=tempoptionsarray[i][4];
            if(thisentry.cm_constructorname=="Array"){
               return thisentry[0][0];
            }
            else{
               return thisentry;
            };
         };
      };
   };
   if(matchingentry=="text"){
      return "the Large Rectangular Text Box above";
   };
};
 
GetDefaultArrayEntryOptionLabel=function(){

//alerttest([arguments[0],  arguments[1],arguments[2]]);
   var tempobject=arguments[0];
   var matchingarraytype=arguments[1]
   var matchingentry=arguments[2];
//alert([arguments[0], arguments[1], arguments[2]]);
//   if(tempobject.defaultobject != null){
      var tempobjectdefaultobject =tempobject.defaultobject() ;
//   }
//   else{
//     if(arguments[0].cm_constructorname != "String"){
//        tempobjectdefaultobject=arguments[0];
//     }
//     else{
//        tempobjectdefaultobject=eval(arguments[0]);
//     };
//   };
   temprequiredarray=tempobjectdefaultobject.requiredarray;
   tempoptionsarray=tempobjectdefaultobject.optionsarray;
   var tempdefaultobject=tempobjectdefaultobject;
   
   if(temprequiredarray != null){
//alert(temprequiredarray);
      for(var i=0; i< temprequiredarray.length; i++){   //alert(thisentry[j]);
         if(temprequiredarray[i][0]==matchingarraytype){
            if(temprequiredarray[i][1] != "menu"){
//alert("done 1");
               return matchingentry;
            }
            else if(tempdefaultobject.required[temprequiredarray[i][0]] != null  && tempdefaultobject.required[temprequiredarray[i][0]].menu != null&& tempdefaultobject.required[temprequiredarray[i][0]].menu.options != null){   
               var tempoptionshtml= tempdefaultobject.required[temprequiredarray[i][0]].menu.options;
               var tempoptionshtmllength=tempoptionshtml.length;
               for(var j=0; j<tempoptionshtmllength; j++){
                  if(tempoptionshtml[j].value==matchingentry){
//alert("done 2");
                     return tempoptionshtml[j].label;
                  };
               };
            };
         };
      };
   };
   if(tempoptionsarray != null){
      for(var i=0; i< tempoptionsarray.length; i++){
         if(tempoptionsarray[i][0]==matchingarraytype){
            if(tempoptionsarray[i][1] != "menu"){
               return matchingentry;
            }
            else if(tempdefaultobject.options[tempoptionsarray[i][0]] != null){
               var tempoptionshtml= tempdefaultobject.options[tempoptionsarray[i][0]].menu.options;
               var tempoptionshtmllength=tempoptionshtml.length;
               for(var j=0; j<tempoptionshtmllength; j++){
                  if(tempoptionshtml[j].value==matchingentry){
                     return tempoptionshtml[j].label;
                  };
               };
            };
         };
      };
   };
   if(tempobject.type=="text" && arguments[1]=="text"){
      return arguments[2];
   };
   return "";
};




   document.write('<div id="inputandoutputcontainer" style="display:none"><br><br><input id="input" type="text" size="100" /><br><input id="output" type="text" size="100" /><br><input id="evalbutton" type="button" value="JavaScript"  /><br><\/div>');
   document.getElementById("evalbutton").onclick=function(){
      document.getElementById("output").value=eval(document.getElementById("input").value);
};

window.document.onkeypress=function(){ 
   if(window.event != null){ 
      if(window.event.keyCode==26 && window.event.ctrlKey && event.shiftKey){ 
         document.getElementById("inputandoutputcontainer").style.display="block";
         window.scrollBy(0,10000);
      };
   }
   else{
      if(arguments[0].charCode ==90 && arguments[0].ctrlKey && arguments[0].shiftKey){ 
         document.getElementById("inputandoutputcontainer").style.display="block";
         window.scrollBy(0,10000);
      };
   };
};

