<!--
/******************************************************************************************************************
This Javascript Code is Protected by copyright laws, two patents and international treaties.  Unauthorized use, 
reproduction and or distribution of this Javascript Code, or any portion of it, will result in severe civil 
and criminal penalties. Violators will be prosecuted to the maximum extent possible under the law.
version 06-23-07
******************************************************************************************************************/
var mainFrameHeader = 1;						//set to 1 for ON, set to 0 for off
var gradTopBottom = "#FF000000";
var gradLeftRight = "#FF000000";
var dropDepthX = 0;	
var dropDepthY = 0;
var dropColor = "#FFCCCCCC";
var scrollINTO = 700;							//sets the hieght the click next will come down in pix's 500 
var backtrackScrollenable = true;				//if true, the page will return to the scroll position when linked out of on backtrack
var checkSize = false;
var prelim = false;
var autoCenter = false;							//if true, graphics placed in right frame will auto center based on hidden layer size
var numBR_roksForm = 2;
var redoakLayer_scrollINTO = 165;
var demo = false;

//no edits below this line_________________________________________________________________________________________

var list = new Array()   										// create an array to put the List in. 
var allLinks = document.getElementsByTagName("a")  			//find all references to images within the document.
var totalProcedures = document.getElementsByTagName("li")  	//find all <li> tags within the document.
var totalOutline = document.getElementsByTagName("ol")		//find all outline tags (used to measure height later on)
var totalParagraphs = document.getElementsByTagName("p")  	//find all <p> tags within the document.
var allAreas=document.getElementsByTagName("area")			//find all <area> tags within the document
var allIMG=document.getElementsByTagName("img")				//find all <img> tags within the document
var allLines=document.getElementsByTagName("hr")			//find all <hr> tags within the document
var totalFile=document.getElementsByTagName("html")			//create array for all HTML docs in file
var allSpans=document.getElementsByTagName("div")			//find all <div> tags within the document		
var allClickNext=document.getElementsByTagName("span")		//find all <span> tags within the document	
var postOutlineBreaks = 0;						/*counter to record number of breaks found after </ol>. Used to change header offset*/  
var redoakTableheight = 0;						//sets the hieght of the tack in the click next - based on template table
	
var ValnextStep = 1;								//global which stores the current step value
var commentIDCounter = 0;							//global which holds the next comment ID to be added
var newCommentID = 0;								//global value reset
var viewComment = 0;								//global value reset
var init = 0;
var sframeVal = 0; 
var activeNote = 0;
var isopen = 0;
var readyForComment = 0;
var printActive = 0;
var activeComment = 0;
var oDisplay = null;  
var titleBarHeight=0;
var loadingFlag = 1;
var projectPath = "";
var titleHeight = "0";
var win2 = 0;
var SplitToFull = false;
var thisCount = 0;
var doExtraFrame = false;		//extra frame in procedure. Created for Diebold to put Bill of Materials there
var isSpanish = false;			//this variable is set to true in individual pages to enable spanish stuff
var notesEnable = false;		//set to false to turn notes OFF and true to turn notes ON.
var TurnOffNotes = false;     //this variable is set to true in individual pages to disable notes on page to page basis
var picResizeEnable = true;		//set to true to turn resize function ON and false to turn resize function OFF.
var findstep = 0;

QueryString.keys = new Array();
QueryString.values = new Array();
NoteList = new Array(); 
	
//if (navigator.appName == "Netscape") alert("You are trying to run this knowledge System in Netscape Navigator. The script required for proper functionality will not run in Netscape.");

if (parent.frames.length)
{	
	if (window.frames.addEventListener) //DOM method for binding an event. For Firefox compatibility
		window.frames.addEventListener("load", subLoad, false)
	else if (window.frames.attachEvent)
		window.frames.attachEvent("onload", subLoad);	
	
}

else
{ 	
	if (window.addEventListener) //DOM method for binding an event. For Firefox compatibility
		window.addEventListener("load", noframeEvent, false)
	else if (window.attachEvent)
		window.attachEvent("onload", noframeEvent);	
	
}

if (location.href.substr(0,7) != "file://" & notesEnable == true & TurnOffNotes == false)
	{
		setTimeout("populateNotes()",400);
	}
		
	
/* START FRAME BUILDER FUNCTIONS */
//***************************************************************************************************** 
//***************************************************************************************************** 

/******************************************************************************
 This function is run when no frames have been generated yet.
******************************************************************************/ 
function noframeEvent()
{

getMETAData();

//if (window.document.readyState == "complete")
//{ 
	if (window.removeEventListener) //DOM method. For Firefox compatibility
		window.removeEventListener("load", noframeEvent, false)
	else if (window.detachEvent)
		window.detachEvent("onload", noframeEvent);
	
	//window.detachEvent("onload", noframeEvent);
	
	delete_cookie(fileNameFromURL(document.location.href)+"exit_scrollTop");
	frameStyle = dispProp[0]	
	titleFramevisible = eval(dispProp[1])
    
	if (frameStyle != null)
	{
    	sframeVal = frameStyle
	}  
   	
	if (titleFramevisible != null)
	{
   		if (titleFramevisible)
		{
	    	titleHeight = '25';
	    	generateFrameSet(sframeVal,titleHeight);
			return false;
		}	
	 	else
	 	{
	 		titleHeight = '0';
	 		generateFrameSet(sframeVal,titleHeight);
	 	}
	 
	}
	else
	{
		return false;
	}	 
}

/******************************************************************************
 This function is called from noFrameEvent. This function obtains the values
 for the Display Properties set for a particular page.
******************************************************************************/ 
function getMETAData()
{
var metaData = document.getElementsByTagName('META')

for (var m = 0; m < metaData.length; m++) 
{
	if (metaData[m].name.toUpperCase() == "DISPLAYPROPERTIES") 
	{
    	metaKeywords = metaData[m].content
		oKeywords = metaData[m]	  
	}
	
	if (metaData[m].name.toUpperCase() == "EXTRAFRAME")
	{
		doExtraFrame = true;
	}
	
	if (metaData[m].name.toUpperCase() == "SPANISH") 
	{
    	isSpanish = true;	  
	}
	
	if (metaData[m].name.toUpperCase() == "NONOTES")
	{   
		TurnOffNotes = true;
	}
	
}
	
var oHead = document.getElementsByTagName('HEAD')

	if (oKeywords != null)
	 {
		
	 } 
	 else 
	 {
		var oMetaKeywords = document.createElement("META");
		oMetaKeywords.name = "DISPLAYPROPERTIES"
		oMetaKeywords.content = "50,true,true,false,false,false,false,false,,,,"
		oHead(0).appendChild(oMetaKeywords)
	 }  
    this.dispProp = oKeywords.content.split(",");	
}

/******************************************************************************
 This function is called from noFrameEvent. This function takes the values
 obtained in the getMETAData function and builds the frames for that page.
******************************************************************************/ 
function generateFrameSet(sType,sTHeight)
{
	NOscroll = eval(dispProp[3])
	
	scrollBar = "scrolling='AUTO'" //set for backward compatibility
	
	if (NOscroll)
	{
		scrollBar = "scrolling='NO'"
	}
	
	newDocs=location.href;
	passTitle=escape(document.title);
	HorizontalFrameSet = eval(dispProp[4])
	No_Bottom_Controlbar = eval(dispProp[5])
	
	if (No_Bottom_Controlbar)
	{
		bcb_height = 0;
	} 
	else 
	{
		bcb_height = 47;
	}

	No_Top_Controlbar = eval(dispProp[6])
	if (No_Top_Controlbar)
	{
		tcb_height = 0;
	} 
	else 
	{
		tcb_height = 40;
	}

	if (location.href.substr(0,7) != "file://" & notesEnable == true & TurnOffNotes == false) //determine whether to include notes frame
	{
		notesHeight = 30;
	}
	else
	{
		notesHeight = 0;
	}
	
	if (doExtraFrame == true) // determine whether to include BOM frame in mainFrame
	{
		extraFrameHeight = 100;
	}
	else
	{
		extraFrameHeight = 0;
	}

if (HorizontalFrameSet != null)
{

	if (!HorizontalFrameSet)
	{
		var newFile = QueryString_Parse(newDocs)
		fromEditor = QueryString('ToDo');	
		No_Top  = document.getElementById("CBPath"); 
   
   		if (sType >= 0)
		{
			var checkPathLevel = document.getElementsByTagName("LINK")
			var findSlashes = checkPathLevel[0].href.lastIndexOf("StyleSheets");
			var sPrefix = checkPathLevel[0].href.substring(0,findSlashes);
			chooseControlBar();
			chooseTopBar();
		}
		else
		{
			alert("You must enter a positive number in the Size field.");
		}		
	    
		var replaceExistingFrame = '<html>'
			+ '<head>'
			+ '<title></title>'
			+ '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'
			+ '<script id="AutoGen"></script>'
			+ '<style>'
			+ 'html,body {margin:0;	padding:0; height:100%;'
			+ 'html>body #wrap {height:100%;}'
			+ '#wrap {width:1024px; margin:0 auto;}'
			+ '</style>'
    		+ '</head>'
			+ '<frameset id="framer1" name="framer1" rows="' + tcb_height + ',*" frameborder="NO" border="0" framespacing="0"> '
  			+ '<frame name="topFrame" scrolling="NO" noresize src=' + sPrefix + controlbartop + '>'
  			+ '<frameset id="framer2" name="framer2" rows="*,' + bcb_height + '" frameborder="NO" border="0" framespacing="0">' 
  			+ '<frameset id="framer3" name="framer3" cols="' + sType + '%,*" frameborder="NO" border="0" framespacing="0">' 
      		+ '<frameset id="framer4" name="framer4" rows="' + sTHeight + ',' + notesHeight + ',*,' + extraFrameHeight + '" frameborder="NO" border="0" framespacing="0">'
			+ '<frame name="titleFrame" scrolling="NO" noresize src="" >'
			+ '<frame name="notesFrame" src=' + sPrefix + '_Notes_Function/Notes_Frame.htm>'
			+ '<frame name="mainFrame" src="?'
			+ newDocs 
			+ '" noresize '
			+ scrollBar 
			+ '>'
			+ '<frame name="extraFrame" src=' + sPrefix + '_ROKS_MasterFiles/extraframe_table.htm>'
  			+ '</frameset>'
			+ '<frame name="rightFrame" scrolling="NO" noresize src=' + sPrefix + '_ROKS_MasterFiles/splitscreen_clicknext_right.htm>'
  			+ '</frameset>'
			+ '<frame id="bottomFrame" name="bottomFrame" scrolling="NO" noresize src=' + sPrefix + controlbarbottom + '>' 
			+ '</frameset>'
			+ '</frameset>'
			+ '<noframeset>'
			+ '<body bgcolor="#cccccc" leftmargin="0" topmargin="0">'
			+ '<div id="wrap">'
			+ '</div>'
			+ '</body>'
			+ '</noframeset>'
			+ '</html>';	
		}			
			
	else
	{
		//horizontal
		var newFile = QueryString_Parse(newDocs)
		fromEditor = QueryString('ToDo');	
		No_Top  = document.getElementById("CBPath"); 
		var checkPathLevel = document.getElementsByTagName("LINK")
		var findSlashes = checkPathLevel[0].href.lastIndexOf("StyleSheets");
		var sPrefix = checkPathLevel[0].href.substring(0,findSlashes);
		chooseControlBar();
		chooseTopBar();
				
		var replaceExistingFrame = '<html>'
			+ '<head>'
			+ '<title></title>'
			+ '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">'
			+ '<script id="AutoGen"></script>'
    		+ '</head>'
			//+ '<frameset rows="40,1*" frameborder="NO" border="0" framespacing="0" >'
			//+ '<frame name="topFrame" scrolling="NO" noresize src=' + sPrefix + controlbartop + '>'
			+ '<frameset name="framer1" rows="' + tcb_height + ',*,' + bcb_height + '" frameborder="NO" border="0" framespacing="0"> '
  			+ '<frame name="topFrame" scrolling="NO" noresize src=' + sPrefix + controlbartop + '>'
			+ '<frameset rows="' + sTHeight + ',*" frameborder="NO" border="0" framespacing="0">' //title height
			+ '<frame name="titleFrame" scrolling="NO" noresize src="" >'
			+ '<frameset id="framer3" name="framer3" rows="' + notesHeight + ',' + sType + ',*" frameborder="NO" border="0" framespacing="0" cols="*">' 
			+ '<frame name="notesFrame" src=' + sPrefix + '_Notes_Function/Notes_Frame.htm>'
			+ '<frame name="rightFrame" scrolling="NO" noresize src=' + sPrefix + '_ROKS_MasterFiles/splitscreen_clicknext_right.htm>'
			+ '<frame name="mainFrame" src="?'
	        + newDocs 
			+ '">'
			+ '</frameset>'
			+ '</frameset>'
			+ '<frame name="bottomFrame" scrolling="NO" noresize src=' + sPrefix + controlbarbottom + '>' 
			+ '</frameset>'
			;				
	}
	}
				
else
{
	alert('trap - should not see this, check form');
} 
	
oNewdoc = parent.document.open("text/html","replace");
oNewdoc.write(replaceExistingFrame);
oNewdoc.close();

} /***End Function***/

/******************************************************************************
 This function will determine what control bar to place in the page. When viewing
 the Knowledge System pages locally or by previewing, the control bar needs to be 
 without any reference to Iframes. Also the Notes function is deactivated because
 it will not work.
******************************************************************************/ 
function chooseControlBar()
{
		
	if (isSpanish == true)
	{
		var cbFolder = "_Controlbar_bottom_s/";
	}
	else
	{
		var cbFolder = "_Controlbar_bottom/";
	}	
	
	if (location.href.substr(0,7) != "file://" & notesEnable == true & TurnOffNotes == false)
	{
		//controlbarbottom = "../_Controlbar_bottom/controlbar_bottom.htm";
		controlbarbottom = cbFolder + "controlbar_bottom.htm";
	}
	else
	{
		//controlbarbottom = "../_Controlbar_bottom/controlbar_bottom_dev.htm";
		controlbarbottom = cbFolder + "controlbar_bottom_dev.htm";
	}

return controlbarbottom;

} /***End Function***/

