
/**************************************************
	SHORTCODES - GALLERY
**************************************************/

function shortcode_gallery() {
	
	$('.gallery dl.gallery-item dt.gallery-icon a img').hover(function(){
		$('.gallery dl.gallery-item dt.gallery-icon a img').not(this).animate(
			{opacity: '0.5'}, {queue:false, duration: 300}
		);
	},
	function(){
		$('.gallery dl.gallery-item dt.gallery-icon a img').not(this).animate(
			{opacity: '1'}, {queue:false, duration: 300}
		);
	});
	
	var link = '.gallery dl.gallery-item dt.gallery-icon a';
	var file = $(link).attr('href');
	var name = /^.+\.([^.]+)$/.exec(file);
	
	if (name != null) {
		$(link).prettyPhoto({
			showTitle : false,
			theme : 'light_square'
		});
	}
}

/**************************************************
	SHORTCODES - ACCORDION
**************************************************/

function shortcode_accordion() {
	
	$('.sc-accordion').accordion({
		header: 'h3'
	});
}

/**************************************************
	SHORTCODES - NIVO SLIDER
**************************************************/

function shortcode_nivo() {
	
	$('.sc-nivo').nivoSlider();
}

/**************************************************
	SHORTCODES - LIGHTBOX
**************************************************/

function shortcode_lightbox() {
	
	$("a[rel^='prettyPhoto']").prettyPhoto({
		showTitle : false,
		theme : 'light_square'
	});
}

/**************************************************
	SHORTCODES - TOOLTIP
**************************************************/

function shortcode_tooltip() {
	
	$('.tooltip.top').tipsy({ gravity: 's' });
	$('.tooltip.right').tipsy({ gravity: 'w' });
	$('.tooltip.bottom').tipsy({ gravity: 'n' });
	$('.tooltip.left').tipsy({ gravity: 'e' });
}

/**************************************************
	SHORTCODES - TOOLTIP
**************************************************/

function shortcode_divider() {
	
	$('.sc-divider a').click(function() {
		$('html, body').animate({scrollTop: 0}, 'slow');
		return false;
	});
}

/**************************************************
	DOCUMENT READY
**************************************************/

$(document).ready(function() {
	
	shortcode_accordion();
	shortcode_gallery();
	shortcode_nivo();
	shortcode_lightbox();
	shortcode_tooltip();
	shortcode_divider();
});
