$(document).ready(function() {

	if ( !($.browser.msie && $.browser.version == 7.0) ){
		$('#slides').slides({
			preload: true,
			preloadImage: 'img/loading.gif',
			play: 5000,
			pause: 2500,
			hoverPause: true,
			animationStart: function(){
				$('.caption').animate({
					bottom:-35
				},100);
			}, 
			animationComplete: function(current){
				$('.caption').animate({
					bottom:0
				},200);
				if (window.console && console.log) {
					// example return of current slide number
					console.log(current);
				};
			}
		});
	}
	
	try { app.preview('a#menu_breadsticks'); } catch (e) { }
});

var app = {
	preview: function (id) {
		$(id).imgPreview({
		    containerID: 'imgPreviewWithStyles',
		    imgCSS: {
		        // Limit preview size:
		        height: 150
		    },
		    // When container is shown:
		    onShow: function(link){
		        // Animate link:
		        $(link).stop().animate({opacity:0.4});
		        // Reset image:
		        $('img', this).stop().css({opacity:0});
		    },
		    // When image has loaded:
		    onLoad: function(){
		        // Animate image
		        $(this).animate({opacity:1}, 300);
		    },
		    // When container hides: 
		    onHide: function(link){
		        // Animate link:
		        $(link).stop().animate({opacity:1});
		    }
		});
		
		$(id).click(function () {
		    return false;
		});
	}
}
