// Drop Down Menu
jQuery(document).ready(function(){

    jQuery("ul#top_nav li.dropdown").hover(function(){
    
        jQuery(this).addClass("hover");
        jQuery('ul:first',this).css('visibility', 'visible');
    
    }, function(){
    
        jQuery(this).removeClass("hover");
        jQuery('ul:first',this).css('visibility', 'hidden');
    
    });
});

// Home Page Slider
jQuery(document).ready(function() {
	jQuery("#controller").jFlow({
		slides: "#slides",
		width: "570px",
		height: "270px",
		duration: 1200,
		auto: true,
		slideSwitch: 8000,
	});
	
});

// Equal height columns
function equalHeight(group) {
    tallest = 0;
    group.each(function() {
        thisHeight = $(this).height();
        if(thisHeight > tallest) {
            tallest = thisHeight;
        }
    });
    group.height(tallest);
}

jQuery(document).ready(function() {
    equalHeight($(".equal"));
});

// Page scrolling

// scrolling
jQuery(document).ready(function() {
	jQuery("a.scroller").anchorAnimate()
});

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 400
	}, settings);	
	
	return this.each(function(){
		var caller = this
		jQuery(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}

