var requiredVersion = 4;
var flash2Installed = false;
var flash3Installed = false;
var flash4Installed = false;
var flash5Installed = false;
var flash6Installed = false;
var flash7Installed = false;
var flash8Installed = false;
var flash9Installed = false;
var flash10Installed = false;
var flash11Installed = false;
var flash12Installed = false;
var maxVersion = 12;
var actualVersion = 0;
var hasRightVersion = false;
var transparentFlash="false";
var jsVersion = 1.0;
var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
jsVersion = 1.1;

// Use VBScript written to the browser if this is IE on Windoze
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');  
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');  
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');  
  document.write('flash10Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10"))) \n');  
  document.write('flash11Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.11"))) \n');  
  document.write('flash12Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.12"))) \n');  
  document.write('</SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

detectFlash();

var blnHoverLock;
onload_events = new Array();
//onload_events[onload_events.length] = "initNavMouseovers('Khov4NewHomesMainNav')";




window.onload = function(){
	for (var i=0; i< onload_events.length; i++) {
		eval(onload_events[i]);
	}
};

var DOM_OBJECTS = Array();
var nav_off_regex = /(\.+)[0](\.gif)$/;


function initNavMouseovers(nav_id) {


	if (DOM_OBJECTS[nav_id] = document.getElementById(nav_id)) {

		var nav_images = Array();
		nav_images = DOM_OBJECTS[nav_id].getElementsByTagName('img');

		for (var i=0; i< nav_images.length; i++) {
			if (!nav_off_regex.test(nav_images[i].src)) continue;

			nav_images[i].std_img = new Image();
			nav_images[i].std_img.src = nav_images[i].src;

			nav_images[i].hover_img = new Image();
			nav_images[i].hover_img.src = nav_images[i].src.replace(nav_off_regex, "$1" + "1" + "$2");

			nav_images[i].onmouseover = function() { if(nav_id=='Khov4NewHomesMainNav'){		nav_images2 = document.getElementById("productsandservices").getElementsByTagName('img');

		for (var j=0; j< nav_images2.length; j++) 
		{
			nav_images2[j].src = nav_images2[j].src.replace(/(\.+)[1](\.gif)$/, "$1" + "0" + "$2");
		}	}

this.src = this.hover_img.src;  blnHoverLock=true;};
			nav_images[i].onmouseout = function() { this.src = this.std_img.src;  blnHoverLock=false;};
		}


	}

} // end initNavMouseovers()


function detectFlash() 
{  

		if (navigator.plugins) 
		{
			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;
				var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
				flash2Installed = flashVersion == 2;    
				flash3Installed = flashVersion == 3;
				flash4Installed = flashVersion == 4;
				flash5Installed = flashVersion == 5;
				flash6Installed = flashVersion >= 6;
				flash7Installed = flashVersion >= 7;
				flash8Installed = flashVersion >= 8;
				flash9Installed = flashVersion >= 9;
				flash10Installed = flashVersion >= 10;
				flash11Installed = flashVersion >= 11;
				flash12Installed = flashVersion >= 12;
			}
		}

		// Set Maximum Version installed
		for (var i = 2; i <= maxVersion; i++) if (eval("flash" + i + "Installed") == true) actualVersion = i;
		// WebTV kludge
		if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 3;  
		

} // end detectFlash


function launchVideo(oTemp, eTemp, sTemp, sID)
{
var tmpPos = new ElementPosition(sID);
sTemp='<div id="MediaContent" style="width:400px; height:300px;"></div>';
detectFlash();
	if(flash8Installed)
	{
		domTT_activate(oTemp, eTemp, 'position','absolute','content', sTemp, 'type', 'sticky', 'x', divPos.x+50 ,'y', tmpPos.y-113 , 'closeAction','destroy','closeLink', 'X&nbsp;');
		eval("launchTour" + sID + "();");
	}
	else
	{
		domTT_activate(oTemp, eTemp, 'content', '<div style="background:#fff;">You need the <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW">Adobe Flash Player</a> to view this content. <br/>Please <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BIOW">Install the Flash Player</a> and reload the video.<br/><br/></div>','type', 'sticky', 'parent' ,document.getElementById('InnerBodyWrapper'),'position','absolute','x', divPos.x+50 ,'y', tmpPos.y-113 , 'closeLink', 'X&nbsp;');
	}
}


function TableToggle(WhichSection,classStyle) {
	var CurrSection = document.getElementById(WhichSection);
		if(classStyle!='')
		{
			classStyle=classStyle;
		}
		else
		{
			classStyle='showtablecolumn';
		}



	if ((CurrSection.className == classStyle) || (CurrSection.className.length == 0)) {
		CurrSection.className = "hidetablecolumn";
	} else {
	CurrSection.className = classStyle;
	}
}

function TableToggleOff(WhichSection) {
	var CurrSection = document.getElementById(WhichSection);
		CurrSection.className = "hidetablecolumn";
}

