
$(document).ready(function() {

	//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
        //$('.accordionButton').hide();
        /********************************************************************************************************************
	CLOSES ALL S ON PAGE LOAD
	********************************************************************************************************************/
	$('.accordionContent').hide();
        $('div.init').show().addClass('expanded');
        $('.justbut').mouseover(function() {
            $('.accordionContent:visible').slideUp('normal').removeClass('expanded');
        });
	$('.accordionBut').bind('mouseenter',function() {
                $(this).addClass('over');
                var checkElement = $(this).next();
                if((checkElement.is('.accordionContent')) && (checkElement.is(':visible'))) {
                    return false;
                }
                if((checkElement.is('.accordionContent') && !checkElement.is(':visible'))) {
                    $('.accordionContent:visible').slideUp('normal').removeClass('expanded');
                    checkElement.slideDown('normal').addClass('expanded');
                    return false;
                 }
		return false;
	 }).bind('mouseleave',function() {
		$(this).removeClass('over');
	});

	$('.contentElement').bind('mouseenter',function() {

                $(this).addClass('overcontent');

	 }).bind('mouseleave',function() {

                $(this).removeClass('overcontent');

	 });
	/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/

	//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER
	//$('.accordionButton').bind('mouseenter',function() {
  //              $(this).addClass('over');

	//ON MOUSEOUT REMOVE THE OVER CLASS
	//}).bind('mouseleave',function() {
	//	$(this).removeClass('over');
	//});

	/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/

	$('#menuwrapper').bind('mouseleave',
            function()
            {
              if(!$('div.init').is(':visible'))
              {
                  $('.accordionContent').slideUp('normal').removeClass('expanded');
                  $('div.init').slideDown('normal').addClass('expanded');
              }
            }
            );


});

