//JS file for SiteMap Tree

/**********Folder Definitions*******************/
//Top Level: Domain
Level0 = createFolder("Symphony  Technologies Home Page", "index.htm", "images/stbul_l.gif", "Symphony Technologies Web Site")

//Level1: Products
Level1 = insertFolder( Level0, createFolder("Software Products", "index.htm", "images/cd_s.gif", "Standard Software Products"))

//Level2 : ProMSA
Level2 = insertFolder( Level1, createFolder("Measurement Systems Analysis: ProMSA", "promsa.htm", "images/proico_s.gif", "Software for Measurement Systems Analysis (MSA) as per AIAG MSA Manual - 4th edition"))
//Level3 = insertFolder( Level2, createFolder("View Features Demo", "msasld.htm", "images/ppticon.gif", "Features Demo: View on-line Slide Show"))
Level3 = insertFolder( Level2, createFolder("Download PowerPoint", "download/ProMSA4.pps", "images/ppt.gif", "Download PowerPoint demo to share with your colleagues"))
Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO: English", "confirm.htm?aText=ProMSA V4 (English)&bText=msa_en.zip", "images/disc.gif", "Try the software for 30 days FREE!"))
//Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO: Portuguese-Brazil", "confirm.htm?aText=ProMSA V4 (Portuguese)&bText=msa_pt.zip", "images/disc.gif", "Try the software for 30 days FREE!"))

//Level2: SPC
Level2 = insertFolder( Level1, createFolder("Statistical Process Control: SPC WorkBench", "spcwork.htm", "images/spcico_s.gif", "SPC Software for the shop floor"))
Level3 = insertFolder( Level2, createFolder("View Features Demo", "spcsld.htm", "images/ppticon.gif", "Features Demo: View on-line Slide Show"))
Level3 = insertFolder( Level2, createFolder("Download PowerPoint", "download/spcpps.zip", "images/ppt.gif", "Download PowerPoint demo to share with your colleagues"))
Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO", "confirm.htm?aText=SPC Workbench V4.0&bText=spc.zip", "images/disc.gif", "Try the software for 30 days FREE!"))

//Level2: NNPC
Level2 = insertFolder( Level1, createFolder("Non-Normal Process Capability Evaluator", "nnpc.htm", "images/nnpc16.gif", "Non-Normal Process Capability Evaluator"))
Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO", "confirm.htm?aText=Non-Normal Process Capability Evaluator&bText=nnpc.zip", "images/disc.gif", "Try the software for 15 days FREE!"))

//Level2: Quincunx
Level2 = insertFolder( Level1, createFolder("SPC Training Simulator", "quincunx.htm", "images/quinico_s.gif", "Training Aid in SPC and Concepts of Variation"))
Level3 = insertFolder( Level2, createFolder("User Testimonials", "quincunx2.htm", "images/doc.gif", "Read what our users say"))
Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO", "confirm.htm?aText=SPC Training Simulator&bText=quin.zip", "images/disc.gif", "Download FREE Evaluation version"))

//Level2: FMEA Executive
Level2 = insertFolder( Level1, createFolder("FMEA Executive", "fmeams.htm", "images/fmeaico_s.gif", "Software for creating &amp; maintaining Design &amp; Process FMEAs."))
//Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO", "confirm.htm?aText=FMEA Executive V4.0&bText=fmea.zip", "images/disc.gif", "Download FREE Evaluation version"))

//Level2: GDT&Wiz
Level2 = insertFolder( Level1, createFolder("GD&T Trainer: GD&T WIZ Tutor", "gdtwiz.htm", "images/gdtico_s.gif", "Multimedia Trainer for basic concepts in GD&T based on ASME Y14.5M 1994 standard."))
Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO", "confirm.htm?aText=GDT WIZ Tutor&bText=gdtwiz.zip", "images/disc.gif", "Download FREE Evaluation version"))

