function startup()
{

	var topnav = document.getElementById('layer_left');
	if(topnav != null)
	{
		var sloc = window.location.href.toLowerCase().replace('.html','/').replace('//','/');
		var arrloc = sloc.split('/');
		var i;
		for(i =3; i < arrloc.length;i++)
			arrloc[i] = null;
		
		sloc = arrloc.join('/').replace('//','/');
		var as = topnav.getElementsByTagName('A');
		for(var i=0; i< as.length;i++)
		{
			var sAloc = as[i].href.toLowerCase();
			sAloc = sAloc.replace('.html','/').replace('//','/').replace('//','/');
			if(sAloc == sloc)
			{
				as[i].className = 'group_items_selected';	
			}
		}
	}

	var subnav = document.getElementById('layer_left');
	if(subnav != null)
	{
		var sloc = window.location.href.toLowerCase();
		var as = subnav.getElementsByTagName('a');
		for(var i=0; i< as.length;i++)
			if(as[i].href.toLowerCase() == sloc)
			{
				as[i].className = 'group_items_selected';	
			}
	}
}

function divshowhide(divid) 
{ 
	if (document.getElementById(divid).className == 'left_navigator_sub') 
	{ 
		document.getElementById(divid).className = 'left_navigator_sub_over';
	} 
	else 
	{ 
		document.getElementById(divid).className = 'left_navigator_sub';
	} 
}


var adjustTop = 0;                   // Set if flyout top not aligned
var adjustLeft = 0;                  // Set if flyout not aligned on right side of menu bar
var flyoutMenu = null;               // Selected menu reference
var highlighted = null;              // The top level menu item selected
var offsetX = 0;                     // Flyout left offset
var offsetY = 0;                     // Flyout top offset
var timeout = null;                  // Reference to timeout event

/*
Calculators the X and Y coordination offsets for the flyout
from the root of the document xml tree.
*/
function calculateOffsets(obj)
{
  var tagObject = obj;

  offsetY = adjustTop;
  offsetX = obj.offsetWidth;

  while (tagObject) // Calculate x,y offsets
  {
    offsetY = offsetY + tagObject.offsetTop;
    offsetX = offsetX + tagObject.offsetLeft;
    tagObject = tagObject.offsetParent;
  }

  // Perform adjustments
  offsetY += adjustTop;
  offsetX += adjustLeft;
}

/*
Cancels the current window timeout event
*/
function cancelTimeout()
{
  window.clearTimeout(timeout);
  timeout = null; // Remove reference
}

/*
Displays the flyout menu at the specified X and Y coordination
*/
function display(xPos, yPos, stayOpen)
{
  flyoutMenu.style.display = "block";
  flyoutMenu.style.visibility = "visible";

  flyoutMenu.style.left = "170px";
  flyoutMenu.style.top =  "49px";

  /*flyoutMenu.style.left = "0px";
  flyoutMenu.style.top =  "0px";*/

  /*flyoutMenu.style.left = xPos + "px";
  flyoutMenu.style.top =  yPos + "px";*/

  // turn highlight on
  highLightOn();
}

/*
Hides the currently displayed flyout menu
*/
function hide()
{
  if((flyoutMenu != null) && (flyoutMenu != undefined))
  {
    flyoutMenu.style.display="none";
    flyoutMenu.style.visibility="hidden";

    // Reset offsets to zero
    flyoutMenu.style.left =  0 + "px";
    flyoutMenu.style.top = 0 + "px";

    // Reset references
    flyoutMeanu = null;

    // turn highlight off
    highLightOff();
  }
}

/*
Starts the display of flyout menu by determining the select menu
*/
function mouseOver(group)
{
  if(!(typeof(group) == "string")) // guard
  {
    // The group must be a string value of the id attribute of the menu group DIV tag
    return;
  }

  var stayOpen = false;
  var group = document.getElementById(group) // Get the DIV menu_group

  if((flyoutMenu != null) && (flyoutMenu.parentNode.id == group.id))
  {
    stayOpen = true;
    cancelTimeout();
  }
  else // Menu group selected
  {
    if((flyoutMenu != null) && (flyoutMenu != undefined))
    {
      // A flyout menu currently open
      cancelTimeout();
      hide(); // Hide now
    }

    // Get the first unordered list in the menu_group DIV tag
    flyoutMenu = group.getElementsByTagName("ul")[0];

    // Calculate the x,y position from the menu_grop
    calculateOffsets(group);

    // Get the first A child tag of the DIV within the menu_group
    highlighted = group.getElementsByTagName("div")[0].firstChild;
  }

  if((flyoutMenu != null) && (flyoutMenu != undefined))
  {
    display(offsetX, offsetY, stayOpen); // display the flyout
  }
}

/*
Closes the currently display flyout menu in a delayed time period
*/
function shut()
{
  if((flyoutMenu != null) && (flyoutMenu != undefined))
  {
    timeout = window.setTimeout("hide();", 400);
  }
}

