// script generated by Xtreeme SiteXpert
// sitemap and search engine creator
// http://www.xtreeme.com/sitexpert
// Copyright(C) 2001 Xtreeme GmbH

function getIndent (theItem)
	{
	end = theItem.id.indexOf ("SXE") ;
	if (end == -1)
		return -1 ;
	return parseInt (theItem.id.substring (1, end)) ;
	}

function getIndex (el)
	{
	ind = -1 ;
	tempColl = document.getElementsByTagName ("DIV") ;
	for (i = 0 ; i < tempColl.length ; i++)
		{
		var theItem = tempColl [i] ;
		if (theItem.id == el)
			{
			ind = i ;
			break ;
			}
		}
	return ind ;
	}

function onClicked (el)
	{
	theItem = document.getElementById (el + "SXC") ;
	image = document.images ["M"+el+"SXP"] ;

	var image2 = null ;
	if (bOpenIcon)
		image2 = document.images ["N"+el+"SXP"] ;

	var bShow = (theItem.style.display == "none") ;
	switchVisibility (theItem, image, image2)

	var ind = getIndex (theItem.id) + 1 ;
	tempColl = document.getElementsByTagName ("DIV") ;
	while (ind != -1 && ind < tempColl.length)
		{
		var retVal = 0 ;
		elem = tempColl [ind] ;
		var tci = getIndent (elem) ;
		var tii = getIndent (theItem) ;
		var bfold = (elem.id.indexOf ("SXP") != -1) ;
		if (tci == (tii + 1))
			{
			if (bfold)
				retVal = 3 ;
			  else
				retVal = 1 ;
			}
		  else if (tci > (tii + 1))
			retVal = 2 ;
		  else if (tci == tii && !bfold)
			retVal = 3 ;
		  else
			break ;
		if (bShow)
			{
			if (retVal == 3)
				switchVisibility (elem, null, null) ;
			}
		  else
			{
			elem.style.display = "none" ;
			if (bfold)
				{
				document.images ["M"+elem.id].src = imf + "/sxicon0.gif" ;
				if (bOpenIcon) document.images["N"+elem.id].src = imf + "/sxicon2.gif" ;
				}
			}
		ind++ ;
		}
	return ind;
	}

function switchVisibility (theItem, image, image2)
	{
	if (theItem.style.display == "none")
		{
		theItem.style.display = "block" ;
		if (image)
			image.src = imf + "/sxicon1.gif" ;
		if (image2)
			image2.src = imf + "/sxicon3.gif" ;
		}
	  else
		{
		theItem.style.display = "none" ;
		if (image)
			image.src = imf + "/sxicon0.gif" ;
		if (image2)
			image2.src = imf + "/sxicon2.gif" ;
		}
	}

function onExpandAll ()
	{
	newSrc = imf + "/sxicon1.gif" ;
	divColl = document.getElementsByTagName ("DIV") ;
	for (i = 0 ; i < divColl.length ; i++)
		{
		el = divColl[i] ;
		el.style.display = "block";
		if (el.id.indexOf ("SXP") != -1)
			{
			document.images["M"+el.id].src = newSrc ;
			if (bOpenIcon)
				document.images["N"+el.id].src = imf + "/sxicon3.gif" ;
			}
		}
	}

function onCollapseAll ()
	{
	newSrc = imf + "/sxicon0.gif" ;

	divColl = document.getElementsByTagName ("DIV") ;
	for (i = 0 ; i < divColl.length ; i++)
		{
		el = divColl[i] ;
		if (el.id.indexOf ("SXP") != -1)
			{
			document.images ["M"+el.id].src = newSrc ;
			if (bOpenIcon)
				document.images ["N"+el.id].src = imf + "/sxicon2.gif" ;
			}
		if (el.id.indexOf ("SXC") != -1 || getIndent (el) > 0)
			el.style.display = "none" ;
		}
	}

function fixDate(date)
	{
	var base = new Date (0) ;
	var off = base.getTime () ;
	if (off > 0)
		date.setTime (date.getTime () - off) ;
	}

function saveCookie()
	{
	if (nDays > 0)
		{
		var now = new Date () ;
		fixDate (now) ;
		now.setTime (now.getTime () + nDays * 24 * 60 * 60 * 1000) ;
		var strnow = now.toGMTString();

		var ckstr="";
		var str;
		ind = -1 ;
		tempColl = document.getElementsByTagName ("DIV") ;
		for (i = 0 ; i < tempColl.length ; i++)
			{
			var theItem = tempColl [i] ;
			if (theItem.id.indexOf ("SXP") != -1)
				{
				var sxc = document.getElementById (theItem.id.substring (0, theItem.id.indexOf ("SXP")) + "SXC") ;
				if (sxc.style.display=="none")
					ckstr += "0";
				  else
					ckstr += "1";
				}
			}
		document.cookie = "sxtree="+ckstr+"; expires="+strnow ;
		document.cookie = "sxpossaved=true; expires="+strnow ;
		}

	return true;
	}

function initialize ()
	{
	var nextind=0;
	var sxpind=0;
	var state;
	if (nDays > 0)
		{
		cks = document.cookie.split (';');
		for (i = 0 ; i < cks.length ; i++)
			{
			if (cks [i].indexOf ("sxtree") != -1) state=cks[i].substring (cks[i].indexOf ("=") + 1);
			}
		}
	tempColl = document.getElementsByTagName ("DIV");
	for (i = 0 ; i < tempColl.length ; i++)
		{
		el = tempColl[i];
		ii = getIndent (el);
		if (!state || nDays == 0 || document.cookie.indexOf ("sxpossaved") == -1)
			{
			if ((el.id.indexOf ("SXC") != -1 && ii == showLevel) || ii > showLevel) el.style.display = "none";
			}
		  else if (el.id.indexOf ("SXP") != -1)
			{
			var bset = false;
			if (i >= nextind && state.substr (sxpind,1) == "0")
				{
				var elid = el.id.substring (0,el.id.indexOf ("SXP"));
				nextind = onClicked (elid);
				bset = true;
				}

			if (!bset && i >= nextind)
				{
				document.images ["M"+el.id].src = imf + "/sxicon1.gif" ;
				if (bOpenIcon) document.images ["N"+el.id].src = imf + "/sxicon3.gif"  ;
				}
			sxpind++;
			}
		}
	}