var $j = jQuery;
$(document).ready(function() {

	//Caption Sliding (Partially Hidden to Visible)
	$j('.boxgrid.caption').hover(function(){
		$j(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160});
	}, function() {
		$j(".cover", this).stop().animate({top:'100px'},{queue:false,duration:160});
	});

	
	//Tabs
	$j("#tabs").tabs();
	
	//Gallery overlay
	$j(".thumbs a").overlay({
        target: '#gallery'
    }).gallery({
        speed: 800
    });
	
	//Iframe overlay
	$j("#triggers a[rel]").overlay();
	
	//Tooltips
	$j('#tTip1').tooltip({speed: 150, delay: 300});
	$j('#tTip2').tooltip({speed: 150, delay: 300});
	
	(function($) {
		$.fn.slideFadeToggle = function(speed, easing, callback) {
			return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
		};
	})(jQuery);
	
	$(function()
	{		
		$("#SidePanel div.demo:eq(0) div.expander").click(function(event) {
			$(this).toggleClass('open').next("div.collapse").slideFadeToggle('slow','linear');
		});
		
		$("#SidePanel div.demo:eq(1) div.expander").click(function(event) {
			$(this).toggleClass('open').next("div.collapse").slideFadeToggle('slow','linear');
		});
	});
});
