// DropDown.js will handle a mouseover event and cause a helper menu to scroll down
// below the hyperlink menu item.

//create 3 variable to handle detection of specific browsers
//NS4 for all Netscape 4.x systems
//IE should be capable of handling IE 4 and 5.0
//DOM should handle IE 5.5 and Netscape 6.0
// 1 means the browser by that name is true, 0 is false
var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;
var DOM = (document.getElementById) ? 1 : 0;

var loaded = 0;
var gotLayers = 0;
var lastbutton;


//LoadImgs preloads any images for the page before it displays
//this enables faster rollover effects as the rollover image is already in memory 
//instead of having to make a new call to the server to make the rollover work
function LoadImgs () 
{
	if (document.images) 
	{
		Order10 = new Image();
		Order10.src = "images/OrderNow0.gif";
		Order11 = new Image();
		Order11.src = "images/OrderNow1.gif";
		
		Order20 = new Image();
		Order20.src = "images/OrderNow0.gif";
		Order21 = new Image();
		Order21.src = "images/OrderNow1.gif";
		
		Order30 = new Image();
		Order30.src = "images/OrderNow0.gif";
		Order31 = new Image();
		Order31.src = "images/OrderNow1.gif";

		webdesign0 = new Image();
		webdesign0.src = "images/webdesign0.jpg";
		webdesign1 = new Image();
		webdesign1.src = "images/webdesign1.jpg";
		
		loaded = 1;
	}//end if
}// end function LoadImgs


	/*
	popUp controls the visibility of the specified layer on the mouse over event
	then makes a call to moveLayer and moveLayerBack to animate the current layer
	*/
	function popUp(layerName, on, desiredYAmt, vertAmt, returnAmt) 
	{
		if (gotLayers) 
		{
			if (on) 
			{
				if (NS4) 
				{
					document.layers[layerName].visibility = "show";
					moveLayer(layerName, desiredYAmt, vertAmt, returnAmt);
				}//end if statement 
				else if (DOM && (navigator.appName=="Netscape"))
				{
					document.getElementById(layerName).style.visibility = "visible";
					moveLayer(layerName, desiredYAmt, vertAmt, returnAmt);
				}//end else-if statement 
				else {
					document.all[layerName].style.visibility = "visible";
					moveLayer(layerName, desiredYAmt, vertAmt, returnAmt);
				}//end else statemnt
			}//end the if(on) statement 
			else 
			{
				if (NS4) 
				{
					document.layers[layerName].visibility = "hide";
					moveLayerBack(layerName, returnAmt);
				}//end if statement 
				else if (DOM && (navigator.appName=="Netscape"))
				{
					document.getElementById(layerName).style.visibility = "hidden";
					moveLayerBack(layerName, returnAmt);
				}//end else-if statement 
				else 
				{
					document.all[layerName].style.visibility = "hidden";
					moveLayerBack(layerName, returnAmt);
				}//end else statement
			}//end of outer else statement
		}//end of gotLayers if statement
	}//end of function popUp();
	
	/*
	moveLayer will get the current layername that it needs to move and it's position on the 
	y axis given to it by the popUp function.
	Then it will increment its Y position until it's reached it completly.  The setTimeout
	will make the redrawing of the image delay for 40 milliseconds so that the eye sees
	the illusion of movement
	*/
	function moveLayer(layerID, wantedYPos, vertAmt, returnAmt)
	{
		var currentY;
		var wantedY = parseInt(wantedYPos);
		var pixDown = parseInt(vertAmt);
		var temp = null;
		
		if(NS4)
		{
			currentY = parseInt(document.layers[layerID].pageY);
			idx = parseInt(currentY);
			temp = parseInt(wantedY);
			if(idx < temp) 
			{
				currentY += pixDown;
				document.layers[layerID].pageY = currentY;
				setTimeout("moveLayer('" + layerID + "','" + wantedYPos + "','" + vertAmt + "')", 40);
			}//end of if statement

		}//end of NS4 if statement
		
		else if(DOM && (navigator.appName=="Netscape"))
		{
			currentY = parseInt(document.getElementById(layerID).style.top);
			idx = parseInt(currentY);
			temp = parseInt(wantedY);
			
			if(idx < temp) 
			{
				currentY += pixDown;
				document.getElementById(layerID).style.top = currentY;
				setTimeout("moveLayer('" + layerID + "','" + wantedYPos + "','" + vertAmt + "','" + returnAmt + "')", 40);
			}//end of if statement

		}//end of else if statement
		
		else
		{
			currentY = parseInt(document.all[layerID].style.top);
			idx = parseInt(currentY);
			temp = parseInt(wantedY);
			
			if(idx < temp) 
			{
				currentY += pixDown;
				document.all[layerID].style.top = currentY;
				setTimeout("moveLayer('" + layerID + "','" + wantedYPos + "','" + vertAmt + "','" + returnAmt + "')", 40);
				
			}//end of if statement

			
		}//end of else statement
		
	}//end of function moveLayer

	/*
	moveLayerBack does just exactly what it says.  When the user mouses over the hyper link image the
	second time it will set the layer back into the original position so that it can be animated again
	*/
	function moveLayerBack(layerID, returnAmt)
	{
		if(NS4)
		{
			document.layers[layerID].pageY = returnAmt;
		}//end of if
		
		else if (DOM && (navigator.appName=="Netscape"))
		{
			document.getElementById(layerID).style.top = returnAmt;
		}//end of else if
		
		else
		{
			document.all[layerID].style.top = returnAmt;
		}//end of else
	}//end of function moveLayerBack

	function change(Name,No) 
	{
		if (document.images && (loaded == 1) && (document[Name])) 
		{
			document[Name].src = eval(Name + No + ".src");
		}//end if statement
		lastbutton = Name;
		if (No)
		{
			if (gotLayers)
			{
				poUp('ServicesLayer',0);
				popUp('LowerLayer',0);
			}//end if statement
		}//end of Outer if statement
	}//end function change
	
	function change2(Name,No) {
		if (document.images && (loaded == 1) && (document[Name])) 
		{
			document[Name].src = eval(Name + No + ".src");
		}//end if statement
		lastbutton = Name;
		
	}//end function change


//hide just does the opposite of change, it calls change and sets previous parameters to false
function hide() 
{
	if (document.images && (loaded == 1)) 
	{
		change2(lastbutton,0);
	}
}// end function() hide
LoadImgs();