function fadeElement(theID, fadeCurrent, fadeAmount, fadeSteps) {

	if (fadeCurrent == fadeSteps) {

		// We're done, so clear.

		clearInterval(fadeTimer[theID]);
		fadeActive[theID] = false;
		fadeTimer[theID] = false;

		// Should we close it once the fade is complete?

		if (fadeClose[theID] == true) {
			document.getElementById(theID).style.visibility = "hidden";
		}

		// Hang on.. did a command queue while we were working? If so, make it happen now

		if (fadeQueue[theID] && fadeQueue[theID] != false) {
			fadeElementSetup(fadeQueue[theID][0], fadeQueue[theID][1], fadeQueue[theID][2], fadeQueue[theID][3]);
			fadeQueue[theID] = false;
		}
	} else {

		fadeCurrent++;
		
		// Now actually do the fade adjustment.
		
		if (fadeMode[theID] == "shadow") {

			// Do a special fade on the webkit-box-shadow of the object
		
			if (fadeAmount < 0) {
				document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (Math.abs(fadeCurrent * fadeAmount)) + ')';
			} else {
				document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (100 - (fadeCurrent * fadeAmount)) + ')';
			}
			
		} else {
		
			// Set the opacity depending on if we're adding or subtracting (pos or neg)
			
			if (fadeAmount < 0) {
				setOpacity(Math.abs(fadeCurrent * fadeAmount), theID);
			} else {
				setOpacity(100 - (fadeCurrent * fadeAmount), theID);
			}
		}

		// Keep going, and send myself the updated variables
		clearInterval(fadeTimer[theID]);
		fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15);
	}
}
// many instances can run concurrently. Can fade using opacity, or fade using a box-shadow.
many instances can run concurrently. Can fade using opacity, or fade using a box-shadow.
many instances can run concurrently . Can fade using opacity or fade using a box - shadow .
function fadeElement(theID, fadeCurrent, fadeAmount, fadeSteps) {
	if (fadeCurrent == fadeSteps) {
		clearInterval(fadeTimer[theID]);
		fadeActive[theID] = false;
		fadeTimer[theID] = false;
		if (fadeClose[theID] == true) {
			document.getElementById(theID).style.visibility = "hidden";
		}
		if (fadeQueue[theID] && fadeQueue[theID] != false) {
			fadeElementSetup(fadeQueue[theID][0], fadeQueue[theID][1], fadeQueue[theID][2], fadeQueue[theID][3]);
			fadeQueue[theID] = false;
		}
	} else {
		fadeCurrent++;
		if (fadeMode[theID] == "shadow") {
			if (fadeAmount < 0) {
				document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (Math.abs(fadeCurrent * fadeAmount)) + ')';
			} else {
				document.getElementById(theID).style.webkitBoxShadow = shadowSettings + (100 - (fadeCurrent * fadeAmount)) + ')';
			}
		} else {
			if (fadeAmount < 0) {
				setOpacity(Math.abs(fadeCurrent * fadeAmount), theID);
			} else {
				setOpacity(100 - (fadeCurrent * fadeAmount), theID);
			}
		}
		clearInterval(fadeTimer[theID]);
		fadeTimer[theID] = setInterval("fadeElement('"+theID+"', '"+fadeCurrent+"', '"+fadeAmount+"', '"+fadeSteps+"')", 15);
	}
}
function fadeElement ( theID , fadeCurrent , fadeAmount , fadeSteps ) { if ( fadeCurrent == fadeSteps ) { clearInterval ( fadeTimer [ theID ] ) ; fadeActive [ theID ] = false ; fadeTimer [ theID ] = false ; if ( fadeClose [ theID ] == true ) { document . getElementById ( theID ) . style . visibility = "hidden" ; } if ( fadeQueue [ theID ] && fadeQueue [ theID ] != false ) { fadeElementSetup ( fadeQueue [ theID ] [ 0 ] , fadeQueue [ theID ] [ 1 ] , fadeQueue [ theID ] [ 2 ] , fadeQueue [ theID ] [ 3 ] ) ; fadeQueue [ theID ] = false ; } } else { fadeCurrent ++ ; if ( fadeMode [ theID ] == "shadow" ) { if ( fadeAmount < 0 ) { document . getElementById ( theID ) . style . webkitBoxShadow = shadowSettings + ( Math . abs ( fadeCurrent * fadeAmount ) ) + ')' ; } else { document . getElementById ( theID ) . style . webkitBoxShadow = shadowSettings + ( 100 - ( fadeCurrent * fadeAmount ) ) + ')' ; } } else { if ( fadeAmount < 0 ) { setOpacity ( Math . abs ( fadeCurrent * fadeAmount ) , theID ) ; } else { setOpacity ( 100 - ( fadeCurrent * fadeAmount ) , theID ) ; } } clearInterval ( fadeTimer [ theID ] ) ; fadeTimer [ theID ] = setInterval ( "fadeElement('" + theID + "', '" + fadeCurrent + "', '" + fadeAmount + "', '" + fadeSteps + "')" , 15 ) ; } }
many instances can run concurrently.
many instances can run concurrently .
// We're done, so clear. // Should we close it once the fade is complete? // Hang on.. did a command queue while we were working? If so, make it happen now // Now actually do the fade adjustment. // Do a special fade on the webkit-box-shadow of the object // Set the opacity depending on if we're adding or subtracting (pos or neg) // Keep going, and send myself the updated variables