/******************************************************************************
 This function will determine what top bar to place in the frameset.
******************************************************************************/ 
function chooseTopBar()
{		
	if (isSpanish == true)
	{
		var ctFolder = "Controlbar_top_s/";
	}
	else
	{
		var ctFolder = "Controlbar_top/";
	}	
	
	controlbartop = ctFolder + "controlbar_top.htm";	
	
return controlbartop;

} /***End Function***/

/******************************************************************************
 This function will perform an action based on a link_BOM style applied to the link.
******************************************************************************/
function displayExtraFrame(paramx)
{
	var sendurl = unescape(paramx.nxt);
	launchExtraFrame(sendurl)

} /***End Function***/

/******************************************************************************
 This function will perform an action based on a link_BOM style applied to the link.
******************************************************************************/
function launchExtraFrame(newurl)
{

	if (parent.frames.extraFrame)
	{	    
	    var extraFrameDoc = parent.frames.extraFrame;			
		
		extraFrameTable = ' <style type="text/css"> '
						+ ' <!-- '
						+ ' table { '
						+ ' font-family: Arial, Helvetica, sans-serif; '
						+ ' font-size: 12px; '
						+ ' font-weight: normal; '
						+ ' width: 100%; '						
						+ ' } '
						+ ' td { '
						+ ' text-align: center; '
						+ ' visibility: visible; '
						+ ' } '
						+ ' --> '
						+ ' </style> '
						+ ' <body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" bgColor="CCCCCC"> '
						+ newurl
						+ ' </body>'
						+ ' </head> ';
								
		extraFrameDoc.document.open("text/html","replace");
		extraFrameDoc.document.write(extraFrameTable);
		extraFrameDoc.document.close();			
	}		
} /***End Function***/

//***************************************************************************************************** 
//***************************************************************************************************** 
//***************************************************************************************************** 

/* END FRAME BUILDER FUNCTIONS -- START PAGE BUILDER FUNCTIONS */

/******************************************************************************
 This function is run when frames have already been created for a page.
******************************************************************************/
function subLoad()
{

//if (parent.frames.mainFrame && parent.frames.mainFrame.document.readyState == "complete")
if (parent.frames.mainFrame)
  {	
	if (window.frames.removeEventListener) //DOM method. For Firefox compatibility
		window.frames.removeEventListener("load", subLoad, false)
	else if (window.frames.detachEvent)
		window.frames.detachEvent("onload", subLoad);
	
	backTrakscrollTop = read_cookie(fileNameFromURL(document.location.href)+"exit_scrollTop");
	//alert(backTrakscrollTop);
	    if (backTrakscrollTop != null) 
	    {
			//requires onbeforeunload event in mainframe document which saves scrollTop in cookie
			setTimeout("javascript:window.scroll(0,backTrakscrollTop);",50);
			delete_cookie(document.location.pathname+"exit_scrollTop");
		};	
				
	loadingFlag = 0;		
	loadScript();
	
  }
}  /***End Function***/

/******************************************************************************
 See if there is a rightFrame or not. If there is no rightframe then this
 statement assumes a fullscreen click next procedure. The offset value is set
 in each case so each step will display towards the middle of the screen.
******************************************************************************/
function loadScript()
{	
	
var getTheFrame = parent.document.getElementById("framer3");
	
	//if (parent.framer3.cols == "*,100%")
	if (getTheFrame.cols == "*,100%")
	{			
		window.top.location.reload();
		SplitToFull = false;
	}	
			
verifyTitle(document.title);

	//create loading layer on the fly to hide parsing 	
	//bdy = document.all.tags("body");	
	/** bdy = document.getElementsByTagName("body"); bdy1 = bdy[0].outerHTML.split('>'); bdyinner = bdy[0].innerHTML; **/		
	/** bdy = document.body;  // THIS REPLACES THE ABOVE THREE LINES OF CODE. I DON'T KNOW WHETHER THIS IS NEEDED. DON'T THINK SO
	bdy1 = bdy.outerHTML.split('>'); bdyinner = bdy.innerHTML; **/
	
	bgTable = document.getElementById("backgroundX");
	if (bgTable) 
	{
		parent.frames.mainFrame.document.body.style.backgroundColor = bgTable.bgColor;
		parent.frames.mainFrame.document.body.background = bgTable.background;
	}
	//afterEnd
	//parent.frames.mainFrame.document.body.insertAdjacentHTML("afterEnd",'<div id="loading" style="width:100%; height:100%; layer-background-color:#FFFFFF; background-color:#FFFFFF "><font face="Arial, Helvetica, sans-serif"><br><br><b>Loading, one moment please ...</b></font></div>');
	//parent.frames.mainFrame.document.body.insertAdjacentHTML("afterBegin",'<div id="noteDiv"></div>');
	
	var newDiv = document.createElement("div");
	newDiv.id = "noteDiv";
	document.body.appendChild(newDiv);
	/*
	- Cause parent.frames.notesFrame.document.body object sometimes is null so this will be created when null
	*/
	if (location.href.substr(0,7) != "file://" & notesEnable == true)
	{
		var oBody;
		var oDoc = parent.frames["notesFrame"].document;
		if(oDoc!=null){
			oBody = oDoc.body;
			if(oBody==null)
			{
				oBody = oDoc.createElement("BODY");			
			}
			oBody.insertAdjacentHTML("afterBegin",'<div id="noteDiv"></div>');
		}	
		//parent.frames.notesFrame.document.body.insertAdjacentHTML("afterBegin",'<div id="noteDiv"></div>'); //To place notes in other frame
	}
		
	setTimeout("continue_()",50);
	}
	function continue_()
	{
	//tableshuffle(); //Call to Table Shuffling functions
	
	scrollINTO = redoakLayer_scrollINTO;
		
	//Build_Drawing_Target();
	bgTable = document.getElementById("backgroundX");
	if (bgTable) 
	{
		colour = bgTable.bgColor;
	}
	else
	{
		colour = 'white';
	}
	
	getMETAData();	
	cList = eval(dispProp[2])	
	
		if (cList)
		{
			init=1;
			initScript();
		}
		else
		{
			formatLineBreaks();
			placeImageNoList(0)
			fixATagsHTML();
			fixAreasHTML();			
			//fixFSObjectHTML();
			//formatCommandButton();
	  		if (backtrackScrollenable) 
			
			if (window.addEventListener) //DOM method for binding an event. For Firefox compatibility
				window.addEventListener("beforeunload", savePosition, false)
			else if (window.attachEvent)
				window.attachEvent("onbeforeunload", savePosition);	
					
	   		init=0;
		}	
	
	//turn loading layer off 
	//loadLayer= parent.frames.mainFrame.document.getElementById("loading");
	//loadLayer.style.visibility='hidden';
	//loadLayer.style.width='500';
	//loadLayer.style.height='0';
	//loadLayer.style.top='20';
	
	All_margins_0 = eval(dispProp[7])
	left_margin = dispProp[8]
	right_margin = dispProp[9]
	top_margin = dispProp[10]
	bottom_margin = dispProp[11]
	
	if (All_margins_0 == true)
	{
	  	document.body.style.marginLeft = 0;
	  	document.body.style.marginRight = 0;
	  	document.body.style.marginTop = 0;
	  	document.body.style.marginBottom = 0;
	}
	else
	{		
		if (left_margin)
		{
			document.body.style.marginLeft = left_margin;		
		}
		  
		if (right_margin)
		{
			document.body.style.marginRight = right_margin;
		}
		
		if (top_margin)
		{
			document.body.style.marginTop = top_margin;
		}
		
		if (bottom_margin != null)
		{
			document.body.style.marginBottom = bottom_margin;
		}
		
	}	
		
	redoak_layer = document.getElementById("redoak2");
	
	if (redoak_layer != null)
   	{	
		redoak_layer.style.width = 0;
		redoak_layer.style.height = 0;
		redoak_layer.innerHTML = "";
	}	
	
	document.body.style.visibility='visible';
	
	if (checkSize) {checkRightFrameSize()};
	
	return false;	
	
} /***End Function***/

/******************************************************************************
 This function will check your system for a cookie that stores the step you
 were on. If no cookie was detected or if you were on the very last step 
 then a cookie is written or updated to the first step.
******************************************************************************/ 
function initScript()
{
  
  theStep = read_cookie (document.location.pathname+"current_step");
  
     
	 if (theStep == null||theStep == (totalProcedures.length+2))
            {
			 write_cookie (document.location.pathname+"current_step", 2);
			 theStep=2;
			}

     if (theStep==2)
            {
			 scrollReset();			 
			 contractAll();			 
			 
			 for (var i=0 ;i<allLinks.length;i++)
    			if (allLinks[i].className=="JS_Reference_Button")
	    			{
					//alert(allLinks[i].href);
			 		//openPic(allLinks(i).nxt);
					//openNew(allLinks[i].nxt);
					//openNew(allLinks[i].getAttribute("nxt"));
					openNew(allLinks[i].href);
					i = allLinks.length + 1;
					}
			 //return false;
			}
 
     else
            {
		     contractAll();
			// return false;			 
            }			

	fixATagsHTML();
	fixAreasHTML();
	fixLITags()		
  //fixBodyFooter()	

return false; 
		  
} /***End Function***/

/******************************************************************************
This function will find all nxt or href properties within all <a> tags and add 
 the onClick event so the images will load when the link is clicked.
******************************************************************************/ 
function fixATagsHTML()
{
   for (var i=0 ;i<allLinks.length;i++)
   {
   
    if (allLinks[i].className=="JS_Reference_Button")
	    {      		
	 
		/** var parentNode = ;
		allLinks[i].setAttribute("onclick", "loadImage(this.href)");
		allLinks[i].removeAttribute("href"); **/
		
    	allLinks[i].outerHTML='<A class=JS_Reference_Button onClick=loadImage(this) nxt='
         		+ allLinks[i].href
		 		+ '>' 
		 		+ allLinks[i].innerHTML
		 		+ '</A>';		
		
		}
		
	  if (allLinks[i].className=="JS_Object_Fullscreen")
	    {
		allLinks[i].outerHTML='<A class=JS_Object_Fullscreen '
				+ 'onmouseover="this.style.backgroundColor=\'blue\';this.style.color=\'white\'" onmouseout="this.style.backgroundColor=\'transparent\';this.style.color=\'red\'"'
		 		+ 'onClick=loadObjectFull(this) nxt='
		 		+ allLinks[i].href
		 		+ '>' 
				+ allLinks[i].innerHTML 
		 		+ '</A>';
		}
		
	 if (allLinks[i].className=="JS_Float_Window")
	    {
        allLinks[i].outerHTML='<A class=JS_Float_Window '
				+ 'onmouseover="this.style.backgroundColor=\'blue\';this.style.color=\'white\'" onmouseout="this.style.backgroundColor=\'transparent\';this.style.color=\'red\'"'
		 		+ 'onClick=displayDrawing(this) nxt='
		 		+ allLinks[i].href
		 		+ '>' 
				+ allLinks[i].innerHTML 
		 		+ '</A>';  				
		 }
	
	if (allLinks[i].className=="JS_Command_Fullscreen")
	    {
		allLinks[i].outerHTML='<A class=JS_Command_Fullscreen '
				+ 'onmouseover="this.style.backgroundColor=\'blue\';this.style.color=\'white\'" onmouseout="this.style.backgroundColor=\'transparent\';this.style.color=\'black\'"'
		 		+ 'onClick=loadObjectFull(this) nxt='
		 		+ allLinks[i].href
		 		+ '>'  
				+ allLinks[i].innerHTML 
		 		+ '</A>';
		}
		
	if (allLinks[i].className=="JS_Command_Float")
	    {
		allLinks[i].outerHTML='<A class=JS_Command_Float '
				+ 'onmouseover="this.style.backgroundColor=\'blue\';this.style.color=\'white\'" onmouseout="this.style.backgroundColor=\'transparent\';this.style.color=\'black\'"'
		 		+ 'onClick=displayDrawing(this) nxt='
		 		+ allLinks[i].href
		 		+ '>' 
				+ allLinks[i].innerHTML 
		 		+ '</A>';				
		}
		
	if (allLinks[i].className=="JS_Mainmenu_Fullscreen")
	    {
		allLinks[i].outerHTML='<A class=JS_Mainmenu_Fullscreen '
				+ 'onmouseover="this.style.backgroundColor=\'6699FF\';this.style.cursor=\'hand\';" onmouseout="this.style.backgroundColor=\'0066CC\'"'
		 		+ 'onClick=loadObjectFull(this) nxt='
		 		+ allLinks[i].href
		 		+ '>' 
		 		+ allLinks[i].innerText 
		 		+ '</A>';
		}
		
	if (allLinks[i].className=="link_BOM")
	    {
		allLinks[i].outerHTML='<A class=link_BOM '
				+ 'onmouseover="this.style.backgroundColor=\'blue\';this.style.color=\'white\'" onmouseout="this.style.backgroundColor=\'transparent\';this.style.color=\'red\'"'
		 		+ 'onClick=displayExtraFrame(this) nxt='
		 		+ allLinks[i].href
		 		+ '>' 
		 		+ allLinks[i].innerText 
		 		+ '</A>';				
		}		
	}
		
}  /***End Function***/

/******************************************************************************
 This function will find all nxt or href properties within all <area> tags and add 
 the onClick event so the images will load when the link is clicked.
******************************************************************************/ 
function fixAreasHTML()
{
   for (var i=0 ;i<allAreas.length;i++)
   {
    if (allAreas[i].className=="JS_Reference_Button")
	   {
           allAreas[i].outerHTML='<AREA  onmouseover="this.style.cursor=\'hand\'  " onClick= loadImage(this) coords='
		   + allAreas[i].coords
		   + ' shape='
		   + allAreas[i].shape
		   + ' nxt='
		   + allAreas[i].href
		   + ' target='
		   + allAreas[i].target 
		   + '>' 
	    }
		
	if (allAreas[i].className=="JS_Object_Fullscreen")
	   {
           allAreas[i].outerHTML='<AREA  onmouseover="this.style.cursor=\'hand\'  " onClick= loadObjectFull(this) coords='
		   + allAreas[i].coords
		   + ' shape='
		   + allAreas[i].shape
		   + ' nxt='
		   + allAreas[i].href
		   + ' target='
		   + allAreas[i].target 
		   + '>' 
	    }
		
	if (allAreas[i].className=="JS_Float_Window")
	   {
           allAreas[i].outerHTML='<AREA  onmouseover="this.style.cursor=\'hand\'  " onClick= displayDrawing(this) coords='
		   + allAreas[i].coords
		   + ' shape='
		   + allAreas[i].shape
		   + ' nxt='
		   + allAreas[i].href
		   + ' target='
		   + allAreas[i].target 
		   + '>' 
	    }
	}
		
}  /***End Function***/

