// Get total occupied height of element
function getOffsetHeight(obj) {
	return obj.offsetHeight;
};

function ShowFind()
{
	$('lnk_find').addClassName('active');
	$('lnk_filter').removeClassName('active');
	
	var leftColumn 	= $$('.find_filter_content')[0];
	var filterHeight 		= getOffsetHeight($('form_search'));
	var formHeight 			= getOffsetHeight($('form_filter'));
	
	if(filterHeight > formHeight) {
		leftColumn.style.height = filterHeight + 'px';
	} else {
		leftColumn.style.height = formHeight + 'px';
	}
	
	$('form_search').show();
	$('form_filter').hide();
}

function ShowFilter()
{
	$('lnk_filter').addClassName('active');
	$('lnk_find').removeClassName('active');

	var leftColumnHeight 	= $$('.find_filter_content')[0].style.height;
	var filterHeight 		= getOffsetHeight($('form_search'));
	var formHeight 			= getOffsetHeight($('form_filter'));
	
	if(filterHeight > formHeight) {
		leftColumnHeight = filterHeight + 'px';
	} else {
		leftColumnHeight = formHeight + 'px';
	}

	$('form_filter').show();
	$('form_search').hide();
}

var ShowTransition = 'false';

function Show(id,idNo)
{
	if(ShowTransition == 'false') {
		ShowTransition = 'true'
		var display = $(id).style.display;
		clearTimeout(popupWindow.OpenTimer);
		popupWindow.OpenTimer = '';
		if ('none' == display)
		{
			Effect.Appear($(id), { beforeStart: function() {
					setTimeout("ShowScroller('" + idNo + "')", 50)
				}, duration: 0.5, afterFinish: function() { ShowTransition = 'false'; }});
		}
		else
		{
			Effect.Fade($(id), { duration: 0.5, afterFinish: function() { ShowTransition = 'false' }});
		}
	}
}

function ShowScroller(idNo) {
	new Generic.Slider('exhibit_txt' + idNo, {
		axis: 'vertical',
		handle: 'event_handle',		// Class for the handle
		slider: 'event_slider',		// Class for the slider
		handleSize: 'dynamic'	// Static: controlled by CSS, Dynamic: set by the script based on height difference
	});
}

function ShowDetails(div, title)
{
	var display = $(div).style.display;
	
	if ('none' == display)
	{
		Effect.BlindDown(div);
		$(title).removeClassName('xpnd');
		$(title).addClassName('cllps');
	}
	else
	{
		Effect.BlindUp(div);
		$(title).removeClassName('cllps');
		$(title).addClassName('xpnd');
	}
}

function GetCookie(Name)
{
  if (document.cookie.length > 0)
  {
      c_start = document.cookie.indexOf(Name + "=");
      if (c_start != -1)
      {
        c_start = c_start + Name.length+1;
        c_end = document.cookie.indexOf(";", c_start);
        if (c_end == -1) c_end = document.cookie.length;
        return document.cookie.substring(c_start, c_end);
      }
  }
  return "";
}

function SetCookie(Name, Content)
{
  var exdate = new Date();
  exdate.setDate(exdate.getDate() + 1);

  document.cookie = Name + "=" + Content + ";path=/;expires="+exdate.toGMTString();
}


function SetOpenClose(DivId, CookieName)
{
  var display = $(DivId).style.display;
  
  if ('none' == display)
  {
    SetCookie(CookieName, 'open');
  }
  else
  {
    SetCookie(CookieName, '');
  }
}