//Level2: Strategy Track	REMOVED: 11-Jun-2007
//Level2 = insertFolder( Level1, createFolder("Strategy Track", "strategy.htm", "images/slico_s.gif", "Software to create professional Gantt Charts and track project activities."))
//Level3 = insertFolder( Level2, createFolder("Download Evaluation DEMO", "confirm.htm?aText=Strategy Track V2.0&bText=strack.zip", "images/disc.gif", "Download FREE Evaluation version"))

//Level2: GageWedge	REMOVED: 11-Jun-2007
//Level2 = insertFolder( Level1, createFolder("Gage Wedge", "gauge.htm", "images/wedgeico_s.gif", "Acquire data from digital gages directly into any software or spreadsheet"))
//Level3 = insertFolder( Level2, createFolder("Download PowerPoint", "confirm.htm?aText=PowerPoint DEMO: Gage Wedge&bText=wedgepps.zip", "images/ppt.gif", "Download PowerPoint demo"))

//Level1: Freeware
Level1 = insertFolder( Level0, createFolder("Freeware", "freeware.htm", "images/free_s.gif", "FREEWARE Software from Symphony"))
Level2 = insertFolder( Level1, createFolder("Process Capability Calculator", "pccfree.htm", "images/pccico_s.gif", "Cp,Cpk,PP,Ppk,Histogram, Normality Test & Normal Probability Plot"))
//Level3 = insertFolder( Level2, createFolder("Download Freeware", "confirm.htm?aText=Freeware Process Capability Calculator&bText=proccap.zip", "images/disc.gif", "Download Freeware"))
Level2 = insertFolder( Level1, createFolder("GRR Calculator", "grrfree.htm", "images/irrico_s.gif", "GR&R for Coordinate Measuring Machines (CMMs) and Automated Testing Equipments (ATEs)...and more"))
Level3 = insertFolder( Level2, createFolder("Download Freeware", "confirm.htm?aText=Freeware GRR Calculator&bText=instrr.zip", "images/disc.gif", "Download Freeware"))

//Level1: Training
Level1 = insertFolder( Level0, createFolder("Training", "training.htm", "images/free_s.gif", "In-house &amp; Open Training"))
Level2 = insertFolder( Level1, createFolder("Course Contents", "ccontent.htm", "images/pccico_s.gif", "Course Contents"))


