//<![CDATA[
// scripts require mootools include somewhere before
	
// -----------------------------------------------------------------------------
function init_accordion(prev, curr)
	{
	//if (prev != curr)
	//	{
	var found = 0;
	var strhash = '#'+curr;
	$$('h2.toggler a').each(function(link, i) {
		if (link.hash ==  strhash)
			found = i;
		});
	//	}	
		
	var myAccordion = new Accordion($('menu'), 'h2.toggler', 'div.element', {
		display: found, 
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#111');
			},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#afafaf');
			}
		});
	}
// -----------------------------------------------------------------------------
function init_info()
	{
	var mySlide = new Fx.Slide('info');
	mySlide.hide();
	$('ainfo').addEvent('click', function(e){
		e = new Event(e).stop();
		mySlide.toggle();
		});
	}

// -----------------------------------------------------------------------------
function set_ext_hrefs()
	{
	$$('a').each(function(link, i)
		{
		if (link.getProperty('href') != '')
			if (link.getProperty('rel') == 'ext')
				link.setProperty('target', '_blank');
		});
	}

// -----------------------------------------------------------------------------
function change_arrow(box, str_from, str_to)
	{
	boxid = new String($(box).getProperty('id'));
	arrowid = boxid.replace('box', 'arrow');	
	s = new String($(arrowid).getProperty('src'));
	$(arrowid).setProperty('src', s.replace(str_from, str_to));
	}
	
function grow_artbox(box)
	{
	$(box).setStyle('width', '98%');
	$(box).setStyle('height', 'auto');
	change_arrow(box, 'down', 'up'); 
	$(box).addClass('artbox3_wide');
	}
	
function shrink_artbox(box)
	{
	$(box).setStyle('width', '48%');
	$(box).setStyle('height', '140px');
	change_arrow(box, 'up', 'down');	
	$(box).removeClass('artbox3_wide');
	}
	
function get_open_artbox() 
	{
	var ret = null;
	$$('div.artbox3').each(function(e) { 
		if ($(e).hasClass('artbox3_wide'))
			ret = $(e);
		}); 
	return ret;
	}
	
function set_expand_links() 
	{
	$$('a.artbox3_change').each(function(link, i) {
	
		$(link).addEvent('click', function(e) {
			new Event(e).stop();
			hrefid = new String($(link).getProperty('id'));
			boxid = hrefid.replace('href', 'box');
			var box_new = $(boxid);
			var box_old = get_open_artbox();
			
			if (box_new == null) return;
			if (box_old == null) 
				{
				grow_artbox(box_new);
				}
			else
				{
				if (box_old != box_new) 
					{
					shrink_artbox(box_old);	
					grow_artbox(box_new);
					}
				else
					{
					shrink_artbox(box_new);
					}
				}
			});
		});
	}

// -----------------------------------------------------------------------------

//]]>


