$(document).ready(function() {
	$('#header #user-control .login a').toggle(
		function() { $(this).addClass('hover'); $('#header #user-control .login-form').animate({ height: 'toggle' }); },
		function() { $('#header #user-control .login-form').animate({ height: 'toggle' }, function() { $('#header #user-control .login a').removeClass('hover'); }); }
	);
	
	$('.form-poll label.radio').click(function() {
		$('.form-poll label.radio').removeClass('checked');
		$(this).addClass('checked');
	});
	
	$('.basket-checkbox label.checkbox').click(function() {
		$('.basket-checkbox label.checkbox').removeClass('checked');
		$(this).addClass('checked');
	});
	
	$('ul.help-list li a.answer-link').toggle(
		function() { $(this).next('.answer').animate({ height: 'toggle' }); },
		function() { $(this).next('.answer').animate({ height: 'toggle' }); }
	);
	
	$('#header #user-control .login-form form input#login-user').focus(function() { if($(this).val() == 'Korisničko ime') { $(this).val(''); } });
	$('#header #user-control .login-form form input#login-user').blur(function() { if($(this).val() == '') { $(this).val('Korisničko ime'); } });
	
	$('#header #user-control .login-form form input#login-pass').focus(function() { if($(this).val() == 'Lozinka') { $(this).val(''); } });
	$('#header #user-control .login-form form input#login-pass').blur(function() { if($(this).val() == '') { $(this).val('Lozinka'); } });
	
	$('#header form#search-form input').focus(function() { $(this).addClass('focus'); $('#header form#search-form button').addClass('focus'); });
	$('#header form#search-form input').blur(function() { $(this).removeClass('focus'); $('#header form#search-form button').removeClass('focus'); });
	
	$('.register-form ul li input, .newsletter-form ul li input').focus(function() { $(this).parent('li').addClass('current'); });
	$('.register-form ul li input, .newsletter-form ul li input').blur(function() { $(this).parent('li').removeClass('current'); });
	
	$('.register-form ul li div textarea').focus(function() { $(this).parent().parent('li').addClass('current'); });
	$('.register-form ul li div textarea').blur(function() { $(this).parent().parent('li').removeClass('current'); });
	
	$('.register-form .register-checkbox label').click(function() {
		$('.register-form .register-checkbox label').removeClass('checked');
		$(this).addClass('checked');
	});
	
	$('.newsletter-form .newsletter-checkbox label').click(function() {
		$('.newsletter-form .newsletter-checkbox label').removeClass('checked');
		$(this).addClass('checked');
	});
	
	$('.book-comments-form .book-comments-more a').toggle(
		function() { $('.book-comments-form form').animate({ height: 'toggle' }); },
		function() { $('.book-comments-form form').animate({ height: 'toggle' }); }
	);
	
	$('.basket-promotion .pay .pay-box').toggle(
		function() { $('.basket-promotion .pay .selectbox-wrapper').css('display','block'); },
		function() { $('.basket-promotion .pay .selectbox-wrapper').css('display','none'); }
	);
	
	$('#footer #go-top a').click(function() { $('html, body').animate({ scrollTop: '0px' }, 300); return false; });
	
	$('.full-column .view-all a').toggle(
		function() { $(this).html('zatvori sve'); $('.cats-accordion ul').slideDown(); $('.cats-accordion h4').addClass('selected'); return false; },
		function() { $(this).html('otvori sve'); $('.cats-accordion ul').slideUp(); $('.cats-accordion h4').removeClass('selected'); return false; }
	);
	
	$('.book-carousel ul li a, ul.book-list li a, ul.book-view li a').hover(
		function() { $(this).children('.price').css('display','block'); },
		function() { $(this).children('.price').css('display','none'); }
	);
	
	$('.book-carousel').jcarousel();
	$('.photo-carousel').jcarousel({ scroll: 1 });
	$('.cats-accordion').accordion({ header: 'h4', autoheight: false, active: false, alwaysOpen: false });
	$('.slider').cycle({ timeout: 10000 });
	$('.content-tabs').tabs({ fxFade: true, fxSpeed: 'fast' });
	$('.basket-promotion .pay select, .register-form ul li select').selectbox({ debug: true });
});
Shadowbox.init();