
// Function used to show/hide the target div
function ToggleDiv($WhichDiv) {
	if (document.getElementById($WhichDiv).style.display == "none") {
		setOpac($WhichDiv,100); // set it to opaque (just in case)
		document.getElementById($WhichDiv).style.display = "block";
	} else {
		document.getElementById($WhichDiv).style.display = "none";
	}
}

// Function used to show/hide the target div utilizing fade effects below
function FadeToggleDiv($WhichDiv) {
	if (document.getElementById($WhichDiv).style.display == "none") {
		FadeIn($WhichDiv);
	} else {
		FadeOut($WhichDiv);
	}
}

// Function used to fade "in" a div
function FadeIn($WhichDiv) {
	setOpac($WhichDiv,0); // set it to transparent
	// display as block just in case
	document.getElementById($WhichDiv).style.display = "block"; 
	for( var i = 0 ; i <= 100 ; i++ ) {
		   setTimeout( 'setOpac(\''+$WhichDiv+'\',' + i + ')' , 8 * i );
	}
}

// Function used to fade "out" a div
function FadeOut($WhichDiv) {
	for( var i = 0 ; i <= 100 ; i++ ) {
		   setTimeout( 'setOpac(\''+$WhichDiv+'\',' + (100 - i) + ')' , 8 * i );
	}
	setTimeout('ToggleDiv(\''+$WhichDiv+'\')', 8 * i);
	setOpac($WhichDiv,100); // set it to opaque (just in case)
}

// Function used to set the opacity of a div (from 0 to 10)
function setOpac( $WhichDiv, value ) {
	document.getElementById($WhichDiv).style.opacity = value / 100;
	document.getElementById($WhichDiv).style.filter = 'alpha(opacity=' + value + ')';
}


// Function used to shrink/grow a div vertically
function ToggleVert($WhichDiv, $MinHeight, $MaxHeight) {
	var $CurrHeight = parseInt(document.getElementById($WhichDiv).style.height);
	if ($CurrHeight < ($MaxHeight - 10)) {
		VertScale($WhichDiv,$MaxHeight);
	} else {
		VertScale($WhichDiv,$MinHeight);
	}
}

// Function used to animate the scaling of a div vertically
function VertScale($WhichDiv, $EndHeight) {
	var $StartHeight = parseInt(document.getElementById($WhichDiv).style.height);
	// display as block just in case
	document.getElementById($WhichDiv).style.display = "block"; 
	// set the overflow to hidden
	document.getElementById($WhichDiv).style.overflow = 'hidden'; 
	for( var i = 0 ; i <= 50 ; i++ ) {
		   $CurrHeight = ($StartHeight - ((($StartHeight - $EndHeight) / 50) * (i-1)));
		   setTimeout( 'setHeight(\''+$WhichDiv+'\',' + $CurrHeight + ')' , 8 * i );
	}
	if ($EndHeight == 0) {
		setTimeout('ToggleDiv(\''+$WhichDiv+'\')', 8 * i);
	}
}

// Function used to set the height of a div
function setHeight( $WhichDiv, value ) {
	document.getElementById($WhichDiv).style.height = parseInt(value) + "px";
}