// Accessibility Options and Effects //
// Version V1.0.0, 18/02/2007 WBM. //
// Copyright 2007 Design Atom - www.designatom.com //

// Display the Accessibility Button
function fctShowAccessibility(){
	// Get the current position of the Button
	intPosLeft = parseInt(document.all.Accessibility.style.left);

	// Check if the Button has reached its final position
	if (intPosLeft < 8) {
		// Move the Accessibility Button onto the screen
		intPosLeft += 1;
		document.all.Accessibility.style.left = intPosLeft + "px";
		
		// Recall this function after a short delay to continue the motion
		setTimeout('fctShowAccessibility()',15);
	}
	else{
		// Show the scrollbars
		fctShowScrollbars(0)
	}
}

// Display the Scrollbars

// Define the Target colours for the scrollbar elements
scrollbarFaceColour = 'B203B0'; 
scrollbarShadowColour = '6D026C'; 
highlight_color = 'CC5FCB'; 
dlight_color = '000000'; 
darkshadow_color = '6D026C'; 
track_color = 'CC5FCB'; 
arrow_color = 'FFFFFF';
strStartColour = 'FFFFFF';

// Create two Arrays containing the target colours for the scrollbar and the target element names
arrTargetColours = new Array(scrollbarFaceColour, scrollbarShadowColour, highlight_color, dlight_color, darkshadow_color, track_color, arrow_color)
arrTargetElements = new Array("scrollbarFaceColor", "scrollbarShadowColor" , "scrollbarHighlightColor" , "scrollbar3dLightColor" , "scrollbarDarkShadowColor" , "scrollbarTrackColor" , "scrollbarArrowColor")

// Initialise the step counter for the number of passes through the function
var intStep = 0;
var intIndex = 0;

// Show Scrollbars function called after the Accessibility Button has finished
function fctShowScrollbars(){
	intIndex += 1;
	intPasses = 40;
	
	// Loop through each of the Scrollbar Elements defined in the array
	for(intCount=0; intCount<arrTargetElements.length; intCount++){
		// Split out the components for the target colour
		strTargetRed = arrTargetColours[intCount].substr(0,2);
		strTargetGreen = arrTargetColours[intCount].substr(2,2);
		strTargetBlue = arrTargetColours[intCount].substr(4,2);
		intTargetRed = parseInt(strTargetRed,16);
		intTargetGreen = parseInt(strTargetGreen,16);
		intTargetBlue = parseInt(strTargetBlue,16);
	
		// Split out the components for the current colour
		strStartRed = strStartColour.substr(0,2)
		strStartGreen = strStartColour.substr(2,2)
		strStartBlue = strStartColour.substr(4,2)
		intStartRed = parseInt(strStartRed,16);
		intStartGreen = parseInt(strStartGreen,16);
		intStartBlue = parseInt(strStartBlue,16);
	
		// Calculate the Target value for the Red on this pass
		// Make sure the result is an integer and positive
		intCurrentRed = intStartRed - Math.abs(Math.round((intStartRed - intTargetRed)*intIndex/intPasses));
	
		// Convert the Red value to a hex string
		strCurrentRed = intCurrentRed.toString(16);
		if (strCurrentRed.length<2) strCurrentRed = "0" + strCurrentRed;
	
		// Calculate the Target value for the Green on this pass
		// Make sure the result is an integer and positive
		intCurrentGreen = intStartGreen - Math.abs(Math.round((intStartGreen - intTargetGreen)*intIndex/intPasses));
	
		// Convert the Green value to a hex string
		strCurrentGreen = intCurrentGreen.toString(16);
		if (strCurrentGreen.length<2) strCurrentGreen = "0" + strCurrentGreen;
	
		// Calculate the Target value for the Blue on this pass
		// Make sure the result is an integer and positive
		intCurrentBlue = intStartBlue - Math.abs(Math.round((intStartBlue - intTargetBlue)*intIndex/intPasses));
	
		// Convert the Blue value to a hex string
		strCurrentBlue = intCurrentBlue.toString(16);
		if (strCurrentBlue.length<2) strCurrentBlue = "0" + strCurrentBlue;
	
		// alert("Current String" + "\n" + strCurrentRed + "\n" + strCurrentGreen + "\n" + strCurrentBlue)
		// Reconstruct the target colour string and apply to the scrollbar element
		eval('document.body.style.' + arrTargetElements[intCount] + '= "#" + strCurrentRed + strCurrentGreen + strCurrentBlue')
	}
	
	// Check if all the steps have been completed
	if (intIndex < intPasses) {
		// Recall this function after a sort delay
		setTimeout('fctShowScrollbars(' + intIndex + ')',25);
	}
}
