window.DPIFRONTEND = window.DPIFRONTEND || {};

if (undefined == window.console || undefined == window.console.log)
   {
	window.console = {log : function (message) {/*alert(message);*/}};
   }

window.DPIFRONTEND = {
     BVVG : {
	  Menu		    : null,

	  Init : function () {
	       $('body').removeClass('no-js');
	       this.Menu = $('#main-nav');
		var config = {
		    sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
		    interval: 75, // number = milliseconds for onMouseOver polling interval
		    over: this.HoverOver, // function = onMouseOver callback (REQUIRED)
		    timeout: 100, // number = milliseconds delay before onMouseOut
		    out: this.HoverOut // function = onMouseOut callback (REQUIRED)
	       };
	       this.ItemClicked();
	       this.Menu.children("li").hoverIntent(config);
	  },

	  ItemClicked : function(){
	     this.Menu.find("li.head-li").each(function(){
		var section = $(this);
		var sectionContent = section.find('.drop');

		section.click(function(event){
		     if(!section.hasClass('hover')){
			section.addClass('hover');
			sectionContent.fadeIn(200);
		     }
		});
		// hover out
	       section.hover(null,
		     function () {
			var sectionContent = section.find('.drop');
			sectionContent.hide();
			section.removeClass('hover');
		  }
		);
	     });
	  },

	  HoverOver : function(){

	    var section = $(this);
	    var sectionContent = section.find('.drop');

	    if(!section.hasClass('hover')){
	       section.addClass('hover');
	       sectionContent.fadeIn(200);
	    }
	  },

	  HoverOut : function(){
	      var section = $(this);

	      var sectionContent = section.find('.drop');
	      sectionContent.hide();
	      section.removeClass('hover');
	  }
     }
};

