$(document).ready(function(){
	//if ($.cookie('sabak_splash') == '1')
	//	$('#overlay').hide();

	$('a[rel=colorbox]').colorbox({
		transition: 'elastic',
		opacity: 0.9,
		current: _('image') + ' {current} ' + _('image_of') + ' {total} ',
		previous: _('image_previous'),
		next: _('image_next'),
		close: _('image_close')
		
	});
	
	$('a[rel=colorbox_html]').colorbox({
		transition: 'elastic',
		opacity: 0.9,
		current: _('image') + ' {current} ' + _('image_of') + ' {total} ',
		previous: _('image_previous'),
		next: _('image_next'),
		close: _('image_close'),
		width: 760,
		title: false
	});
	
	$('#productImages').cycle({
		pause: true,
		speed: 500,
		timeout: 3000
	});
	
	$('#productImages a.jqzoom').jqzoom({
		zoomType: 'standard',
		alwaysOn: true,
		zoomWidth: 334,
		zoomHeight: 580,
		xOffset: 1,
		yOffset: 0,
		position: 'right',
		title: false
		
	});
	
	$('#rightBanners').cycle({		
		pause: true,
		speed: 1000,
		timeout: 3000
	});
	
	$('#homeBanners').cycle({		
		pause: true,
		speed: 1000,
		timeout: 5000
	});
	$('#warsztat-mistrzow #subPageItems div.clear, #masters-workshop #subPageItems div.clear').remove();
	$('#warsztat-mistrzow #subPageItems, #masters-workshop #subPageItems').cycle({		
		pause: true,
		speed: 300,
		timeout: 0,
		fx:     'custom',
		animOut : {left: '-400px', opacity: 0},
		cssBefore : {left: '-400px', opacity: 0, display: 'block'},
		cssAfter: {display: 'none'},
		animIn : {left: 0, opacity: 1}
	});
	$('.warsztaty').hover(function() {
			$('div.next',this).fadeIn('fast');
		},
		function() {
			$('div.next',this).fadeOut('fast');
		}
	).click(function() {
		$('#subPageItems').cycle('next');
	});
	/*
	$("#jplayer").jPlayer({
		ready: function () {
			$(this).jPlayer("setMedia", {
				m4a: "http://razdwa.nazwa.pl/sabak/assets/templates/sabak/js/dont_make_me_wait.m4a"				
			})
			if ($.cookie('sabak_mute') !== '1')
				$(this).jPlayer("play");
		},
		ended: function (event) {
			$(this).jPlayer("play");
		},
		cssSelectorAncestor: "",
		cssSelector: {
			play: "#playerStart",
			pause: "#playerStop",
		},
		backgroundColor: '#ffffff',
		swfPath: "assets/templates/sabak/js",
		supplied: "m4a",
		solution: 'html, flash',
		volume: 0.6,
		muted: false,
		errorAlerts: false,
		warningAlerts: false
	});

	$('#playerStart').click(function() {$.cookie('sabak_mute','0',{ expires: 7, path: '/' });});
	$('#playerStop').click(function() {$.cookie('sabak_mute','1',{ expires: 7, path: '/' });});
	*/
	if ($('#shopList')) {
		var mask = document.getElementById('shopListWrapper');
		var content = document.getElementById('shopList');
	
		new Dragdealer('shopListScrollBar',
		{
			horizontal: false,
			vertical: true,
			yPrecision: content.offsetHeight,
			animationCallback: function(x, y)
			{
				var margin = y * (content.offsetHeight - mask.offsetHeight);
				content.style.marginTop = String(-margin) + 'px';
			}
		});
	}
	
});

$(window).load(function() {
	//if ($.cookie('sabak_splash') != '1')
	$('#splash1').delay(500).fadeOut(2000,function() {
		$('#splash2').fadeIn(1000).parent().delay(2000).fadeOut(1000);
		$.cookie('sabak_splash','1');
	});
	
});

		/* cssSelector: {
		  videoPlay: '.jp-video-play',
		  play: '.jp-play',
		  pause: '.jp-pause',
		  stop: '.jp-stop',
		  seekBar: '.jp-seek-bar',
		  playBar: '.jp-play-bar',
		  mute: '.jp-mute',
		  unmute: '.jp-unmute',
		  volumeBar: '.jp-volume-bar',
		  volumeBarValue: '.jp-volume-bar-value',
		  currentTime: '.jp-current-time',
		  duration: '.jp-duration'
		}, */
