<!-- specify tasks and number of pages in each task -->
var m0=1;
var m1=3; 
var m2=4; 
var m3=5; 
var m4=4; 
var m5=1; 



<!-- specify the last task in the tutorial -->
var lastModuleNumber=5;

<!-- TRANSLATE -->
<!-- specify titles for each task -->
var m0title="Overview";
var m1title="About SAS Enterprise Guide";
var m2title="Working with Data";
var m3title="Working with Tasks";
var m4title="Working with Results";
var m5title="Learning More";
<!-- END TRANSLATE -->


<!-- TRANSLATE -->
<!-- specify title graphics for each section -->
var s1title="Quick Start";
var s2title=" ";
<!-- END TRANSLATE -->




<!-- specify how tasks are grouped into sections and write the section title -->
function setSectionTitle() {
   if (myModuleNumber<5) {
    document.write(s1title);
	}
   else if (myModuleNumber>4) {
    document.write(s2title);
    }
  }


<!-- don't edit below this line ----------------------------------------------- -->
<!-- -------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------- -->
<!-- -------------------------------------------------------------------------- -->

function setTaskTitle() {
   document.write(eval(moduleTitle));
}
function setEndTaskTitle() {
   document.write("<strong>"+eval(moduleTitle)+"</strong>. ");
}

function setTaskTitleLowcase() {
   myString=eval(moduleTitle);
   firstChar=myString.charAt(0);
   lowcaseTitle=firstChar.toLowerCase()+myString.substring(1);
   document.write(lowcaseTitle);
}

function setPageTitle() {
   if (setTitle == 1) {  
   document.write('<TITLE>'+eval(moduleTitle)+' ('+myPage+' of '+eval(myModule)+')</TITLE>');
   }
   else document.write('<TITLE>'+eval(moduleTitle)+': Notes</TITLE>');
}

function setPageNumber() {
   document.write(myPage+" of "+eval(myModule))
}

var thisWindow = window.location.href;
var myName = thisWindow.substring(thisWindow.lastIndexOf("/")+1,thisWindow.lastIndexOf("."));
var myModule = myName.substring(myName.lastIndexOf("m"),myName.lastIndexOf("_"));
var moduleTitle = myModule+"title";
var myModuleNumber = myModule.substring(1);
var myPage = myName.substring(myName.lastIndexOf("_")+1, myName.length);
var myPath = thisWindow.substring(0,thisWindow.lastIndexOf("/")+1)+myModule+"/";
var resultsWindow = myName + "x.htm";
var lastChar = myName.charAt(myName.length-1);
var alreadyopen = true;
if (lastChar >= 'a') var setTitle = 0;
else var setTitle = 1;
if (setTitle == 1) {
   var goNext=eval(myPage)+1;
   var goPrev=eval(myPage)-1;
}

if(document.images){
tocn=new Image();tocn.src="images/toc.gif";
tocy=new Image();tocy.src="images/toc_h.gif";
backn=new Image();backn.src="images/back.gif";
backy=new Image();backy.src="images/back_h.gif";
nextn=new Image();nextn.src="images/next.gif";
nexty=new Image();nexty.src="images/next_h.gif";
glossn=new Image();glossn.src="images/gloss.gif";
glossy=new Image();glossy.src="images/gloss_h.gif";
toc2n=new Image();toc2n.src="images/toc.gif";
toc2y=new Image();toc2y.src="images/toc_h.gif";
back2n=new Image();back2n.src="images/back.gif";
back2y=new Image();back2y.src="images/back_h.gif";
next2n=new Image();next2n.src="images/next.gif";
next2y=new Image();next2y.src="images/next_h.gif";
gloss2n=new Image();gloss2n.src="images/gloss.gif";
gloss2y=new Image();gloss2y.src="images/gloss_h.gif";
}

