
// MYVOID to replace void -- which some browsers (i.e., IE) do not like

function myVoid() {
// nothing here
}

// STATUSY/N - makes sure statusbar stays empty on pure mouseovers

function statusynw() { self.status='opens in new window'; return true }
function statusy() { self.status=''; return true }
function statusn() { self.status=''; return true }


/* ****** BEGIN RANDOM IMAGE CODE *********************  */
/* These are the functions for generating a random image */
/* and the accompanying text tags for the images         */

var imageIndex = 0;    // Initialize an index for the array

/* Define the structure of myImageDef */

function myImageDef (imageName, imageText) {
  this.imageName = imageName;
  this.imageText = imageText;
return this;
}

/* Set up the array using the index(imageIndex) */
/* and the array structure(myImageDef)          */

var myImages = new Array();

//0 Vacuum Picker
myImages[imageIndex++] = new myImageDef("facspix/ct-vacpickfr.gif", "<td><h3>Vacuum Picker, front</h3><A href='javascript:myVoid()' onClick='alterContent(3,1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span> &nbsp;(1st of 7 slides)</span></a></td>");

//1 Vacuum Picker side
myImages[imageIndex++] = new myImageDef("facspix/ct-vacpicksd.gif", "<td><h3>Vacuum Picker, side</h3><p></p><A href='javascript:myVoid()' onClick='alterContent(3,2); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span> &nbsp;(2nd of 7 slides)</span></a><a href='javascript:myVoid()' onClick='alterContent(3,0); return false;' onMouseover='return statusy()' onMouseOut='return statusn()' onFocus='if(this.blur)this.blur()'>Back</a></td>");

//2  Fluid Injection Nozzles
myImages[imageIndex++] = new myImageDef("facspix/ct-nozzles.gif", "<td><h3>Fluid Injection Nozzles</h3><A href='javascript:myVoid()' onClick='alterContent(3,3); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span> &nbsp;(3rd of 7 slides)</span></a><a href='javascript:myVoid()' onClick='alterContent(3,1); return false;' onMouseover='return statusy()' onMouseOut='return statusn()' onFocus='if(this.blur)this.blur()'>Back</a></td>");

//3 Display Packaging
myImages[imageIndex++] = new myImageDef("facspix/ct-plugbox.jpg", "<td><h3>Display Packaging</h3><A href='javascript:myVoid()' onClick='alterContent(3,4); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span> &nbsp;(4th of 7 slides)</span></a><a href='javascript:myVoid()' onClick='alterContent(3,2); return false;' onMouseover='return statusy()' onMouseOut='return statusn()' onFocus='if(this.blur)this.blur()'>Back</a></td>");

//4 Custom Tools
myImages[imageIndex++] = new myImageDef("facspix/ct-tools.gif", "<td><h3>Custom Tools</h3><A href='javascript:myVoid()' onClick='alterContent(3,5); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span> &nbsp;(5th of 7 slides)</span></a><a href='javascript:myVoid()' onClick='alterContent(3,3); return false;' onMouseover='return statusy()' onMouseOut='return statusn()' onFocus='if(this.blur)this.blur()'>Back</a></td>");

//5 Widget
myImages[imageIndex++] = new myImageDef("facspix/ct-widget.gif", "<td><h3>Widget</h3><A href='javascript:myVoid()' onClick='alterContent(3,6); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span> &nbsp;(6th of 7 slides)</span></a><a href='javascript:myVoid()' onClick='alterContent(3,4); return false;' onMouseover='return statusy()' onMouseOut='return statusn()' onFocus='if(this.blur)this.blur()'>Back</a></td>");

//6 Male-Female Punch
myImages[imageIndex++] = new myImageDef("facspix/ct-mfpunch.gif", "<td><h3>Male-Female Punch</h3><A href='javascript:myVoid()' onClick='alterContent(3,0); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Start Again<span> &nbsp;(7th of 7 slides)</span></a><a href='javascript:myVoid()' onClick='alterContent(3,5); return false;' onMouseover='return statusy()' onMouseOut='return statusn()' onFocus='if(this.blur)this.blur()'>Back</a></td>");


var number_of_images = myImages.length;  // Determine number of images in array

