﻿// JScript File

AC_FL_RunContent = 0;

// =======================================
// set the following variables
// =======================================
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;
// Specify the image files
var Pic = new Array(); // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
var total=13;
var n=0;
for (var i=0;i<total; i++)
{
n=i+1;
Pic[i] = 'ad_images/p'+n+'.png';
}
// =======================================
// do not edit anything below this line
// =======================================
var t;
var j = 0;
var p = Pic.length;
var preLoad = new Array();
for (i = 0; i < p; i++){
   preLoad[i] = new Image();
   preLoad[i].src = Pic[i];
}
function runSlideShow(){
    if (document.all){
        document.images.SlideShow.style.filter="blendTrans(duration=2)"
         document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
        document.images.SlideShow.filters.blendTrans.Apply()      
    }
    document.images.SlideShow.src = preLoad[j].src
    if (document.all){
        document.images.SlideShow.filters.blendTrans.Play()
    }
    j = j + 1
    if (j > (p-1)) j=0
    t = setTimeout('runSlideShow()', slideShowSpeed)
}
function changeImage(imgName, newSrc)
{
    var img = document.getElementById(imgName);
    if(img)
    {
        img.src = newSrc;
    }
}
function ToggleDisplay(id,imgId)
{
    var elem = document.getElementById(id);
    var img = document.getElementById(imgId);
    if (elem)
    {
      if (elem.style.display != 'block')
      {
        elem.style.display = 'block';
        elem.style.visibility = 'visible';
        img.src = 'images/minus.jpg'; 
      }
      else
      {
        elem.style.display = 'none';
        elem.style.visibility = 'hidden';
        img.src = 'images/plus.jpg'; 
      }
    }
}
function Popup(source)
{
    var smallImages = document.getElementById("roll-over-images");
    var largeImage = document.getElementById("pop-up-image");
    var image = document.getElementById("pop-up-display-image");
    if (smallImages)
    {
      smallImages.style.display = 'none';
      smallImages.style.visibility = 'hidden';
      largeImage.style.display = 'block';
      largeImage.style.visibility = 'visible';
      image.src=(source);
    }
}
function Popdown()
{
    var smallImages = document.getElementById("roll-over-images");
    var largeImage = document.getElementById("pop-up-image");
    var image = document.getElementById("pop-up-display-image");
    if (smallImages)
    {
      largeImage.style.display = 'none';
      largeImage.style.visibility = 'hidden';
      smallImages.style.display = 'block';
      smallImages.style.visibility = 'visible';
      image.src=("");
    }
}
//******
//dropDownActivate
//  This function turns on the dropdown menu portion of a navigation element
//******
//navBarElement - id of the element in the top level navigation bar
//dropDownElement - id of the dropdown element corresponding to
//the navBarElement
//******
function dropDownActivate(navBarElement, dropDownElement)
{
    var navBar = document.getElementById(navBarElement);
    var dropDown = document.getElementById(dropDownElement);
    RemoveClassName(navBar,"navmenu-dropdown-top");
    AddClassName(navBar,"navmenu-dropdown-top-active",1);
    dropDown.style.display = 'block';
    dropDown.style.visibility = 'visible';
}
//******
//dropDownDeactivate
//  This function turns off the dropdown menu portion of a navigation element
//******
//navBarElement - id of the element in the top level navigation bar
//dropDownElement - id of the dropdown element corresponding to
//the navBarElement
//******
function dropDownDeactivate(navBarElement, dropDownElement)
{
    var navBar = document.getElementById(navBarElement);
    var dropDown = document.getElementById(dropDownElement);
    RemoveClassName(navBar,"navmenu-dropdown-top-active");
    AddClassName(navBar,"navmenu-dropdown-top",1);
    dropDown.style.display = 'none';
    dropDown.style.visibility = 'hidden';

}
//******
//navMenuHoverOver
//  This function alters the background of a passed element
//******
//navBarElement - id of the target element
//******
function navMenuHoverOver(navBarElement)
{
    var navBar = document.getElementById(navBarElement);
    navBar.style.backgroundColor = "#FBDCD6";
}
//******
//navMenuHoverOut
//  This function alters the background of a passed element
//******
//navBarElement - id of the target element
//******
function navMenuHoverOut(navBarElement)
{
    var navBar = document.getElementById(navBarElement);
    navBar.style.backgroundColor = "White";
}

//******
//sidebarActivate
//  This function turns on the dropdown menu portion of a navigation element
//******
//navBarElement - id of the element in the top level navigation bar
//dsidebarElement - id of the dropdown element corresponding to
//the navBarElement
//******
function sidebarActivate(navBarElement, sidebarElement)
{
    var navBar = document.getElementById(navBarElement);
    var sidebar = document.getElementById(sidebarElement);
    RemoveClassName(navBar,"navmenu-sidebar-left");
    AddClassName(navBar,"navmenu-sidebar-left-active",1);
    sidebar.style.display = 'block';
    sidebar.style.visibility = 'visible';
}
//******
//sidebarDeactivate
//  This function turns off the dropdown menu portion of a navigation element
//******
//navBarElement - id of the element in the top level navigation bar
//sidebarElement - id of the dropdown element corresponding to
//the navBarElement
//******
function sidebarDeactivate(navBarElement, sidebarElement)
{
    var navBar = document.getElementById(navBarElement);
    var sidebar = document.getElementById(sidebarElement);
    RemoveClassName(navBar,"navmenu-sidebar-left-active");
    AddClassName(navBar,"navmenu-sidebar-left",1);
    
    navBar.style.backgroundColor = "";

    sidebar.style.display = 'none';
    sidebar.style.visibility = 'hidden';

}