/******************************************************************************
 This function will parse objects from a hidden field in a step.
 This function is based on a prototype for Diebold to display parts information
 in an extra frame.
******************************************************************************/
function parseHiddenTB(curIdx)
{	

	var getAllHiddenTables = getLikeElements("table", "id", "tbBOM"); // identify all tables with id=tbBOM
	
	for (var i = 0; i < getAllHiddenTables.length; i++) // hide all tables with id=tbBOM
	{
		getAllHiddenTables[i].style.visibility="hidden";
	}	

	var stepContents = totalProcedures[curIdx].getElementsByTagName("table"); // find all tables in current step
		
	for (var i = 0; i < stepContents.length; i++) // find table with id=tbBOM
	{
		var findBOMTable = stepContents[i];
			
		if (findBOMTable.id == "tbBOM")
		{
			var parseBOMTable = findBOMTable.outerHTML;			
			launchExtraFrame(parseBOMTable);
		}			
	}
	
} /***End Function***/

/******************************************************************************
This function will find all like elements in an html page.
This function is pulled from Task Based Training templates. It sill be used here for
Diebold protoype to recognize BOM tables in a page. 
******************************************************************************/
function getLikeElements(tagName, attrName, attrValue) 
{
	var startSet;
    var endSet = new Array( );
   
	if (tagName) 
	{
        startSet = document.getElementsByTagName(tagName);    
    } 
	else 
	{
        startSet = (document.all) ? document.all : 
        document.getElementsByTagName("*");
    }

	if (attrName) 
		{
        for (var i = 0; i < startSet.length; i++) 
			{
            if (startSet[i].getAttribute(attrName)) 
				{
                if (attrValue) 
					{
                    if (startSet[i].getAttribute(attrName) == attrValue) 
						{
                        endSet[endSet.length] = startSet[i];
                    	}
                	} 
				else 
					{
                    endSet[endSet.length] = startSet[i];
                	}
            	}
        	}
    	} 
	else 
		{
        endSet = startSet;
    	}

return endSet;

} /***End Function***/

/******************************************************************************
function fixBodyFooter()
******************************************************************************/ 
function fixBodyFooter()
{
 startingPoint = totalFile[0].outerHTML.indexOf("<BR>",totalFile[0].outerHTML.indexOf("</OL>"));
	while (startingPoint != -1)
	{
		postOutlineBreaks ++;
		startingPoint = totalFile[0].outerHTML.indexOf("<BR>",startingPoint + 4);
	}
	if (allLines.length > 0) postOutlineBreaks ++;
	
} /***End Function***/

/******************************************************************************
 fixLITags (fix Line Item Tags) is used to add a click next javascript call to
 the end of each procedure step (<li> tag) found in the file with the exception
 of the last one.   
******************************************************************************/ 
function fixLITags()
{

	if (isSpanish == true)
	{
		var clNext = '{haga clic para continuar luego}';
		var endofProc = 'el fin del procedimiento.';
	}
	else
	{
		var clNext = '{Click NEXT to Continue}';
		var endofProc = 'End of Procedure.'
	}	
	
	var clickNextString = "<span id='cn' onClick='nextStep()'><div style='margin-left:0px; margin-top:10px;'><font style='cursor:pointer; font-size:14px;font-family: Arial;font-weight: bold;color: #0000FF'>"
							+ clNext 
							+ "</font></span>";
							
	var clickNextString2 = "<span id='cn' onClick='nextStep()'><div style='margin-left:-20px; margin-top:18px;'><font style='cursor:pointer; font-size:18px;font-family: Arial;font-weight: bold;color: #000000'>"
							+ endofProc 
							+ "</font></span><br><hr>";
	
	for (var i=0 ;i<totalProcedures.length-1;i++)
   		{		   
			//alert(totalProcedures[i].innerHTML);
		  	var newDiv = document.createElement("div");
			newDiv.setAttribute("id", "noteDiv");
			newDiv.innerHTML = clickNextString;
			totalProcedures[i].appendChild(newDiv);				   
		}
	
		if (totalProcedures.length > 0)
		{		   
		   	var newDiv = document.createElement("div");
			newDiv.setAttribute("id", "noteDiv");
			newDiv.innerHTML = clickNextString2;
			totalProcedures[i].appendChild(newDiv);		   
		 }
  
} /***End Function***/

/******************************************************************************
 formatLineBreaks -- function called when click next is turned off. Creates line breaks.
 -- Removed this function, isn't needed any longer --
******************************************************************************/ 
function formatLineBreaks()
{

			   
} /***End Function***/

/* END PAGE BUILDER FUNCTIONS */
//***************************************************************************************************** 
//***************************************************************************************************** 
//***************************************************************************************************** 

function checkRightFrameSize()
{
	alert('height= ' + parent.frames.rightFrame.document.body.clientHeight);
	alert('width= ' + parent.frames.rightFrame.document.body.clientWidth);
	parent.frames.rightFrame.document.write('height= ' + parent.frames.rightFrame.document.body.clientHeight + 'width= ' + parent.frames.rightFrame.document.body.clientWidth);
}

/******************************************************************************
 This function places the step counter in the blue caption bar above the procedure.
******************************************************************************/ 
function showCurrentStep(iVal,jVal)
{
	var sNewSteps
 	if (jVal != 0)
 	{
 		counterStepper = parent.frames.titleFrame.document.getElementById("stepCounter"); 	
  		if (counterStepper)
  		{		
   			sNewSteps	= (iVal +" of " + jVal);			
   			counterStepper.innerHTML = sNewSteps;
   			return sNewSteps;
  		}
 	} 
	
} /***End Function***/

/******************************************************************************
 This function will find all of the steps in the document(<li> tags) and assign 
 them an id. Then all of the steps are initially hidden. The current step is
 determined and all steps up to the current step are made visible. This function
 will also make a call to another funtion to determine which graphic to open
 in the right frame if applicable. 
******************************************************************************/ 
function contractAll() 
{
	foundImage=0; 
     for (var i=1 ;i<totalProcedures.length+1;i++)
      {  
        totalProcedures[i-1].id="step"+ i;
		list[i] = document.getElementById("step" + i);
		//list[i] = eval("step" + i);  //Does not work in Firefox.
		hideStep( list [i]);
		
      }
		//setCommentScroll(theStep - 1);

     for (var j=1;j<theStep;j++) //determine current step
       { 
         if (j != totalProcedures.length+1 )
               {
			    showStep( list [ j ]);
				setScrollPosition(j -1);	
			   }   

         if (theStep==2 && foundImage != 1)
               {
				foundImage=1;
			    placeImage(0)
			   }
      
		 if (foundImage==0)
               {
			    foundImage=1;
			    placeImage(theStep -2);
			   }
        } 
		
	showCurrentStep(theStep - 1,totalProcedures.length);
	
} /***End Function***/

/******************************************************************************
 This function will expand all hidden steps in a document. 
******************************************************************************/ 
function explodeProc()
{
	foundOne=0;
	nn = parent.frames.mainFrame.document.getElementsByName('cn');
	
	for (var i=0 ;i<allLinks.length;i++)
    if (!cList || !parent.frames.rightFrame)
	    {
          foundOne=1;
		} 	
		
	if (foundOne == 0)
	{
		for (var i=1 ;i<totalProcedures.length+1;i++)
		{
			ValnextStep=(i+1);
  			showStep( list [ValnextStep]);
			write_cookie (document.location.pathname+"current_step", (ValnextStep));
		}
	}
	
} /***End Function***/

/******************************************************************************
 This function is run to expand to a specific step from a procedure.
 This may be added as a button on the Bottom Bar at a later date. 
******************************************************************************/ 
function explodeSteps(stepNumber)
{	
	var stepExpand = parseFloat(stepNumber) + 1;
	if (stepNumber <= totalProcedures.length)
	{
		contractAll();
		foundOne=0;
		nn = parent.frames.mainFrame.document.getElementsByName('cn');
	
		for (var i=0 ;i<allLinks.length;i++)
    	if (!cList || !parent.frames.rightFrame)
		{
       		foundOne=1;
		} 
	
		if (foundOne == 0)
		{
			for (var j=1 ;j<stepExpand;j++)
			{
  				showStep( list [j])
				placeImage(j);
	  			ValnextStep=(j+1);
			}		
		}
		
		setScrollPosition(stepNumber); return false;
	}
	else
	{
		alert("There are only " + totalProcedures.length + " steps in this procedure. Please enter another number."); return true;
	}
	
} /***End Function***/

/******************************************************************************
showStep(name)
******************************************************************************/ 
function showStep(name)
{
	if (demo && (document.getElementById("demoID") == null))
	{
		if (name.id == "step2")
		{
			delete_cookie (document.location.pathname+"current_step");
			//refreshCommentIcons();
			scrollReset();
			alert("demo version");
			return false;
		}
	}

    if (ValnextStep !== totalProcedures.length+1 && name != null) 
    {
	    openstep=name;			
	    name.style.visibility='visible';
	}
    else 
	{
    	if (printActive == 0)
		{
		 	//delete_cookie (document.location.pathname+"current_step");
		 	//alert("End of procedure. Click on the Back Button below to return to the previous page.");
		}
    }
   
} /***End Function***/

/******************************************************************************
hideStep(name)
******************************************************************************/ 
function hideStep(name)
{
	if (isopen == 0) 
	{
		name.style.visibility='hidden';
	}

} /***End Function***/

/******************************************************************************
 This function will make sure that step being passed to it is valid. The step
 is not valid if it has reached the last step. If valid, the step number will
 be passed to sortLinks function to extract the correct image for the step.
 
 This function is run when clicking NEXT or PREVIOUS buttons to navigate in page.
******************************************************************************/ 
function placeImage(idx)
{
   if (idx < totalProcedures.length &&  isopen == 0)
      {
	   sortLinks(idx);
	   parseHiddenTB(idx);	   
	   picResize(); 	   
	  }

} /***End Function***/

/******************************************************************************
 This function is run when there is no numbered list to ensure the first
 reference button is placed in the right frame.
******************************************************************************/ 
function placeImageNoList(idx)
{
   	for (var i=0 ;i<allLinks.length;i++)
   	{
    	if (allLinks[i].className=="JS_Reference_Button")
	    {
        	openNew(allLinks[i].href);
			//openNew(allLinks[i].nxt);
			i = allLinks.length + 1;
		}
	 }
	     
	 picResize(); 	   
	  
} /***End Function***/

/******************************************************************************
 This function will cycle through all of the links that are in this step, find
 any that are marked with nxt, make sure there is a rightFrame to place it in 
 and put the first one there. note: use document.write to make nxt's clickable. 
******************************************************************************/ 
function sortLinks(curIdx)
{

var iLnks=totalProcedures[curIdx].getElementsByTagName("a"); //returns the number of links within the step
for (var j=(iLnks.length-1); j>-1; j--)
	{
		if (iLnks[j].getAttribute("nxt") && parent.frames.rightFrame)
        {			
			if (iLnks[j].className=="JS_Reference_Button" && parent.frames.rightFrame)
			{	
				//alert(iLnks[j].outerHTML);
        		openNew(iLnks[j].getAttribute("nxt"));
				//openNew(iLnks[j].href);
			}
		
			if (iLnks[j].className=="link_BOM" && parent.frames.extraFrame)
		 	{
				launchExtraFrame(iLnks[j].nxt);
			}
			
		}
		
		else 
	    {
			//if (iLnks[j].nxt)
			if (iLnks[j].getAttribute("nxt"))
			{
	     		openNew(iLnks[j].getAttribute("nxt"));
		 		return false;
		 	}
		}	
	}
        
} /***End Function***/

/******************************************************************************
 This function will accept an object that refers to the <a> nxt tag and load it
 in the rightFrame when clicked.
 
 This function is run when clicking on red links to display images manually in
 right frame.
******************************************************************************/ 
function loadImage(theStr)
{

    if (parent.frames.rightFrame)
       {
	    	openNew(theStr.nxt);		
	    	picResize();
       }
	   
} /***End Function***/

/******************************************************************************
 This function will accept an object that refers to the <a> nxt tag and load it
 into a fullscreen with bottom control bar only when clicked.
******************************************************************************/ 
function loadObjectFull(theStr)
{
	
    if (parent.frames.mainFrame)
       {
	    	generateFullObjectWindow(theStr.nxt);
			return false;
       }
	   
} /***End Function***/

/******************************************************************************
 
******************************************************************************/ 
function generateFullObjectWindow(sFileOBJ)
{
	SplitToFull = true;
	openNew(sFileOBJ);
								
} /***End Function***/

/******************************************************************************
 This function will reset the scrollbar to the top of the page
******************************************************************************/ 
function scrollReset()
{
  setTimeout("javascript:window.scroll(0,0)",1000);
} 

/***End Function***/

/******************************************************************************
 This function will handle the click NEXT to continue command.
******************************************************************************/ 
function nextStep()
{

 if (!cList || init==0)
	{
		alert('End of procedure');
		return false;
	} 

  for (var i=0;i<list.length;i++)
 
   if (openstep==list[i]) // This code is run each time Next is clicked. //
      {		  	
		placeImage(i);
	  	ValnextStep=(i+1);
	  	setScrollPosition(i);
	  }

	if (ValnextStep != (totalProcedures.length +1)) // This code run each time Next is clicked except last step. //
      {
	  	showStep(list[ValnextStep]);	  
	  	write_cookie (document.location.pathname+"current_step", (ValnextStep+1));      
      	showCurrentStep(ValnextStep,totalProcedures.length);
	  }
	  
	else  // This code is only run when NEXT is clicked after last step displayed. //
      {
	  	showStep(list[ValnextStep]);
	  	//write_cookie (document.location.pathname+"current_step", (ValnextStep+1));
		write_cookie (document.location.pathname+"current_step", (ValnextStep));
	  	ValnextStep = ValnextStep - 1;
	  	return false;
	  } 
   
} /***End Function***/

