var requiredFlashVersion = 8;
var isMac = navigator.userAgent.toLowerCase().indexOf("mac") + 1;
if (flashVersion >= requiredFlashVersion)
{	
    document.cookie = 'flash=' + flashVersion;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function displayAudit(){
	MM_openBrWindow('http://www.energysavingtrust.org.uk/proxy/view/full/165/homeenergycheck','audit','status=yes,scrollbars=yes,resizable=yes,width=780,height=600');
}

function displayIndesit(){
	MM_openBrWindow('/popup/popup.html','indesit','status=yes,scrollbars=no,resizable=no,width=600,height=600');
}

function displayToyota(){
	MM_openBrWindow('/popup/popup_toyota.html','toyota','status=yes,scrollbars=no,resizable=no,width=598,height=525');
}

function displayTC(){
	MM_openBrWindow('/popup/tc.html','toyota','status=yes,scrollbars=yes,resizable=no,width=598,height=525');
}

function displayPodcast(){
	MM_openBrWindow('/popup/jhpodcast.html','podcast','status=yes,scrollbars=no,resizable=no,width=401,height=327');
}

// =======================================================================
// Functions for displaying tips in Virtual House - HTML alternative
// -----------------------------------------------------------------------

function switchDiv(strDivName,bolVisible){
	var imgName = strDivName + "_img";
	objElement = document.getElementById(strDivName).style;
	imgElement = document.getElementById(imgName).style;
	if(!bolVisible){
		objElement.display = "none";
		imgElement.display = "none";
	} else {
		objElement.display = "";
		imgElement.display = "";
	}
}

function changeClass(Elem, myClass) {
	var elem;
	if(document.getElementById) {
		var elem = document.getElementById(Elem);
	} else if (document.all){
		var elem = document.all[Elem];
	}
	elem.className = myClass;
}

function hideHouseTips(){
	switchDiv("kitchen",false);
	switchDiv("dining",false);
	switchDiv("lounge",false);
	switchDiv("hallway",false);
	switchDiv("bathroom",false);
	switchDiv("bedroom",false);
}
function showHouseTips(room){
	hideHouseTips();
	switchDiv(room,true);	
}
// ============================================================================
