function hsEnlargeImage(img,link,inplace)
{
	var newsrc;
	var newlinktext;

	if (img)
	{
		if (!img.src)
			img = documentElement(img);

		if (img)
		{
			if (img.src.substring(img.src.length-9,img.src.length-4).toLowerCase() == 'thumb')
			{
				newsrc = img.src.substring(0,img.src.length-10) + img.src.substring(img.src.length-4);
				newlinktext = link.innerHTML.replace(/enlarge/gi,"shrink");
			}
			else
			{
				newsrc = img.src.substring(0,img.src.length-4) + '_thumb' + img.src.substring(img.src.length-4);
				newlinktext = link.innerHTML.replace(/shrink/gi,"enlarge");
			}
			if (!inplace)
			{
				var newimage = new Image();
				newimage.src = newsrc;
				hsOpenWindow(newimage.src,newimage.width+20,newimage.height+25);
			}
			else
			{
				img.src = newsrc;
				link.innerHTML = newlinktext;
			}
		}
	}
}

function hsOpenWindow(strURL,strWidth,strHeight)
{
    /* open a new browser window based on info passed to the function */
    window.open(strURL,"","Width=" + strWidth + ",Height=" + strHeight,0);
}


function HSToggleSection(id)
{
	var element;
	var img;

	// Find the element
	element = documentElement(id);
	img = documentElement(id+"_Image");
	if (element)
	{
		if (element.className=="hs-collapsed")
		{
			element.className="hs-expanded";
			if (img)
			{
				img.src = "images/hs-expanded.gif";
				img.alt = "Hide";
			}
		}
		else
		{
			element.className="hs-collapsed";
			if (img)
			{
				img.src = "images/hs-collapsed.gif";
				img.alt = "Show";
			}
		};
	}
}
function HSHideOrShowAllCSections(show)
{
	var spans
	var divs

	spans = document.getElementsByTagName("SPAN");
	if (spans)
	{
		for (var spanindex = 0 ; spanindex < spans.length ; spanindex++)
		{
			if ((spans[spanindex].className == "hs-collapsed" && show) || (spans[spanindex].className == "hs-expanded" && !show))
			{
				HSToggleSection(spans[spanindex].id)
			}
		}
	}
	divs = document.getElementsByTagName("DIV")
	if (divs)
	{
		for (var divindex = 0 ; divindex < divs.length ; divindex++)
		{
			if ((divs[divindex].className == "hs-collapsed" && show) || (divs[divindex].className == "hs-expanded" && !show))
			{
				HSToggleSection(divs[divindex].id)
			}
		}
	}
}
function HSHideAllCSections()
{
	var HSHideAll = documentElement("HSHideAll");
	var HSShowAll = documentElement("HSShowAll");
	
	HSHideOrShowAllCSections(false)	
	if (HSHideAll)
	{
		HSHideAll.style.display="none";
		if (HSShowAll)
		{
			HSShowAll.style.display="block";
		}
	}
}
function HSShowAllCSections()
{
	var HSHideAll = documentElement("HSHideAll");
	var HSShowAll = documentElement("HSShowAll");
	
	HSHideOrShowAllCSections(true)
	if (HSShowAll)
	{
		HSShowAll.style.display="none";
		if (HSHideAll)
		{
			HSHideAll.style.display="block";
		}
	}	
}