/******************************************************************************
previousStep()
******************************************************************************/ 
function previousStep()
{

theStep = read_cookie (document.location.pathname+"current_step");

	if (theStep == 2)
	{
		pStep = ValnextStep;
	}
	else
	{
		pStep = theStep - 1;
	}

if (pStep != 1  && list[pStep] != null)
{	
	hideStep(list[pStep]);
	
    if (parseInt(pStep) > 2)
	{
		//write_cookie (document.location.pathname+"current_step", (pStep - 1));
		write_cookie (document.location.pathname+"current_step", (pStep));
        ValnextStep = pStep - 1;
        openstep=list[pStep - 1];
	    showStep(list[pStep - 1]); 
	    showCurrentStep(pStep - 1,totalProcedures.length);
	    setScrollPosition(pStep - 2);
	    placeImage(pStep - 2);
	}
	else
	{
		showStep(list[pStep - 1]); 
		showCurrentStep(pStep - 1,totalProcedures.length);
		scroll(0,0);
		placeImage(pStep - 2);
	}	
}
 
} /***End Function***/

/******************************************************************************
setCommentScroll(visibleStep) -- This function is activated in "click NEXT" procedures
to show notes in the visible steps and hide notes in the hidden steps.
******************************************************************************/ 
function setCommentScroll(visibleStep)
{    
	scrollMultiplier = currentVisibleHeight();
	allSpans = document.getElementsByTagName("div");
	for (i=0;i<allSpans.length;i++)
	{
		if (allSpans[i].className == "noteIcon")
		{
			
			 if (parseInt(allSpans[i].style.top) > (scrollMultiplier))
			 {
			 	allSpans[i].style.visibility = 'hidden'
			 }
			 else
			 {
			 	allSpans[i].style.visibility = 'visible'
			 }
		}
	}
	
} /***End Function***/

/******************************************************************************
currentVisibleHeight() -- This function calculates the scrollMultiplier value that
is used in the setCommentScroll function to determine whether to show or hide notes
in a "click NEXT" procedure.
******************************************************************************/
function currentVisibleHeight()
{
    allSpans = document.getElementsByTagName("div")
	
    if (allSpans.length != 0) 
    {
        for (i=0;i<allSpans.length;i++)
    	{
	        if (allSpans[i].className == "noteIcon")
		      {
               	if (allSpans[i].deleteTag != "Yes")
			        {
               		}
			  }
        }
    }	

	if (totalOutline.length == 0 || !cList ){return document.body.length;}
	totalProcedures = document.getElementsByTagName("li")
  	offsetVal = document.body.scrollHeight - totalOutline[0].scrollHeight - ((postOutlineBreaks - numBR_roksForm) * 40) - redoakTableheight;
	//offsetVal = document.body.scrollHeight - totalOutline[0].scrollHeight - redoakTableheight;
	 
 	scrollMultiplier=offsetVal;
	for (var stepIndex=0; stepIndex < totalProcedures.length; stepIndex++)
	{  
		 if (totalProcedures[stepIndex].style.visibility == 'visible')
		 	scrollMultiplier = (scrollMultiplier+totalProcedures[stepIndex].scrollHeight);	
	}
	
	return scrollMultiplier;
	
} /***End Function***/

/******************************************************************************
setScrollPosition(visibleStep)
******************************************************************************/
function setScrollPosition(visibleStep)
{
  if (totalOutline.length == 0) return 0;
  totalProcedures = document.getElementsByTagName("li");
  offsetVal = document.body.scrollHeight - totalOutline[0].scrollHeight;
 	
  scrollMultiplier=offsetVal;
  for (var stepIndex=0;stepIndex < visibleStep; stepIndex++)
       //alert(totalProcedures[stepIndex].scrollHeight);
	   scrollMultiplier = (scrollMultiplier+totalProcedures[stepIndex].scrollHeight+16); //Added 16 after recent changes.
	   
       if (stepIndex <= totalProcedures.length && stepIndex != 0)
           {
		   window.scrollTo(0,scrollMultiplier - scrollINTO);return false;
		   }
		   
 } /***End Function***/

/******************************************************************************
function write_cookie (name, value);
function write_cookie (name, value, path);

write_cookie creates a cookie with the name, value, and path given in the
parameters.  If no path is supplied, write_cookie uses the document's default
cookie path.  Each cookie is set with an expiration time of 1 year.
******************************************************************************/
function write_cookie (name, value, path)
{

   // Build the expiration date string:
   var expiration_date = new Date ();
   expiration_date . setYear (expiration_date . getYear () + 1);
   expiration_date = expiration_date . toGMTString ();
   
	// Build the set-cookie string:
    var cookie_string = escape (name) + "=" + escape (value) +
    "; expires=" + escape(expiration_date);	
	
    if (path != null)
	{
    	cookie_string += "; path=" + path;
	}
	
    // Create/update the cookie:
    document.cookie = cookie_string;
   
} /***End Function***/

/******************************************************************************
function read_cookie (key)
function read_cookie (key, skips)

read_cookie searches through the current document's cookie string (i.e., the
concatenation of all cookies readable by the current document) for a cookie
whose name is identical to key.  If read_cookie finds a matching cookie, it
returns a string containing the value of cookie.  If read_cookie cannot find a
match, it returns null instead.

An optional skips parameter may be supplied if there is a need to select among
multiple cookies with the same name.  If a skips parameter is supplied,
read_cookie will skip that many occurrences of matching cookies and then return
the next one it finds, or null if there aren't any more.
******************************************************************************/
function read_cookie (key, skips)
{

        // Set skips to 0 if parameter was omitted:
        if (skips == null)
                skips = 0;

        // Get cookie string and separate into individual cookie phrases:
        var cookie_string = "" + document . cookie;
        var cookie_array = cookie_string . split ("; ");

        // Scan for desired cookie:
        for (var i = 0; i < cookie_array . length; ++ i)
        {
                var single_cookie = cookie_array [i] . split ("=");
                if (single_cookie . length != 2)
                        continue;
                var name  = unescape (single_cookie [0]);
                var value = unescape (single_cookie [1]);

                // Return cookie if found:
                if (key == name && skips -- == 0)
                        return value;
        }

        // Cookie was not found:
        return null;
  
} /***End Function***/

/******************************************************************************
delete_cookie (name)
delete_cookie (name, path)

delete_cookie deletes the cookie with the specified name and path.  If no path
is given, the default cookie path for the current document is used instead.  If
the name and path do not match an existing cookie, delete_cookie has no effect.
******************************************************************************/
function delete_cookie (name, path)
{
        // Build expiration date string:
        var expiration_date = new Date ();
        expiration_date . setYear (expiration_date . getYear () - 1);
        expiration_date = expiration_date . toGMTString ();

        // Build set-cookie string:
        var cookie_string = escape (name) + "=; expires=" + expiration_date;
        if (path != null)
                cookie_string += "; path=" + path;

        // Delete the cookie:
        document . cookie = cookie_string;
  
} /***End Function***/

/******************************************************************************
This is run during print functions if "add date" was selected from print popup.
******************************************************************************/
function addDateToPrint()
{

	var date = new Date();
	var d  = date.getDate();
	var day = (d < 10) ? '0' + d : d;
	var m = date.getMonth() + 1;
	var month = (m < 10) ? '0' + m : m;
	var yy = date.getYear();
	//var year = (yy < 1000) ? yy + 1900 : yy;
	var year = ((yy < 1000) ? yy + 1900 : yy).toString();
	var newyear = year.substring(2,4);
	var thisDate = (month + "/" + day + "/" + newyear);
	
	dateString =  "<table width='90%' border='0' cellspacing='1' cellpadding='1'>"
					+"<tr><td><div align='right'>Date Printed: " + thisDate + "</div></td></tr>"
					+"</table>"	;			
	
	return dateString;	
	
} /***End Function***/ 

/******************************************************************************
 Function is used to print the complete contents of the mainFrame. In order
 to do this, all of the line items must be temporairly displayed.  The function
 displays all of them, focuses on the frame, calls the print method, rehides
 all of the items, and then redisplays up to the current step.
******************************************************************************/
function printDocument(TheDate, HeadFoot)
{
	//printComments = 0;
	printActive = 1;
	foundOne=0;
	nn = parent.frames.mainFrame.document.getElementsByName('cn');
	var setTheDate = TheDate;
	var setHeadFoot = HeadFoot;
   
    if (SplitToFull == true)
	{
  		parent.frames.rightFrame.window.focus();
		parent.frames.rightFrame.window.print();
		return false;
	}
   
	for (var i=0 ;i<allLinks.length;i++)
	
   		if (!cList || !parent.frames.rightFrame)
	    {
         	foundOne=1;
		} 	
		
		if (foundOne == 0)
		{	
			for (var i=0 ;i<nn.length;i++) 
			{
	 			nn(i).style.visibility='hidden';     
			} 
			for (var i=1 ;i<totalProcedures.length+1;i++)
			{
  		   		showStep( list [i])
		   		//parent.frames.mainFrame.document.body.insertAdjacentHTML("beforeEnd","<br>TEST<br><br style='page-break-after:'>TEST 2");
			}
		}		
		
		if (setTheDate == true)
		{				
			addDateToPrint();
			
			if (setHeadFoot == "top")
			{parent.frames.mainFrame.document.body.insertAdjacentHTML("afterBegin",dateString);}
			else if (setHeadFoot == "bottom")
			{parent.frames.mainFrame.document.body.insertAdjacentHTML("beforeEnd",dateString);}
		}		
	
		parent.frames.mainFrame.window.focus();
		parent.frames.mainFrame.window.print();
	
		if (document.getElementById("noPrintRefresh") == null)
		{
			parent.top.location.reload();
		}
		else
		{	
			for (i=0;i<allSpans.length;i++)
			{	
				if (allSpans[i].className=="noteIcon")
				{
					allSpans[i].style.visibility = "visible";
				}
			}
	 	}

	printActive = 0;
	
} /***End Function***/

/******************************************************************************
 Function is used to print the image displayed in the right Frame.
******************************************************************************/
function printDocumentRFOnly(TheDate, HeadFoot)
{		
	var setTheDate = TheDate;
	var setHeadFoot = HeadFoot;
	
	printActive = 1;
	foundOne=0;
	nn = parent.frames.mainFrame.document.getElementsByName('cn');  
	
	if (setTheDate == true)
		{				
			addDateToPrint();
			
			if (setHeadFoot == "top")
			{parent.frames.rightFrame.document.body.insertAdjacentHTML("beforeEnd",dateString);}
			else if (setHeadFoot == "bottom")
			{parent.frames.rightFrame.document.body.insertAdjacentHTML("afterEnd",dateString);}
		}		
		
	parent.frames.rightFrame.document.body.bgColor="FFFFFF"; 
  	parent.frames.rightFrame.window.focus();
	parent.frames.rightFrame.window.print();
	parent.frames.rightFrame.document.body.bgColor="000000";
	
	if (document.getElementById("noPrintRefresh") == null)
	{
	 parent.top.location.reload();
	}	
	
	printActive = 0;
	
} /***End Function***/

/******************************************************************************
 Function is used to print the complete contents of the mainFrame. Function also
 prints all of the associated graphics referenced in the mainFrame.
 
 In order to do this, all of the line items must be temporairly displayed.  The function
 displays all of them, focuses on the frame, calls the print method, rehides
 all of the items, and then redisplays up to the current step.
******************************************************************************/
function printDocumentSpecial()
{	
	printComments = 0;
	printActive = 1;
	foundOne=0;
	nn = parent.frames.mainFrame.document.getElementsByName('cn');   
   
	for (var i=0 ;i<allLinks.length;i++)
    
	if (!cList || !parent.frames.rightFrame)
	{
    	foundOne=1;
	} 	
		
	if (foundOne == 0)
	{
		for (var i=0 ;i<nn.length;i++) 
		{
	 		nn(i).style.visibility='hidden';     
		} 
		for (var i=1 ;i<totalProcedures.length+1;i++)
  	
		   showStep( list [i-1])
	}	
	
	for (var i=0 ;i<totalProcedures.length;i++)
	{
		var stepObj = totalProcedures(i).all.tags("a");
				
		//testForJPG = (thisPage.substring(thisPage.lastIndexOf(".")) = ".jpg");
		//testForGIF = (thisPage.substring(thisPage.lastIndexOf(".")) = ".gif");
		
		for (var x=0 ;x<stepObj.length;x++)
		{
			var objStep = (stepObj(x).nxt);		
			
		   	if (stepObj(x).className=="JS_Reference_Button")
	    	{
				testForExt = (objStep.substring(objStep.lastIndexOf(".")));
				testForExtUpper = testForExt.toUpperCase();
				testForExtUpper=testForExtUpper.split("$");
				testForExtUpper=testForExtUpper[0];	
				
				if (testForExtUpper == ".JPG" || testForExtUpper == ".GIF")
				{
					imageTableString =  "<br style='page-break-after:always'>"	
										+"<table width='100%' border='0' cellspacing='1' cellpadding='1'>"
										//+"<tr><td align='center'>" + (document.title) + "</td></tr>"
										+"<tr><td align='center' height='40'><b>Step " + (i+1) + " Graphic</b></td></tr>"
										+"<tr><td align='center'><img src=" + stepObj(x).nxt + "></td></tr>"
										+"</table>"		
										//+"<br style='page-break-after:always'>"					
				
					parent.frames.mainFrame.document.body.insertAdjacentHTML("beforeEnd",imageTableString + "</table>");
				}
				
				if (testForExtUpper == ".HTM" || testForExtUpper == ".HTML")
				{
					/*** SPLIT THE HREF IN ORDER TO DROP THE $LAYER REFERENCE. THEN OPEN THE HTM FILE, IN A NEW WINDOW ***/
												
					var splitHTML = objStep.split("$");
					var getHTML = splitHTML[0];
					var getLayer = splitHTML[1];
					var newWind = window.open(getHTML, "subWindow", "status=1,menubar=1,height=10,width=10,left=2000,top=2000");
					var newWindSrc = newWind.document.getElementsByTagName("img");
					var newWindDiv = newWind.document.getElementsByTagName("div");
						
					/*** LOOP THROUGH ALL IMG TAGS IN HTM DOCUMENT. WHEN IMG TAG WITH NAME="MAINPIC" IS FOUND,
						 GET THE OUTERHTML FOR THAT IMG TAG AND PLACE INTO VARIABLE GETSRC ***/
						
					for (var x=0 ;x<newWindSrc.length;x++)
					{
						if (newWindSrc[x].name == "mainpic")
						{
							var getSrc = newWindSrc[x].outerHTML;
						}
					}						
												
					/*** LOOP THROUGH ALL DIV TAGS IN HTM DOCUMENT. WHEN DIV TAG WITH ID = $LAYER IS FOUND,
						 GET THE OUTERHTML FOR THAT DIV TAG AND PLACE INTO VARIABLE GETDIV.
						 THEN, IN THE VARIABLE GETDIV, REPLACE VISIBILITY:HIDDEN WITH VISIBILITY:VISIBLE.
						 IF THERE IS NO $ ATTACHED TO HTM LINK, RUN ELSE STATEMENT ***/
						
					if (getLayer != undefined)
					{
						for (var x=0 ;x<newWindDiv.length;x++)
						{
							if (newWindDiv[x].id == getLayer)
							{
								var getDiv = newWindDiv[x].outerHTML;											
								var srchText = /hidden/g;
								var replacement = "visible";
								var getDiv = getDiv.replace(srchText, replacement);											
							}
						}
					}
					else
					{									
						getDiv = ('&nbsp;');
					}
							
					newWind.close();
						
					imageTableString =  "<br style='page-break-after:always'>"	
					+"<table width='100%' border='0' cellspacing='1' cellpadding='1'>"
					+"<tr><td align='center' height='40'><b>Step " + (i+1) + " Graphic</b></td></tr>"
					+"</table>"
					+"<div style='position: relative; left: 0px; top: 0px; width:200px; height:200px; z-index: 1; vertical-align: middle; horizontal-align: center; visibility: visible'>"
					+"<div id='main' style='position: absolute; left: 0px; top: 0px; width:200px; height:200px; z-index: 1; vertical-align: middle; visibility: visible'>" 
					+"" + getSrc + ""
					+"" + getDiv + ""
					+"</div>"
					+"</div>"
											
					parent.frames.mainFrame.document.body.insertAdjacentHTML("beforeEnd",imageTableString + "</table>");
														
					}					
				}			
		}
	}	
	
	parent.frames.mainFrame.window.focus();
	parent.frames.mainFrame.window.print();
	
	if (document.getElementById("noPrintRefresh") == null)
	{
	 parent.top.location.reload();
	}
	else
	{	
	for (i=0;i<allSpans.length;i++)
	{	
		if (allSpans[i].className=="noteIcon")
		{
		 allSpans[i].style.visibility = "visible";
		}
	  }
	}
	
	printActive = 0;
	
} /***End Function***/



