jQuery(document).ready(function($){
	
	// shadowbox init index.php
	
	window.onload = function(){
	
		var options = {
			
			overlayColor: "#fff",
			overlayOpacity: 0.5, 
			skipSetup: true
			
		};
	
		Shadowbox.init(options);
		
		Shadowbox.setup('.blog_post_thumb a.video', {
		
			height:     360,
			width:      640,
			flashVars:  {
				
				autoplay:   "1"
		
			}
			
		});
		
		Shadowbox.setup('.blog_post_thumb a.picture', {
		
			handleOversize: "resize"
			
		});		
		
	};
	
	// variable width #blog
	
	var blogWidth =	$("#blog_container").width - 150;

	$("#blog").width(blogWidth);
	$(".jspContainer").width(blogWidth);
	
	// invisible jscrollpane

	$("#blog").hover(
	
		function(){
		
			$(".jspVerticalBar").animate({opacity:1.0},300);
		
		},
		
		function(){
		
			$(".jspVerticalBar").animate({opacity:0},300);			
		
		}
				
	);

	// jscrollpane
	
	$('.scroll-pane').each(
		
		function(){

			$(this).jScrollPane({
				
				showArrows: true,
				verticalGutter: 20, 
				autoReinitialise: true
					
			});
			
			var api = $(this).data('jsp');
			var throttleTimeout;
			
			$(window).bind('resize',function(){

				if ($.browser.msie) {

					if (!throttleTimeout){
				
						throttleTimeout = setTimeout(function(){api.reinitialise();throttleTimeout = null;},50);
				
					}
					
				} else {
						
					api.reinitialise();
					
				}
				
			});
		
		}
	
	);
	
	// masonry grid system

	$("#wrap").masonry({
	
		singleMode: true, 
		itemSelector: '.blog_post', 
		animate: true 
	
	});
			
});
