jQuery.noConflict();

  jQuery(document).ready(function(){ 

  jQuery('.accordionMenu').Accordion({
      active: 'h3.selected',
      // the tag that will be the header of the submenu
      header: 'h3.subMenuhead', 
      // if this value is false you can open and close the accordion menu by pressing on the header.
      // if it's true the only to close an opened accordion is to open another one
      alwaysOpen: false,             
       animated: 'bounceslide', //animation of the accordion: bounceslide, easeslide,slide
      showSpeed: 600,
      autoheight: true, 
       navigation: true, 
      hideSpeed: 800
    });    
  //initial hiding of all menus
  jQuery("h3.mainMenuHeader ~ li").hide();
  //rounding the main menu buttons

  jQuery("h3.mainMenuHeader").corner("0px"); //there is a change inside jquery.corner.js: row 68  Part of the backgroundcolor

  var alertTimerId = 0; // setTimeout thread id (fadeOut effect). Not used.
  var alertTimerId2 = 0; //setTimeout thread id (fadeIn effect). Not used.
  var initStart = 0; // not used
  var b=0; 
  var newMouseOver;

  //on click on the main menu
  
  jQuery("h3.mainMenuHeader").mouseover(function () {

    newMouseOver=true;
    // make the background black for all main menus
    jQuery("h3.mainMenuHeader").css({ backgroundColor:"#222" });     
    //taking the object and fadeIn 
    b = jQuery(this).next(); 
    jQuery(b).fadeIn(0);

    //red background color
    jQuery(this).css({ backgroundColor:"#222" });

  });
  
  //added by JCO
  jQuery("h3.mainTopLevelMenuHeader").mouseout(function () {
    newMouseOut=true;
    jQuery("h3.mainTopLevelMenuHeader").css({ backgroundImage:"url(../images/skin/menu-home-off.png)" });             
    }
  );  
  
  jQuery(".mainUL").hover(
    //on mouse over
    function () {
      if(newMouseOver==false)
      {
        var a = jQuery(this);
        clearTimeout(alertTimerId);
        jQuery(a).children('.liForMainMenu').show(0);
      }
      //jQuery(a).children('.liForMainMenu').fadeIn(1200);     
    },
    //on mouse out we hide the opened menu
    function () { 
      var a = jQuery(this);
      newMouseOver=false;
      
      jQuery(a).children('.liForMainMenu').fadeOut(0);
      jQuery(a).children('h3.mainMenuHeader').css({ backgroundColor:"#000" });
      $$('li.accSubElement h3').each(function(element){
        if(!element.hasClassName('subMenuhead')){
          element.toggleClassName('subMenuhead');
        }
      });
      
    }
    );
  }); 