/******************************************************************************
 Function ClassExists is used to test for a class type.Calling script passes 
 type to check for, returns true if class exists, returns false if class does 
 not exist. Jimb 1-2-01
******************************************************************************/
function ClassExists(ClassType)
{
var allLinks = document.all.tags("a") 

   for (var i=0 ;i<allLinks.length;i++)
    if (allLinks(i).className==ClassType)
	    {
		   return true;
		}
		return false;
		
} /***End Function***/

/******************************************************************************
 Function is called from the bottomFrame 'back' button.  It is used to send
 the user back to a previous screen.
******************************************************************************/
function exit_Document(myCount)
{
	
	if (myCount == 2) // Back button
	{
		history.back();
		
		delete_cookie(document.location.pathname+"current_step");
	
		ValnextStep=1;
		write_cookie (document.location.pathname+"current_step", 2);
	
		theStep=2;
	}
	
	delete_cookie(document.location.pathname+"current_step");	
	
	if (myCount == 0) // Exit button
	{
		if (navigator.appName == "Microsoft Internet Explorer")
		{
			parent.close();return false;
		}
		else if (navigator.appName == "Netscape")
		{
			
			window.open(",'_parent',") 
			window.close();
			//alert("exit");
		}
		
	}	
	
	if (!cList || init==0)
		{
     	return false;
		}	  

} /***End Function***/

/******************************************************************************
 Function is called from the bottomFrame 'reset' button.  It is used to send
 the user back to the top of the screen and hide all except the first step.
******************************************************************************/
function reset_Document()
{
	delete_cookie(document.location.pathname+"current_step");

	ValnextStep=1;
	scrollReset();
	
	write_cookie (document.location.pathname+"current_step", 2);
		
	theStep=2;
	
if (!cList || init==0)
	{
     return false;
	}  
  contractAll();	
  setCommentScroll(theStep - 1);
} 

/***End Function***/

/******************************************************************************
fileNameFromURL(startString)
******************************************************************************/
function fileNameFromURL(startString)
{
		if (startString.lastIndexOf("/") != -1)
			return startString.substring(startString.lastIndexOf("/") + 1 ,startString.length)
		else
			return startString
			
} /***End Function***/

/******************************************************************************
write_storage
******************************************************************************/
function write_storage(oObj, sVal)
{
alert('write storage');
alert(oObj);

if (oObj != null)
   {
	oObj.setAttribute("XXPersistValue",sVal);
	oObj.save("XXXMLStore");
   }	 
   
} /***End Function***/

/******************************************************************************
read_storage
******************************************************************************/
function read_storage(oObj)
{
 
if (oObj != null)
   {
	oObj.load("XXXMLStore");
        var lVal = oObj.getAttribute("XXPersistValue");
	return lVal;
   }	
   
} /***End Function***/

/******************************************************************************
delete_storage
******************************************************************************/
function delete_storage(oObj)
{
if (oObj != null)
   {
	var oTimeNow = new Date(); // Start Time
    oTimeNow.setMinutes(oTimeNow.getMinutes() - 1);
    var sExpirationDate = oTimeNow.toUTCString();
	
    oObj.expires = sExpirationDate;
    write_storage(oObj, 0);		  
   }	
   
} /***End Function***/

//************************************************************************************
//this function is passed an href
//it then checks for the anchor tag # in a path (href)
//if an anchor tag # is found it is retruned, as follows: #anchor
//if no anchor tag # is found, null is returned
//jimb 1-03-01*************************************************************************

function GetAnchor(t)
{
	x=t.charAt(0);
	var i=0;
	while ((x != '#') && ( i < t.length))
	{
		i=i+1;
		x=t.charAt(i);
	}
	if (i == t.length)
	{
		//no anchor tag # found
		return null
	}
	else
	{
		var build = x=t.charAt(i);
		for (var j=i ;j<t.length;j++)
		{
			x=t.charAt(j+1);
			build=build + x;
		}
	return build;
	}
	
} /***End Function***/

/******************************************************************************
getURLfolder
******************************************************************************/
function getURLfolder(passURL)
{
	passURL_ = passURL;
	if ((passURL_.indexOf("file") != -1) || (passURL_.indexOf("http") == 0))
	{
		passURL_ = passURL_.substring(0,passURL_.lastIndexOf("/"));
		passURL_ = passURL_.substring(0,passURL_.lastIndexOf("/") + 1);
		return passURL_;
	}
	
    monikerCheck = passURL_.indexOf(":");
	
	if (monikerCheck == 2)
	{
		//mk:@MSITStore: compliled .CHM file uses backward slashes
		x = 14;
	}
	else
	{
		//ms-its: compiled .ITS file - code below will not work for ITS
		//x = 7;
		alert('Red Oak Msg: Unable to determine external file path');
		alert(passURL);
		return false
	};
	
	y = passURL_.lastIndexOf("\\") + 1;
	tempX = (passURL_.substring(x,y));	   
	tempX = tempX.split("\\");
	passURL_ = tempX[0];
	for (var i=1 ;i<tempX.length;i++)
	   {
		   passURL_ = passURL_ + "/" + tempX[i];
	   }
	
	if (passURL_.indexOf("%20") != -1)
	{
		alert(passURL_ + "  folder names with spaces are not supported, please rename your folder without spaces, drawings will not be found");
	}
	
	return passURL_;
	
} /***End Function***/

/******************************************************************************
This function extracts the values from the url
******************************************************************************/ 
function QueryString(key)
{
	var value = null;
	
	for (var i=0;i<QueryString.keys.length;i++)
	{
		if (QueryString.keys[i]==key)
		{
			value = QueryString.values[i];	
			
			break;
		}
	}
	
	return value;
	
} /***End Function***/

