function move_up() 
{
	var move = getCookie('move');
	if (move == '') return false;
	
	var menu = document.getElementById('menu');
	menu.scrollTop = move;
	
	// should i delete the cookie here
	// or reset it to zero
}


function do_click()
{
	moved = document.getElementById('menu');
	moved = moved.scrollTop;
	
	// record the cookie
	setCookie('move', moved, 1);
}

function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start = document.cookie.indexOf(c_name + "=")

		if (c_start != -1)
		{ 
			c_start = c_start + c_name.length + 1 
			c_end = document.cookie.indexOf(";", c_start)
			
			if (c_end == -1) c_end = document.cookie.length
			return unescape(document.cookie.substring(c_start, c_end))
		} 
	}
	return 0;
}

function setCookie(c_name,value,expiredays)
{
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + expiredays);
	document.cookie = c_name + "=" + escape(value) +
	((expiredays==null) ? "" : ";expires=" + exdate.toGMTString()) + '; path=/';
}


/*	Expanding Menus for Indexhibit
 *		uses jquery
 *
 *	Created by Ross Cairns  Mar 2008
 *  Customized by Vaska Nov 2008
*/
var active = 999;

function expanding_menus() 
{
	var num = 0;

	$('#menu ul li.section-title').each(function()
	{
		// get the ul id
		var ul = this.parentNode.id;
		ul = ul.replace('section-id-', '');
		
		// open active (hide others) and highlight
		var item_title = $("#menu ul").eq(num).children(":first");
		var items = $("#menu ul").eq(num).children().filter(function (index) { return index > 0; });
		(items.is(".active") == false) ? items.hide() : items.parent('ul').css({color:"#F73400"});
		
		// set the onclick
		$(this).css({cursor:"pointer"}).bind('click', function(e){ expander(ul); return false; });
		
		num++;
	});
}

function expander(ul)
{
	// if it's open stop
	if (active == ul) return false;
	
	var speed = 100;

	// hide all sibling li's
	$('#menu ul li.section-title').css({color:"#333"});
	$('#menu ul li:not(.section-title)').hide();
	
	// expand current
	$('#menu ul#section-id-' + ul + ' li.section-title').css({color:"#F73400"});
	$('#menu ul#section-id-' + ul + ' li:not(.section-title)').show(speed);
	
	active = ul;
}