<!-- set style -->
if(navigator.userAgent.indexOf('Win') != -1) {
document.write("<style> <!-- TD {font-family : Arial, Helvetica, sans-serif; font-size : smaller;} OL {font-family : Arial, Helvetica, sans-serif;} UL {font-family : Arial, Helvetica, sans-serif;} LI {font-family : Arial, Helvetica, sans-serif;}  PRE {font-family : Courier New, Courier, monospace; font-size : x-small;} CODE {font-family : Courier New, Courier, monospace; font-size : x-small;} --> </style>");
}
else {
document.write("<style> <!-- TD {font-family : Arial, Helvetica, sans-serif; } OL {font-family : Arial, Helvetica, sans-serif;} UL {font-family : Arial, Helvetica, sans-serif;} LI {font-family : Arial, Helvetica, sans-serif;} PRE {font-family : Courier New, Courier, monospace; font-size : small;} CODE {font-family : Courier New, Courier, monospace; font-size : small;} --> </style>");
}

   
function prevPage() {
  if(myPage>1) {
     window.location.href=myModule+"_"+goPrev+".htm";
	 }
  else if(myPage==1 && myModule=="m0") {
     if (confirm('This is the first page of the tutorial.\n Do you want to return to the menu?')) window.location.href="menu.htm";
	  }
  else {
     prevModule="m"+(--myModuleNumber);
	 newPage=prevModule+"_"+eval(prevModule)+".htm"; 
	 window.location.href=newPage;
	 }
 }

function nextPage() {
  if(eval(myModule)>myPage) {
     window.location.href=myModule+"_"+goNext+".htm";
	 }
  else if(lastModuleNumber==myModuleNumber && myPage==eval(myModule)) {
     if (confirm('This is the last page of the tutorial.\n Do you want to return to the menu?')) window.location.href="menu.htm";
	 }
  else {
     nextModule="m"+(++myModuleNumber); 
	 newPage=nextModule+"_1.htm"; 
     window.location.href=newPage;
	 }
 }
 
function setBackImage() {
   if(myPage==1 && myModule=="m0") {
      document.write('<IMG src="images/backgray.gif"');
	  document.write(' alt="back" width="30" height="56" BORDER="0" VALIGN="top" name="backg">');
	  }
   else {
      document.write('<IMG src="images/back.gif"');
	  document.write(' alt="back" width="30" height="56" BORDER="0" VALIGN="top" name="back">');
	  }
}

function setBackImage2() {
   if(myPage==1 && myModule=="m0") {
      document.write('<IMG src="images/backgray.gif"');
	  document.write(' alt="back" width="30" height="56" BORDER="0" VALIGN="top" name="backg2">');
	  }
   else {
      document.write('<IMG src="images/back.gif"');
	  document.write(' alt="back" width="30" height="56" BORDER="0" VALIGN="top" name="back2">');
	  }
}

function setNextImage() {
   if(lastModuleNumber==myModuleNumber && myPage==eval(myModule)) {
      document.write('<IMG src="images/next_g.gif"');
	  document.write(' ALT="next" width="38" height="56" BORDER="0" VALIGN="top" name="nextg">');
	  }
   else {
      document.write('<IMG src="images/next.gif"');
	  document.write(' alt="next" width="38" height="56" BORDER="0" VALIGN="top" name="next">');
	  }
}

function setNextImage2() {
   if(lastModuleNumber==myModuleNumber && myPage==eval(myModule)) {
      document.write('<IMG src="images/next_g.gif"');
	  document.write(' ALT="next" width="38" height="56" BORDER="0" VALIGN="top" name="nextg2">');
	  }
   else {
      document.write('<IMG src="images/next.gif"');
	  document.write(' alt="next" width="38" height="56" BORDER="0" VALIGN="top" name="next2">');
	  }
}

function rOver(boxL){
 if(document.images)
 {document[boxL].src=eval(boxL+'y.src');}
}

function rOut(boxL){
 if(document.images)
 {document[boxL].src=eval(boxL+'n.src');}
}

var alreadyopen = true;
function openGlossary(docname) {
   newWindow = window.open('','Glossary','top=0,left=0,width=370,height=360,resizable=1,scrollbars=yes');
      if (alreadyopen) {
         alreadyopen = false;
         openGlossary(docname);
      }
   alreadyopen = true;
   newWindow.location.href=docname;
}



function openOther(page) {
   newWindow = window.open('','Other','top=0,left=0,width=500,height=500,resizable=1,scrollbars=yes');
      if (alreadyopen) {
         alreadyopen = false;
         openOther(page);
      }
   alreadyopen = true;
   newWindow.location.href=page;
}

function displayHelpWindow(docname) {
   helpWindow =  window.open(docname,'Help','top=0,left=0,width=600,height=400,resizable=1,scrollbars=yes,toolbar=no');
}