//******
//Javascript included to help with class manipulations
//******

// ----------------------------------------------------------------------------
// HasClassName
//
// Description : returns boolean indicating whether the object has the class name
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function HasClassName(objElement, strClass)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();

      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {

         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {

            // we found it
            return true;

            }

         }

      }

   // if we got here then the class name is not there
   return false;

   }


// ----------------------------------------------------------------------------
// AddClassName
//
// Description : adds a class to the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function AddClassName(objElement, strClass, blnMayAlreadyExist)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // if the new class name may already exist in list
      if ( blnMayAlreadyExist )
         {

         // get uppercase class for comparison purposes
         var strClassUpper = strClass.toUpperCase();

         // find all instances and remove them
         for ( var i = 0; i < arrList.length; i++ )
            {

            // if class found
            if ( arrList[i].toUpperCase() == strClassUpper )
               {

               // remove array item
               arrList.splice(i, 1);

               // decrement loop counter as we have adjusted the array's contents
               i--;

               }

            }

         }

      // add the new class to end of list
      arrList[arrList.length] = strClass;

      // add the new class to beginning of list
      //arrList.splice(0, 0, strClass);
      
      // assign modified class name attribute
      objElement.className = arrList.join(' ');

      }
   // if there was no class
   else
      {

      // assign modified class name attribute      
      objElement.className = strClass;
   
      }

   }


// ----------------------------------------------------------------------------
// RemoveClassName
//
// Description : removes a class from the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to remove
//
function RemoveClassName(objElement, strClass)
   {

   // if there is a class
   if ( objElement.className )
      {

      // the classes are just a space separated list, so first get the list
      var arrList = objElement.className.split(' ');

      // get uppercase class for comparison purposes
      var strClassUpper = strClass.toUpperCase();

      // find all instances and remove them
      for ( var i = 0; i < arrList.length; i++ )
         {

         // if class found
         if ( arrList[i].toUpperCase() == strClassUpper )
            {

            // remove array item
            arrList.splice(i, 1);

            // decrement loop counter as we have adjusted the array's contents
            i--;

            }

         }

      // assign modified class name attribute
      objElement.className = arrList.join(' ');

      }
   // if there was no class
   // there is nothing to remove

   }

