
// company xfader


var layerThatFades1, layerThatFades2, layerThatAppears1, layerThatAppears2;

var op1, op2, stepAmount, stepInterval, stepCounter, hop;

function Opacitate3() {
	
	  op1-=hop;
	  op2+=hop;
	
		setOpacity(layerThatFades1,op1);
		setOpacity(layerThatAppears1,op2);

		setOpacity(layerThatFades2,op1);
		setOpacity(layerThatAppears2,op2);		
		
		stepCounter++;
		
		if (stepCounter<stepAmount) {
			setTimeout("Opacitate3()", stepInterval);
		} else {
			document.getElementById(layerThatFades1).style.visibility = "hidden";
			document.getElementById(layerThatFades2).style.visibility = "hidden";
			return;
		}
}

function divcrossfade3(divToShow, divToHide2, divToHide1) {
	
	if (document.getElementById(divToShow).style.visibility == "visible") return;
	
	duration = 200; 	// transition duration in miliseconds
	hop = 0.05; 			// opacity change interval
	
	stepAmount = Math.round( 1 / hop ); // how many steps
	stepInterval = Math.round( duration / stepAmount );
	stepCounter = 0;

	layerThatAppears1=divToShow;
	layerThatAppears2=divToShow + 'Menu';
	
	op1=1; // from one to zero, disappears
	op2=0; // from zero to one, appears
	
	if (document.getElementById(divToHide1).style.visibility == "visible") {
		layerThatFades1=divToHide1;
		layerThatFades2=divToHide1 + 'Menu';
	}
	else {
		layerThatFades1=divToHide2;
		layerThatFades2=divToHide2 + 'Menu';
	}
	
	setOpacity(layerThatAppears1,0);
	setOpacity(layerThatFades1,1);

	setOpacity(layerThatAppears2,0);
	setOpacity(layerThatFades2,1);
	
	document.getElementById(layerThatAppears1).style.visibility = "visible";		
	document.getElementById(layerThatFades1).style.visibility = "visible";

	document.getElementById(layerThatAppears2).style.visibility = "visible";		
	document.getElementById(layerThatFades2).style.visibility = "visible";
	
	setTimeout("Opacitate3()", stepInterval);
	
}



