jQuery(document).ready(function() {
    jQuery('#carousel').jcarousel({
			scroll: 3,
      visible: 7
		});

		$("a[rel^='prettyPhoto']").prettyPhoto();
		$("a[rel^='shadowbox']").prettyPhoto();
		$("a[rel^='lightbox']").prettyPhoto();

	$("ul > li.menu > ul").hide();

	$(".menu").hover(function () {
		$(this).find(".podslozky").toggle("fast"); //animate({height: ['toggle', 'swing'], duration: '400'})
	});

	$(".cars").tooltip();

	$('input.confirm, a.confirm').click(function (e) {
		e.preventDefault();

		var page = $(this).attr('href');
		// example of calling the confirm function
		// you must use a callback function to perform the "yes" action
		confirm1("Opravdu si přejete položku vymazat ?", function () {
			if(page) {
				window.location = page;
			} else {
				//$(form).attr('form').onsubmit();
				$('#form').submit();
			}
		});
	});

//stylish scrollbar
  $('.jScrollbar').jScrollPane({
			allowMouseWheel : true,
      scrollStep : 20,
			showArrows: true,
		}
	);
	//end of scrolllbar

	jQuery("a.demand").modalBox({
					getStaticContentFrom : "#demandContent"
	});
});

function confirm1(message, callback) {
	$('#confirm').modal({
		closeHTML: "<a href='#' title='Close' class='modal-close'>x</a>",
		position: ["20%",],
		overlayId: 'confirm-overlay',
		containerId: 'confirm-container', 
		onShow: function (dialog) {
			var modal = this;

			$('.message', dialog.data[0]).append(message);

			// if the user clicks "yes"
			$('.yes', dialog.data[0]).click(function () {
				// call the callback
				if ($.isFunction(callback)) {
					callback.apply();
				}
				// close the dialog
				modal.close(); // or $.modal.close();
			});
		}
	});
};

