/***********************************************************************
* CreateArray	creates an array with n elements
* Input: n	-	number of elements
* Returns:		the created array
************************************************************************/

function CreateArray(n)
	{
	this.length = n;
	for (var i=1; i <= n; i++)							// for all ns
		{
		this[i] = new Section();						// create a section structure
		}
	return this;											// return the created array
	}

/***********************************************************************
* Section	-	creates the section structure for raw section lists
************************************************************************/

function Section()
	{
	this.sURL = null;
	this.sName = null;
	this.sImage = null;
	this.nImageWidth = null;
	this.nImageHeight= null;
	this.nSectionId	= null;
	this.pChild = null;
	}
	
/***********************************************************************
* SwapImage			  -	swaps an image to the alternative
* Input:	sName	  -	name of the image
*			sAltImage -	filename of the alternative image
************************************************************************/

function SwapImage(sName, sAltImage)
	{
	var nCount = 0;
	document.aSource = new Array;						// array for images
	if (document[sName] != null)						// if image name exists
		{
		document.aSource[nCount++] = document[sName];	// store image
		if(null == document[sName].sOldSrc)
			{
			document[sName].sOldSrc = document[sName].src;// store image source
			}
		document[sName].src = sAltImage;				// change image source to alternative
		}
	}

function RestoreImage()
	{
	var nCount, aSource = document.aSource;
	if (aSource != null)									// if array of images exists
		{
		for(nCount=0; nCount < aSource.length; nCount++)	// restore all images
			{
			if ((aSource[nCount] != null) &&
				(aSource[nCount].sOldSrc != null))	// if we stored something for this image
				{
				aSource[nCount].src = aSource[nCount].sOldSrc;	// restore the original image
				}
			}
		}
	}

function PreloadImages()
	{
	if(document.images)
		{
		if(!document.Preloaded)							// preload array defined?
			{
			document.Preloaded = new Array();		// no, define it
			}
		var nCounter , nLen = document.Preloaded.length, saArguments = PreloadImages.arguments;
		for(nCounter = 0; nCounter < saArguments.length; nCounter++)	// iterate through arguments
			{
			document.Preloaded[nLen] = new Image;
			document.Preloaded[nLen++].src = saArguments[nCounter];
			}
   	}
	}
	
function newWindow(bookgif) {
bookWindow = window.open(bookgif, 'bookWin', 'width=500,height=390,resizable=yes,scrollbars=no,top=50,left=100')
bookWindow.focus()
}

function checkExpand( ) {
 if ("" != event.srcElement.id)    {
    var ch = event.srcElement.id + "Child";
    var el = document.all[ch];
    if (null != el)       {
       el.style.display = "none" == el.style.display ? "" : "none";
       if (el.style.display != "none")
       event.returnValue=false;
    }
  }
}

function loadImages() {
if (document.getElementById) {  // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  // Netscape 4
document.hidepage.visibility = 'hidden';
}
else {  // IE 4
document.all.hidepage.style.visibility = 'hidden';
      }
   }
}

function SwitchImg() {
  var rem, keep=0, store, obj, switcher=new Array, history=document.Data;
    for (rem=0; rem < (SwitchImg.arguments.length-2); rem+=3) {
    	store = SwitchImg.arguments[(navigator.appName == 'Netscape')?rem:rem+1];
    if ((store.indexOf('document.layers[')==0 && document.layers==null) ||
        (store.indexOf('document.all[')==0 && document.all==null))
         store = 'document'+store.substring(store.lastIndexOf('.'),store.length);
         obj = eval(store);
    if (obj != null) {
   	   switcher[keep++] = obj;
      switcher[keep++] = (history==null || history[keep-1]!=obj)?obj.src:history[keep];
      obj.src = SwitchImg.arguments[rem+2];
  } }
  document.Data = switcher;
}

function RestoreImg() {
  if (document.Data != null)
    for (var rem=0; rem<(document.Data.length-1); rem+=2)
      document.Data[rem].src=document.Data[rem+1];
}

function doColor(item, color, bg) {
item.style.color = color; // changes text color
item.style.backgroundColor = bg; // changes background
}

function undoColor(item) {
item.style.color = "#F2F2FF"; // sets color back to light blue
item.style.backgroundColor = ""; // sets background to default
}

function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'top=33,left=33,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=410,height=386');");
}


function frameprint() {
window.parent.Main.focus(); // Note: Main is the frame name as set in the Frameset of the index page
window.print();
}

function bookmarkit()
{window.external.addFavorite('http://www.safetyknife.net','The Safety Knife Co.Ltd.')
};
if (document.all)
document.write()