function openImage(img,x,y){ 
   var newWind;
   var output; 
   if (newWind != null) newWind.close(); 
   x=eval(x+50);
   y=eval(y+80);
   newWind = window.open("","Details","HEIGHT="+y+",WIDTH="+x+",scrollbars,resizable,top=5,left=5"); 
   output="<HTML><HEAD><TITLE>Details</TITLE></HEAD><BODY BGCOLOR='#FFFFF0' ";  
   output+="onLoad='this.focus()' onBlur='opener.newWind=null'><CENTER>"; 
   output+="<IMG SRC='"+img+"'>"; 
   output+="<FORM><INPUT TYPE='button' VALUE='Close' onClick='self.close()'>"; 
   output+="</FORM></CENTER></BODY></HTML>"; 
   newWind.document.write(output); 
   newWind.document.close(); 
} 


function openImageAutoSize(alink){
   var imgTag = alink.childNodes[0].outerHTML;
   var imgSrc = imgTag.substring(imgTag.indexOf("images/")+7,imgTag.indexOf(".gif")-1);
   imgSrc = "images/" + imgSrc + ".gif"; 
   
   openImageWin(imgSrc);
}

 function openImageWin(imgSrc)  {
   var output; 
   if (newWind != null) newWind.close(); 
   var newWind = window.open("","Details","scrollbars,resizable,top=5,left=5");

   output="<HTML><HEAD><TITLE>Details</TITLE>";
   output+="<SCRIPT>";
   output+="function specialInit()";
   output+="{";
   output+="if (document.all || document.layers)";
   output+="window.resizeTo(document.images[0].width + 50,document.images[0].height + 130);";
   output+="}";
   output+="</SCRIPT>";
   output+="</HEAD><BODY BGCOLOR='#FFFFF0' onLoad='specialInit();'> ";  
   output+="<SCRIPT>";
   output+="document.write('<center>');";
   output+="document.write('<IMG SRC=\\'"+imgSrc+"\\'>');";
   output+="document.write('<P><P><P><FORM><INPUT ";
   output+='TYPE="button" VALUE="Close" onClick="window.close()">';
   output+="</FORM>');";
   output+="document.write('</center>')";
   output+="</SCRIPT>";
   output+="</BODY></HTML>";

   newWind.document.open();
   newWind.document.write(output); 
   newWind.document.close(); 
} 


// --------------code for animations-----------

function preLoad(GIFname) {
  if   (document.images) {
    var newGIF = new Image();
    newGIF.src = GIFname;
  }
}

timer1 = null;
  
function swapGIF(GIFname,newGIF){
  if (document.images) {
    eval("document."+GIFname+".src=\""+newGIF+"\";");
  }
  else {
    if ((timer1 != null) && (swapGIF.arguments.length == 2)) return;
    var oldLoc = eval("document."+GIFname+".location.href");
    if (swapGIF.arguments.length == 5) {
      timer1 = setTimeOut('swapGIF("'+GIFname+'","'+oldLoc+'",1);',2000);
    }
    else { timer1=null; }
    eval("document."+GIFname+".location.href=\""+newGIF+"\";");
  }
}

function scroll(backnext,totalanim) {
   if (document.images) {
      period = (document.images.animation.src.lastIndexOf("."));
      alocation = (document.images.animation.src.lastIndexOf("a"));
      imgnum = (eval(document.images.animation.src.substring(alocation+1,period)));
   }
   else {
      period = (document.animation.location.href.lastIndexOf("."));
	  alocation = (document.animation.location.href.lastIndexOf("a"));
      imgnum = (eval(document.animation.location.href.substring(alocation+1,period)));
   }
   if (backnext=="back" && imgnum>1) {
      swapGIF('animation','images/'+myName+'a'+eval(imgnum-1)+'.gif');
	  document.frameplay.page.value=' '+eval(imgnum-1)+' of '+totalanim;return false;
   }
   if (backnext=="next" && imgnum<totalanim) {
      swapGIF('animation','images/'+myName+'a'+eval(imgnum+1)+'.gif');
	  document.frameplay.page.value=' '+eval(imgnum+2-1)+' of '+totalanim;return false;
   }
   if (backnext=="same") {
      swapGIF('animation','images/'+myName+'a'+eval(imgnum)+'.gif');
	  document.frameplay.page.value=' '+eval(imgnum)+' of '+totalanim;return false;
   }
   if (backnext=="all") {
      swapGIF('animation','images/'+myName+'a0.gif');
	  document.frameplay.page.value=' All of '+totalanim;return false;
   }
}

//-------new animation code-------------
<!-- text animation code -->

var totalanim;
var imageWidth;
var imageHeight;
var appendSteps;
var heightMultiplier;
var cellHeight;
var heightFlag=0;

