
var browser = document.all?"IE":(document.layers?"NS":(document.getElementById?"NS6":"IE"));//detect browser else try IE

function flashDetect(){
	if (typeof(browser)== "undefined") return;
	if (browser == "IE") return flashDetectIE()
	else return flashDetectNS()
}

//Internet Explorer Code
function flashDetectIE(){
	var fDetect = false;
	for (var i=1;i<10;i++){
		try { var x = typeof(new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i))} 
			catch(e){}
		if (x == "object") {
			// flash object detected
			fDetect = i
		}
	}
	return fDetect;			
}

//Netscape  code
function flashDetectNS(){
	var flashVersion = false;
	if (navigator.plugins) {
		// ...then check for flash 2 or flash 3+.
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {	
			var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;

			// DEBUGGING: uncomment next line to see the actual description.
			// alert("Flash plugin description: " + flashDescription);
			var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
		}
	}
	return flashVersion;
}

function AddFlashObjectToElement(element, name, url, flashVersion, height, width, alternativeContent)
{

	if (flashDetect() >= flashVersion)
	{
	var scriptStr = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+flashVersion+",0,0,0\" width=\""+width+"\" height=\""+height+"\" id=\""+name+"\"><param name=\"movie\" value=\""+url+"\"/> <param name=\"menu\" value=\"false\"/><param name=\"WMode\" value=\"transparent\"/> <param name=\"quality\" value=\"high\"/> <param name=\"bgcolor\" value=\"#FFFFFF\"/> <embed src=\"" + url + "\" menu=\"false\" quality=\"high\" bgcolor=\"#FFFFFF\" wmode=\"transparent\" width=\""+width+"\" height=\""+height+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></embed></object>";
	element.innerHTML = scriptStr;
	}
	else
	{
	element.innerHTML = alternativeContent;
	}
}

	function ObjectOnLoad()
	{
		if (document.getElementById("borderland")) 
		{
			var curEle = document.getElementById("borderland"); 
			AddFlashObjectToElement(curEle, "borderland", "/historiccarlisle/business/borderland.swf", 2, 244, 420, "To display the page correctly, your browser must support flash.");
		}

		if (document.getElementById("carlisle")) 
		{
			var curEle = document.getElementById("carlisle"); 
			AddFlashObjectToElement(curEle, "carlisle", "/historiccarlisle/business/carlisle.swf", 2, 244, 420, "To display the page correctly, your browser must support flash.");
		}

		if (document.getElementById("edenvalley")) 
		{
			var curEle = document.getElementById("edenvalley"); 
			AddFlashObjectToElement(curEle, "edenvalley", "/historiccarlisle/business/edenvalley.swf", 2, 244, 420, "To display the page correctly, your browser must support flash.");
		}

		if (document.getElementById("hadrianswall")) 
		{
			var curEle = document.getElementById("hadrianswall"); 
			AddFlashObjectToElement(curEle, "hadrianswall", "/historiccarlisle/business/hadrian.swf", 2, 244, 420, "To display the page correctly, your browser must support flash.");
		}

		if (document.getElementById("solwayfirth")) 
		{
			var curEle = document.getElementById("solwayfirth"); 
			AddFlashObjectToElement(curEle, "solwayfirth", "/historiccarlisle/business/solway.swf", 2, 244, 420, "To display the page correctly, your browser must support flash.");
		}
	}
