

$(document).ready(function()
{
  var infoBoxMoreInfo = $.cookie('infoBoxMoreInfo');
  
  if (infoBoxMoreInfo == "expanded") {
	 $("#info_box_more_link").css('visibility', 'hidden');
	 $("#info_box_more_info").show();
	 $("#info_box").css('height', $("#info_box").parent().height() + 'px');
	 //console.log("expanded");
  } else {
	 $("#info_box_more_link").css('visibility', 'visible');
	 $("#info_box").css('height', 'auto');
	 $("#info_box_more_info").hide();
	 //console.log("collaped");
  }	
  
  $("#info_box").css('cursor', 'pointer');
  var startHeight = $.cookie('infoBoxStartheight')? $.cookie('infoBoxStartheight'): $("#info_box").height();

  $("#info_box").click(function()
  {
	  if ($(this).height() == $(this).parent().height()) {
		$(this).animate({ 
		  height: startHeight + 'px'
		}, 'fast', function () {
		 $("#info_box_more_link").css('visibility', 'visible');			
		 $(this).css('height', 'auto');
		});
		$("#info_box_more_info").fadeOut('fast');
		
		$.cookie('infoBoxMoreInfo', 'collapsed'); 
	  } else {
		$("#info_box_more_link").css('visibility', 'hidden');
		$(this).animate({ 
		height: $(this).parent().height() + 'px'
		}, 'fast');
		$("#info_box_more_info").fadeIn('fast');
		$.cookie('infoBoxMoreInfo', 'expanded');
		$.cookie('infoBoxStartheight', startHeight);
  		}  
  });
});
