// Insert preloaded image after it finishes loading
//$(document).ready(function(){
	//Run the script to preload images from CSS
	//$.preloadCssImages(); 
//});
	
//slide show fade
jQuery(document).ready(function(){	
    $('#slider').cycle({ 
	    fx:     'fade', 
    	speed:   500, 
    	timeout: 6000,  
    	pause:   1,   
	    next:   '#nextBtn', 
	    prev:   '#prevBtn',
	    cleartype: true,
	    cleartypeNoBg: true
	});
});

//slide panel
jQuery(document).ready(function(){	

	$(".btn-slide").click(function(){
		$("#panel").slideToggle("fast");
		$(this).toggleClass("active"); return false;
	});
	
	 $(".sb-tgl").click(function(){
        $(this).closest("div").find(".sb-pnl").slideToggle("fast");
        $(this).toggleClass("active"); return false;
    });
	
	$(".sb-tgl-close").click(function(){
		$(this).closest("div.sb-pnl").slideToggle("fast");
		$(this).toggleClass("active"); return false;
	});

});

//tooltips
jQuery(document).ready(function(){	
	$('a.tTip').tinyTips('title');
	//$('a.imgTip').tinyTips('<img src="images/demo-image.jpg" /><br />You can even put images or any other markup in the tooltips.');
	$('img.tTip').tinyTips('title');
	//$('h1.tagline').tinyTips('tinyTips are totally awesome!');
});

//fancybox
jQuery(document).ready(function() {
	$('a.fancybox').fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'elastic',
		'transitionOut'	: 'elastic'
	});
});

jQuery(document).ready(function() {
	$('a#inline').fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none'
	});
});

//remove broken images
jQuery('img').error(function() {
	$(this).remove();
}); 