//***************************** Lightbox *****************************//


jQuery(document).ready(function(){
	jQuery("a[rel^='prettyPhoto']").prettyPhoto({
		theme: 'facebook'
	});
});


//***************************** Scrollable Content *****************************//


jQuery(function() {
	jQuery("#scrollslider").smoothDivScroll({
	scrollingSpeed: 4,
	mouseDownSpeedBooster: 1,
	autoScroll: "",
	autoScrollDirection: "endlessloop",
	autoScrollSpeed: 2,
	visibleHotSpots: "always",
	startAtElementId: "startslider1"
	});
	jQuery("#scrollportfolio").smoothDivScroll({
	scrollingSpeed: 4,
	mouseDownSpeedBooster: 1,
	autoScroll: "",
	autoScrollDirection: "endlessloop",
	autoScrollSpeed: 2,
	visibleHotSpots: "always",
	startAtElementId: "startportfolio1"
	});		
});


//***************************** Image Hover Effect *****************************//


jQuery(document).ready(function(){
    jQuery('.image-thumb').css({'opacity':'0'});
	jQuery('.jFlowControl, .portfolio-thumbnails').hover(
		function() {
			jQuery(this).find('.image-thumb').stop().fadeTo(500, 0.8);
		},
		function() {
			jQuery(this).find('.image-thumb').stop().fadeTo(500, 0);
		}
	)
});	


//***************************** Slide Effects *****************************//


jQuery(function() {
	jQuery("#slider-container-large").hover(function(){
		jQuery(this).find(".pop_box_upper_large").animate({top:"-525px"},{queue:false,duration:500});},
		function(){ jQuery(".pop_box_upper_large").animate({top:"-650px"},{queue:false,duration:500});
		});
	
		jQuery("#slider-container-large").hover(function(){
		jQuery(this).find(".pop_box_lower").animate({top:"-100px"},{queue:false,duration:500});},
		function(){ jQuery(".pop_box_lower").animate({top:"0px"},{queue:false,duration:500});
	});
	jQuery("#slider-container-medium").hover(function(){
		jQuery(this).find(".pop_box_upper_medium").animate({top:"-350px"},{queue:false,duration:500});},
		function(){ jQuery(".pop_box_upper_medium").animate({top:"-475px"},{queue:false,duration:500});
		});
	
		jQuery("#slider-container-medium").hover(function(){
		jQuery(this).find(".pop_box_lower").animate({top:"-100px"},{queue:false,duration:500});},
		function(){ jQuery(".pop_box_lower").animate({top:"0px"},{queue:false,duration:500});
	});
	jQuery("#slider-container-small").hover(function(){
		jQuery(this).find(".pop_box_upper_small").animate({top:"-418px"},{queue:false,duration:500});},
		function(){ jQuery(".pop_box_upper_small").animate({top:"-553px"},{queue:false,duration:500});
		});	
	
		jQuery("#slider-container-small").hover(function(){
		jQuery(this).find(".pop_box_lower").animate({top:"-100px"},{queue:false,duration:500});},
		function(){ jQuery(".pop_box_lower").animate({top:"0px"},{queue:false,duration:500});
	});
});

/*************************** Image Preloader ***************************/

jQuery(function () {
	jQuery('.preload').hide();//hide all the images on the page
});

var i = 0;//initialize
var int=0;//Internet Explorer Fix
jQuery(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 images = jQuery('.preload').length;//count the number of images on the page
	if (i >= images) {// Loop the images
		clearInterval(int);//When it reaches the last image the loop ends
	}
	jQuery('.preload:hidden').eq(0).fadeIn(500);//fades in the hidden images one by one
	i++;//add 1 to the count
}
