
// superfish
$(document).ready( function() {
	$( 'ul.sf-menu' ).superfish({ 
		delay:			200,								// one second delay on mouseout 
		animation:		{opacity: 'show', height: 'show'},	// fade-in and slide-down animation 
		speed:			'fast',								// faster animation speed 
		autoArrows:		false,								// disable generation of arrow mark-up 
		dropShadows:	true								// turn on drop shadows
	}); 
});

// easyslider
$(document).ready( function() {
	if ( $( '#slider' ).length ) {
		$( '#slider' ).easySlider({
			auto: 			true,
			continuous: 	true,
			numeric: 		true,
			pause:			12000
		});
	}
});

// back to top
$(document).ready( function() {
    $( 'a[href=#top]' ).click( function() {
        $( 'html, body' ).animate( {scrollTop:0}, 'slow' );
        return false;
    });
});

// image preloading
$(function () {
	$( '.blog-image-holder img' ).hide(); // hide all the images on the page
});
		
var i = 0; //initialize
var int = 0; //Internet Explorer Fix

$( window ).bind( 'load', function() { // the load event will only fire if the entire page or document is fully loaded
	var int = setInterval( 'doThis(i)', 500 ); // 500 is the fade in speed in milliseconds
});

function doThis() {
	var imgs = $( 'blog-image-holder img' ).length; // count the number of images on the page
	if ( i >= imgs ) {// loop the images
		clearInterval( int ); // when it reaches the last image the loop ends
	}
	$( '.blog-image-holder img:hidden' ).eq(0).fadeIn(500); // fades in the hidden images one by one
	i++; //add 1 to the count
}

// Setup the FAQ lists
$(function () {
	$( '.faqList dd' ).hide(); // Hide all DDs inside .faqs
	$( '.faqList dt' ).hover( function() { $( this ).addClass( 'hover' ) }, function() { $( this ).removeClass( 'hover' ) } ).click( function() { // Add class "hover" on dt when hover
		$( this ).next().slideToggle( 'normal' ); // Toggle dd when the respective dt is clicked
	}); 
}); 

