
	function startExpand(e,element)
	{
		var fromElement = e.relatedTarget || e.fromElement;
		while (fromElement && fromElement != element && fromElement.nodeName != 'BODY')
			fromElement = fromElement.parentNode
		if (fromElement == element)
			return;
		
		var tableElement = element;
		var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
		
		if(!imgElement.inited)
			init(imgElement);

		//tableElement.style.width = tableElement.offsetWidth;
		tableElement.nextSibling.width = tableElement.offsetWidth;
		tableElement.nextSibling.height = tableElement.offsetHeight+1;
		tableElement.className = "gr_expanded";
		tableElement.parentNode.style.zIndex = 1;
		window.clearTimeout(imgElement.imgDelayID);
		imgElement.imgDelayID = window.setTimeout(imgElement.expand,300);
	}

	function endExpand(e,element)
	{
		var toElement = e.relatedTarget || e.toElement;
		while(toElement && toElement != element && toElement.nodeName != 'BODY')
			toElement = toElement.parentNode;
		if(toElement == element)
			return;

		var tableElement = element;
		var imgElement = tableElement.firstChild.firstChild.firstChild.firstChild.firstChild;
		window.clearTimeout(imgElement.imgDelayID);
		hideElements(tableElement);
		imgElement.contract();
	}

	function init(imgElement)
	{
		imgElement.originalHeight = imgElement.height;
		imgElement.originalWidth = imgElement.width;

		
		imgElement.expand = function() 
							{
								var factor = Math.round(imgElement.height*.06);
								if(imgElement.width + factor < imgElement.originalWidth*2)
								{
									imgElement.width += factor;
									imgElement.height += factor;
									imgElement.imgDelayID = window.setTimeout(imgElement.expand,18);
								}
								else
								{
									imgElement.width = imgElement.originalWidth*1.5;
									imgElement.height = imgElement.originalHeight*1.5;
									var tableElement = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
									showElements(tableElement);
									if(tableElement.getAttribute("pushdown") == "1")
										tableElement.nextSibling.height = tableElement.offsetHeight+1;
								}
							};
		imgElement.contract = function() 
							{
								var factor = Math.round(imgElement.height*.08);
								if(imgElement.width - factor > imgElement.originalWidth)
								{
									imgElement.width -= factor;
									imgElement.height -= factor;
									imgElement.imgDelayID = window.setTimeout(imgElement.contract,15);
								}
								else
								{
									imgElement.width = imgElement.originalWidth;
									imgElement.height = imgElement.originalHeight;
									
									var parentTable = imgElement.parentNode.parentNode.parentNode.parentNode.parentNode;
									parentTable.className = "gr_expandable";
									parentTable.parentNode.style.zIndex = 0;
									parentTable.nextSibling.height = "1";
									parentTable.nextSibling.width = "1";
								}
							};
		
		imgElement.inited = true;
	}

	function showElements(element)
	{
		var trElements = element.firstChild.childNodes;
		if(trElements[1].nodeName != "SCRIPT")
		{
			if(trElements[1].firstChild.firstChild.nodeName == "SCRIPT")
				trElements[1].firstChild.childNodes[1].style.height = "";
			else
				trElements[1].firstChild.firstChild.style.height = "";
		}
		
		for(var i=0;i<trElements.length;i++)
		{
			if(trElements[i].getAttribute("hideexp") == "1")
				trElements[i].style.display = "none";
			else
			{
				if(trElements[i].style.display == "none")
				{
					trElements[i].style.display = "";
					trElements[i].rehide = true;
				}
			}
		}
	}

	function hideElements(element)
	{
		var trElements = element.firstChild.childNodes;
		if(trElements[1].nodeName != "SCRIPT")
		{
			if(trElements[1].firstChild.firstChild.nodeName == "SCRIPT")
				trElements[1].firstChild.childNodes[1].style.height = "30px";
			else
				trElements[1].firstChild.firstChild.style.height = "30px";
		}

		for(var i=0;i<trElements.length;i++)
		{
			if(trElements[i].getAttribute("hideexp") == "1")
				trElements[i].style.display = "";

			if(trElements[i].rehide)
				trElements[i].style.display = "none";
		}
	}

