
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
version = "unset";
if (browserName == "Netscape") version = "n" + browserVer;
if (browserName == "Microsoft Internet Explorer") version = "e" + browserVer;

function img_act(imgName) {
  if (version == "n3" || version == "n4" || version == "e4") {
    imgOn = eval(imgName + "_on.src");
    document [imgName].src = imgOn;
  }
  else if (document.layers){
    imgOn = eval(imgName + "_on.src");
    document.layer.document [imgName].src = imgOn;
  }
  else if( document.all ){
    imgOn = eval(imgName + "_on.src");
    document [imgName].src = imgOn;
  }
  else {
    imgOn = eval(imgName + "_on.src");
    document [imgName].src = imgOn;
  }
}
function img_inact(imgName) {
  if (version == "n3" || version == "n4" || version == "e4") {
    imgOff = eval(imgName + "_off.src");
    document [imgName].src = imgOff;
  }
  else if (document.layers){
    imgOff = eval(imgName + "_off.src");
    document.layer.document [imgName].src = imgOff;
  }
  else if( document.all ){
    imgOff = eval(imgName + "_off.src");
    document [imgName].src = imgOff;
  }
  else {
    imgOff = eval(imgName + "_off.src");
    document [imgName].src = imgOff;
  }
}

function Change_Portholes(fname) {
  if (version == "n4" ){
    img1On = eval(fname + "1_mo.src");
    img2On = eval(fname + "2_mo.src");
    document.layer.document.porthole1.src = img1On;
    document.layer.document.porthole2.src = img2On;
  } else {
    img1On = eval(fname + "1_mo.src");
    img2On = eval(fname + "2_mo.src");
    document.porthole1.src = img1On;
    document.porthole2.src = img2On;
  }
}

function MediaClickWithInfo( AdditionalInfo )
{
    if( LoadInNewWindow ) {
        URL = xMediaContent[iCurrentImage+1] + AdditionalInfo;
        win=window.open(URL,"NewWindow","");
        if (!win.opener)win.opener=self;
    } else
        document.location.href = (xMediaContent[iCurrentImage+1] + AdditionalInfo);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

//=====================================================================||
//               NOP Design Media Cycling Script                       ||
//                                                                     ||
// For more information on SmartSystems, or how NOPDesign can help you ||
// Please visit us on the WWW at http://www.nopdesign.com              ||
//                                                                     ||
// The media cycler is available as freeware from NOP Design, under the||
// GNU Public License.  You must keep this comment unchanged in your   ||
// code.  For more information contact Scott@NopDesign.com             ||
//                                                                     ||
// MediaCyle Script Module, V.1.0.0                                    ||
//=====================================================================||
//---------------------------------------------------------------------||
// INTERNAL GLOBAL VARIABLES                                           ||
// PURPOSE:     Internal use only, do not modify.                      ||
//---------------------------------------------------------------------||
var xMediaContent  = new Array();
var xMediaImage    = new Image;
var iCurrentImage  = 0;
var iInternalCount = 5000;
var xTimerHandle   = null;
var bTimerRunning  = false;


//---------------------------------------------------------------------||
// USER DEFINED VARIABLES                                              ||
// PURPOSE:     Set these variables to customize your script           ||
//              TimeInSecondsBetweenCycles - Seconds to wait before    ||
//                                           cycling to the next image ||
//              LoadInNewWindow            - When true, the link will  ||
//                                           be opened in a new window ||
//                                           otherwise, it will load in||
//                                           the current window.       ||
//              WrapAtEnd                  - Wraps to start at end.    ||
//                                                                     ||
//              MEDIAIMAGE                - Needs defined in your HTML ||
//                                           page as an image name.    ||
//---------------------------------------------------------------------||
var TimeInSecondsBetweenCycles = 7;
var LoadInNewWindow = false;
var WrapAtEnd       = true;


//---------------------------------------------------------------------||
// MEDIA FILES TO LOAD                                                 ||
// PURPOSE:     This is the image that you wish displayed, followed by ||
//              the URL to link to.  All images should be on even      ||
//              numbered lines, URLS on odd.  Pay careful attention to ||
//              increment the counter inside of the [] symbols when you||
//              add more images.  There is no maximum to the amount of ||
//              images you can load.                                   ||
//---------------------------------------------------------------------||
xMediaContent[0] = "images/shared/t1.jpg";
xMediaContent[1] = "images/shared/t2.jpg";
xMediaContent[2] = "images/shared/t3.jpg";
xMediaContent[3] = "images/shared/t4.jpg";
xMediaContent[4] = "images/shared/t5.jpg";
xMediaContent[5] = "images/shared/t6.jpg";
xMediaContent[6] = "images/shared/t7.jpg";
xMediaContent[7] = "images/shared/t8.jpg";
xMediaContent[8] = "images/shared/t9.jpg";
xMediaContent[9] = "images/shared/t10.jpg";

//---------------------------------------------------------------------||
// FUNCTION:    MediaStop                                              ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Moves the media                                        ||
//---------------------------------------------------------------------||
function MediaStop()
{
    if( bTimerRunning )
        clearTimeout( xTimerHandle );

    bTimerRunning = false;
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaInternalCycle                                     ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Internal media cycle routine                           ||
//---------------------------------------------------------------------||
function MediaInternalCycle()
{
    (iCurrentImage == (xMediaContent.length - 1)) ? iCurrentImage = 0 : iCurrentImage+=1;
    if( document.MEDIAIMAGE ) document.MEDIAIMAGE.src = xMediaContent[iCurrentImage];

    xTimerHandle   = setTimeout("MediaInternalCycle()", iInternalCount);
    bTimerRunning  = true;
}


//---------------------------------------------------------------------||
// FUNCTION:    MediaStart                                             ||
// PARAMETERS:                                                         ||
// RETURNS:                                                            ||
// PURPOSE:     Starts the media cycling. Call with 'OnLoad' from body ||
//              tag to have an image start cycling on page load.       ||
//---------------------------------------------------------------------||
function MediaStart()
{
    iInternalCount = TimeInSecondsBetweenCycles * 1000;
    MediaStop();
    MediaInternalCycle();
}