/* Set up the generalized random generator (x and y are inputs) */

function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}

/* Get the next image (it's either random or not) */
/* The random or not is based on the random_display */
/* variable set above in the initialize variables */

function getNextImage(random_display) {
  if (random_display) {
    imageIndex = generate(0, number_of_images-1);
  }
  else {
    if(imageIndex == (number_of_images)) {  // This extra if does a check to see if
      imageIndex = -1;                      // we're at the last image and resets the index
    }                                       // but only if we're NOT in random mode
    imageIndex = (imageIndex+1) % number_of_images;
  }
return(imageIndex);
}

/* This function replaces the image and the text.           */
/*                                                          */
/* The image id must be set to id="rImage" and have         */
/* some image defined as an initial image even              */
/* though the image will not be the image that displays.    */
/* For example: <IMG name="rImage" src="white.jpg">         */
/*                                                          */
/* To handle NS4+, IE4+ and NS6 you need to use both a      */
/* <DIV> or <SPAN> AND an <ILAYER><LAYER> (for NS4)         */
/* The <DIV> (or <SPAN>) must have an empty DIV tag         */
/* with an id="dtext", for example:                         */
/* <DIV id="dtext"></DIV>                                   */
/*                                                          */
/* The empty ilayer with a nested layer for NS4+ should     */
/* look something like the example below:                   */
/* <ILAYER id="ns4dtext" width="160" height="80">           */
/* <LAYER id="ns4dtext2"></LAYER></ILAYER>                  */
/*                                                          */
/* When you call the function from within the HTML,         */
/* you must specify a value for BOTH isRandom AND picNum    */
/* even though picNum is ignored except when isRandom=3.    */
/* Possible values for the isRandom parameter are:          */
/*  1=random, the picNum parameter is ignored but MUST be   */
/*    specified -- for example calling the following in the */
/*    BODY will generate a random image to put in the page  */
/*    <BODY onLoad="alterContent(1,1);">         */
/*  0=in order, the picNum parameter is ignored but MUST be */
/*    specified -- for example, callint the function as     */
/*    shown below will display the next picture (in order). */
/*    <A href="myVoid()" onClick="alterContent(0,0);return false;">click</a> */
/*  3=specific picture, the picNum parameter is actually    */
/*    used this time. The function will display the picture */
/*    specified in the picNum parameter.  For example:      */
/*    <BODY onLoad="alterContent(3,0);">                    */
/*    will force the first picture in the array to be loaded */
/* AT THE BOTTOM of this page -- after the CODE is a section */
/* of HTML that will work if you put this code in an external */
/* JavaScript document                                        */
//

function alterContent(isRandom,picNum){
  if(isRandom == 3 && picNum < 0) {
    alert("Picture number out of array range -- setting it to first picture in array!");
    arrayNum = 0;
  }
  else if(isRandom == 3 && picNum > (number_of_images - 1)) {
    alert("Picture number out of array range -- setting it to last picture in array!");
    arrayNum = number_of_images - 1;
  }
  else if(isRandom == 3) {
    arrayNum = picNum;
  }
  else {
    arrayNum = getNextImage(isRandom);
  }
  myImg = myImages[arrayNum].imageName;
  myText = myImages[arrayNum].imageText;
  document['rImage'].src=myImg;
  //if IE 4+
  if (document.all){
    dtext.innerHTML=myText;
  }
  //else if NS 4
  else if (document.layers){
    document.layers.ns4dtext.layers.ns4dtext2.document.write(myText);
    document.layers.ns4dtext.layers.ns4dtext2.document.close();
  }
  //else if NS 6 (supports new DOM)
  else if (document.getElementById){
    rng = document.createRange();
    el = document.getElementById("dtext");
    rng.setStartBefore(el);
    htmlFrag = rng.createContextualFragment(myText);
    while (el.hasChildNodes())
    el.removeChild(el.lastChild);
    el.appendChild(htmlFrag);
  }
}

//NETSCAPE 4.X RELOAD SCRIPT - TO PREVENT BROKEN CSS AND JSCRIPT

function MM_reloadPage(init) {  
/*reloads the window if Nav4 resized */
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4))
  {document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