/******************************************************************************
This function extracts the variables passed in url query string
******************************************************************************/ 
function QueryString_Parse(newUrl)
{

QueryString.keys = new Array();
QueryString.values = new Array();

var pos2 = newUrl.indexOf('?');

    newUrl = newUrl.substring(pos2+1);
	
	var query = newUrl;
	
	var pairs = query.split("&");
	
	for (var i=0;i<pairs.length;i++)
	{
		var pos = pairs[i].indexOf('=');
	
		if (pos >= 0)
		{
			var argname = pairs[i].substring(0,pos);
			var value = pairs[i].substring(pos+1);
			QueryString.keys[QueryString.keys.length] = argname;
			QueryString.values[QueryString.values.length] = value;	
			
		}
	}

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a GIF or JPG file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doImage(newurl)
{
var thisBG = getBGColor();

rightframeTable = '<body leftmargin="0" topmargin="0" bgColor=' + thisBG + ' ' 
				+ ' scroll="no"> '
				+ ' <table id="holder" width="100%" height="100%" border="0" bordercolor="#000000" cellspacing="0" cellpadding="0" style="position:absolute; '
				+ '\')"> '
				+ ' <tr>'
				+ ' <td>'
				+ ' <div align="center" position="absolute"><img id="pic"'
				+ ' src="' 
				+ newurl 
				+ '"'+' border="0"><div>'
				+ ' </td>' 
				+ ' </tr>'
				+ ' </table>'
				+ ' </body>'
				+ ' </head> ';		

return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display an AVI, MPG, or WMV file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doVideo(newurl)
{

rightframeTable = '<head> \n'
				+ '<style type="text/css"> \n'
				+ '</style> \n'
		 		+ '</head> \n' 
		 		+ '<BODY leftmargin="0" topmargin="0" scroll="no"> \n'
				+ '<TABLE width="100%" height="100%" bgcolor="000000" border="0" align="center" cellpadding="0" cellspacing="0"> '
				+ '<TR> '
				+ '<TD> '
				+ '<div align="center"> '
				+ '<OBJECT ID = "MediaPlayer" STYLE = "width:' + sW + '; height:' + sH + '; MARGIN: 0; BORDER: 0; ' 
				+ 'classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://www.microsoft.com/Windows/MediaPlayer/"> \n '
				+ '<PARAM NAME = "FileName" ' + 'VALUE = "' +  newurl + '">  \n'
				+ '<PARAM NAME = "AUTOSTART" VALUE="true">  \n'
				+ '<PARAM NAME = "AUTOREWIND" VALUE="true">  \n'
				+ '<PARAM NAME = "SHOWDISPLAY" VALUE="false">  \n'
				+ '<PARAM NAME = "PLAYCOUNT" VALUE="true"> \n'
				+ '<PARAM NAME = "SHOWCONTROLS" VALUE="true"> \n'
				+ '<EMBED TYPE="application/x-mplayer2"  \n'
				+ 'SRC = "' + newurl + '" \n'
				//+ 'WIDTH = "100%" \n'
				//+ 'HEIGHT = "100%" \n'
				+ 'WIDTH=' + sW + ' \n'
				+ 'HEIGHT=' + sH + ' \n'
				+ 'AUTOSTART = "true" \n'
				+ 'AUTOREWIND = "false" \n'
				+ 'pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"  CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,0,0" \n'
				+ 'SHOWCONTROLS = "true"> \n'
				+ '</EMBED> \n'
		        + '</OBJECT> \n'
				+ '</div> '
				+ '</TD> '
				+ '</TR> '
				+ '</TABLE> '
				+ '</BODY>';

return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a DWF file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doDWF(newurl)
{
	//alert("");
rightframeTable = '<head> \n'
		 		
		 		+ '</head> \n' 
				+ '<body leftmargin="0" topmargin="0" \n' 
				+ ' marginwidth="0" marginheight="0" scroll="no"> \n' 
		        + '<table bgcolor="000000" border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> \n'
			 	+ '<tr> \n'
			 	+ '<td align="center"> \n'
			 	+ '<OBJECT id="AdView" align=baseline classid="clsid:A662DA7E-CCB7-4743-B71A-D817F6D575DF" TYPE="drawing/x-dwf" '
			 	+ 'codebase="../_ROKS_MasterFiles/ExpressViewerSetup.cab" '
			 	+ 'height=' + sH 
			 	+ ' width=' + sW 
			 	//+ ' width=' + 400
			 	+ ' border="0"> \n'
			 	+ '<param name="Src" value="' + newurl + '"> \n'
				+'</object> \n' 
			  	+'</td> \n'
			  	+ '</tr> \n'
			 	+'</table> \n'
				+ '</BODY>';	

return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a DWG or DXF file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doDWGDXF(newurl)
{

rightframeTable = '<body leftmargin="0" topmargin="0" \n' 
				+ ' marginwidth="0" marginheight="0" scroll="no"> \n' 
		        + '<table border="0" cellpadding="0" cellspacing="0" width="100%"> \n'
			  	+ '<tr> \n'
			  	+ '<td align="left" width="100%"> \n'
			  	+ '</td> \n'
			  	+ '</tr> \n'
			  	+ '</table> \n'
			 	+ '<table border="0" cellpadding="0" cellspacing="0" width="100%"> \n'
			 	+ '<tr> \n'
			 	+ '<td align="center"> \n'			 
				+ '<object id="Main" classid="clsid:8718C658-8956-11D2-BD21-0060B0A12A50" ' 
				+ 'width=' + sW 
				+ ' height=' + sH +'> '
				+ '<param name="src" value="' + newurl + '"> \n'			
				+ '</object> \n'
			  	+'</td> \n'
			  	+ '</tr> \n'
			 	+'</table> \n'
				+ '</BODY>';	

return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a DXF file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doDXF(newurl)
{


} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a SWF file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doSWF(newurl)
{

rightframeTable = '<head> \n'
		 		
		 		+ '</head> \n' 
		 		+'<body bgColor="696969" leftmargin="0" topmargin="0" \n' 
				+ ' marginwidth="0" marginheight="0" scroll="no"> \n' 		        
				+ '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> \n'
				+ '<tr> \n'
				+ '<td align="center"> \n'
				+ '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="mapcontrols" width=' + sW + ' height=' + sH + '> \n'
    			+ '<param name="movie" value="' + newurl + '"> \n'	
				+ '<embed src="' +  newurl + '" type="application/x-shockwave-flash" vspace="0" hspace="0" align="absbottom" name="mapcontrols"> \n'
				+ 'border="0" \n'
			 	+ 'userinterface="off"> \n' 
    			+ '</embed> \n'
  				+ '</object> \n'
			  	+'</td> \n'
			  	+ '</tr> \n'
			 	+'</table> \n'
				+ '</BODY>';	

return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a DWF file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doDOC(newurl)
{
rightframeTable = '<head> \n'
		 		
		 		+ '</head> \n' 
				+ '<body leftmargin="0" topmargin="0" \n' 
				+ ' marginwidth="0" marginheight="0" scroll="no"> \n' 
		        + '<table bgcolor="000000" border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> \n'
			 	+ '<tr> \n'
			 	+ '<td align="center"> \n'
			 	+ '<OBJECT id="test" align=baseline classid="CLSID:0002E510-0000-0000-C000-000000000046" '
			 	//+ 'codebase="../_ROKS_MasterFiles/ExpressViewerSetup.cab" '
			 	+ 'height=' + sH 
			 	+ ' width=' + sW 
			 	//+ ' width=' + 400
			 	+ ' border="0"> \n'
			 	+ '<param name="Src" value="' + newurl + '"> \n'
				+'</object> \n' 
			  	+'</td> \n'
			  	+ '</tr> \n'
			 	+'</table> \n'
				+ '</BODY>';	

return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a DCR file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doDCR(newurl)
{	
//alert("");	
rightframeTable = '<head> \n'
			+ '<script language="VBScript"> \n'
			+ 'sub MovieName_ExternalEvent(aCommand) \n'
			+ 'call escapeMovie() \n'
			+ 'End Sub \n'
			+ '</s' + 'cript> \n'
			+ '<SCRIPT LANGUAGE="JavaScript">  \n'
			+ 'function escapeMovie() \n'
			+ '{ \n'
			+ 'parent.frames.bottomFrame.goBack() \n'
			+ '} \n'
			+ '</s' + 'cript> \n'
			+ '<link rel="stylesheet" href="../StyleSheets/RedOakStyleSheet.css"> \n'
			+ '</head> \n' 
			+ '<body bgColor="CCCCCC" leftmargin="0" topmargin="0" \n' 
			+ ' marginwidth="0" marginheight="0" scroll="no"> \n'   
			//+ '<br> \n'
			+ '<table border="0" cellpadding="0" cellspacing="0" width="100%"> \n'
			+ '<tr> \n'
			+ '<td> \n'
			+ '<div align="center"><img src="../Graphics_Misc/Bullet_Diamond1.gif" width="12" height="12">&nbsp;&nbsp; \n'
			+ '<a href="#" onClick="javascript:history.back()" \n'
			+ 'class="RO_Command_Button_Red">Click here to exit the Animation</a></div> \n'
			+ '</td> \n'
			+ '</tr> \n'
			+ '<tr> \n'
			+ '<td> &nbsp;\n'
			+ '</td> \n'
			+ '</tr> \n'
			+ '<tr> \n'
			+ '<td align="center" valign="middle"> \n'
			+ '<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" name="MovieName" width="' + sW + '" height="' + sH + '"> \n'
			+ '<param name="src" value="' + newurl + '" > \n'	
			+ '<embed src="' +  newurl + '" type="application/x-director" name="MovieName" width="' + sW + '" height="' + sH + '"> \n'
			+ '</embed> \n'
  			+ '</object> \n'
			+' </td> \n'
			+ '</tr> \n'
			+' </table> \n'
			+ '</BODY>';
		
return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will will check the user's computer to determine whether
 Shockwave Player is installed
******************************************************************************/ 
function checkForShockWave()
{

} /***End Function***/

/******************************************************************************
 This function will write the HTML to display a PDF file. This is called
 from openpic and opennew. This is also called from displaydrawing function
******************************************************************************/ 
function doPDF(newurl)
{

rightframeTable =  '<head> \n'
				+ '<style type="text/css"> \n'
				+ 'body \n' 
				+ '{ \n'
				//+ 'background-image: url(../Graphics_Misc/broken_link.jpg); \n'
				+ '} \n'
				+ '</style> \n'
				+ '</head> \n' 
		 		+ '<body leftmargin="0" topmargin="0" \n' 
				+ ' marginwidth="0" marginheight="0" scroll="no" > \n'       
				+ '<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%"> \n'
			  	+ '<tr> \n'
				+ '<td align="center" valign="middle"> \n'
				+ '<param name="src" value="' + newurl + '" > \n'
				+ '<embed src="' +  newurl + '" type="application/pdf" name="PDF" width="' + sW + '" height="' + sH + '"> \n'
				+ '<noembed> \n'
				//+ '<img src="../Graphics_Misc/broken_link.jpg" width="510" height="680"> \n'
				+ '</noembed> \n'
				+ '</embed> \n'
  				+ '</object> \n'
				+'</td> \n'
			  	+ '</tr> \n'
			 	+'</table> \n'
				+ '</BODY>';		
				
return rightframeTable;

} /***End Function***/

/******************************************************************************
 This function will look in the META Display Properties to determine
 the assigned Background Color for the Right Frame. If the value is null,
 the default Background Color will be Black '000000'.
******************************************************************************/ 
function getBGColor()
{
	getMETAData();
	var getBG = dispProp[12];

	if (getBG == '' || getBG == undefined) 
		{
			getBG = '000000';
		}

	return getBG;

} /***End Function***/

/******************************************************************************
 This function will accept a URL or jpg and load it in the right frame when the
 red reference button is clicked. This new URL or jpg will replace the old one 
 and will not be added to the history list. If no right frame exists, this call
 will be ignored.
******************************************************************************/ 
function openNew(newurl,sTarget,bFull)
{
//alert("openNew " + newurl);
var newExtCase = newurl.substring(newurl.lastIndexOf("."));
newExtCase = newExtCase.toLowerCase();
 
	testForFileType = (newExtCase != ".htm" && newExtCase != ".swf" && newExtCase != ".wmv" && newExtCase != ".dwf" 
					&& newExtCase != ".dxf" && newExtCase != ".dwg" && newExtCase != ".dcr" && newExtCase != ".avi"
					&& newExtCase != ".pdf" && newExtCase != ".mpg" && newExtCase != ".doc");     
   
 	if (parent.frames.rightFrame && testForFileType != false 
   						&& newurl.indexOf("#") < 0 
						&& newurl.indexOf("$") < 0 
						&& newurl.indexOf("?") < 0)
       {
	    
	    var rightFrameDoc = parent.frames.rightFrame
		var mySize=0
		var vAuto = "no"		
		
		var rightframeTable = doImage(newurl);
								
		rightFrameDoc.document.open("text/html","replace");
		rightFrameDoc.document.write(rightframeTable);
		rightFrameDoc.document.close();		
				
		if (SplitToFull == true)
			{
			parent.framer3.cols="*,100%";
			parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/link_fullscreen.htm");
			}							
	   }  
	   
    else
	   {		   
	   	if  (newurl.indexOf('?') > 0)
	      	{ 			
		  	var pos2 = newurl.indexOf('?')
            var extensionChoice = newurl.substring(pos2,newurl.lastIndexOf("."))
			extensionChoice = extensionChoice.toLowerCase(); 
			}
		else
			{
			var extensionChoice = newurl.substring(newurl.lastIndexOf("."))
			extensionChoice = extensionChoice.toLowerCase();			
	        }			
			
	switch(extensionChoice)
		
		{	    
		case ".wmv":
		case ".avi":
		case ".mpg":
	   	 
			var rightFrameDoc = parent.frames.rightFrame
			var mySize=0
				
			var searchStr = "%20";
			var replaceStr = " ";
			var re = new RegExp(searchStr , "g");
			var newurl = newurl.replace(re, replaceStr);
			
			QueryString_Parse(newurl); 
		
			if (newurl.indexOf('?') > 0)
				{					
				newurl = newurl.substring(0,newurl.indexOf('?'));   
				sW = QueryString("width");
				sH = QueryString("height");
				}
			else
				{
				sW = "500";
				sH = "375";				
				}
			
			var rightframeTable = doVideo(newurl);			
								
	   		rightFrameDoc.document.open("text/html","replace");		
			rightFrameDoc.document.write(rightframeTable);
	 		rightFrameDoc.document.close();	
		
			if (SplitToFull == true)
				{
				parent.framer3.cols="*,100%";
				parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm");
				}		
		 		 
	 		return false;
   			break		
			
		
		case ".dwf":	
			
			if (SplitToFull == true)
				{
				var getFramer3 = parent.document.getElementById("framer3");	
				//parent.framer3.cols="*,100%";
				getFramer3.cols="*,100%";
				parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm");
				}			
		
			rightFrameDoc = parent.frames.rightFrame
			
			sH = rightFrameDoc.document.body.clientHeight;
	    	sW = rightFrameDoc.document.body.clientWidth;				
					
			var searchStr = "%20";
			var replaceStr = " ";
			var re = new RegExp(searchStr , "g");
			var newurl = newurl.replace(re, replaceStr);
		
			var newurlX = newurl.substr(0,8);
		
			if (newurlX == "file:///")
				{
				newurl = newurl.substr(8,500);			
				}			
					
	    	var rightframeTable = doDWF(newurl);		
	
			rightFrameDoc = parent.frames.rightFrame;
			rightFrameDoc.document.open("text/html","replace");	  
			rightFrameDoc.document.write(rightframeTable); 
			rightFrameDoc.document.close();				
		 
			return false;
   			break		
					
		
		case ".swf":	
		
			if (SplitToFull == true)
				{
				//parent.framer1.rows="0,*"; // No Top Bar //
				//parent.framer2.rows="*,0"; // No Bottom Bar //
				parent.framer3.cols="*,100%";
				parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm");
				}	
		
			QueryString_Parse(newurl); 
		
			if (newurl.indexOf('?') > 0)
				{					
				newurl = newurl.substring(0,newurl.indexOf('?'));   
				sW = QueryString("width");
				sH = QueryString("height");
				}
			else
				{
				sW = "800";
				sH = "600";				
				}				
				
	  		var rightframeTable = doSWF(newurl);							
	
			rightFrameDoc = parent.frames.rightFrame
			rightFrameDoc.document.open("text/html","replace");	  
			rightFrameDoc.document.write(rightframeTable);
	 		rightFrameDoc.document.close();	
				 
			return false;
   			break
		
		
		case ".dcr":	
		
			if (SplitToFull == true)
				{
				var getFramer1 = parent.document.getElementById("framer1");
				var getFramer2 = parent.document.getElementById("framer2");
				var getFramer3 = parent.document.getElementById("framer3");				
					//parent.frames.framer1.rows="0,*";  // No Top Bar 
				getFramer1.rows="0,*";  // No Top Bar
					//parent.frames.framer2.rows="*,0";  // No Bottom Bar 
				getFramer2.rows="*,0";  // No Bottom Bar
					//parent.frames.framer3.cols="*,100%";
				getFramer3.cols="*,100%";
				parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm");				
				}	
		
			rightFrameDoc = parent.frames.rightFrame;
			
			QueryString_Parse(newurl); 
		
			if (newurl.indexOf('?') > 0)
				{					
				newurl = newurl.substring(0,newurl.indexOf('?'));   
				sW = QueryString("width");
				sH = QueryString("height");
				}
			else
				{
				sW = "800";
				sH = "600";				
				}
					
	    	var rightframeTable = doDCR(newurl);				
			rightFrameDoc = parent.frames.rightFrame
			rightFrameDoc.document.open("text/html","replace");	  
			rightFrameDoc.document.write(rightframeTable);
	 		rightFrameDoc.document.close();		
				 
			return false;
   			break
			
		
		case ".doc":	
		
			if (SplitToFull == true)
				{
				parent.framer3.cols="*,100%";
				parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm");
				}	
		
			rightFrameDoc = parent.frames.rightFrame
			sH = rightFrameDoc.document.body.clientHeight;
	    	sW = rightFrameDoc.document.body.clientWidth;					
			
			var rightframeTable = doDOC(newurl);	
			
			rightFrameDoc = parent.frames.rightFrame
		 	rightFrameDoc.document.open("text/html","replace");	
			rightFrameDoc.document.write(rightframeTable);
			rightFrameDoc.document.close();		
					
			return false;
   			break
			
		
		case ".pdf":	
		
			if (SplitToFull == true)
				{
				parent.framer3.cols="*,100%";
				parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm");
				}	
		
			rightFrameDoc = parent.frames.rightFrame
			sH = rightFrameDoc.document.body.clientHeight;
	    	sW = rightFrameDoc.document.body.clientWidth;					
			
			var rightframeTable = doPDF(newurl);	
			
			rightFrameDoc = parent.frames.rightFrame
		 	rightFrameDoc.document.open("text/html","replace");	
			rightFrameDoc.document.write(rightframeTable);
			rightFrameDoc.document.close();		
					
			return false;
   			break
		
		
		case ".htm":	
	   
	   }	   	   
	   
	   if (newurl.indexOf("#") > 0 )
	    {
	   		splitURL=newurl.split("#");
			ob = parent.frames.rightFrame.window.document.getElementsByName(splitURL[1]);
            ob(0).scrollIntoView();
		}
		else
		{			
			splitURL=newurl.split("$");		//look for $ for exposeHighliteLayer()
			write_cookie ("displayLayer", newurl); 
			parent.frames.rightFrame.window.location.replace(splitURL[0]); 
			return false; 			
		}			
	}
	
} /***End Function***/

/******************************************************************************
 This function must be called at the bottom of an htm file with layers to expose.
 The click event from the procedure uses openNew to write a cookie saving the 
 target layer id.  the target id in the procudure must use an $ deliminator between
 the file and the layer name.
 
 This function reads the cookie "displayLayer".  
 
 if the cookie returns undefined, then this will point to a layer with the id="main"
******************************************************************************/ 
function exposeHighliteLayer()
{
if (parent.frames.rightFrame)
{		
		var rightFrameDoc = parent.frames.rightFrame;
		
		if (rightFrameDoc.document.getElementById("main") == null) {return false;}
		LayerToShow = read_cookie ("displayLayer");
				
		if (LayerToShow == null) {return false;}
	
		LayerToShow = LayerToShow.split("$");
			
		if (escape(LayerToShow[1]) == "undefined")
		{
			collObjects = parent.frames.rightFrame.document.getElementsByName("main");
			showLayer (collObjects);
		}
		else
		{
			for (i=1;i<LayerToShow.length;i++)
			{
				collObjects = parent.frames.rightFrame.document.getElementsByName(LayerToShow[i]);
				if (escape(collObjects[0]) == "undefined") {alert ("layer " + LayerToShow[i] + " does not exist, check your link.");return false;}
				showLayer (collObjects);
			}
		}
}

} /***End Function***/

/******************************************************************************
 showLayer
******************************************************************************/ 
function showLayer (collObjects)
{
		var rightFrameDoc = parent.frames.rightFrame;
		var myHeight=0;
		var myWidth=0;
			
		if (SplitToFull == true && thisCount == 0)
			{
			thisCount = 1;
			parent.framer3.cols="*,100%"; 
			parent.frames.mainFrame.document.open("../_ROKS_MasterFiles/splitscreen_clicknext_right.htm"); 
			}			
		
		windowHeight = rightFrameDoc.document.body.clientHeight ;
	   	windowWidth = rightFrameDoc.document.body.clientWidth ;
		mainLayer= rightFrameDoc.document.getElementsByName("main");
		mainPic= rightFrameDoc.document.getElementsByName("mainpic");
				
		if (windowHeight > mainPic(0).height)
		{
			mainLayer(0).style.top = (windowHeight - mainPic(0).height) / 2;
		}
		else
		{			
			if (!autoCenter)
			{
				mainLayer(0).style.top = 0;
			}
			else
			{
				if (((windowHeight - parseInt(collObjects(0).style.height)) / 2) < parseInt(collObjects(0).style.top))
				{			
					mainLayer(0).style.top = ((windowHeight - parseInt(collObjects(0).style.height)) / 2) - parseInt(collObjects(0).style.top);
				}
				else
				{
					//mainLayer(0).style.top = - parseInt(collObjects(0).style.top);
					mainLayer(0).style.top = 0;
				} 
			}
		}
		
		if (windowWidth > mainPic(0).width)
		{
			mainLayer(0).style.left = (windowWidth - mainPic(0).width) / 2;			
		}
		else
		{
			
			if (!autoCenter)
			{
				mainLayer(0).style.left = 0;
			}
			else
			{
				if (((windowWidth - parseInt(collObjects(0).style.width)) / 2) < parseInt(collObjects(0).style.left))
				{
					mainLayer(0).style.left = ((windowWidth - parseInt(collObjects(0).style.width)) / 2) - parseInt(collObjects(0).style.left);
				}
				else
				{
					mainLayer(0).style.left = 0;
				}
			}
		}
		
		collObjects(0).style.visibility='visible';
		mainLayer(0).style.visibility='visible';
		delete_cookie ("displayLayer");
		return false;
	 
} /***End Function***/

/******************************************************************************
verifyTitle
******************************************************************************/ 
function verifyTitle(sTitle)
{

	var w = parent.frames.mainFrame.document.body.clientWidth -65	
		
		var fakeTitle = '<body bgcolor="#003399" text="#000000" leftmargin="0" topmargin="0" scroll="no">'
				  + '<table valign="top" id="tBar"  width="100%" height="25" border="0" cellpadding="6" cellspacing="0" bgcolor="#003399" nowrap> '
				  + '<tr >'
              	  + '<td width="' + w + '" bgcolor="#003399" bordercolor="#003399" nowrap>'
				  + '<font style="font-family: Arial; font-size: 13px; text-decoration: none; color: #FFFFFF">' 
				  + sTitle + '</td>'
  				  + '<td  width="65" height="25" align="center" valign="top" bgcolor="#003399"  nowrap><font id = "stepCounter" '
				  + 'style="font-family: Arial; font-size: 13px; text-decoration: none; color: #FFFF00">'
				  + '</td>'
				  + '</tr>'
				  + '</table>' 
				  + '</body>'								
   
   getMETAData()
   
  frameStyle = dispProp[0]
  titleFramevisible = eval(dispProp[1])
     	
   if (frameStyle != null)
     {
      sframeVal = frameStyle
     }
	  
  if (titleFramevisible != null)
	{
   if (titleFramevisible)
	 {
  		parent.frames.titleFrame.document.write(fakeTitle);
	 }	
	}

} /***End Function***/

/******************************************************************************
savePosition
******************************************************************************/
function savePosition()
{
	
	//write_cookie (fileNameFromURL(document.location.href)+"exit_scrollTop", document.body.scrollTop);
	write_cookie (fileNameFromURL(document.location.href)+"exit_scrollTop", document.documentElement.scrollTop);

} /***End Function***/

/******************************************************************************
attachUnload
******************************************************************************/
function attachUnload()
{
	window.attachEvent("onbeforeunload", savePosition);

} /***End Function***/

/******************************************************************************
displayDrawing
******************************************************************************/
function displayDrawing(paramx)
{
	newurl = unescape(paramx.nxt);
   
	if  (newurl.indexOf('?') > 0)
	   	{ 
	  	var pos2 = newurl.indexOf('?')
        var extensionChoice = newurl.substring(pos2,newurl.lastIndexOf("."))
		extensionChoice = extensionChoice.toLowerCase();
		}
	else
		{
		var extensionChoice = newurl.substring(newurl.lastIndexOf("."))
		extensionChoice = extensionChoice.toLowerCase();
	    }
			
	switch(extensionChoice)
		{
	   
		case ".wmv":
		case ".avi":
		case ".mpg":
	   	 
			var searchStr = "%20";
			var replaceStr = " ";
			var re = new RegExp(searchStr , "g");
			var newurl = newurl.replace(re, replaceStr);
			
			QueryString_Parse(newurl); 
		
			if (newurl.indexOf('?') > 0)
				{					
				newurl = newurl.substring(0,newurl.indexOf('?'));   
				sW = QueryString("width");
				sH = QueryString("height");
				}
			else
				{
				sW = "500";
				sH = "375";				
				}
		
	    	var rightframeTable = doVideo(newurl);
				
			var loadg = '<div id="loadMess" class="RO_Menu_Header" z-index:290">Loading...Please Wait.</div>'
			win2 = open('','title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=0,titlebar=no, width=840, height=660 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-360) );
	    	
			win2.document.write(rightframeTable);
			win2.document.write(loadg);
			win2.document.close();	
			win2.document.focus();			
		
	 		return false;
   			break
			
		
		case ".dwf":	
		
			sH = '600'
	    	sW = '800'
		
			var searchStr = "%20";
			var replaceStr = " ";
			var re = new RegExp(searchStr , "g");
			var newurl = newurl.replace(re, replaceStr);
		
			var newurlX = newurl.substr(0,8);
		
			if (newurlX == "file:///")
				{
				newurl = newurl.substr(8,500);
				}			
		
			var rightframeTable = doDWF(newurl);		
		
			win2 = open('','title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=0,titlebar=no, width=840, height=660 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-360) );
	    	win2.document.write(rightframeTable);
			win2.document.close();	
			win2.document.focus();		 
		
			return false;
   			break		
				

		case ".swf":
    
			QueryString_Parse(newurl); 
		
			if (newurl.indexOf('?') > 0)
				{					
				newurl = newurl.substring(0,newurl.indexOf('?'));   
				sW = QueryString("width");
				sH = QueryString("height");
				}
			else
				{
				sW = "800";
				sH = "600";				
				}			
	
			var rightframeTable = doSWF(newurl);    
	
	   		win2 = open('','title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=0,titlebar=no, width=840, height=660 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-360) );
	    	win2.document.write(rightframeTable);
	   		win2.document.close();	
			win2.document.focus();	
		
			return false;
   			break
			
		
		case ".dcr":
    
			QueryString_Parse(newurl); 
		
			if (newurl.indexOf('?') > 0)
				{					
				newurl = newurl.substring(0,newurl.indexOf('?'));   
				sW = QueryString("width");
				sH = QueryString("height");
				}
			else
				{
				sW = "800";
				sH = "600";				
				}			
	
			var rightframeTable = doDCR(newurl);    
	
	    	win2 = open('','title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=0,titlebar=no, width=840, height=660 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-360) );
	    	win2.document.write(rightframeTable);
	    	win2.document.close();	
			win2.document.focus();	
		
			return false;
   			break		
		
		
		case ".jpg":
		case ".gif": 	
	    
			var rightframeTable = doImage(newurl); 
	    
			win2 = open('','title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=1,titlebar=no, width=840, height=700 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-380) );
	    	win2.document.write(rightframeTable);
			win2.document.close();	
			win2.document.focus();	
		
			return false;
   			break
			

		case ".pdf":		
		
			sH = '600'
			sW = '800'
		
			var rightframeTable = doPDF(newurl);    		
		
			win2 = open('','title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=0,titlebar=no, width=840, height=660 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-360) );
	    	win2.document.write(rightframeTable);
	    	win2.document.close();	
			win2.document.focus();	
		
			return false;
   			break
		
		
		case ".htm":	
		
	 	  }	 
	   		
			win2 = document.open(newurl,'title', 'resizable=1 toolbar=0,location=0,status=0,menubar=0,scrollbars=1,titlebar=no, width=840, height=660 left='+ ((window.screen.width/2)-420) +' top=' + ((window.screen.height/2)-360) );
	    	win2.document.focus();	
			
	   		/** if (newurl.indexOf("#") > 0 )
	    		{
	   			splitURL=newurl.split("#");
				ob = parent.frames.rightFrame.window.document.getElementsByName(splitURL[1]);
            	ob(0).scrollIntoView();
				}
			else
				{
				splitURL=newurl.split("$");		//look for $ for exposeHighliteLayer()
				write_cookie ("displayLayer", newurl); 
				parent.frames.rightFrame.window.location.replace(splitURL[0]); 
				return false;
				} **/	
		 
} /***End Function***/

/******************************************************************************
I moved this function from Note.js. I want to remove Note.js completely from the
JavaScripts folder. This function is not being referenced anymore because I
has to switch to another search function. But I am not sure yet how to edit the bottom
control bar so that I dont get error related to this function.
******************************************************************************/ 
function getLastSearch()
{
sSearch=read_cookie('lastSearch');
if (sSearch != null) 
	{
	//write_cookie('lastHighlight',sSearch);
	return sSearch;
	}
	
}  /***End Function***/

/******************************************************************************
/* OWLWATCH-7-12-2005
 *  added this picResize function to test if there is an image in the right hand frame,
 *  this will test the size of the picture and the frame and resize accordingly. 
******************************************************************************/ 
function picResize()
{
  if(parent.frames.rightFrame && picResizeEnable == true)
  {
   
    var pic = parent.frames.rightFrame.document.getElementById('pic');
    
    if(pic)
	{ 
		
      if(!IsImageOk(pic))
	  {
	    setTimeout("picResize()", 20)
        return false;
      }	  
	 
      frame_h = parent.frames.rightFrame.document.body.clientHeight;
      frame_w = parent.frames.rightFrame.document.body.clientWidth;
      pic_h = pic.height;
      pic_w = pic.width;		
     
	  if(!pic.init)
	  //alert(pic);
	  //if(pic.init)
	  {
        pic.orig_h = pic_h;
        pic.orig_w = pic_w;
        pic.resize= true; // Set to true when you want right frame image to be resized by default.
		//pic.resize = false; // Set to false when you want right frame image to be full size by default 
        pic.holder = pic.parentNode;
        pic.style.cursor="pointer";
		
        pic.onclick=function()
		{
		//alert("click on image");
          this.resize = !this.resize;
		  
          if(!this.resize)
		  {
            pic.width=pic.orig_w;
            pic.height=pic.orig_h;
            this.holder.style.position='relative';
            this.holder.style.overflow='auto';
            this.holder.style.width=parent.frames.rightFrame.document.body.clientWidth;
            this.holder.style.height=parent.frames.rightFrame.document.body.clientHeight;
          }
          else
		  {
            this.holder.style.overflow='hidden';
            this.holder.style.width="100%";
            this.holder.style.height="100%";
          }
		  
          picResize();
		   
        } ///// End of pic.onclick
		
        pic.init = true;
		//pic.init = false;
		
      } ///// End of if(!pic.init)
	  
      var b = parent.frames.rightFrame.document.body;
      pic.holder.style.width=b.clientWidth;
      pic.holder.style.height=b.clientHeight > pic.orig_h ? pic.orig_h : b.clientHeight;
	  
      if(!pic.resize)
	  {
	  //alert();
        return false;
      }
      else
	  {
	  
      //}
      //window.status="frame_h = "+frame_h+" frame_w="+frame_w+" pic.orig_h="+pic.orig_h+" pic.orig_w="+pic.orig_w;
	  
      if(frame_h < pic.orig_h || frame_w < pic.orig_w)
	  {
        h_dif = pic.orig_h - frame_h;
        w_dif = pic.orig_w - frame_w;
      
	    if(h_dif > w_dif)
		{
          pic.height = frame_h;
          pic.width = frame_h / pic.orig_h * pic.orig_w;
        }
        else
		{
          pic.width = frame_w;
          pic.height = frame_w / pic.orig_w * pic.orig_h;
        }
      }
      else
	  {
        pic.width = pic.orig_w;
        pic.height = pic.orig_h;
      }
	  
      pic.holder.style.height=pic.height;
	  
      } ///// End of if(frame_h < pic.orig_h || frame_w < pic.orig_w)
  
    } ///// End of if(pic)
      
  } ///// End of if (parent.frames.rightFrame)

} ///// End of Procedure


window.onresize=function()
{
  picResize();
}

function IsImageOk(img)
{
    // During the onload event, IE correctly identifies any images
    // that weren't downloaded as not complete. Others should too.
    // Gecko-based browsers act like NS4 in that they report this
    // incorrectly: they always return true.
    if (!img.complete)
        return false;

    // However, they do have two very useful properties: naturalWidth
    // and naturalHeight. These give the true size of the image. If
    // it failed to load, either of these should be zero.
    if (typeof img.naturalWidth != "undefined" && img.naturalWidth == 0)
        return false;

    // No other way of checking: assume it's ok.
    return true;
}

/******************************************************************************
/******************************************************************************
/ START NOTES FUNCIONS 
/******************************************************************************
/******************************************************************************

/******************************************************************************
populateNotes() This function is called after the Frame Builder functions at top of this file.
				This function will pass the Querystring to NotePopulateFrame.asp 
				This function only runs when project is run through web server and when
				there is a Control Bar selected for the page.
******************************************************************************/ 
function populateNotes()
{    

	getMETAData();
	No_Bottom_Controlbar = eval(dispProp[5])
	//alert(No_Bottom_Controlbar);
	
	if (location.href.substr(0,7) != "file://" & No_Bottom_Controlbar == false)
	{
		
		var hrefLast = escape(location.href.substring(location.href.lastIndexOf("\/"),location.href.length));
		var hrefFirst = location.href.split("\/"); 
		var hrefFirst = hrefFirst[hrefFirst.length-2];	
		//var newHref = "../" + hrefFirst + hrefLast;
		var newHref = hrefFirst + hrefLast;
			
		var checkPathLevel = document.getElementsByTagName("LINK")
		var findSlashes = checkPathLevel(0).href.lastIndexOf("StyleSheets");
		var sPrefix = checkPathLevel(0).href.substring(0,findSlashes);
		
		newHref = sPrefix + newHref;
		//alert("looking for findslashes value " + findSlashes);
		parent.frames.bottomFrame.notepopulateframe.document.location.replace("../_Controlbar_bottom/notepopulateframe.asp?dbHref=" +  (newHref)); 
	}


} /***End Function***/


/******************************************************************************
displayNewCommentIcon() -- This values from an array in the function updateNote()
of "Note_Add.htm" are passed into this function. The values from the array are extracted and then
passed to NoteManageFrame.asp as a querystring.
******************************************************************************/ 
function displayNewCommentIcon()
{

var newQueryString  = ""

	//NoteList[6] = (window.event.clientX-20 );
	//NoteList[7] = (window.event.clientY + document.body.scrollTop)-(20 + titleBarHeight);
	//NoteList[6] = getXPos;
	//NoteList[7] = 2;	

	newQueryString = "Name=" + NoteList[0] + "&" 
				   + "Date=" + NoteList[1] + "&" 
				   + "Note=" + NoteList[2] + "&" 
				   + "Page=" + NoteList[3] + "&" 
				   + "Time=" + NoteList[4] + "&" 
				   + "Title=" + NoteList[5] + "&"
				   //+ "Xpos=" + NoteList[6] + "&"
				   //+ "Ypos=" + NoteList[7] ;  
		
	if (newCommentID != 0 && readyForComment == 1)
	{
      readyForComment = 0;
		//if (currentVisibleHeight() < window.event.offsetY && cList)
		//{
			//alert('Cannot place note there.  Try again.');
			//readyForComment = 1;
		//}
		//else
		//{
		
            //window.event.srcElement.focus();
			//alert(newQueryString);
			parent.frames.bottomFrame.notemanageframe.document.location.replace("../_Controlbar_bottom/notemanageframe.asp?" +  unescape(newQueryString));
			
			newCommentID = 0
			//refreshCommentIcons();
			
			document.body.style.cursor = "default"
			
			if (oModal != null)
				{
				  oModal.close();				
				}
			
		  //}
	}

} /***End Function***/


function displayNewCommentIconPost()
{

		
	if (newCommentID != 0 && readyForComment == 1)
	{
		readyForComment = 0;
		
		// refresh main window		
		parent.location.href = parent.location.href;
		//parent.frames.bottomFrame.noteaddpostframe.document.location.replace("../_Notes_Function/note_add_post.asp");
		newCommentID = 0
					
		document.body.style.cursor = "default"
			
		if (oModal != null)
			{
			  oModal.close();				
			}		
	}

} /***End Function***/
/******************************************************************************
NoteDelete() -- This function is called from the deleteNote() function from Note_Display.htm
******************************************************************************/ 
function NoteDelete(NoteID)
{
//alert("Note Delete in Redoak.js" + NoteID); 

var newQueryString  = ""

	newQueryString = "NoteID=" + NoteID;
	//window.event.srcElement.focus();
	parent.frames.bottomFrame.notemanageframe.document.location.replace("../_Controlbar_bottom/notemanageframe.asp?" +  unescape(newQueryString));  
	parent.top.location.reload();
	//oModal.close();
//return false;

}  /***End Function***/

/******************************************************************************
NoteEdit() -- This function is called from the editNote() function from Note_Display.htm
******************************************************************************/ 
function NoteEdit(NoteID, fdNote)
{
//alert("Note Delete in Redoak.js" + NoteID); 

var newQueryString  = ""

	newQueryString = "noteEditID=" + NoteID + "&" 
				   + "noteEdit=" + fdNote;
	//alert(newQueryString);
	//window.event.srcElement.focus();
	/*
	- Remove unescape function that unescape newQueryString
	*/
	parent.frames.bottomFrame.notemanageframe.document.location.replace("../_Controlbar_bottom/notemanageframe.asp?" +  newQueryString);  
	parent.top.location.reload();
	//oModal.close();
	//return false;

}  /***End Function***/

/******************************************************************************
addNewComment()
******************************************************************************/ 
function addNewComment()
{

	// Adding a N in front of the Comment ID passed to the add comment window
	// will interpret the comment as a 'new' comment and begin in add mode
	displayComment("N");
	newCommentID = parseInt(FindCommentCounter()) + 1;
	//alert("newcommentID = " + newCommentID);
	
} /***End Function***/

/******************************************************************************
FindCommentCounter()
******************************************************************************/ 
function FindCommentCounter()
{

	strCookie = document.cookie
	
	arrayCookies = strCookie.split(';')
	 
	for (i=0;i<arrayCookies.length;i++)
	{
		cookieField=arrayCookies[i].split("=")
		if (cookieField[0].indexOf("CCID") != -1)
		{
			return cookieField[1]
		}
	}
	newCookie = "CCID=0;expires=Thursday, 31-Dec-20 12:00:00 GMT;"
	document.cookie = newCookie;
	return 0;	
	
} /***End Function***/

/******************************************************************************
displayComment(commentID) -- This function is run when adding a note (Note_Add.htm is launched)
and when viewing a note (Note_Display.htm is launched). 
******************************************************************************/
function displayComment(commentID,sName,sDate,sComment)
{

    var sUserName="temp";  
	viewComment = 1;
	
	newCookie = "CWStatus=1;expires=Thursday, 31-Dec-20 12:00:00 GMT;"
	
	document.cookie = newCookie;
	
	if (commentID == "N")
	{
	
		var hrefLast = escape(location.href.substring(location.href.lastIndexOf("\/"),location.href.length));
		var hrefFirst = location.href.split("\/"); 
		var hrefFirst = hrefFirst[hrefFirst.length-2];		
		//var newHref = "../" + hrefFirst + hrefLast;
		var newHref = hrefFirst + hrefLast;
		
		var checkPathLevel = document.getElementsByTagName("LINK")
		var findSlashes = checkPathLevel(0).href.lastIndexOf("StyleSheets");
		var sPrefix = checkPathLevel(0).href.substring(0,findSlashes);
		
		newHref = sPrefix + newHref;
	
	var lVariables = new Array()
	
	lVariables[0] = window 
	lVariables[1] = "?"
	lVariables[2] = commentID
	lVariables[3] = "&"
	//lVariables[4] = document.location.href
	lVariables[4] = newHref
	lVariables[5] = document.title
	
	//var notesBox = sPrefix + '_Notes_Function/Note_Add.htm';
	var notesBox = sPrefix + '_Notes_Function/NoteAddFrame.htm';
	
	  //oModal = window.showModelessDialog("../_Notes_Function/Note_Add.htm",lVariables , "dialogHeight: 465px; dialogWidth: 465px;  center: Yes; scroll: No; help: No; resizable: No; status: No; unadorned: yes;");
	  oModal = window.showModelessDialog(notesBox,lVariables , "dialogHeight: 465px; dialogWidth: 465px;  center: Yes; scroll: No; help: No; resizable: No; status: No; unadorned: yes;");  
	}	
	
	else
	{
	var lVariables = new Array()
	
	lVariables[0] = window
	lVariables[1] = "?"
	lVariables[2] = commentID
	lVariables[3] = "&"
	lVariables[4] = sName
	lVariables[5] = "&"
	lVariables[6] = sDate
	lVariables[7] = "&"
	lVariables[8] = sComment
	lVariables[9] = "&"
	lVariables[10] = document.location.href
	
	if (oDisplay)
	 {
	  toReset = parent.frames.mainFrame.document.getElementById("note" + commentID);
	  if (toReset)
         {
		  toReset.moveable = 'false' ;
	      oDisplay.close();
		 }
	 }
	  //oDisplay = window.showModelessDialog("../_Notes_Function/Note_Display.htm", lVariables , "dialogHeight: 465px; dialogWidth: 465px;  center: Yes; scroll: No; help: No; resizable: No; status: No; unadorned: Yes;");
	  oDisplay = window.showModelessDialog("../_Notes_Function/NoteDisplayFrame.htm", lVariables , "dialogHeight: 465px; dialogWidth: 465px;  center: Yes; scroll: No; help: No; resizable: No; status: No; unadorned: Yes;");
   }
} /***End Function***/

/******************************************************************************
addCommentIcon(x, y, ID, Name, Date, Comment) -- This function is called from
NotePopulateFrame.asp as a page is opened or refreshed. This function is only called
if a note has been left on this page. NotePopulateFrame.asp pulls values from
the database and then passes them to this function, which then populates the page
with the pushpin. 
******************************************************************************/
function addCommentIcon(ID, Name, Date, Comment)
{   

var myComment = Comment

var getXPos = 0;

var sum;

	//allSpans = document.all.tags("div")
	
	// FOR PLACING NOTES IN A FRAME OTHER THAN MAIN FRAME BAR
	var getTop = parent.frames.notesFrame;
	allSpans = getTop.document.all.tags("div");	
	
		for (i=0;i<allSpans.length;i++)
			{
				//if (allSpans[i].className == "noteIcon")
				//{
					sum = i
					getXPos = 20 + (sum * 20);
				//}
			}
	
	ID = parseInt(ID)
	//fakeSpan = document.getElementById("noteDiv");
	fakeSpan = getTop.document.getElementById("noteDiv");
	
	if (fakeSpan)
	{	
		//getXPosition()		
		fakeSpan.outerHTML = fakeSpan.outerHTML 
		+ "<div class='noteIcon' "
		+ "id='note" + ID + "' "
		+ "moveable = 'false' "
		+ "fdDate='" + Date + "' "
		+ "fdName='" + Name + "' "
		+ "fdComment='" + Comment + "' "
		+ "fdCommentID='" + ID + "' "
		+ "deleteTag='No' "
		+ "fdX='" + getXPos + "' "
		+ "style=' background: clear; border: 1;"
		+ "position: absolute; "
		//+ "left:" + x + "px;"
		+ "left:" + getXPos + "px;"
		//+ "top:" + y + ";"
		+ "top:" + 2 + ";"
		+ "z-index: 0; cursor: hand;'>"
		+ "<a onclick='parent.frames.mainFrame.drag_view(" + '"' + ID + '"'  + "," + '"' + Name + '"' + "," + '"' + Date + '"' + "," + '"' + myComment + '"' +  ")'>"  
		//+ "<a onclick=javascript:drag_view(" + ID  + "," +  Name + "," + Date + "," + Comment + ");>"
		+ "<IMG Id='pin' SRC='../_Notes_Function/Note_Pushpin.gif' style='cursor:hand;clip:auto' BORDER=0></font></a></div>";	
		
	}		

	theStep = read_cookie (document.location.pathname+"current_step");
	setCommentScroll(theStep - 1);
	
	
} /***End Function***/

/******************************************************************************
drag_view(ID) -- This function is run when the user clicks on a note icon on a page.  
******************************************************************************/
function drag_view(note_ID,sName,sDate,sComment)
{	

   if (parent.frames.notesFrame.document.getElementById("note" + note_ID).moveable == 'false')
     {
		displayComment(note_ID,sName,sDate,sComment);
	 }
	 
} /***End Function***/

/******************************************************************************
displayCommentIcon(x,y,ID,Name,Date,Comment) -- After a note is created, its information
is sent to the database in NoteManageFrame.asp. Then, NoteManageFrame.asp sends the note
information to this function, which then passes the information to addCommentIcon so that
the note that was just left can be populated onto your page without a refresh.
NOTE: The code is not going past the return false. Does it need to??
******************************************************************************/
function displayCommentIcon(ID,Name,Date,Time,Comment)
{	

		if (Name != "" || Comment != "")
		{			
			addCommentIcon(ID,Name,Date,Comment);
			parent.top.location.reload();			
		}
		
		return false;	
	
	
	name = "note" + parseInt(ID);
	foundit = -1
	
	allSpans = document.all.tags("div")
	for (i=0;i<allSpans.length;i++)
	{	
		if (allSpans[i].className == "noteIcon")
		{	
		
			if (parseInt(allSpans[i].fdCommentID) == parseInt(ID))
			{
			
				allSpans[i].style.left = x
				allSpans[i].style.top = y
				allSpans[i].style.visibility = "visible"
				if (allSpans[i].fdName == "" && allSpans[i].fdComment == "")
				{
					allSpans[i].deleteTag = "Yes"				 
					 
				}
				else
				{
					allSpans[i].deleteTag = "No"
				}
				foundit = i
			}
		}
	}
	if (foundit == -1)
	{
		if (Name != "" || Comment != "")
		{
			addCommentIcon(x,y,ID,Name,Date,Comment);
		}
		else
		{
			strCookie = ID + "=;expires=Sunday 17-Dec-00 12:00:00 GMT;"
			document.cookie = strCookie
		}			
	}
	setCommentScroll();
	
} /***End Function***/

/*****************************************************************************
******************************************************************************
******************************************************************************/


//-->