jQuery(document).ready(function() {

 jQuery('img.singlepic').each(function() {
        var maxWidth = 780; // Max width for the image
        var maxHeight = 2000;    // Max height for the image
        var ratio = 0;  // Used for aspect ratio
        var width = jQuery(this).width();    // Current image width
        var height = jQuery(this).height();  // Current image height
 
        // Check if the current width is larger than the max
        if(width > maxWidth){
            ratio = maxWidth / width;   // get ratio for scaling image
            jQuery(this).css("width", maxWidth); // Set new width
            jQuery(this).css("height", height * ratio);  // Scale height based on ratio
            height = height * ratio;    // Reset height to match scaled image
            width = width * ratio;    // Reset width to match scaled image
        }
 
        // Check if current height is larger than max
        if(height > maxHeight){
            ratio = maxHeight / height; // get ratio for scaling image
            jQuery(this).css("height", maxHeight);   // Set new height
            jQuery(this).css("width", width * ratio);    // Scale width based on ratio
            width = width * ratio;    // Reset width to match scaled image
        }
    });

jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme: 'dark_rounded'});

jQuery('.homeslide').nivoSlider({
		effect:'random',
		slices:20,
		animSpeed:500,
		pauseTime:5000,
		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
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8 //Universal caption opacity
		
	});

});