var megaConfig = { interval: 50, sensitivity: 4, over: addMega, timeout: 100, out: removeMega };
function addMega(){
	jQuery(this).find('div.mega').css('left','0px'); //Find sub and fade it in
	jQuery(this).find('div.mega').stop().fadeTo('fast', 1).show(); //Find sub and fade it in
}
function removeMega(){
	jQuery(this).find('div.mega').stop().fadeTo('fast', 0, function() { //Fade to 0 opactiy
		jQuery(this).hide();  //after fading, hide it
		jQuery(this).find('div.mega').css('left','-9999px'); //Find sub and fade it in
	});
}
jQuery(document).ready(function() {
	/* Activate hoverintent dropdown nav menu */
	jQuery('ul#mainnav li').hoverIntent(megaConfig);
	/* If IE6 then add hover class to li elements and add png fix */
	if(jQuery.browser.msie && jQuery.browser.version.substr(0,1)<7) {
		jQuery('ul#mainnav li').hover(function() {
			jQuery(this).addClass('hover');
		}, function() {
			jQuery(this).removeClass('hover');
		});
	}
	/* Hide all submenus so they fade proper when first hovered.  Otherwise the first hover is a snap, not a fade. */
	jQuery('ul#mainnav li').find('div.mega').stop().hide();

	/* Activate the Nivo Slider for Folio Slideshows */
	jQuery('.nivoSlideshow').nivoSlider({
        effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
        slices:15,
        animSpeed:500, //Slide transition speed
        pauseTime:7000,
        startSlide:0, //Set starting Slide (0 index)
        directionNav:true, //Next & Prev
        directionNavHide:true, //Only show on hover
        controlNav:false, //1,2,3...
        controlNavThumbs:false, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:false, //Use image rel for thumbs
        controlNavThumbsSearch: '.jpg', //Replace this with...
        controlNavThumbsReplace: '.jpg', //...this in thumb Image src
        keyboardNav:false, //Use left & right arrows
        pauseOnHover:true, //Stop animation while hovering
        manualAdvance:false, //Force manual transitions
        captionOpacity:0.0, //Universal caption opacity
        beforeChange: function(){},
        afterChange: function(){},
        slideshowEnd: function(){}, //Triggers after all slides have been shown
        lastSlide: function(){}, //Triggers when last slide is shown
        afterLoad: function(){} //Triggers when slider has loaded
    });
	
    jQuery("a[rel^='prettyPhoto']").prettyPhoto();
	 
	 if(jQuery('.hpimages').length > 0 && (jQuery.browser.msie && jQuery.browser.version.substr(0,1)==7)) {
		 jQuery('.hpimages').css({'position':'absolute', 'top':'24px','left':'40px'});
		 jQuery('#content').css({'padding-left':'287px', 'min-height':'622px', 'background-position':'661px bottom'});
		 jQuery('#content h3').css({'margin':'0px'});
	 }
});
