// JavaScript Document
$(document).ready(function(){
	var windowHeight = $(window).height() - 100;
	var containerHeight = $('#container').height() + 40;
	if (containerHeight < windowHeight)
		$('#bg').css('height', '' + windowHeight + 'px');
	else 
		$('#bg').css('height', '' + containerHeight + 'px');
		
	$('#nav li').mouseover(function(){
		$(this).children('table').show();
	}).mouseout(function(){
		$(this).children('table').hide();
	});
	
	$('.answer:first').show();
	$('.question').click(function(){
		$('.answer').slideUp();
		$(this).next('p.answer').slideDown();
	 });
	$('#fontIncrease').click(function(){
		$(this).hide();
		$('#fontDecrease').show();
	});
	$('#fontDecrease').click(function(){
		$(this).hide();
		$('#fontIncrease').show();
	});
	
	var mysheet = getCookie('mysheet');
	if (mysheet=='large-theme') {
		$('#fontIncrease').hide();
		$('#fontDecrease').show();
	} else {
		$('#fontIncrease').show();
		$('#fontDecrease').hide();
	}
	
	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 "";
	}
});
