// Relative location of help folder, i.e., help folder located relative to [TutorialFolder]/steps
// or [TutorialFolder]/stage is [helpFolderLoc]/help. Final forward slash (before "help") must be
// included in helpFolderLoc.

var helpFolderLoc = "../../";

// Relative location of overall tutorial home that includes images folder, this file, and style sheet.

var tutorialHome = "../../";  

// This variable defines the default file, if any, that loads onto the "stage" when 
// a new step loads. The new step can be chosen either from the menu (bottom left) or
// by using the navigation arrrows.  If stageDefault = "", the stage doesn't change.

// var stageDefault = "stage_blank.htm";
var stageDefault = "";

// var color1="#FFFFFF" 	// white
// var color2="#000000" 	// black

// etc.  add colors as needed

// please keep these lines on when you copy the source

// made by: Nicolas - http://www.javascript-page.com

function mg(txt) {window.status = txt;}

function mg2() {txt = "Open Help Menu"; window.status = txt;}

function wopen1(helpPath) 
{
helpURL = helpFolderLoc + helpPath;
window.open(helpURL,"Help_Menu","width=580,height=150,location=no,toolbar=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
}

function wopen2() 
{
window.open("../feedback/feedbackhelp.htm","Help_Menu","width=580,height=150,location=no,toolbar=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes");
}

function helpwin(helpMenu)
{
document.location = helpFolderLoc + helpMenu;
}



function wopen3(tutIndex) 
{
window.open(tutIndex,"Tutorial","width=996,height=664,location=no,toolbar=yes,status=yes,menubar=yes,scrollbars=no,resizable=yes");
}


function tester(stageno) { 
var aa = 0;
if(document.forms[0].elements[0].checked==true) { 
aa = 1;
} 
if(document.forms[0].elements[1].checked==true) { 
aa = 2;
} 
if(document.forms[0].elements[2].checked==true) { 
aa = 3;
} 
if(document.forms[0].elements[3].checked==true) { 
aa = 4;
} 
if(document.forms[0].elements[4].checked==true) { 
aa = 5;
} 
bb = aa;
// frames (second option for window.open below):  framework = bottom or bottom right; stage = top, right, or top right; step = left, or top left; menu = bottom left;
// _top = entire browser window;  _self = same frame; _blank (or any other name) = new window.
// if (bb==0) {window.open("stage"+stageno+"r0.htm","response");}
if (bb==0) {alert("You need to answer the question!!!");}
if (bb==1) {window.open("stage"+stageno+"r1.htm","response");}

if (bb==2) {window.open("stage"+stageno+"r2.htm","response");}
if (bb==3) {window.open("stage"+stageno+"r3.htm","response");}
if (bb==4) {window.open("stage"+stageno+"r4.htm","response");}
if (bb==5) {window.open("stage"+stageno+"r5.htm","response");}
} 

function loadstage(stagefile)
{
if (stagefile) {window.open("../stage/"+stagefile, "stage");}
else {
stagefile = stageDefault;
if (stagefile) {window.open("../stage/"+stagefile, "stage");}
} 
}

function popupTester(stepno) { 
var aa = 0;
if(document.forms[0].elements[0].checked==true) { 
aa = 1;
} 
if(document.forms[0].elements[1].checked==true) { 
aa = 2;
} 
if(document.forms[0].elements[2].checked==true) { 
aa = 3;
} 
if(document.forms[0].elements[3].checked==true) { 
aa = 4;
} 
if(document.forms[0].elements[4].checked==true) { 
aa = 5;
} 
if(document.forms[0].elements[5].checked==true) { 
aa = 6;
} 
if(document.forms[0].elements[6].checked==true) { 
aa = 7;
} 
bb = aa;
// Window "popup" is a small popup window
// _top = entire browser window;  _self = same frame; _blank (or any other name) = new window.
// if (bb==0) {window.open("stage"+stageno+"r0.htm","response");}
if (bb==0) {alert("You need to answer the question!!!");}
if (bb==1) {window.open("step"+stepno+"r1.htm","popup","width=300,height=100");}
if (bb==2) {window.open("step"+stepno+"r2.htm","popup","width=300,height=100");}
if (bb==3) {window.open("step"+stepno+"r3.htm","popup","width=300,height=100");}
if (bb==4) {window.open("step"+stepno+"r4.htm","popup","width=300,height=100");}
if (bb==5) {window.open("step"+stepno+"r5.htm","popup","width=300,height=100");}
if (bb==6) {window.open("step"+stepno+"r6.htm","popup","width=300,height=100");}
if (bb==7) {window.open("step"+stepno+"r7.htm","popup","width=300,height=100");}
} 


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function navButtons(stepNo,last,stageL,stageR)
{
// 
// This function determines the navigation from the current step (which should be the same as
// stepNo). If stepNo = 0 (the introductory step), the right (forward) button goes to step 1, and 
// the left (backward) button is grayed out. If last = "not last" and stepNo > 0, the left button
// goes to step = stepNo - 1, and the right button goes to step = stepNo + 1. If last = "last", 
// the left button goes to step = stepNo - 1, and the right button is grayed out. Hovering over a
// button that is an active link swaps out the image for the button.
//
// There IS NO DEFAULT VALUE for either stepNo or last. You must always call these variables.
//
// stageL and stageR are the files that are loaded into the "stage" (right) frame, where the simulator
// is usually located, when the left (stageL) or right (stageR) buttons are clicked. The default is 
// "usually no change, that is, the "stage" does NOT change when thestep" changes. To keep the default, 
// either set stageL = "" and/or stageR = "", or do not include the variables in the function call.
//
// Note that this function also essentially writes the entire frame with the navigation buttons. If you
// want to change the appearance of that frame, you only need to edit the text below.
//

if (stageL && stageR) {stageFileLeft = stageL; stageFileRight = stageR;}
else if (stageL) {stageFileLeft = stageL; stageFileRight = stageDefault;}
else if (stageR) {stageFileLeft = stageDefault; stageFileRight = stageR;}
else {stageFileLeft = stageDefault; stageFileRight = stageDefault;}

lastStep = stepNo - 1; 
nextStep = stepNo + 1;

if (stepNo != 0 && stepNo <= 10 ) {lastFrame="stepframe0"+lastStep+".htm";}
else {lastFrame="stepframe"+lastStep+".htm";}

if (stepNo < 9 ) {nextFrame="stepframe0"+nextStep+".htm";}
else {nextFrame="stepframe"+nextStep+".htm";}

rew1 = tutorialHome+"images/b_rew1.gif";
rew2 = tutorialHome+"images/b_rew2.gif";
rew3 = tutorialHome+"images/b_rew3.gif";
fwd1 = tutorialHome+"images/b_fwd1.gif";
fwd2 = tutorialHome+"images/b_fwd2.gif";
fwd3 = tutorialHome+"images/b_fwd3.gif";
spacer = tutorialHome+"images/spacer.gif";
tdid = "buttons";
gotoNext = "Go to next step";
gotoLast = "Go to last step";
backid = "back";
nextid = "next";
nada = "";

document.write("<BODY class='navFrame' onload='MM_preloadImages(rew2,fwd2)'>");
document.write("<CENTER>");
document.write("<TABLE BORDER=0 align='center' cellpadding='0' cellspacing='0'>");
document.write("<TR><TD>");

if (stepNo != 0) 
{
document.write("<a href='"+lastFrame+"' TARGET='step' onmouseout='MM_swapImgRestore()'  onmouseover='MM_swapImage(backid,nada,rew2,1); mg(gotoLast); return true' onclick='loadstage(stageFileLeft)'>");
document.write("<img src='"+rew1+"' name='back' width='24' height='24' border='0' id='back' />");
document.write("</a>");
}
else
{
document.write("<img src='"+rew3+"' name='back' width='24' height='24' border='0' id='back' />");
}

document.write("</TD><TD>");
document.write("<img src='"+spacer+"' width='20' height='4' />");
document.write("</TD><TD>");

if (last != "last") 
{
document.write("<a href='"+nextFrame+"' TARGET='step' onmouseout='MM_swapImgRestore()'  onmouseover='MM_swapImage(nextid,nada,fwd2,1); mg(gotoNext); return true' onclick='loadstage(stageFileRight)'>");
document.write("<img src='"+fwd1+"' name='next' width='24' height='24' border='0' id='next' />");
document.write("</a>");
}
else
{
document.write("<img src='images/b_empty.gif' name='next' width='24' height='24' border='0' id='back' />");
}
document.write("</TD></TR></TABLE></CENTER></BODY>");
}


function stepFrames(stepNo) 
{

//
// This function creates the frameset for steps (which contain the content), including a frame for 
// the arrows used for navigation. The only variable needed the step number of the current step.
//
// This function appears in the files with the names "stepframeNN.htm" located in the folder "steps". // Note that in the folder "steps", "stepNN.htm" contain the content, and "stepnavNN.htm" contain the 
// function call to navButtons above. ("NN" is a two-digit integer in the sequence 00, 01, 02, etc.).
//

if (stepNo < 10) {stepNum = "0" + stepNo;} 
else {stepNum = stepNo;}
stepContent = "step" + stepNum + ".htm";
stepNav = "stepnav" + stepNum + ".htm";

document.write("<FRAMESET rows='99%' FRAMEBORDER=0 BGCOLOR='#000000' framespacing='0' border='0'>");
document.write("<NOFRAMES>");
document.write("<BODY>");
document.write("<P>For this tutorial, you need to use a browser that supports frames.");
document.write("To run the simulators, you need Internet Explorer 4.0 or later, ");
document.write("either PC or Macintosh versions. These versions of Internet Explorer support frames.</P>");
document.write("</BODY>");
document.write("</NOFRAMES>");
document.write("<FRAMESET rows='504,36' FRAMEBORDER=0>");
document.write("<FRAME SRC='"+stepContent+"' NAME=page MARGINWIDTH=12 MARGINHEIGHT=12 FRAMEBORDER=0>");
document.write("<FRAME SRC='"+stepNav+"' NAME=nav SCROLLING=no MARGINWIDTH=12 MARGINHEIGHT=0 FRAMEBORDER=0>");
document.write("</FRAMESET></FRAMESET>");

}


