$(function () {
    // Enabling cycling effent on top-items-wrapper
    if ($().cycle) {
        $('.slot-1, .slot-2, .slot-3, .slot-4, .slot-5').cycle({slideExpr: '.slot-item'});
    };

	$('.wares-list-sorting select').change(function () {
		$(this).parents('form').submit();
	});
	
	if ($().overlay) {
		// docs: http://flowplayer.org/tools/overlay/index.html
		$('a[rel]').overlay();
		$('.close').click(function(event) {
			event.preventDefault();
			$(this).parents('.filled').removeClass('filled');
			return false;
		});
	};
	
	if ($().mask) {
		$.mask.definitions['~'] = '\d?';
		$('.supplier-form-wrapper input[name="form_text_11"]').mask('(~99~) ~9~-99-99');
	};
	
	if ($().lightBox) {
		// Enabling lightbox effect
		// Just got var lightbox_data from footer.php
		$('.lightbox').lightBox({
			overlayBgColor: '#FFF',
			overlayOpacity: 0.6,
			containerResizeSpeed: 350,
			imageLoading:  lightbox_data.imageLoading,
			imageBtnClose: lightbox_data.imageBtnClose,
			imageBtnPrev:  lightbox_data.imageBtnPrev,
			imageBtnNext:  lightbox_data.imageBtnNext,
			imageBlank:    lightbox_data.imageBtnBlank,
			txtImage: lightbox_data.txtImage,
			txtOf: lightbox_data.txtOf
		});
	}
});

