if (!wws) {
	var wws = {};
}

wws.fx = {};
wws.fx.zz = function() {
	$('.zz').fancybox({
		'imageScale': true,
		'overlayShow': false,
		'zoomOpacity': true,
		'zoomSpeedIn': 600,
		'zoomSpeedOut': 500
	});
};

wws.fx.slide = function() {
	var r;
	var t;
	var effect;
	var strips;
	var delay;
	var position;
	var direction;
	var links;

	$('p.ss').each(function() {
		$(this).find('br').each(function() {
			$(this).remove();
		});

		r = 'wws-fx-' + Math.random().toString().replace('.', '');

		effect = 'wave';
		strips = 20;
		delay = 5000;
		position = 'alternate';
		direction = 'fountainAlternate';
		links = false;

		$.each($(this).attr('class').split(' '), function(i,c) {
			t = c.split('-');
			if (t[0] === 'effect') {
				effect = t[1];
			}
			if (t[0] === 'strips') {
				strips = parseInt(t[1], 10);
			}
			if (t[0] === 'delay') {
				delay = parseInt(t[1], 10);
			}
			if (t[0] === 'position') {
				position = t[1];
			}
			if (t[0] === 'direction') {
				direction = t[1];
			}
			if (t[0] === 'links') {
				links = true;
			}
		});

		$(this).attr('id', r);

		$('#' + r).jqFancyTransitions({
			effect: effect,
			strips: strips,
			delay: delay,
			position: position,
			direction: direction,
			links: links,
			width: $(this).width(),
			height: $(this).height()
		});

		$('.ft-title').each(function() {
			$(this).css('width', ($('#' + r).width() - 10) + 'px');
			$(this).css('padding', '5px');
		});

		if (!links) {
			$(this).find('*').css('cursor', 'wait');
		}
	});
};

$(document).ready(function() {
	wws.fx.zz();
	wws.fx.slide();
});

