jQuery(document).ready ( function () {
  //hover
	jQuery("#menu>tbody>tr>td>div").hover(
		function() {
		  jQuery(this).addClass('hover');
      jQuery(this).find("ul").stop(true)
        .css('height', 'auto')
        .css('display', 'none') //reset css behavior if JS
        .css('width', jQuery(this).find("ul").width())
        .slideDown('slow');
    },
		function() {
		  jQuery(this).removeClass('hover');
      jQuery(this).find("ul").stop(true).slideUp('slow');
    }
	);
	
	//focus - menu
	jQuery("#menu>tbody>tr>td>div").focusin(
		function() {
		  jQuery(this).addClass('hover');
      jQuery(this).find("ul").stop(true)
        .css('height', 'auto')
        .css('width', jQuery(this).find("ul").width())
        .slideDown('slow');
    }
  );
	jQuery("#menu>tbody>tr>td>div").focusout(
    function() {
      jQuery(this).removeClass('hover');
      jQuery(this).find("ul").stop(true).slideUp('slow');
    }
	);
	
	//focus - drop down menu
	jQuery("#menu li>a").focusin(
		function() {
		  jQuery(this).addClass('hover');
    }
  );
	jQuery("#menu li>a").focusout(
    function() {
      jQuery(this).removeClass('hover');
    }
	);
	
	//text-resizer start
	CheckSize('body');
	

    /* header show/hide */
    jQuery("#head_button").click(
		function() {
            if(!jQuery("#head_image").is('.head_hidden')) {
                $.post( 
                    "/session_service.php",
                    {hide: true},
                    function (data) {
                        jQuery("#head_image").addClass('head_hidden').stop(true).slideUp('slow');
                    }
                );
        } else {
              $.post(
                    "/session_service.php",
                    {hide: false},
                    function (data) {
                        jQuery("#head_image").removeClass('head_hidden').stop(true).slideDown('slow');
                    }
              );
        }
        return false;
    });
});

