jQuery(document).ready(function() {

// HOVER USED FOR MAIN NAVIGATION ---------------------------------------------------------------------------------------------------------------------
//On Hover Over
function megaHoverOver(){
    jQuery(this).find(".dropDown").stop().fadeTo('fast', 1).show(); //Find dropDown and fade it in
}
//On Hover Out
function megaHoverOut(){
  jQuery(this).find(".dropDown").stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
      jQuery(this).hide();  //after fading, hide it
  });
}

//Set custom dropdown configurations
var config = {
     sensitivity: 5, // number = sensitivity threshold (must be 1 or higher)
     interval: 0, // number = milliseconds for onMouseOver polling interval
     over: megaHoverOver, // function = onMouseOver callback (REQUIRED)
     timeout: 100, // number = milliseconds delay before onMouseOut
     out: megaHoverOut // function = onMouseOut callback (REQUIRED)
};

jQuery("ul#Nav li .dropDown").css({'opacity':'0'}); //Fade sub nav to 0 opacity on default
jQuery("ul#Nav li").hoverIntent(config); //Trigger Hover intent with custom configurations

// END HOVER ---------------------------------------------------------------------------------------------------------------------

// ACCORDION ---------------------------------------------------------------------------------------------------------------------

jQuery('#accordion').accordion({
autoheight:true,
active: 0
});

var accordions = jQuery('#accordion');

// END ACCORION ---------------------------------------------------------------------------------------------------------------------

// CONTENT TABS ---------------------------------------------------------------------------------------------------------------------

jQuery(".tab_content").hide(); //Hide all content
jQuery("ul#tabs li:first").addClass("active").show(); //Activate first tab
jQuery(".tab_content:first").slideDown(500).fadeIn(); //Show first tab content

//On Click Event
jQuery("ul#tabs li").click(function() {
	jQuery("ul#tabs li").removeClass("active"); //Remove any "active" class
	jQuery(this).addClass("active"); //Add "active" class to selected tab
	jQuery(".tab_content").hide(); //Hide all tab content

	
	var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
	jQuery(activeTab).fadeIn(); //Fade in the active ID content
	return false;
});

// END CONTENT TABS ---------------------------------------------------------------------------------------------------------------------

// SIMPLE TOGGLE ---------------------------------------------------------------------------------------------------------------------

//Hide (Collapse) the toggle containers on load
jQuery("#toggleContent").hide(); 

//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
jQuery("p.toggle").click(function(){
	jQuery(this).toggleClass("active").next().slideToggle("fast");
});
// END SIMPLE TOGGLE ---------------------------------------------------------------------------------------------------------------------


// FOOTER MORE ABOUT VONAGE TOGGLE -------------------------------------------------------------------------------------------------------
jQuery(".trigger").click(function () {
  jQuery("div.aboutVonage").slideToggle("slow");
});
// END FOOTER MORE ABOUT VONAGE TOGGLE -------------------------------------------------------------------------------------------------------

});