function setAnimationParameters() {
   totalanim = document.getElementById("numberOfImages").innerText;
   imageWidth = document.getElementById("imageWidth").innerText;
   imageHeight = document.getElementById("imageHeight").innerText;
   appendSteps = document.getElementById("appendSteps").innerText;
   heightMultiplier = Number(document.getElementById("heightMultiplier").innerText); 
   cellHeight = Number(document.getElementById("cellHeight").innerText); 
}

function createAnimation(direction) {

if (direction=='back') scroll('back',totalanim);
else if (direction=='next') scroll('next',totalanim);

   if (document.images) {                         
      period = (document.images.animation.src.lastIndexOf("."));
      alocation = (document.images.animation.src.lastIndexOf("a"));
      newimgnum = (eval(document.images.animation.src.substring(alocation+1,period)));
   }
   else {
      period = (document.animation.location.href.lastIndexOf(".")); 
	  alocation = (document.animation.location.href.lastIndexOf("a"));
      newimgnum = (eval(document.animation.location.href.substring(alocation+1,period)));
   }
   var textTD = document.getElementById("animationTextFrame");
   var animText="";
   var addedHeight=0;
   var totalLength=0;
   <!-- find the animation divs -->
   var animDivs = document.getElementsByTagName("div"); 
   var relevantDiv=0;
      for (n=0; n<=animDivs.length-1; n++) {  
         addedHeight+=heightMultiplier; 
	     totalLength+=animDivs[n].innerText.length;
         var divClass=animDivs[n].className; 
         <!-- find only divs with class=animationText --> 
         if (divClass.indexOf('animationText') !=-1){
		    relevantDiv++; 
			if (relevantDiv == newimgnum) {
               if (appendSteps == "yes") { 
	   		      animText+=animDivs[n].innerHTML + "<br>"; 
			   }
			   else { 
			      heightFlag=1;
				  textTD.height=cellHeight;
			      animText=animDivs[n].innerHTML; 
			   } 
			}   
		 }
	  }
   if (heightFlag == 0) {
      textTD.height=addedHeight;
      heightFlag=1;
   }
   textTD.innerHTML = animText;
}

function setTextAnimationParameters() {
   totalanim = document.getElementById("numberOfSteps").innerText;
   heightMultiplier = Number(document.getElementById("heightMultiplier").innerText); 
}

var myStep=1;

function createTextAnimation(direction) {
// change to advance text but not image
   var textTD = document.getElementById("animationTextFrame");
   var animText="";
   var addedHeight=0;
   var totalLength=0;
   <!-- find the step number and set scroll text -->
if (direction=='none') { 
}
  if (direction=='back') { 
     if (myStep > 1) myStep=myStep-1;
     document.frameplay.page.value=' '+ myStep +' of '+totalanim; 
  }
  else if (direction=='next') { 
     if (myStep < totalanim) myStep=myStep+1;
     document.frameplay.page.value=' '+ myStep +' of '+totalanim; 
  }
   <!-- find the animation divs -->
   var animDivs = document.getElementsByTagName("div"); 
      for (n=0; n<=animDivs.length-1; n++) { 
         addedHeight+=heightMultiplier; 
	     totalLength+=animDivs[n].innerText.length;
         var divClass=animDivs[n].className;
         <!-- find divs with class=animationText < newimgnum -->
         if (divClass.indexOf('animationText') !=-1) {
			if (n < myStep) {
			   animText+=animDivs[n].innerHTML + "<br>"; 
			}
		 }
	  }
   if (heightFlag == 0) {
      textTD.height=addedHeight;
      heightFlag=1;
   }
   textTD.innerHTML = animText;
}

function writeAnimationNumber() {
document.write('<img src="../images/bullet' + n +'.gif" width="20" height="20">');
}

function openAnimText() {
   var exampleName = document.getElementById("exampleName").innerText;
   var animText="<center><strong>" + exampleName + "</strong></center><p>";
   var animDivs = document.getElementsByTagName("div"); 
      for (n=0; n<=animDivs.length-1; n++) { 
         var divClass=animDivs[n].className;
         <!-- find divs with class=animationText <= imgnum -->
         if (divClass.indexOf('animationText') !=-1) {
            animText+=animDivs[n].innerHTML + "<br>";
		 }
	  }
   <!-- write any div that number or lower to the id=animationTextFrame TD -->
   newWind = window.open("","TextVersion","HEIGHT=500,WIDTH=500,scrollbars,resizable,top=5,left=5"); 
   textvers='<HTML><HEAD><TITLE>Text Version of Animation</TITLE>';  
   textvers+='<link rel="stylesheet" href="tut.css"></HEAD><BODY BGCOLOR="#FFFFF0" ';  
   textvers+='onLoad="this.focus()" onBlur="opener.newWind=null"><CENTER>'; 
   textvers+=animText; 
   textvers+='<FORM name="form1"><INPUT TYPE="button" name="Button" VALUE="Close" onClick="self.close()">'; 
   textvers+='</FORM></CENTER></BODY></HTML>'; 
   newWind.document.write(textvers); 
   newWind.document.close(); 
}

