/*
 * Author => Company       : Prodo Ltd
 *        => Website       : http://www.prodo.com
 * Code   => Last Modified : 14 May 2010
 */

$(function() {
	
	/*
	 * External Links
	 */
	$('a[rel=external]').click(function(e) {
		open(this.href);
		e.preventDefault();
	}).attr('title', 'Opens in a new window');
	
	/*
	 * Lists >> Last Item
	 */
	$('li:last-child').addClass('last-item');
	
	/*
	 * FancyBox Gallery
	 */
	$('a[rel=group]').fancybox({
		changeFade    : 400,
		titlePosition : 'over',
		transitionIn  : 'elastic',
		transitionOut : 'elastic',
		type          : 'image'
	});
	
	/*
	 * FancyBox Modal
	 */
	$('a[rel=modal]').fancybox({
		autoScale     : false,
		height        : '80%',
		titleShow     : false,
		transitionIn  : 'elastic',
		transitionOut : 'elastic',
		type          : 'iframe',
		width         : '80%'
	});
	
	/*
	 * Manipulate Umbraco's image alignment
	 */
	$('#content img').each(function(e) {
		if($(this).css('float') == 'left') {
			$(this).addClass('left');
		}
		else if($(this).css('float') == 'right') {
			$(this).addClass('right');
		}
	});
	
	/*
	 * Promotional
	 */
	$('#promotional').append('<div class="images"></div>');
	$('#promotional .images').append('<img alt="Image 1" height="555" src="/images/promotional/1.jpg" width="960" />');
	$('#promotional .images').append('<img alt="Image 2" height="555" src="/images/promotional/2.jpg" width="960" />');
	$('#promotional .images').append('<img alt="Image 3" height="555" src="/images/promotional/3.jpg" width="960" />');
	$('#promotional .images').append('<img alt="Image 4" height="555" src="/images/promotional/4.jpg" width="960" />');
	$('#promotional .images').cycle({
		speed   : 2000,
		timeout : 4000
	});
	$('.addthis_button_facebook_like').attr('fb:like:layout', 'button_count');
});
