$(document).ready(function(){

  $(".question").hide();
  $(".toggler").click(function(){
    $(this).hide();
    $(this).parent().parent().next(".question").slideToggle(600);
		$("#cont-pri").css( 'height', '' );
    return false;
  });

	doHeights();
	
	$('#caption,#info').css('opacity', '.925');
	$("#info").click(function(){

		
		// toggle the showing attribute
		$(this).data('show', ($(this).data('show')) ? false : true );
		
		if( $(this).data('show') ){
			$(this).data('cleft', $('#caption').attr('offsetLeft'));
			$(this).data('bleft', $(this).attr('offsetLeft'));
			$(this).animate({left: "929px"}, "slow")
				.html( "X" );
				
			$("#caption").animate({ left: "-1px" }, "slow");
		}
		else{
			$(this).animate({left: $(this).data('bleft'), html:"?"}, "slow")
				.html( "?" );
			$("#caption").animate({ left: $(this).data('cleft') }, "slow")
		}
	
  });
	
});


// From http://michael.futreal.com/jquery/vjustify

jQuery.fn.equalHeights=function() {
    var maxHeight=0;
    this.each(function(){
        if (this.offsetHeight>maxHeight) {maxHeight=this.offsetHeight;}
    });
    this.each(function(){
        $(this).height(maxHeight + "px");
        if (this.offsetHeight>maxHeight) {
            $(this).height((maxHeight-(this.offsetHeight-maxHeight))+"px");
        }
    });
};

function doHeights()
{
	
	$("#cont-pri,#cont-sec,#features,#snw").equalHeights();

	$("#hleft,#hright").equalHeights();
	
}


