// Macromedia stuff

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_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_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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];}
}

// Common Javascript Functions Library v1.0 //
// © 2001 Simon Seeber //
var defaultStatusMessage = "Dynamech Equipment";

//Browser Detect
//Test Generic Major Versions
var W3C = (document.getElementById)? 1:0;
var IE4 = (document.all && !document.getElementById) ? true : false;
var IE5 = (document.all && document.getElementById && (navigator.userAgent.indexOf('Opera') == -1))? true : false;
var NS4 = (document.layers) ? true : false;
var NS6 = (document.getElementById && !document.layers && !document.all)? true : false;
var OP = (navigator.userAgent.indexOf('Opera')!= -1)? true : false;
if (OP) {NS6 = 0};
var iCab = (navigator.appName == "iCab")?1:0;
if (iCab) {IE = 0};
//Test for Operating Systems
var Mac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;
var Win = (navigator.appVersion.indexOf("Win") != -1) ? true : false;
//Test for Platform Specific Versions
var IE4Mac = (IE4 && Mac) ? true : false;
var IE5Mac = (IE5 && Mac) ? true : false;
var IE4Win = (IE4 && Win) ? true : false;
var IE5Win = (IE5 && Win) ? true : false;

var ua = (navigator.userAgent);

function showBrowserVariables() {
	alert("::Displaying variables used to detect what browser is being used::\n===================================================" + "\nW3C = " + W3C + "\nNS4 = " + NS4 + "\nIE4 = " + IE4 + "\nNS6 = " + NS6 + "\nIE5 = " + IE5 + "\nOP5 = " + OP + "\nMac = " + Mac + "\n===================================================\n" + ua);
}

// Image Object Builder Script
// Set these variables with the required settings.
// Names of all the rollover images go in this array
var imageList = new Array("image01","image02","image03","image04","image05");

// The first part of the actual image file names
var imageNamePrefix = "images/b-navigation-";

// What format the images are saved in, .gif, .jpg or .png
var imageFormat = ".gif";

// The suffix that you are adding to the end of your rollover images.
var rolloverSuffix = "-o"

function createImages() {
	for (i=0; i<imageList.length; i++) {
		// creates the normal state images
		temp = imageList[i] + "n";
		eval(temp + " = returnImage(imageList[i])");

		// creates the rollover state images
		temp2 = imageList[i] + "a";
		eval(temp2 + " = returnImage(imageList[i] + rolloverSuffix)");
	}
}

// creates the actual image object and assigns the SRC to it
// then hands it back to the main function.
function returnImage(imageName) {
	temp = new Image();
	temp.src = imageNamePrefix + imageName + imageFormat;
	return temp;
}

// image rollover functions
function roll(imageToChange, state) {
//	if (IE) { //all this commented code is only needed if rollovers are inside a div
		if (state) {
			document.images[imageToChange].src = eval(imageToChange + "a").src;
		} else {
			document.images[imageToChange].src = eval(imageToChange + "n").src;
		}
//	} else if (NS) { //all this commented code is only needed if rollovers are inside a div
//		if (state) {
//			document.header.document.images[imageToChange].src = eval(imageToChange + "a").src;
//		} else {
//			document.header.document.images[imageToChange].src = eval(imageToChange + "n").src;
//		}
//	}
}

// set the status bar message
function setStatus(state, message) {
	if (state) {
		window.status = message;
	} else {
		window.status = defaultStatusMessage;
	}
}

// open a normal window
function openWindow(linky, name) {
	tempWindowHolderVariableThingy = window.open(linky.href, name, "location,menubar,resizable,scrollbars,status,toolbar");
	tempWindowHolderVariableThingy.focus();
}

// open a sized window
function openSizedWindow(linky, name, windowHeight, windowWidth) {
	tempWindowHolderVariableThingy = window.open(linky.href, name, "location,menubar,resizable,scrollbars,status,toolbar,height=" + windowHeight + ",width=" + windowWidth);
	tempWindowHolderVariableThingy.focus();
}

function loadPopupImage() {
	imageToLoad = location.search;

	heightStart = imageToLoad.indexOf("&") +1;
	widthStart = imageToLoad.indexOf("&", heightStart) +1;

	imgHeight = imageToLoad.slice(heightStart, widthStart -1);
	imgWidth = imageToLoad.slice(widthStart, imageToLoad.length);

	imageToLoad = imageToLoad.slice(1,imageToLoad.indexOf("&"));
	return '<IMG SRC="images/'+ imageToLoad +'" WIDTH="'+ imgWidth +'" HEIGHT="'+ imgHeight +'" ALT="" BORDER="0">';
}

// Netscape 4 window resize fix
if (NS4) {
	window.onresize = NSreloader;
	var winWidth = window.innerWidth;
	var winHeight = window.outerHeight;
}

function NSreloader(NSevent) {
	if (winWidth!=NSevent.width && winHeight!=NSevent.height) {
		location.reload();
	}
}

// code that is run ones the document is loaded
window.status = defaultStatusMessage;
createImages();

//EoF