<!--

// ALPHA FADE ROUTINE

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
} 

var lst = 0;
var lst2 = 0;
var lst3 = 0;

function setFadeIn(objContainer,status) {
	var obj = document.getElementById(objContainer);
	if(lst != 0){ lst.style.display = "none"; }
	changeOpac(0,objContainer);
	obj.style.display = status;
	opacity(objContainer,0,100,500);
	lst = obj;
}

function setFadeIn2(objContainer,status) {
	var obj = document.getElementById(objContainer);
	if(lst2 != 0){ lst2.style.display = "none"; }
	changeOpac(0,objContainer);
	obj.style.display = status;
	opacity(objContainer,0,100,500);
	lst2 = obj;
}

function setFadeInSubBack(objContainer,status) {
	var obj = document.getElementById(objContainer);
	if(lst3 != 0){ lst3.style.display = "none"; }
	changeOpac(0,objContainer);
	obj.style.display = status;
	opacity(objContainer,0,95,500);
	lst3 = obj;
}



// VISIBILITY TAGS

function fnVisible(objContainer) {
	var obj = document.getElementById(objContainer);
	if (obj.style.display == "block") {
		obj.style.display = "none";
	} else {
		obj.style.display = "block";
	}
}

function setVisible(objContainer,status) {
	var obj = document.getElementById(objContainer);
	obj.style.display = status;
}




// REPLACE DIV CONTENTS

