var flashVersion = 0;
var flashVersion_DONTKNOW = -1;
function flash_version() {
	var agent = navigator.userAgent.toLowerCase(); 
	
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			if (flashPlugin.description.indexOf('7.') != -1) flashVersion = 7;
			else if (flashPlugin.description.indexOf('6.') != -1) flashVersion = 6;
			else if (flashPlugin.description.indexOf('5.') != -1) flashVersion = 5;
			else if (flashPlugin.description.indexOf('4.') != -1) flashVersion = 4;
			else if (flashPlugin.description.indexOf('3.') != -1) flashVersion = 3;
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	  document.write('<scr' + 'ipt language="VBScript"\> \n');
		document.write('on error resume next \n');
		document.write('dim obFlash \n');
		document.write('set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.7") \n');
		document.write('if IsObject(obFlash) then \n');
		document.write('flashVersion = 7 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.6") end if \n');
		document.write('if flashVersion < 7 and IsObject(obFlash) then \n');
		document.write('flashVersion = 6 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.5") end if \n');
		document.write('if flashVersion < 6 and IsObject(obFlash) then \n');
		document.write('flashVersion = 5 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.4") end if \n');
		document.write('if flashVersion < 5 and IsObject(obFlash) then \n');
		document.write('flashVersion = 4 \n');
		document.write('else set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash.3") end if \n');
		document.write('if flashVersion < 4 and IsObject(obFlash) then \n');
		document.write('flashVersion = 3 \n');
		document.write('end if');
		document.write('</scr' + 'ipt\> \n');
  }
		
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else {
		flashVersion = flashVersion_DONTKNOW;
	}

	return flashVersion;
}

function flash_plugin(name, width, height, version){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width="'+width+'" height="'+height+'"><param name="movie" value="'+name+'"><param name=quality value=high><embed src="'+name+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>');
}
/////////////////////////////////////////////////////////
//
// setMenubarG      menu bar construction script
//
/////////////////////////////////////////////////////////
//
// copyright 2002 web-engineer - www.web-engineer.co.uk
// last edit by J.Howard 19.05.2003
// 
// setMenubarG(openHTML, closeHTML, onstate, offstate, tertiarystate, button1, url1, button2, url2, ... , button[n], url[n])
//
/////////////////////////////////////////////////////////
// Set this variable for subpages to enable tertiary state of menubar
// It must be set to the button name String, NOT the url as this is 
// used for comparisan in setMenubarG!

var parentPage;
function setMenubarG(){
	var pageurl;
	if(location.href.indexOf('?')==-1){
		pageurl=location.href;
	} else { pageurl = 'null'; }
	var i=0;
	var button = '';
	var buttonURL = '';
	var openHTML = arguments[0];
	var closeHTML = arguments[1];
	var onState = arguments[2];
	var offState = arguments[3];
	var terState = arguments[4];
	var writeString = '';
	
	// Write the opening code
	document.write(openHTML);
	for(i=5; i<((arguments.length)-1); i=i+2){
		button = arguments[i];
		buttonURL = arguments[i+1];		
		// If we are at a subpage of the button, then render it in its
		// tertiary state
		if(parentPage==button){
			writeString = terState;
			writeString = writeString.replace(/@button/g, button);
			writeString = writeString.replace(/@URL/g, buttonURL);
			document.write(writeString);
		} else {
			if(pageurl.indexOf('/'+buttonURL)!=-1){
				// if this button is where we are at then dont make it a button
				// replace the @button and @buttonURL symbols
				writeString = offState;
				writeString = writeString.replace(/@button/g, button);
				writeString = writeString.replace(/@URL/g, buttonURL);
				document.write(writeString);
			} else {
				// draw a button
				// replace the @button and @buttonURL symbols
				writeString = onState;
				writeString = writeString.replace(/@button/g, button);
				writeString = writeString.replace(/@URL/g, buttonURL);
				document.write(writeString);
			}
		}
	}
	// Write the closing code
	document.write(closeHTML);
}

/////////////////////////////////////////////////////////
//
// gPreload.js       generic image preloader
//
/////////////////////////////////////////////////////////
//
// copyright 2002 web-engineer - www.web-engineer.co.uk
// last edit by C.Lawson 01.04.2003
//
/////////////////////////////////////////////////////////

function preloadImg(){
	var args = preloadImg.arguments;
	document.imageArray = new Array(args.length);
	for(var i=0; i<args.length; i++){
		document.imageArray[i] = new Image;
		document.imageArray[i].src = args[i];
	}
}
function toggle(element_id){
	var element = document.getElementById(element_id);
	var is_highlighted = (element.src.lastIndexOf('-2')!=-1);
	switch(is_highlighted){
		case true:
		element.src=element.src.substr(0,element.src.length-6)+'-0.jpg';
		break;
		
		case false:
		element.src=element.src.substr(0,element.src.length-6)+'-2.jpg';
		break
	}
}

var newwindow = ''

function popitup(imageurl) {
		if(newwindow!=''){ newwindow.close(); }
    newwindow=window.open('embtech-images.php?img='+imageurl,'embtech','width=556, height=10,top=100,left=100,resizable=no');
		newwindow.focus();
}

