/* name: SPEBK - Functions
 * encoding: UTF-8
 * author: Dawid Horodecki
 */

var SPEBK = {
	init: function() {
		// Form submiting after value select
		$('.nws-autosubmit').change(function() {
			if ($(this).find(':selected').attr('value')) {
				$('.nws-form').submit();
			}
		});
		$('.nws-form input[type=submit]').hide();
		
		// Main page slideshow
		if ($().cycle) {
			$('#slideshow').before('<div id="slideshow-nav" class="frd-slidenav l-clearfix">').cycle({
				fx: 'fade',
				pause: 1,
				speed: 500,
				timeout: 5000,
				pauseOnPagerHover: 1,
				pager: '#slideshow-nav'
			});
		}
		
		// Open Member website in new tab/window
		$('a[rel=external]').click(function() {
			var url = $(this).attr('href');
			window.open(url);
			return false;
		});
	}
};

/* Document ready */

$(function() {
	SPEBK.init();
});
