	$(document).ready(function() {
		$("img[src*='phpThumb']").addClass('loading');
		setTimeout('$("img[src*=\'phpThumb\']").addClass(\'loading\')',10000);
		$('#navigation ul li ul').hover(function() {
			$(this).parent('li').addClass('active');
		},
		function() {
			$(this).parent('li').removeClass('active');
		});
		$('#navigation ul li').hover(
	    function(){
	      $(this).children('ul').animate({ height: 'show', opacity: 'show', width: 'show' }, 'fast');
	    },
	    function(){
	      $(this).children('ul').animate({ height: 'hide', opacity: 'hide' }, 'fast');
	    }
    );
		$('navigation ul li ul:last-child li a').css({'-moz-border-radius' : '0 0 8px 8px'});
		$(".cycle").cycle();
		$('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
		$("#suggest1").autocomplete(categories);
		$("#suggest2").autocomplete(manufacturers);
		$("#featured .cycle").cycle({
			fx:      'scrollLeft',
			easeIn: 'easeOutElastic',
			speedOut: 100,
			delay:   -2000,
			pause: true,
			next: '#nextBtn',
			prev: '#prevBtn'
		});
		$('a.iframe').fancybox({
			'overlayShow' : true,
			'overlayOpacity' : 0.8,
			'overlayColor' : '#000',
			'speedIn' : 500,
			'speedOut' : 200,
			'transitionIn' : 'elastic',
			'transitionOut' : 'elastic',
			'easingIn' : 'easeOutBack',
			'easingOut' : 'easeInBack',
			'width' : 770,
			'height' : 570,
			'autoScale' : false
		});
		$('a[rel=gallery]').fancybox({
			'overlayShow' : true,
			'overlayOpacity' : 0.8,
			'overlayColor' : '#000',
			'speedIn' : 500,
			'speedOut' : 200,
			'transitionIn' : 'elastic',
			'transitionOut' : 'elastic',
			'easingIn' : 'easeOutBack',
			'easingOut' : 'easeInBack',
			'autoScale' : true
		});
		$('a[rel=image_gallery]').fancybox({
			'overlayShow' : true,
			'overlayOpacity' : 0.8,
			'overlayColor' : '#000',
			'speedIn' : 500,
			'speedOut' : 200,
			'transitionIn' : 'elastic',
			'transitionOut' : 'elastic',
			'easingIn' : 'easeOutBack',
			'easingOut' : 'easeInBack',
			'autoScale' : true
		});
		$("a.zoom").hover(function() {
			$(this).css({'z-index' : '10'});
			$(this).find('img').addClass("hover").stop()
				.animate({
					marginTop: '-110px', 
					marginLeft: '-110px', 
					top: '50%', 
					left: '50%', 
					width: '174px', 
					height: '174px',
					padding: '20px' 
				}, 'fast');
			
			} , function() {
			$(this).css({'z-index' : '0'});
			$(this).find('img').removeClass("hover").stop()
				.animate({
					marginTop: '0', 
					marginLeft: '0',
					top: '0', 
					left: '0', 
					width: '93px', 
					height: '93px', 
					padding: '1px'
				}, 'fast');
		});
		function findValueCallback(event, data, formatted) {
			$("<li>").html( !data ? "No match!" : "Selected: " + formatted).appendTo("#result");
		}
		function formatItem(row) {
			return row[0] + " (<strong>id: " + row[1] + "</strong>)";
		}
		function formatResult(row) {
			return row[0].replace(/(<.+?>)/gi, '');
		}
	});
	
	function changeOptions(){
		var max = parseInt(window.prompt('Please type number of items to display:', jQuery.Autocompleter.defaults.max));
		if (max > 0) {
			$("#suggest1").setOptions({
				max: max
			});
		}
	}
	function changeScrollHeight() {
	    var h = parseInt(window.prompt('Please type new scroll height (number in pixels):', jQuery.Autocompleter.defaults.scrollHeight));
	    if(h > 0) {
	        $("#suggest1").setOptions({
				scrollHeight: h
			});
	    }
	}
