//functions to show/hide topnav menu dropdowns...
function toggleCheck(thisField) {
   checkSet = eval("document.TheForm." + thisField)
   checkSet.checked = !(checkSet.checked)
}

function toggleRadio(thisField,thisValue) {
   radioSet = eval("document.TheForm."+thisField)
   for (i=0;i < radioSet.length;i++) {
      if (radioSet[i].value == thisValue)
         radioSet[i].checked = true
   }
}
	
	function getRealLeft(theimg) 
	{
		xPos = theimg.offsetLeft;
		tempEl = theimg.offsetParent;
	  	while (tempEl != null) {
	  		xPos += tempEl.offsetLeft;
	  		tempEl = tempEl.offsetParent;
	  	}
		return xPos;
	}

	function getRealTop(theimg) 
	{
		yPos = theimg.offsetTop;
		tempEl = theimg.offsetParent;
		while (tempEl != null) {
	  		yPos += tempEl.offsetTop;
	  		tempEl = tempEl.offsetParent;
	  	}
		return yPos;
	}


	function FindMyObj(strName) 
	{ 
		var i, retval;  
		dizoc=document; 

		if(!(retval=dizoc[strName]) && dizoc.all) 
			retval=dizoc.all[strName]; 
		
		for (i=0;!retval && i<dizoc.forms.length; i++) 
			retval=dizoc.forms[i][strName];
	  
		for(i=0; !retval&&dizoc.layers && i<dizoc.layers.length; i++) 
			retval = FindMyObj(strName, dizoc.layers[i].document); 
			
		return retval;
	}

	function ShowLayers()
	{
		var obj, args = ShowLayers.arguments;
	  
		for (i=0; i<(args.length); i++)
		{
	  		if ((obj=FindMyObj(args[i]))!=null) 
			{ 	
				if (obj.style) 
				{ 
					obj=obj.style; 			
				}
				obj.visibility = 'visible'; 
			}
		}
	}

	function ShowLayer(layername, theObject)
	{
		var obj;
	  
		if ((obj=FindMyObj(layername))!=null) 
		{ 
			var IE4 = (document.all) ? true : false;
			var NS4 = (document.layers) ? true : false;
			var xPos = (NS4) ? theObject.x : getRealLeft(theObject);
			var yPos = (NS4) ? theObject.y : getRealTop(theObject);
						
			yPos += 16;
			xPos -= 9;
			
			//set the location of the menu...
			if (obj.style) 
			{ 
				obj=obj.style; 	
				obj.pixelLeft = xPos;
				obj.pixelTop = yPos;		
			}
			obj.left = xPos;
			obj.top = yPos;
			obj.visibility = 'visible'; 
			
		}
	}
	
	//IE only...
	function ShowLayerIE(layername, theObject)
	{
		var obj;
		
		var IE4 = (document.all) ? true : false;
		var NS4 = (document.layers) ? true : false;
	  
		if (IE4)
		{
			if ((obj=FindMyObj(layername))!=null) 
			{ 
				var IE4 = (document.all) ? true : false;
				var NS4 = (document.layers) ? true : false;
				var xPos = (NS4) ? theObject.x : getRealLeft(theObject);
				var yPos = (NS4) ? theObject.y : getRealTop(theObject);
							
				yPos += 16;
				xPos -= 9;
				
				//set the location of the menu...
				if (obj.style) 
				{ 
					obj=obj.style; 	
					obj.pixelLeft = xPos;
					obj.pixelTop = yPos;		
				}
				obj.left = xPos;
				obj.top = yPos;
				obj.visibility = 'visible'; 
				
			}
		}
	}

	function HideLayers()
	{
		var obj, args = HideLayers.arguments;
	  
		for (i=0; i<(args.length); i++)
		{
	  		if ((obj=FindMyObj(args[i]))!=null) 
			{ 
				if (obj.style) 
				{ 
					obj=obj.style; 			
				}
				obj.visibility = 'hidden'; 
			}
		}
	}

	//IE only
	function HideLayersIE()
	{
		var obj, args = HideLayersIE.arguments;
	
		var IE4 = (document.all) ? true : false;
		var NS4 = (document.layers) ? true : false;
			  
		if(IE4)
		{
			for (i=0; i<(args.length); i++)
			{
	  			if ((obj=FindMyObj(args[i]))!=null) 
				{ 
					if (obj.style) 
					{ 
						obj=obj.style; 			
					}
					obj.visibility = 'hidden'; 
				}
			}
		}
	}

	function MenuRollOut(layerName)
	{
		var obj, errorMargin;
		errorMargin = 5;
		obj = FindMyObj(layerName);
		if (obj.style) 
		{ 
			obj=obj.style; 			
		}

		if (((window.event.clientX < obj.pixelLeft + errorMargin) || (window.event.clientX > obj.pixelLeft + obj.pixelWidth - errorMargin)) || 
			((window.event.clientY < obj.posTop - errorMargin) || (window.event.clientY >= obj.pixelHeight + obj.pixelTop - errorMargin)))
		{	
			obj.visibility = 'hidden';
		}
	}

	function LinkRollOut(layerName, theObject)
	{
		var obj, errorMargin;
		errorMargin = 5;
		obj = FindMyObj(layerName);
		if (obj.style) 
		{ 
			obj=obj.style; 			
		}
		
		if (((window.event.clientX <= (getRealLeft(theObject) + errorMargin)) || (window.event.clientX > getRealLeft(theObject) + theObject.offsetWidth)) ||
			(window.event.clientY < getRealTop(theObject) + errorMargin)) 
		{	
			obj.visibility = 'hidden';
		}
	}
	
function radioValidator()
{

radioOption = -1
for (counter=0; counter<document.TheForm.cputype.length; counter++) {
if (document.TheForm.cputype[counter].checked) {
radioOption = counter
}
}
if (radioOption == -1) {
alert("Please Select a CPU before continuing.")
return false
}

radioOption = -1
for (counter=0; counter<document.TheForm.pccase.length; counter++) {
if (document.TheForm.pccase[counter].checked) {
radioOption = counter
}
}
if (radioOption == -1) {
alert("Please Select a PC CASE before continuing.")
return false
}
return (true);
}