function fetchpage(url, target) {
  document.getElementById(target).innerHTML="&nbsp;";
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {fetchpageDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function fetchpageDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" Screen Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function load(name, div) {
	fetchpage(name,div);
	return false;
}


// FOR DOT LOAD

function fetchpage2(url2, target2) {
  document.getElementById(target2).innerHTML="&nbsp;";
  if (window.XMLHttpRequest) {
    req2 = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req2 = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req2 != undefined) {
    req2.onreadystatechange = function() {fetchpageDone2(url2, target2);};
    req2.open("GET", url2, true);
    req2.send("");
  }
}  

function fetchpageDone2(url2, target2) {
  if (req2.readyState == 4) { // only if req is "loaded"
    if (req2.status == 200) { // only if "OK"
      document.getElementById(target2).innerHTML = req2.responseText;
    } else {
      document.getElementById(target2).innerHTML=" Screen Error:\n"+ req2.status + "\n" +req2.statusText;
    }
  }
}

function loaddots(name2, div2) {
	fetchpage2(name2,div2);
	return false;
}





//------- GLOBAL FUNCTIONS ---------

// HIDE LOADING DIV
function hideloading() {
	document.getElementById('loadingboxwoodfin').style.display='none';
	document.getElementById('loadingwoodfin').style.display='none';
}



// DISPLAY SUBPAGE FRAME
function showsubpageframe() {
	if (document.getElementById('whitecontentback').style.display!='block') {
		setFadeInSubBack('whitecontentback','block');
		document.getElementById('whitecontent').style.display='block';
	}
}
// HIDE SUBPAGE FRAME
function hidesubpageframe() {
	document.getElementById('whitecontent').style.display='none';
	document.getElementById('whitecontentback').style.display='none';
}



// QUICK LINKS OPEN
function showquicklinks() {
	document.getElementById('qlclosed').style.display='none';
	document.getElementById('qlopen').style.display='block';
	document.getElementById('qllinks').style.display='block';
}
// QUICK LINKS CLOSED
function hidequicklinks() {
	document.getElementById('qlclosed').style.display='block';
	document.getElementById('qlopen').style.display='none';
	document.getElementById('qllinks').style.display='none';
}
// QUICK LINKS DOT PAGE CLICK
function loadquickdotpage(section) {
	hideallsectionlinks();
	hidesectionlinks(section);
	replacesectionroll(section);
}




// SKIP INTRO ON
function showskipintro() {
	document.getElementById('skipintro').style.display='block';
}
// SKIP INTRO OFF
function hideskipintro() {
	document.getElementById('skipintro').style.display='none';
}
// SKIP INTRO
function skipintro() {
	hidequicklinks();
	hideskipintro();
	hideintromovies();
	if (document.getElementById('fuels_over').style.display=="block") {
		showhousecut();
		showsectionlinks('fuels');
		showsectiondots('fuels');
	} else if (document.getElementById('plumbing_over').style.display=="block") {
		showhousecut();
		showsectionlinks('plumbing');
		showsectiondots('plumbing');
	} else if (document.getElementById('hvac_over').style.display=="block") {
		showhousecut();
		showsectionlinks('hvac');
		showsectiondots('hvac');
	} else if (document.getElementById('iaq_over').style.display=="block") {
		showhousecut();
		showsectionlinks('iaq');
		showsectiondots('iaq');
	} else if (document.getElementById('electric_over').style.display=="block") {
		showhousecut();
		showsectionlinks('electric');
		showsectiondots('electric');
	} else if (document.getElementById('security_over').style.display=="block") {
		showhousecut();
		showsectionlinks('security');
		showsectiondots('security');
	} else if (document.getElementById('company_over').style.display=="block") {
		showhousecut();
		showsectionlinks('company');
		showsectiondots('company');
	} else if (document.getElementById('conservation_over').style.display=="block") {
		showhousecut();
		showsectionlinks('conservation');
		showsectiondots('conservation');
	} else if (document.getElementById('explore_over').style.display=="block") {
		showhousecut();
		showsectiondots('explore');
	} else {
		showquicklinks();
		showsubpageframe();
		load("home.php","whitecontent");
	}
}
// SHOW INTRO MOVIES
function showintromovies() {
	document.getElementById('intromovies').style.display='block';
}
// HIDE INTRO MOVIES
function hideintromovies() {
	document.getElementById('intromovies').style.display='none';
	load("empty.php","intromovies");
}




// SHOW HOUSE CUT
function showhousecut() {
	if (document.getElementById('housecut').style.display!='block') {
		setFadeIn('housecut','block');
	}
}
// HIDE HOUSE CUT
function hidehousecut() {
	document.getElementById('housecut').style.display='none';
}



// RETURN TO HOUSE FROM DOT PAGE
function housereturn() {
	hidesubpageframe();
}



// SHOW SECTION LINKS
function showsectionlinks(section) {
	var sectionlinkcloseddiv=section+"_closed";
	var sectionlinkopendiv=section+"_open";
	var sectionlinks=section+"_links";
	document.getElementById(sectionlinkcloseddiv).style.display='none';
	document.getElementById(sectionlinkopendiv).style.display='block';
	document.getElementById(sectionlinks).style.display='block';
}
// HIDE SECTION LINKS
function hidesectionlinks(section) {
	var sectionlinkcloseddiv=section+"_closed";
	var sectionlinkopendiv=section+"_open";
	var sectionlinks=section+"_links";
	document.getElementById(sectionlinkcloseddiv).style.display='block';
	document.getElementById(sectionlinkopendiv).style.display='none';
	document.getElementById(sectionlinks).style.display='none';
}
// REMOVE SECTION LINKS
function removesectionlinks(section) {
	var sectionlinkcloseddiv=section+"_closed";
	var sectionlinkopendiv=section+"_open";
	var sectionlinks=section+"_links";
	document.getElementById(sectionlinkcloseddiv).style.display='none';
	document.getElementById(sectionlinkopendiv).style.display='none';
	document.getElementById(sectionlinks).style.display='none';
}
// HIDE ALL SECTION LINKS
function hideallsectionlinks() {
	removesectionlinks('fuels');
	removesectionlinks('plumbing');
	removesectionlinks('hvac');
	removesectionlinks('iaq');
	removesectionlinks('electric');
	removesectionlinks('security');
	removesectionlinks('company');
	removesectionlinks('conservation');
}




// REVERT NAV ROLLS
function revertnavrolls() {
	document.getElementById('fuels_over').style.display='none';
	document.getElementById('plumbing_over').style.display='none';
	document.getElementById('hvac_over').style.display='none';
	document.getElementById('iaq_over').style.display='none';
	document.getElementById('electric_over').style.display='none';
	document.getElementById('security_over').style.display='none';
	document.getElementById('company_over').style.display='none';
	document.getElementById('conservation_over').style.display='none';
	document.getElementById('explore_over').style.display='none';
}
// REPLACE SECTION ROLL
function replacesectionroll(section) {
	var newrolldiv=section+"_over";
	document.getElementById(newrolldiv).style.display='block';
}




// EXPLORE FUNCTIONS

function exploresectionon(section) {
	if (document.getElementById('explore_over').style.display=="block") {
		var newrolldiv=section+"_over";
		document.getElementById(newrolldiv).style.display='block';
	}
}
function exploresectionoff(section) {
	if (document.getElementById('explore_over').style.display=="block") {
		var newrolldiv=section+"_over";
		document.getElementById(newrolldiv).style.display='none';
	}
}
function exploresectionclick(section) {
	if (document.getElementById('explore_over').style.display=="block") {
		showsectionlinks(section);
	}
}
function exploresectionclose() {
	if (document.getElementById('explore_over').style.display=="block") {
		hideallsectionlinks();
	}
}



// SHOW SECTION DOTS
function showsectiondots(section) {
	if (document.getElementById('housedots').style.display!='block') {
		var sectiondots=section+"_dots.php";
		loaddots(sectiondots,"housedots");
		setFadeIn2('housedots','block');
	}
}
// HIDE ALL DOTS
function hidealldots() {
	document.getElementById('housedots').style.display='none';
}
// DOT OVER CHECK
function dotoversover(overid) {
	if (document.getElementById('housecut').style.display=='block') {
		setVisible(overid,'block')
	}
}
function dotoversout(overid) {
	if (document.getElementById('housecut').style.display=='block') {
		setVisible(overid,'none')
	}
}



// LOAD HOME PAGES
function loadhomepages() {
	hidequicklinks();
	hidehousecut();
	hidealldots();
	revertnavrolls();
	hideallsectionlinks();
	showskipintro();
	hidesubpageframe();
	showintromovies();
	hideloading();
}


//------- END GLOBAL FUNCTIONS ---------




// HOME PAGE FUNCTIONS

function load_quickhome() {
	loadhomepages();
	hideintromovies();
	introhomeone();
	introhometwo();
}

function load_home() {
	loadhomepages();
	var currentpage="home";
	document.getElementById('intromovies').style.width='300px';
	document.getElementById('intromovies').style.left='-20px';
	load("video/intro.php","intromovies");
}

function introhomeone() {
	showsubpageframe();
	load("home.php","whitecontent");
}

function introhometwo() {
	hideskipintro();
	showquicklinks();
}


// SECTION HOMES

function load_fuels() {
	loadhomepages();
	hidesectionlinks('fuels');
	replacesectionroll('fuels');
	document.getElementById('intromovies').style.width='300px';
	document.getElementById('intromovies').style.left='-20px';
	load("video/fuels.php","intromovies");
}

function load_plumbing() {
	loadhomepages();
	hidesectionlinks('plumbing');
	replacesectionroll('plumbing');
	document.getElementById('intromovies').style.width='330px';
	document.getElementById('intromovies').style.left='0px';
	load("video/plumbing.php","intromovies");
}

function load_hvac() {
	loadhomepages();
	hidesectionlinks('hvac');
	replacesectionroll('hvac');
	document.getElementById('intromovies').style.width='300px';
	document.getElementById('intromovies').style.left='-20px';
	load("video/hvac.php","intromovies");
}

function load_iaq() {
	loadhomepages();
	hidesectionlinks('iaq');
	replacesectionroll('iaq');
	document.getElementById('intromovies').style.width='320px';
	document.getElementById('intromovies').style.left='0px';
	load("video/iaq.php","intromovies");
}

function load_electric() {
	loadhomepages();
	hidesectionlinks('electric');
	replacesectionroll('electric');
	document.getElementById('intromovies').style.width='330px';
	document.getElementById('intromovies').style.left='-10px';
	load("video/electric.php","intromovies");
}

function load_security() {
	loadhomepages();
	hidesectionlinks('security');
	replacesectionroll('security');
	document.getElementById('intromovies').style.width='320px';
	document.getElementById('intromovies').style.left='-20px';
	load("video/security.php","intromovies");
}

function load_company() {
	loadhomepages();
	hidesectionlinks('company');
	replacesectionroll('company');
	document.getElementById('intromovies').style.width='300px';
	document.getElementById('intromovies').style.left='-25px';
	load("video/company.php","intromovies");
}

function load_conservation() {
	loadhomepages();
	hidesectionlinks('conservation');
	replacesectionroll('conservation');
	document.getElementById('intromovies').style.width='300px';
	document.getElementById('intromovies').style.left='-20px';
	load("video/conservation.php","intromovies");
}

function load_explore() {
	loadhomepages();
	replacesectionroll('explore');
	document.getElementById('intromovies').style.width='300px';
	document.getElementById('intromovies').style.left='-25px';
	load("video/explore.php","intromovies");
}

// INTRO MOVIE FUNCTIONS
function load_sectionintroone(section) {
	showhousecut();
	showsectiondots(section);
}

function load_sectionintrotwo(section) {
	hideskipintro();
	if (section!="explore") { showsectionlinks(section); }
}


// SUBPAGE CONTENT FUNCTIONS

function load_subpage(passedpage) {
	hideskipintro();
	hidehousecut();
	hidealldots();
	revertnavrolls();
	hideallsectionlinks();
	hideintromovies();
	showsubpageframe();
	hideloading();
	load(passedpage+".php","whitecontent");
}
function load_dotpage(passedsection,passedpage) {
	hideskipintro();
	hideintromovies();
	showhousecut();
	showsectiondots(passedsection);
	showsubpageframe();
	hideloading();
	load(passedpage+".php","whitecontent");
}
function load_changedotpage(passedsection,passedpage) {
	hidealldots();
	revertnavrolls();
	hidequicklinks();
	hideallsectionlinks();
	showsectiondots(passedsection);
	replacesectionroll(passedsection);
	showsectionlinks(passedsection);
	load(passedpage+".php","whitecontent");
}
function onload_subpage() {
	hidequicklinks();
	hideskipintro();
	showsubpageframe();
	hideintromovies();
	hideloading();
}
function onload_dotpage(section) {
	showhousecut();
	showsectiondots(section);
	replacesectionroll(section);
	showsectionlinks(section);
	hideloading();
}


// -->