//Level1: Articles
Level1 = insertFolder( Level0, createFolder("Articles Archive", "feature.htm", "images/arch_s.gif", "Browse the Articles Archive, download articles in PDF fromat and subscribe for Article Alert"))
Level2 = insertFolder( Level1, createFolder("Measurement Systems Analysis - A management perspective", "articles/msaone.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("ISO: From the top", "articles/isotop.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("Three Romeos and A Juliet: Our early brush with Design of Experiments", "articles/romeos.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("Technique Review - Short-Run SPC", "articles/shortrun.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("Simulation - A powerful technique to improve Quality & Productivity", "articles/simulation.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("The Balanced Score Card", "articles/bscard.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("Customer Satisfaction Measurement", "articles/satisfaction.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("The Power of PRE-Control", "articles/precontrol.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("Appropriate Tolerancing for Improved Profits", "articles/tolerance.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("Production Scheduling With a Spreadsheet", "articles/schedulexl.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("V D A 6.1", "articles/vda6.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("Making Filter Paper Slitting Process Robust", "articles/paperslitting.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("ISO 9000:2000", "articles/iso90002000.htm", "images/artic.gif", ""))
Level2 = insertFolder( Level1, createFolder("Measuring Your Process Capability", "articles/processcapability.htm", "images/articred.gif", ""))
Level2 = insertFolder( Level1, createFolder("The Six Sigma Approach", "articles/sixsigma.htm", "images/artic.gif", ""))

//Level1: User Interaction
Level1 = insertFolder( Level0, createFolder("User Interaction", "", "images/inter_s.gif", "Talk to us"))
Level2 = insertFolder( Level1, createFolder("Your Feedback", "feedback.htm", "images/feedbk_s.gif", "Give us your comments, suggestions and feedback"))
Level2 = insertFolder( Level1, createFolder("Quality HelpLine", "helpline.htm", "images/question.gif", "Ask us a question"))

//About us
Level1 = insertFolder( Level0, createFolder("About Symphony", "about.htm", "images/about_s.gif", "About Symphony Technologies"))
Level2 = insertFolder( Level1, createFolder("Contact Us", "contact.htm", "images/cont_s.gif", "Detailed Contact Information"))

//Misc
Level1 = insertFolder( Level0, createFolder("Miscellaneous", "", "images/misc_s.gif", ""))
Level2 = insertFolder( Level1, createFolder("Interesting Quality Links", "links.htm", "images/url.gif", "Links to interesting Web Sites about Quality"))
Level2 = insertFolder( Level1, createFolder("NO SPAM Privacy Policy", "privacy.htm", "images/priv_s.gif", "Read our NO SPAM Privacy Policy"))

//Level1: CUST
Level1 = insertFolder( Level0, createFolder("Our Customers", "cust.htm", "images/cust.gif", "View the list of our Valued Customers"))

/********************JS Code**********************************/
// Define Folder class
// *******************
//constructor 
function Folder(theTitle, theFile,theTip)
{ 
  this.title = theTitle
  this.theFile = theFile
  if(theTip=="")
	this.theTip= theTitle
  else
	  this.theTip= theTip;

  this.fileType = "ContentFile"
  this.folderID = -1
  this.navObj = 0
  this.folderIcon = 0
  this.nodeIcon = 0
  this.isLastNode = 0
  this.color="black"

  this.isOpen = true 
  this.iconSrc ="folderopen.gif"	//  "/ "
  this.spicon = "folderopen.gif"	//	"/  "
  this.children = new Array 
  this.nChildren = 0 
  this.nodeType = "root"
  this.shown=true
  this.visited=0
 
  //methods 
  this.initialize = initializeFolder 
  this.setState = setStateFolder 
  this.addChild = addChild 
  this.createIndex = createEntryIndex 
  this.hide = hideFolder 
  this.display = display 
  this.renderOb = drawFolder 
  this.outputLink = outputFolderLink 
} 

 
function setStateFolder(isOpen) 
{ 
  if (isOpen == this.isOpen) 
    return 
  this.isOpen = isOpen 
  propagateChangesInState(this) 
} 


//assign appropriate icons to Nodes and Folders 
function propagateChangesInState(folder) 
{
  var i=0 
  if (folder.isOpen) 
  { 
    if (folder.nodeIcon) 
      if (folder.isLastNode) 
	 if(folder.nChildren >0)
            folder.nodeIcon.src = "images/mlastnode.gif" 
	 else
            folder.nodeIcon.src = "images/lastnode.gif" 
	
      else 
	if(folder.nChildren >0)
	  folder.nodeIcon.src = "images/mnode.gif" 
        else
	  folder.nodeIcon.src = "images/node.gif" 

/*    if(folder.nChildren >0)
	    folder.folderIcon.src = "images/folderopen.gif" 
    else*/
	    folder.folderIcon.src =  folder.spicon
    for (i=0; i<folder.nChildren; i++) 
	      folder.children[i].display() 

     
  } 
  else 
  { 
    if (folder.nodeIcon) 
      if (folder.isLastNode) 
        if(folder.nChildren >0)
            folder.nodeIcon.src = "images/plastnode.gif" 
	 else
            folder.nodeIcon.src = "images/lastnode.gif" 
	
      else 
	if(folder.nChildren >0)
	  folder.nodeIcon.src = "images/pnode.gif" 
        else
	  folder.nodeIcon.src = "images/node.gif" 


    if(folder.nChildren >0)
	    folder.folderIcon.src = "images/folderclosed.gif" 
    else
	    folder.folderIcon.src = folder.spicon	//"doc.gif" ??
    for (i=0; i<folder.nChildren; i++) 
      folder.children[i].hide() 
  } //L100 
} 
 

//collapse folder
function hideFolder() 
{ 
    if (this.navObj.style.display == "none") 
      return 
    this.navObj.style.display = "none" 
    this.setState(0) 
} 
 

//create index array
//rendering
function initializeFolder(level, lastNode, leftSide) 
{
var i
  var nc = this.nChildren 
  
  this.createIndex() 
  var action = "onclick='clickOnNode(" + this.folderID + ")'"
  
  if (level>0) 
    if (lastNode) 
    { 
      this.renderOb(leftSide + "<img name='nodeIcon" + this.folderID + "' src='images/mlastnode.gif' width=16 height=22 border=0 " + action + ">")	//</a>") 
      leftSide = leftSide + "<img src='images/blank.gif' width=16 height=22>"  
      this.isLastNode = 1 
    } 
    else 
    { 
      this.renderOb(leftSide + "<img name='nodeIcon" + this.folderID + "' src='images/mnode.gif' width=16 height=22 border=0 " + action + ">")	
      leftSide = leftSide + "<img src='images/vertline.gif' width=16 height=22>" 
      this.isLastNode = 0 
    } 
  else 
    this.renderOb("") 
   
  if (nc > 0) 
  { 
    level = level + 1 
    for (i=0 ; i < this.nChildren; i++)  
    { 
      if (i == this.nChildren-1) 
        this.children[i].initialize(level, 1, leftSide) 
      else 
        this.children[i].initialize(level, 0, leftSide) 
      } 
  } 

} 

//render as <table>
function drawFolder(leftSide) 
{ 

  document.write("<table ") 
  document.write(" id='folder" + this.folderID + "' style='position:block;' ") 
  document.write(" border=0 cellspacing=0 cellpadding=0>") 
  document.write("<tr><td align=left id='IMG" + this.folderID + "'>")
  document.write(leftSide) 

  document.write("<img name='folderIcon" + this.folderID + "' alt='" + this.title + "'	") 
  document.write("src='images/" + this.iconSrc+"' border=0></a>") 
  document.write("</td><td align=left valign=middle nowrap id='TD" + this.folderID+"'>") 

  var pp= this.outputLink() 
  pp = pp + this.title + "</a>"
  document.write(pp)

  document.write("</td>")  
  document.write("</table>") 

  this.navObj = document.all["folder"+this.folderID] 
  this.folderIcon = document.all["folderIcon"+this.folderID] 
  this.nodeIcon = document.all["nodeIcon"+this.folderID] 
} 
 

//assign action OnClick (href / javascript function)
function outputFolderLink() 
{var retx;
  if(this.theFile)
    {
	var xx="<a href=\"" + this.theFile + "\" TARGET=\"DisplayFrame\" TITLE='"+ this.theTip	+ "'>"// style='display:none;'>"
	var yy="<a TITLE=\""+ this.title+ "\""
	var zz="onClick='javascript:clickOnFolder("+this.folderID+")'"
	var ww=" CLASS=\""+ this.color +"\" id='AA"+ this.folderID + "'>"

////document.write("<a href=\"" + this.theFile + "\" TARGET=\"DisplayFrame\" TITLE='"+ this.title+ "' CLASS=\""+ this.color +"\" style='display:none;'>") 
//	     document.write("<a href=\"" + this.theFile + "\" TARGET=\"DisplayFrame\" TITLE='"+ this.title+ "' style='display:none;'>") 	
//	     document.write("<a TITLE=\""+ this.title+ "\"") 
//	     document.write("onClick='javascript:clickOnFolder("+this.folderID+")'") 
//	     document.write(" CLASS=\""+ this.color +"\" id='AA"+ this.folderID + "'></A>") 
//		document.write(xx)	//+yy+zz+ww)
	retx=xx
///	  } 
    }
  else 
    //document.write("<a  CLASS=\""+ this.color +"\">") 
	retx="<a  CLASS=\""+ this.color +"\">"

return retx;

} 
//L219 

function addChild(childNode) 
{ 
 // Add to 'children' array; increment array index 
  this.children[this.nChildren] = childNode
  this.nChildren++  
  return childNode 
} 
 
 
function display() 
{ 
    this.navObj.style.display = "block" 
} 

//fill index aray 
function createEntryIndex() 
{ 
  this.folderID = nEntries 
  indexOfEntries[nEntries] = this 
  nEntries++ 
} 

//action when user clicks on 'folder' 
function clickOnFolder(folderId) 
{ 
  testShown=0
  var clicked = indexOfEntries[folderId] 
  setStyle(folderId)
  if(clicked.nChildren==0) openParent(folderId)
  if (!clicked.isOpen) 
    clickOnNode(folderId) 
  currentFolder=folderId

  if(clicked.fileType == "TestFile") 
    {   
	startTest(clicked.theFile, folderId)
    }
  else
    {
      curUrl = clicked.theFile
    }

} 
 

/**********************************
action when user click on 'Node'
Node: + to expand or - to collapse a branch
***********************************/
function clickOnNode(folderId) 
{
 var clickedFolder = 0 
 var state = 0 
 clickedFolder = indexOfEntries[folderId]
 state = clickedFolder.isOpen
 clickedFolder.setState(!state)
} 
 

// for reversemapping: Open parent folder if closed
function openParent(folderId)
{

   var fld = getParent(folderId)
   var parent = indexOfEntries[fld]

   if(!parent.isOpen)
	clickOnNode(fld)
}


//First function to call: uses structure.js
function initializeDocument() 
{
  Level0.initialize(0, 1, "")
  Level0.display()
 
   // close the whole tree 
   clickOnNode(0) 
   // open the root folder 
   clickOnNode(0) 

 setStyle(0)
 clicked = indexOfEntries[0]
 curUrl= clicked.theFile
 clickOnFolder(0)
 clickOnNode(1)
 clickOnNode(2)
} 
 
// Other Functions 
// ***************
 
//Create a folder object
function createFolder(title, theFile, theIcon, theTip) 
{ 
  folder = new Folder(title, theFile,theTip)
  folder.fileType="ContentFile"
  folder.spicon = theIcon
//  folder.nodeType=theNode
  folder.shown=true
 //folder.color = theColor
  return folder
} 

 
function insertFolder(parentFolder, childFolder)
{ 
  return parentFolder.addChild(childFolder)
}


//set highlight
function setStyle(folderId)
{
  var hElem = document.all("TD"+ folderId)
  if(!hElem)return
  hElem.className = "highlight"
  for (var i=0; i<nEntries; i++)
     {  
	if( i != folderId)  
    	   { hElem = document.all("TD"+ i)
             hElem.className = "Nohighlight"
	  }	
      }
}


function clearHighlight()
{
  if(testShown==0)
    {for (var i=0; i<nEntries; i++)
         {  var hElem = document.all("TD"+ i)
            hElem.className = "Nohighlight"
         }
    }
}


function getParentX(folderId)
{
  var aFolder=indexOfEntries[folderId] 
  var ch = aFolder.nChildren

  while(ch == 0)
    { folderId = folderId-1
      aFolder  = indexOfEntries[folderId]
      ch=aFolder.nChildren
    }

  return folderId
}



function getParent(folderId)
{
  var startFolder =0
  var chkFolder = indexOfEntries[folderId]

  for(var i=0; i<nEntries; i++)
   { var aFolder = indexOfEntries[i] 
     var ch = aFolder.nChildren
	for(var j=0; j<ch; j++)
	 { var lf = aFolder.children[j]
	   if(chkFolder == aFolder.children[j])
		return i;
	 }
   }
 return 0 
}



//*****************************************************************//

// Global variables 
// **************** 
 
indexOfEntries = new Array 
nEntries = 0 
currentFolder=0
loadingDone=false
lastUrl=""
curUrl=""
filter=false
testShown=0
resultShown=false



//reverse map interval : 300 msec
//setInterval("x=rMap()",300)

