function filter (imagename, objectsrc) {
	if (document.images) {
	document.images[imagename].src=eval(objectsrc+".src")
	}
}	

var sectionArray = new Array("browser","guide","village","site","city")

function setMouseSection(thisSec,curSec) {
	for (z = 0; z < sectionArray.length; z++) {
		if (thisSec==sectionArray[z]) {
			document.images["Stm0p0i"+z+"eIMG"].src="http://www.3b.net/graphics/icons/nav"+sectionArray[z]+"_on.gif";
		}
	}
	for (z = 0; z < sectionArray.length; z++) {
		if (curSec==sectionArray[z]) {
			document.images["Stm0p0i"+z+"eIMG"].src="http://www.3b.net/graphics/icons/nav"+sectionArray[z]+"_on.gif";
		}
	}
}
//var curSection=thisSection;

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

var arrayIndex = new Array(0,1,2,3,4);
var topnavArray = new Array("download","works","content","create","business");
var downloadArray = new Array("tour","intro3B","dload","getStarted","sysreq");
var worksArray = new Array("link1");
var contentArray = new Array("link2");
var createArray = new Array("link3");
var businessArray = new Array("link4");
var subnavArray = new Array(downloadArray,worksArray,contentArray,createArray,businessArray);

function matchArray(str,array1,array2) {
	var finalValue = "";
	for (z = 0; z < array1.length; z++) {
		if (array1[z]==str) {
			finalValue = array2[z];
		}
	}
	return finalValue;
}

function checkMatch(thisName,curName,writeThis,writeThat) {
	if (thisName==curName) {
		return writeThis;
	} else {
		return writeThat;
	}
}

function navOn(idName) {
	// first we turn off all the main ids
	for (x = 0; x < topnavArray.length; x++) {
//		document.getElementById(topnavArray[x]+"CurveLeft").src="http://www.3b.net/graphics/icons/blankCurveLeft.png";
//		document.getElementById(topnavArray[x]+"CurveRight").src="http://www.3b.net/graphics/icons/blankCurveRight.png";
//		document.getElementById(topnavArray[x]+"Cell").className="blankCurveSpacer "+topnavArray[x];
//		document.getElementById(topnavArray[x]+"Sub").style.display="none";
	}
	document.getElementById(idName+"CurveLeft").src="http://www.3b.net/graphics/icons/fullCurveLeft.png";
	document.getElementById(idName+"CurveRight").src="http://www.3b.net/graphics/icons/fullCurveRight.png";
	document.getElementById(idName+"Cell").className="fullCurveSpacer "+idName;
	
}

function navOff() {
	// first we turn off all the main ids
	var curveName = "blank";
	for (x = 0; x < topnavArray.length; x++) {
		if (topnavArray[x]==hubName) {
			curveName = "full";
		} else {
			curveName = "blank";
		}
		document.getElementById(topnavArray[x]+"CurveLeft").src="http://www.3b.net/graphics/icons/"+curveName+"CurveLeft.png";
		document.getElementById(topnavArray[x]+"CurveRight").src="http://www.3b.net/graphics/icons/"+curveName+"CurveRight.png";
		document.getElementById(topnavArray[x]+"Cell").className=curveName+"CurveSpacer "+topnavArray[x];
	}
}

function subNavOn(idName) {
	if (document.getElementById(subIdName)) {
		document.getElementById(subIdName).className="subOn";
	}
	document.getElementById(idName+"Sub").style.display="inline";
	navOn(idName,true);
}

function subNavOff(idName) {
	var index = matchArray(idName,topnavArray,arrayIndex);
	for (p = 0; p < subnavArray.length; p++) {
		for (q = 0; q < subnavArray[p].length; q++) {
			document.getElementById(subnavArray[p][q]).className="sub";
		}
	}
	if (document.getElementById(subIdName)) {
		document.getElementById(subIdName).className="sub";
	}
	navOff(idName,true);
}


function showSub(idName) {
	if (document.getElementById(idName+"Sub")) {
		document.getElementById(idName+"Sub").style.display="inline";
	}
}

function hideSub(idName) {
	if (idName == "") { // does all of them
		for (x = 0; x < topnavArray.length; x++) {
			document.getElementById(topnavArray[x]+"Sub").style.display="none";
		}
	} else {
		if (document.getElementById(idName+"Sub")) {
		//	document.getElementById(idName+"Sub").style.display="none";
		}	
	}	
}


var vb_flash_check = 0;
function get_flash_version(flash_required) {
    flash_version = 0;
    if (navigator.mimeTypes) {
			var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
			if (plugin)
	  	  flash_version = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
		}

    if (navigator.userAgent && navigator.userAgent.indexOf("MSIE") >= 0 && navigator.userAgent.indexOf("Win") >= 0) {
			document.writeln("<scr" + "ipt language=\"VBScript\"\>");
			document.writeln("on error resume next");
			document.writeln("vb_flash_check = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash."+ flash_required + "\")))");
			document.writeln("</scr" + "ipt>");
			if(vb_flash_check) // Should really check flash version
  		  flash_version = flash_required;
		}
  return flash_version;
}
		
function flashtry(version)
    {
    var flash_version = 0;

    if (parseInt(navigator.appVersion.substring(0,1)) > 2)
			flash_version = get_flash_version(version);

    if (flash_version >= version) {
	    return 1;
	} 
    return 0;
    }

function hasHref(theHref,str) {
	if (theHref!="") {
		return "<a href=\""+theHref+"\">"+str+"</a>";
	} else {
		return str;
	}
}

function matchArray(value,array1,array2) {
	var newValue = "";
	for (a = 0; a < array1.length; a++) {
		if (array1[a] == value) {
			newValue = array2[a];
			break;
		}
	}
	return newValue;
}

function checkMatch(thisValue,curValue,showThis,showThat) {
	if (thisValue==curValue) {
		return showThis;
	} else {
		return showThat;
	}
}

function flashVsImage(flashCheck,flashHref,flashPath,imagePath,fWidth,fHeight) {
	var flashHTML = "";
	var imageHTML = "";
	var html = "";
	
	if (flashPath != "") {
		flashHTML += "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+fWidth+"\" height=\""+fHeight+"\">";
			flashHTML += "<param name=\"movie\" value=\""+flashPath+"?clickTAG="+flashHref+"\">";
			flashHTML += "<param name=\"quality\" value=\"high\">";
			flashHTML += "<embed src=\""+flashPath+"?clickTAG="+flashHref+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+fWidth+"\" height=\""+fHeight+"\"></embed>";
		flashHTML += "</object>";
	}
	
	if (imagePath != "") {
		imageHTML += "<img src=\""+imagePath+"\" border=\"0\">";
	}
	if ((!flashtry(flashCheck)) || (flashCheck==0)) {
		html = imageHTML;
	} else {  // doesn't have flash version, so we show HTML version
		html = flashHTML;
	}		
	document.write(html);
}


