
// 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 video - KEEP THIS
myImages[imageIndex++] = new myImageDef("facspix/clear.gif", "<td><h3>Indexing System (Video)</h3><p>Servo-controlled index feeding saves resources by eliminating the need for personnel to hand-load product from a sporadic product flow. Product is timed perfectly for any conveyor speed.</p><object NAME='Player' WIDTH='250' HEIGHT='210' type='application/x-oleobject' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' style='position: absolute; left: 365px; top: 25px;'><param NAME='URL' VALUE='http://www.facsco.com/facspix/FACS-102107.wmv'><param NAME='AUTOSTART' VALUE='true'><param name='showControls' value='true'><embed WIDTH='350' HEIGHT='300' style='position: absolute; left: -40px; top: -40px;' SRC='http://www.facsco.com/facspix/FACS-102107.wmv' TYPE='application/x-oleobject' ></embed></object><A href='javascript:myVoid()' onClick='alterContent(3,1); return false;' onMouseover='return statusy()' ONMOUSEOUT='return statusn()' onFocus='if(this.blur)this.blur()'>Next<span></span></a></td>");

//1 Assembly Turn Table
myImages[imageIndex++] = new myImageDef("facspix/cm-assembly-table.jpg", "<td><h3>Assembly Turn Table</h3><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;(1st of 4 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 Twistie Tie Roller
myImages[imageIndex++] = new myImageDef("facspix/cm-twistie-tie-roller.jpg", "<td><h3>Twistie-Tie Roller</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;(2nd of 4 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 Barcode Verification System, top, after 
myImages[imageIndex++] = new myImageDef("facspix/cm-barcode-ver-top.jpg", "<td><h3>Barcode Verification System</h3><p>Accept/Reject Conveyor</p><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;(3rd of 4 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  Label Placement Vision System
myImages[imageIndex++] = new myImageDef("facspix/cm-label-placement.gif", "<td><h3>Label Placement Vision System</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;(4th of 4 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>");


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);