function writeFrameplayPage() {
   document.frameplay.page.value=" 1 of "+totalanim;
}

<!-- end of text animation code -->

//------code for marking complete on main menu---------------
exp=new Date();exp.setTime(exp.getTime()+(365*86400000));

function checkForCompleteString(completeStringPrefix){
   var completeStringPrefixEquals=completeStringPrefix+'=';
   var completeCookie=document.cookie;
   if(completeCookie.length>0){
      begin=completeCookie.indexOf(completeStringPrefixEquals);
         if(begin!=-1){
           begin+=completeStringPrefixEquals.length;
           end=completeCookie.indexOf(';',begin);
           if(end==-1) end=completeCookie.length;
           return unescape(completeCookie.substring(begin,end));
         }
   }
return null;
}

function markComplete(myModule) {
      var completedString=new String(checkForCompleteString('modComplete'));
	  var modulePound=myModule+"#";
      if(completedString.indexOf(modulePound)!=-1)
         document.write("<IMG SRC='images/block_ck.gif' width='13' height='17' border='0' alt='Lesson completed'>");
      else 
	     document.write("<IMG SRC='images/block_md.gif' width='13' height='17' border='0' alt='Checkbox'>");
}


function storeComplete() {
         var completedString=new String(checkForCompleteString('modComplete'));
		 var modulePound=myModule+"#";
            if(completedString.indexOf(modulePound)!=-1)
               alert("Our records show that you've already completed\n"+
                     "this task.");
					 
            else (confirm("This task has been marked complete on the main menu."))
               document.cookie='modComplete='+completedString+modulePound+exp.toGMTString();
}


function openSimStepsTutVersion() {
   var simSteps="";
   var tasktitle="";
   if (opener) var simDivs = opener.document.getElementsByTagName("div"); 
   else var simDivs = document.getElementsByTagName("div"); 
   for (n=0; n<=simDivs.length-1; n++) {  
      var divClass=simDivs[n].className;
      if (divClass.indexOf('stepText') != -1){
	     simSteps+="<p>" + simDivs[n].innerHTML + "</p>";
	  }
   }
   if (opener) tasktitle = opener.document.getElementById('taskDescription').innerText + "<p>";
   else tasktitle = document.getElementById('taskDescription').innerText + "<p>";

   newWind = window.open("","TextSteps","HEIGHT=500,WIDTH=500,scrollbars,resizable,top=5,left=5"); 
   if (self.name == "Simulation") textsim='<HTML><HEAD><TITLE>Solution to Practice Simulation</TITLE>';  
   else textsim='<HTML><HEAD><TITLE>Text-Only Version of Steps</TITLE>';  
   textsim+='<SCRIPT LANGUAGE="JavaScript" SRC="tut.js"></SCRIPT>';  
   textsim+='<link rel="stylesheet" href="tut.css"></HEAD><BODY BGCOLOR="#FFFFF0" ';  
   textsim+='onLoad="this.focus()" onBlur="opener.newWind=null">'; 
   textsim+='<font color="#003399"><strong>' + tasktitle + '</strong></font>';
   textsim+='<table width="95%" border="0" cellspacing="0" cellpadding="5" align="center">';
   textsim+='  <tr>';
   textsim+='    <td>' + simSteps +'</td>';
   textsim+='  </tr>';
   textsim+='</table>';
   textsim+='<CENTER><FORM name="form1"><INPUT TYPE="button" name="Button" VALUE="Close" onClick="self.close()">'; 
   textsim+='</FORM></CENTER></BODY></HTML>'; 
   newWind.document.write(textsim); 
   newWind.document.close(); 
}


var addScripts='<META HTTP-EQUIV="imagetoolbar" CONTENT="no">';
	addScripts+='<style> .eg_div,.invisible,.solution,.stepText,.animationText {display: none}';
	addScripts+='.eg2,.le2,.eg3,.eg2_le2,.le2_eg2,.soln {color: #003399;display: none}</style>';
		
document.write(addScripts);

