//test for the flash plug-in
var hasReqestedVersion = DetectFlashVer(7, 0, 0);


var btn = new Image();
btn.url = '/shared/images/btn_property_on.gif';
var btn1 = new Image();
btn1.url = '/shared/images/btn_resident_on.gif';
var btn2 = new Image();
btn2.url = '/shared/images/btn_sniffing_on.gif';


//*********************************************************
function buildFlashHomepage(disableSound, pageUrl) {
	var newHTML = "";
	var flashVars = "disableSound=" + disableSound + "&pageUrl=" + escape(pageUrl);
	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/hp",
			"width", "625",
			"height", "324",
			"align", "center",
			"id", "flashhp",
			"quality", "high",
			"wmode","transparent",
			"bgcolor", "#000000",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"FlashVars", flashVars
		);

	} else {
		newHTML = newHTML + '<img src="/shared/images/home_header.gif" width="625" height="324" border="0">' + "\n";
	}

	document.write(newHTML);
	
}

//*********************************************************
function buildFlashTimeline() {
	var newHTML = "";
	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/timeline-multi",
			"width", "800",
			"height", "300",
			"align", "center",
			"id", "flashhp",
			"quality", "high",
			"wmode","transparent",
			"bgcolor", "#000000",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer"
		);

	} else {
		newHTML = newHTML + '<img src="/shared/images/home_header.gif" width="625" height="324" border="0">' + "\n";
	}

	document.write(newHTML);
	
}

//*********************************************************
function buildFlashHeader(thisSection, headerimg, headercolor, disableSound, pageUrl) {
	var newHTML = "";

	var homelink = "/index.php?noRedirect=true";
	var flashVars = "homelink=" + escape(homelink) + "&sectiontitle=" + thisSection + "&bgcolor=" + headercolor + "&disableSound=" + disableSound + "&pageUrl=" + escape(pageUrl);

	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/header",
			"width", "696",
			"height", "136",
			"align", "left",
			"id", "flashheader",
			"quality", "high",
			"bgcolor", "#000000",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"FlashVars", flashVars
		);
	} else {
		newHTML = newHTML + '<div id="pagetitle">' + thisSection + '</div>' + "\n";
		newHTML = newHTML + '<div><a href="' + homelink + '"><img src="' + headerimg + '" width="696" height="136" border="0"></a></div>' + "\n";
	}

	document.write(newHTML);
}

//*********************************************************
function buildFlashSupportBtn(thisURL, disableSound) {
	var newHTML = "";
	var flashVars = "disableSound=" + disableSound;

	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/support",
			
			"width", "100",
			"height", "65",
			"align", "center",
			"id", "flashsupport",
			"quality", "high",
			"bgcolor", "#000000",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"FlashVars", flashVars
		);
	
	} else {
		newHTML = newHTML + '<a href="' + thisURL + '"><img src="/shared/images/support.gif" border="0"></a>' + "\n";
	}

	document.write(newHTML);
	
}

//*********************************************************
function buildFlashProperty(disableSound) {
	var newHTML = "";
	var flashVars = "disableSound=" + disableSound;

	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/ringbell",
			
			"width", "254",
			"height", "434",
			"align", "top",
			"id", "flashproperty",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"FlashVars", flashVars
		);
	
	} else {
		newHTML = newHTML + '<a href="' + thisURL + '"><img src="/shared/images/support.gif" border="0"></a>' + "\n";
	}

	document.write(newHTML);
	
}

//*********************************************************
function buildFlashResident(disableSound) {
	var newHTML = "";
	var flashVars = "disableSound=" + disableSound;

	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/ringbellalt",
			
			"width", "254",
			"height", "434",
			"align", "top",
			"id", "flashresident",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"FlashVars", flashVars
		);
	
	} else {
		newHTML = newHTML + '<a href="' + thisURL + '"><img src="/shared/images/support.gif" border="0"></a>' + "\n";
	}

	document.write(newHTML);
	
}

//*********************************************************
function buildFlashSniff(disableSound) {
	var newHTML = "";
	var flashVars = "disableSound=" + disableSound;

	if (hasReqestedVersion) {
		AC_FL_RunContent(
			"src", "/shared/flash/sniff",
			
			"width", "254",
			"height", "434",
			"align", "top",
			"id", "flashsniff",
			"quality", "high",
			"bgcolor", "#ffffff",
			"allowScriptAccess", "sameDomain",
			"type", "application/x-shockwave-flash",
			'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
			"pluginspage", "http://www.macromedia.com/go/getflashplayer",
			"FlashVars", flashVars
		);
	
	} else {
		newHTML = newHTML + '<a href="' + thisURL + '"><img src="/shared/images/support.gif" border="0"></a>' + "\n";
	}

	document.write(newHTML);
	
}

//*********************************************************
//swap image with a new image URL
function swapImg(imgName, imgURL) {
	imgNum = getImgNum(imgName);

	if (imgNum > -1) {document.images[imgNum].src = imgURL;}
}

//*********************************************************
//find image number using older method for compatibility
function getImgNum(imgName) {
	for (i=0; i<document.images.length; i++) {
		if (document.images[i].name == imgName) {return i;}
	}

	return -1;
}

//*********************************************************
//preload the array of images
function preloadImages(imgArray) {
	var loadImg = new Array();

	for (i=0; i<imgArray.length; i++) {
		var thisImage = imgArray[i];
		var thisName = "img" + i;

		loadImg[i] = new Image();
		loadImg[i].src = thisImage;
	}
}
