// JavaScript Document
	var objTimer = null;	
	var sCurrentExpandedObject = "";
	var arrayHeights = new Array();
	
	/* these need to be updated if you add a menu item */
	arrayHeights["parent-profile"] = 40;
	arrayHeights["parent-ourwork"] = 40;
	arrayHeights["parent-services"] = 90;
	arrayHeights["parent-knowledge"] = 40;
	arrayHeights["parent-contact"] = 40;
	
	function RollOver(imageID, bIsOver)
	{
//        alert (id);	
        var img = new Image();
		img = document.getElementById(imageID);
		if (!img)
		{
			return;
		}
		
		var imgFile = document.getElementById(imageID).src;		
//		alert(imageID+', '+imgFile);

		if (bIsOver)
		{
			img.src = imgFile.replace(/\.png/gi, "_over.png");
		}
		else
		{		
			img.src = imgFile.replace(/_over\.png/gi, ".png");			
		}		

	}
	
	function Showsub(id)
	{		
		//document.getElementById(id).onmouseout = Hidesub;
		var sActualId = 'parent-' + id;
		var childObj = document.getElementById('sub-' + id);
		var iCurrentChildHeight = parseInt(childObj.style.height);	
		
		if (!isNaN(iCurrentChildHeight) && iCurrentChildHeight > 0)
		{
			// close the current expanded object
			Hidesub(sActualId);
		}

		if (objTimer == null && sCurrentExpandedObject == "")
		{
			objTimer = setInterval("IncreaseHeight('" + sActualId + "'," + arrayHeights[sActualId] + ");", 5);
		}
	}
	
	function IncreaseHeight(objId, iMaxHeight)
	{
		var obj = document.getElementById(objId);
		var iCurrentHeight = parseInt(obj.style.height);
		var childObj = document.getElementById(objId.replace(/parent/gi, "sub"));						
		var iCurrentChildHeight = parseInt(childObj.style.height);	
		
		sCurrentExpandedObject = objId;
		
		if (isNaN(iCurrentChildHeight))
		{
			iCurrentChildHeight = 0;
		}
		
		if (isNaN(iCurrentHeight))
		{
			// minus 15 for the padding
			iCurrentHeight = obj.offsetHeight - 15;
		}

		if (iCurrentChildHeight >= iMaxHeight)
		{
			clearInterval(objTimer);
			objTimer = null;
			sCurrentExpandedObject = "";
			return;
		}

		obj.style.height = iCurrentHeight + 4 + "px";		
		
		childObj.style.height = iCurrentChildHeight + 4 + "px";		
	}		
	
	function Hidesub(id)
	{		
		if (objTimer == null)
		{
			objTimer = setInterval("DecreaseHeight('" + id + "');", 5);
		}
	}
	
	function DecreaseHeight(objId)
	{
		var obj = document.getElementById(objId);
		var iCurrentHeight = parseInt(obj.style.height);
		
		var childObj = document.getElementById(objId.replace(/parent/gi, "sub"));
		var iCurrentChildHeight = parseInt(childObj.style.height);	
		
		if (isNaN(iCurrentHeight) || isNaN(iCurrentChildHeight))
		{
			clearInterval(objTimer);
			objTimer = null;
			sCurrentExpandedObject = "";
			return;
		}		
		
		if (iCurrentChildHeight <= 0)
		{
			clearInterval(objTimer);
			objTimer = null;
			sCurrentExpandedObject = "";
			return;
		}
		
		obj.style.height = iCurrentHeight - 4 + "px";				
		childObj.style.height = iCurrentChildHeight - 4 + "px";
	}
	
	/* not used but good to keep in case */
	/*function Hidesub(event)
	{	
		var current, related;
		
		if (window.event) {
			current = this;
			related = window.event.toElement;
		}
		else {
			current = event.currentTarget;
			related = event.relatedTarget;
		}		

		if (current != related && !contains(current, related))
		{
			if (objTimer == null)
			{
				objTimer = setInterval("DecreaseHeight('" + current.id + "');", 5);
			}
		}
	}
	
	function contains(a, b) 
	{
		// Return true if node a contains node b.
		while (b.parentNode)
		{
			if ((b = b.parentNode) == a)
			{
				return true;
			}
		}
		return false;
	}*/
	/* end not used but good to keep in case */
