$(function() {
	/*var ww = $(window).width();
		var myScroll;
		function loaded() {
			setTimeout(function () {
			myScroll = new iScroll('wrapper',{hideScrollbar: false});
			},3000);
		}
		if(ww < 480){
			loaded();
		}else{
			$('#removeItems').css({
				height: '320px',
				overflowY: 'scroll'
			});
		}
		document.addEventListener('DOMContentLoaded', loaded, false);*/
		
	if($('#home').length){
		$('#slideShow').crossSlide({
			sleep: 2,
			fade: 1
		}, [
			{ src: 'img/slideshow/frutid.png' },
			{ src: 'img/slideshow/specials.png'   },
			{ src: 'img/slideshow/downstairs.png'   },
			{ src: 'img/slideshow/empty-tables.png'   },
			{ src: 'img/slideshow/maurizio.png'   },
			{ src: 'img/slideshow/waiter.png'   },
			{ src: 'img/slideshow/outside.png'   },
			{ src: 'img/slideshow/pasta.png'   },
			{ src: 'img/slideshow/zuppa.png'   }
		]);
	}
	
		if($('#menu').length){
		$.ajax({
			type     : 'GET',
			dataType : 'json',
 		  cache    : false,
			url      : 'cms/data/menu/antipasti.json',
			success  : function(e){
				var menu = null,
						arrM = [];
				for( var x = 0; x < e.length; x++){
					 var mainMenu = {}
					mainMenu["fTitle"] = e[x].name;
					mainMenu["fDescription"] = e[x].description;
					mainMenu["fPrice"] = e[x].price;
					 arrM.push(mainMenu);
				}
				menu = arrM;
				$('#menuTmpl').tmpl(menu).appendTo('#removeItems');
			}
		});
		
		$('#menunav li').click(function(e){
			e.preventDefault();
			var mTitle = $(this).children('a').text(),
					menuUrl = mTitle.toLowerCase();
			$('#course').text(mTitle);
				//$('#removeItems').height('320');
				$('#removeItems').empty();
				$.ajax({
					type     : 'GET',
					dataType : 'json',
					cache    : false,
					url      : 'cms/data/menu/' + menuUrl + '.json',
					success  : function(e){
						var menu = null,
								arrM = [];
						for( var x = 0; x < e.length; x++){
							 var mainMenu = {}
							mainMenu["fTitle"] = e[x].name;
							mainMenu["fDescription"] = e[x].description;
							mainMenu["fPrice"] = e[x].price;
							mainMenu["fPhoto"] = e[x].photo;
							 arrM.push(mainMenu);
						}
						menu = arrM;
						$('#menuTmpl').tmpl(menu).appendTo('#removeItems');
					}
				});			
			});
	}
	
});

