var visibleDiv = $("div1");

function toggle(newSrc){
                if($("div1").fx){$("div1").fx.cancel();}
                if($("div2").fx){$("div2").fx.cancel();}
                if(visibleDiv == $("div1")){
                    $("image2").src = newSrc;
                    $("div1").fx = new Fx.Tween($("div1"), {property: 'opacity'}, {duration: 2000}).start(0);
                    $("div2").fx = new Fx.Tween($("div2"), {property: 'opacity'}, {duration: 2000}).start(1);
                    visibleDiv = $("div2");
                }else{
                    $("image1").src = newSrc;
                    $("div1").fx = new Fx.Tween($("div1"), {property: 'opacity'}, {duration: 2000}).start(1);
                    $("div2").fx = new Fx.Tween($("div2"), {property: 'opacity'}, {duration: 2000}).start(0);
                    visibleDiv = $("div1");
                }
}
function loadImages(buttonsAndImages){
                for(biPairKey in buttonsAndImages) { 
                    var image = new Element('img',{ src:buttonsAndImages[biPairKey], style:'margin:3px;' });
                    $(biPairKey).image = image; 
                }            
}
function faderInit(){
                //create an object to store the relationship of the buttons to the images.
                var buttonsAndImages = {'overview':'../images/stage-overview.jpg','stage-1':'../images/stage-1-img.jpg','stage-2':'../images/stage-3-img.jpg','stage-3':'../images/stage-4-img.jpg'}; 
                loadImages(buttonsAndImages);
}
function restoreno() {
	var restcontainer=document.getElementById('overview');
	restcontainer.style.color="#333333";
	restcontainer.style.background="url(../images/button-iaq-overview.gif) no-repeat top left";
}
function dimno() {
	var restcontainer=document.getElementById('overview');
	restcontainer.style.color="#999999";
	restcontainer.style.background="url(../images/button-iaq-overview-dim.gif) no-repeat top left";	
}