<!--
// notebook.js
//
//
// Unless otherwise licensed, the source code in this file ("the Software") is provided
// under the terms of this LICENSE.
//
// Copyright © 2003 Circus Ponies Software, Inc. All Rights Reserved.
//
// Circus Ponies Software, Inc. ("Circus Ponies") gives you limited permission to
// redistribute the Software provided that all of the following conditions are met:
//
// 1. Redistribution must retain the above copyright notice plus this list of
//    conditions and disclaimers in its entirety.
//
// 2. You may not distribute a modified version of the Software.
//
// 3. You may not charge a fee for the Software or claim that the Software is yours.
//
// 4. You may not use the names Circus Ponies, Circus Ponies NoteBook, or Circus Ponies
//    Software, Inc. to endorse or promote products derived from the Software without
//    the prior written permission of Circus Ponies.
//
// 5. This Software is provided "AS IS," without a warranty of any kind.  ALL EXPRESS
//    OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED
//    WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-
//    INFRINGEMENT, ARE HEREBY EXCLUDED. CIRCUS PONIES AND ITS LICENSORS SHALL NOT BE
//    LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
//    DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL CIRCUS PONIES OR
//    ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
//    INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED
//    AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY
//    TO USE THIS SOFTWARE, EVEN IF CIRCUS PONIES HAS BEEN ADVISED OF THE POSSIBILITY
//    OF SUCH DAMAGES.
//
// 6. You acknowledge that this software is not designed, licensed or intended for use
//    in the design, construction, operation, or maintenance of any nuclear facility.
//
//
// Version: 12-Sep-03    03:03 pm
//
//


// Global Variables
var notebookPageInitFunctions = new Array();
var notebookPageInitFunctionCount = 0;


function SwapImage( image, newImageSrc ) 
{
 if (document.images) {
	eval("document."+image+".src = newImageSrc;");
 }
	
}


function AddNotebookPageInitFunction( theFunction ) {
    notebookPageInitFunctions[notebookPageInitFunctionCount++] = theFunction;
}


function InitNotebookPage() {
    
    // Just execute all the Init Functions
    for(var i=0; i<notebookPageInitFunctionCount; i++) {
    
        eval( notebookPageInitFunctions[i] );
    }
}


function DoControlAnimation( theControlImageID, expand, image1, image2, image3, image4, iteration ) {
       
	// Swap the Image to the next in the animation
	if (iteration == 1) {
		SwapImage( theControlImageID, image1 );
	}
	else if (iteration == 2) {
		SwapImage( theControlImageID, image2 );
	}
	else if (iteration == 3) {
		SwapImage( theControlImageID, image3 );
	}
	else if (iteration == 4) {
		SwapImage( theControlImageID, image4 );
	}
	
	// set up for the next iteration
	if ((iteration < 4) && (iteration > 0)) { 
        
		var nextIteration;
		if (expand) {
			nextIteration = iteration+1;
		}
		else {
			nextIteration = iteration-1;
		}
		
		// Call recursively with a delay of 20 ms
		setTimeout("DoControlAnimation('" +theControlImageID+ "'," +expand+ ",'" +image1+ "','" +image2+ "','" +image3+ "','" +image4+ "'," +nextIteration+ ");", 20);		}
}

function ExpandNotebookCell( theObjectID, theControlImageID, image1, image2, image3, image4 ) {
        
	var theLayer = null;
	if (document.getElementById) {
	
 		// Level 1 DOM code
		theLayer = document.getElementById( theObjectID ).style;
 		if (theLayer) {
                
			if (theLayer.display=='none') {
 				theLayer.display = '';
				DoControlAnimation( theControlImageID, true, image1, image2, image3, image4, 2); // expand animation
			}
			else {
 				theLayer.display = 'none';
				DoControlAnimation( theControlImageID, false, image1, image2, image3, image4, 3); // collapse animation
			}
		}
	}
	else if (document.all) {
	
		// Microsoft DOM code
		theLayer = eval("document.all." +theObjectID+ ".style" );
		if (theLayer) {
			if (theLayer.display=='none') {
				theLayer.display = '';
				DoControlAnimation( theControlImageID, true, image1, image2, image3, image4, 2); // expand animation
			}
			else {
				theLayer.display = 'none';
				DoControlAnimation( theControlImageID, false, image1, image2, image3, image4, 3); // collapse animation
			}
		}
	}
	else if (document.layers) {
	
		// Netscape DOM code
		theLayer = document.layers[ theObjectID ];
		
		if (theLayer) {
			if ( theLayer.visibility == 'hide' ) {
				theLayer.visibility = 'show';
				DoControlAnimation( theControlImageID, true, image1, image2, image3, image4, 2); // expand animation
			}
			else {
				theLayer.visibility = 'hide';
				DoControlAnimation( theControlImageID, false, image1, image2, image3, image4, 3); // collapse animation
			}
		}
	}
}



//-->