function PopulateCategory(strSelection) {
   
   var strHTML = "";

   switch (strSelection) {
       case "FireService":
            strHTML = "<ul> " +
			"<li>Ames Fire Department - Ames, IA</li>" +
			"<li>Berkeley Fire Department - Berkeley, CA</li>" +
			"<li>City of Grand Haven - Grand Haven, MI</li>" +
			"<li>City of Las Vegas Fire & Rescue - Las Vegas, NV</li>" +
			"<li>City of Miami Beach - Miami Beach, FL</li>" +
			"<li>City of Phoenix - Phoenix, AZ</li>" +
			"<li>Commack Fire Department - Commack, NY</li>" +
			"<li>Fort Leavenworth Fire Department - Fort Leavenworth, KS</li>" +
			"<li>Macomb Township Fire Department - Macomb Township, MI</li>" +
			"<li>Okotoks Fire Department - Okotoks, AB</li>" +
			"<li>Palm Springs Fire Department - Palm Springs, CA</li>" +
		"</ul>";

           break;
       case "TrainingCompanies":
           strHTML = "<ul> " +
			"<li>Adgat - Iceland</li>" +
			"<li>Associated General Contractors of VT - Montpelier, VT</li>" +
			"<li>Aurora Tri State - Aurora, IL</li>" +
			"<li>Cintas</li>" +
			"<li>Dynamic Solutions - Trinidad and Tobago</li>" +
			"<li>Emilcott Associates, Inc. - Chatham, NJ</li>" +
			"<li>Fire Risk Pro - Northants, UK</li>" +
			"<li>Fire Safety Training Solutions - North Wales, UK</li>" +
			"<li>FirstLink - Toronto, Canada</li>" +
			"<li>Global Training and Environmental - Lafayette, LA</li>" +
			"<li>K&A First Aid - Gaithersburg, MD</li>" +
			"<li>LAAP, Inc. - Deer Park, TX</li>" +
			"<li>Salamander Consulting - Victoria, Australia</li>" +
			"<li>Simplex Grinnell</li>" +
		"</ul>";
           break;
       case "Hospitality&Entertainment":
           strHTML = "<ul> " +
			"<li>American Museum of Natural History</li>" +
			"<li>Bellagio Hotel and Casino</li>" +
			"<li>Cirque Du Soleil</li>" +
			"<li>ESPN</li>" +
			"<li>Excalibur Casino</li>" +
			"<li>Mirage Casino</li>" +
			"<li>NASCAR</li>" +
			"<li>NBC</li>" +
			"<li>Vail Resorts</li>" +
			"<li>Warner Bros.</li>" +
			"<li>Wynn</li>" +
		"</ul>";
           break;
       case "Travel":
            strHTML = "<ul> " +
			"<li>Alaska Airlines</li>" +
			"<li>Jet Blue</li>" +
			"<li>Newark Airport</li>" +
			"<li>Portland Intl Airport</li>" +
			"<li>Seattle-Tacoma</li>" +
			"<li>Sun Country Airlines</li>" +
			"<li>Tucson Airport</li>" +
		"</ul>";
           break;
       case "Healthcare":
            strHTML = "<ul> " +
			"<li>Northern Westchester Hospital</li>" +
			"<li>Penrose Hospital</li>" +
			"<li>Rhode Island Hospital</li>" +
			"<li>Riverview Services</li>" +
			"<li>Stanford Medical Center</li>" +
			"<li>Stony Brook Medical Center</li>" +
			"<li>Tyco Healthcare</li>" +
			"<li>Veterans Affairs Hospital</li>" +
		"</ul>";
           break;
       case "Pharmaceutical":
            strHTML = "<ul> " +
			"<li>Astra Zeneca</li>" +
			"<li>Bayer Pharmaceutical</li>" +
			"<li>Eli Lilly</li>" +
			"<li>GlaxoSmithKline</li>" +
			"<li>Pfizer</li>" +
			"<li>Wyeth Pharmaceutical</li>" +
		"</ul>";
           break;
       case "Colleges":
            strHTML = "<ul> " +
			"<li>Brigham Young University</li>" +
			"<li>Brown</li>" +
			"<li>California Maritime Academy</li>" +
			"<li>Delgado Maritime Fire, Radar & Industrial Training Facility</li>" +
			"<li>Harvard University</li>" +
			"<li>Illinois State University</li>" +
			"<li>Iowa State</li>" +
			"<li>Ithaca College</li>" +
			"<li>Kansas State</li>" +
			"<li>Michigan State University</li>" +
			"<li>Stanford University</li>" +
		"</ul>";
           break;
       case "Manufacturing":
            strHTML = "<ul> " +
			"<li>AK Steel</li>" +
			"<li>Alcoa</li>" +
			"<li>BF Goodrich</li>" +
			"<li>Corning</li>" +
			"<li>Dixie Chemical</li>" +
			"<li>General Electric</li>" +
			"<li>John Deere</li>" +
			"<li>Luxfer Gas Cylinder</li>" +
			"<li>Rohm & Haas</li>" +
			"<li>Sub Zero</li>" +
		"</ul>";
           break;
       case "Government":
            strHTML = "<ul> " +
			"<li>Federal Reserve</li>" +
			"<li>NASA</li>" +
			"<li>New Boston Air Force Station</li>" +
			"<li>New Jersey Turnpike Authority</li>" +
			"<li>NYS Department of Corrections</li>" +
			"<li>Sacremento Regional CERT - Elk Grove, CA</li>" +
			"<li>State of Alaska</li>" +
			"<li>US Army Corp of Engineers</li>" +
			"<li>US Coast Guard</li>" +
			"<li>US Marine Corps</li>" +
			"<li>US Navy</li>" +
		"</ul>";
           break;
       case "Energy":
            strHTML = "<ul> " +
			"<li>British Petroleum</li>" +
			"<li>Citgo</li>" +
			"<li>Con Edison</li>" +
			"<li>Duke Energy</li>" +
			"<li>Hess</li>" +
			"<li>Paramount</li>" +
			"<li>PXP</li>" +
			"<li>Reliant Energy</li>" +
			"<li>Shell</li>" +
			"<li>Xcel Energy</li>" +
		"</ul>";
           break;
       default:
           strHTML = "";
           break;
    }
    return strHTML;
}

function so_clearInnerHTML(obj) {
   if (obj.innerHTML != "") {
       // perform a shallow clone on obj
       nObj = obj.cloneNode(false);
       // insert the cloned object into the DOM before the original one
       obj.parentNode.insertBefore(nObj, obj);
       // remove the original object
       obj.parentNode.removeChild(obj);
       nObj.innerHTML = "";
       obj.innerHTML = "";
   }
}

function CheckBrowser()
{
    if (/MSIE (\d+\.\d+);/.test(navigator.userAgent))
    { //test for MSIE x.x;
        var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
        if (ieversion>=7)
        {
            //Use 24 bit alpha blend
            alert("IE7 Detected");
            
        }
        else
        {
            //use 8 bit
            window.location = 'http://www.google.com';
            
        }
    }
    else
    {
        //Use 24 bit alpha blend
    }
    //alert(strNewImage);
}
