$(document).ready(function(){

	// Navigation Dropdown Plugin
	$("#navigation .menu li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function(){ $("ul", this).fadeOut("fast"); } 
	);
	if (document.all) {
		$("#navigation .menu li").hoverClass("sfHover");
	}
	
	// Gallery Slider Plugin
	$("#gallery-holder").css("height", "340px").css("width", "930px").nivoSlider({
		controlNav: false, 
		effect: 'boxRain'
	});
	
	// In-Field Label Plugin
	$('.clearField').clearField();			
	prettyPrint();
  
  $(".article-content img").each(function(){
    if( $(".gallery").has(this) ) return;
    var h = $(this).height();
    if(h <= 20) return;
    var w = $(this).width();
    var dHp = 100 - ((h%10) / h);
    $(this).height(h - (h%10));
    $(this).width(w * (dHp/100));
  });
  
  $(".gallery-lightbox").fancybox({
    'titlePosition': 'inside'
  });

});


$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};