function highLightOff()
{
	if(highlighted.parentNode.id != "selected")
	{
		//Restore original colours if item is not selected
		highlighted.style.color = "#FFFFFF";
	}
}

function highLightOn()
{
  // Set highlight colours
  highlighted.style.color = "#000000";
}


// Flash Sniffer

var jimAuld = window.jimAuld || {};
jimAuld.utils = jimAuld.utils || {};
jimAuld.utils.flashsniffer = {
	lastMajorRelease: 9,
	installed: null,
	version: null,
	detect: function(){
		var fPlugin,fPluginDesc,flashAX;
		if (navigator.plugins && navigator.plugins.length){
		fPlugin = navigator.plugins["Shockwave Flash"];
			if (fPlugin){
				jimAuld.utils.flashsniffer.installed = true;
				if (fPlugin.description){
					fPluginDesc = fPlugin.description;
					jimAuld.utils.flashsniffer.version = fPluginDesc.charAt(fPluginDesc.indexOf('.')-1);
				}
			}
			else {
				jimAuld.utils.flashsniffer.installed = false;
			}
			if (navigator.plugins["Shockwave Flash 2.0"]){
				jimAuld.utils.flashsniffer.installed = true;
				jimAuld.utils.flashsniffer.version = 2;
			}
		}
		else if (navigator.mimeTypes && navigator.mimeTypes.length){
			fPlugin = navigator.mimeTypes['application/x-shockwave-flash'];
			if (fPlugin && fPlugin.enabledPlugin){
				jimAuld.utils.flashsniffer.installed = true;
			}
			else{
				jimAuld.utils.flashsniffer.installed = false;
			}
		}
		else {
			for(var i = jimAuld.utils.flashsniffer.lastMajorRelease;i>=2;i--){
				try{
					flashAX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
					jimAuld.utils.flashsniffer.installed = true;
					jimAuld.utils.flashsniffer.version = i;
					break;
				}
				catch(e){
				}
			}
			if(jimAuld.utils.flashsniffer.installed == null){
				try{
					flashAX = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
					jimAuld.utils.flashsniffer.installed = true;
					jimAuld.utils.flashsniffer.version = 2;
				}
				catch(e){
				}
			}
			if(jimAuld.utils.flashsniffer.installed == null){
				jimAuld.utils.flashsniffer.installed = false;
			}
			flashAX = null;
		}
	},
	isVersion: function(exactVersion){
		return (jimAuld.utils.flashsniffer.version!=null && jimAuld.utils.flashsniffer.version==exactVersion);
	},
	isLatestVersion: function(){
		return (jimAuld.utils.flashsniffer.version!=null && jimAuld.utils.flashsniffer.version==jimAuld.utils.flashsniffer.lastMajorRelease);
	},
	meetsMinVersion: function(minVersion){
		return (jimAuld.utils.flashsniffer.version!=null && jimAuld.utils.flashsniffer.version>=minVersion);
	}
};
jimAuld.utils.flashsniffer.detect();

// Check if Flash Player is Installed
if(jimAuld.utils.flashsniffer.version!=null)
{
	//Does the flash version meet a specified min requirement?
	if(!jimAuld.utils.flashsniffer.meetsMinVersion(9))
	{
		// If Flash Version is less than 8, Redirect to Flash Page.
		//window.location = "/flash.html"
		document.write('<div><p>Adobe Flash Player Version 9 + is required to view this site properly. <a target="_blank" href="http://www.adobe.com/products/flashplayer/" title="Adobe Flash Center">Download here.</a></p></div>')
	}
}
else
{
	// If Flash is not installed Redirect to Flash Page.
	//window.location = "/flash.html"
	document.write('<div><p>Adobe Flash Player Version 9 + is required to view this site properly. <a target="_blank" href="http://www.adobe.com/products/flashplayer/" title="Adobe Flash Center">Download here.</a></p></div>')
}


function form_validator(theForm)
{
	if (theForm.name.value == "")
	{
		alert("Please enter your NAME in the provided field.");
		theForm.name.focus();
		return (false);
	}

	if (theForm.company.value == "")
	{
		alert("Please enter your COMPANY in the provided field.");
		theForm.company.focus();
		return (false);
	}

	if (theForm.email.value == "")
	{
		alert("Please enter your EMAIL address in the provided field.");
		theForm.email.focus();
		return (false);
	}

	if (theForm.phone.value == "")
	{
		alert("Please enter your PHONE Number in the provided field.");
		theForm.email.focus();
		return (false);
	}

	with (theForm.email)
	{
		apos=theForm.email.value.indexOf("@")
		dotpos=theForm.email.value.lastIndexOf(".")
		if (apos<1||dotpos-apos<2) 
 		{
			alert("The e-Mail format you eneterd was incorrect. Please try again.");return false
		}
		else 
		{
			return true
		}
	}

}
