function rollover(object,preload)
{
    if (object.src)
    {
        image = object.src;
        imageDot = image.lastIndexOf('.');
        if (imageDot > -1)
        {
            imageName = image.substr(0,imageDot);
            imageExt = image.substr(imageDot+1);
            if (preload) object = new Image();
            if (imageName.substr(imageName.length-5)=='-over')
                imageName = imageName.substr(0, imageName.length-5);
            else
                imageName += '-over';
            object.src = imageName + '.' + imageExt;
        }
    }
}

var flashCanPlay4 = false;
var flashCanPlay5 = false;
var flashCanPlay6 = false;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
        var words = navigator.plugins["Shockwave Flash"].description.split(" ");
        for (var i = 0; i < words.length; ++i)
        {
            if (isNaN(parseInt(words[i])))
            continue;
            var MM_PluginVersion = words[i]; 
        }
        flashCanPlay4 = MM_PluginVersion >= 4;
        flashCanPlay5 = MM_PluginVersion >= 5;
        flashCanPlay6 = MM_PluginVersion >= 6;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
        document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
        document.write('on error resume next \n');
        document.write('flashCanPlay4 = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))\n');
        document.write('flashCanPlay5 = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))\n');
        document.write('flashCanPlay6 = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")))\n');
        document.write('</SCR' + 'IPT\> \n');
}



// popup window function

function openWindow(theURL,PopWidth,PopHeight) {
 var width = PopWidth;
 var height = PopHeight;
 var screenY = screen.height;
 var screenX = screen.width;
 var topvar = (screenY - height) / 2 - 50;
 var leftvar = (screenX - width) / 2;
 window.open(theURL,'','resizable=no,scrollbars=no,toolbar=no,menubar=no,location=no,status=no,top='+topvar+',left='+leftvar+',width='+width+',height='+height+'');
}


// read cookie for popup

function launchPopup(theURL) {
	var visits = readCookie("PopUp");
	if (visits != null) {
		if (visits == "yes") {
		  createCookie("PopUp", "yes", 0);
		} else if (visits == "no") {
		  createCookie("PopUp", "yes", 0);
		  openWindow(theURL,"300","250");
		}
	}
	else {
	createCookie("PopUp", "yes", 0);
	openWindow(theURL,"300","250");
	}
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = ";expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+";path=/";
}

function getElement(objectName)
{
    if (document.getElementById) return document.getElementById(objectName);
    if (document.all) return document.all[objectName].style.display=value;
    return null;
}

function layerSwap(layerOn, layerOff)
{
	var currentMode = getElement(layerOff).style.display;
	getElement(layerOff).style.display = 'none';
	getElement(layerOn).style.display = currentMode;
}