

  	
$(document).ready(function() {
//preloader
	var	$header = $('header');
		
    $("body").queryLoader2();


	
	

	var $bgShow = $('#bgShow'),
		$conts = $('#contents'),
		$main = $('#main'),
		$header = $('header'),
		$gallery = $('#gallery'),
		$nav = $('#nav li');


/* Cycles */	
	$('#bgShow #main').fadeIn(3000, function() {
		$bgShow.cycle({
			fx:      'fadeBG',
			timeout: 0,
			pager:  '#nav',
			pagerAnchorBuilder: function(idx, slide) { 
				return '#nav li:eq(' + idx + ') a'; 
			}
		});
	});		

	$conts.cycle({
		fx: 'fade',
		sync: false,
		timeout: 0,
		cleartypeNoBg: true,
		pagerClick: 
			function () {
				$main.cycle('pause');
				$header.animate({
				right: '720px'
				}, 600, 'easeInOutQuart',
					function () {
						$conts.fadeIn( function() {
							$('.jp-container').jScrollPane();
						});
					});
			},
		pager:  '#nav',
		pagerAnchorBuilder: function(idx, slide) { 
			return '#nav li:eq(' + idx + ') a'; 
		}
	});



	$('#main img:first').fadeIn(1000, function() {
		$main.cycle({
			fx:      'fade',
			timeout: 7000,
			speed: 4000,
			startingSlide: 0,
			random:1
		});
    });
	
//	if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
//	}else
//	{
//		$gallery.cycle({
//			fx:      'scrollHorz',
//			timeout: 0,
//			speed: 700,
//			easing: 'easeInOutQuart',
//			prev:   '#prev', 
//			next:   '#next', 
//			pager:  '#gallery_nav'
//		});
//	}

		
		
	$('#home').click(function() {
		$main.cycle('resume');
		$conts.fadeOut();
		$header.animate({
			right: '60px'
		}, 1000, 'easeInOutQuart');		
		$bgShow.cycle(0); 
		$nav.removeClass("current");
		return false; 
	});
	
	$('#nav-main').click(function() {
		$bgShow.cycle(1); 
		return false; 
	});
	$('#nav-happyhour').click(function() {
		$bgShow.cycle(7); 
		return false; 
	});
	$('#nav-privatedining').click(function() {
		$bgShow.cycle(8); 
		return false; 
	});
	$('#nav-pesce').click(function() {
		$bgShow.cycle(9); 
		return false; 
	});
	$('#nav-dolci').click(function() {
		$bgShow.cycle(10); 
		return false; 
	});
	$('#pr1').click(function() {
		$bgShow.cycle(18); 
		return false; 
	});
	$('#pr2').click(function() {
		$bgShow.cycle(17); 
		return false; 
	});
	$('#pr3').click(function() {
		$bgShow.cycle(16); 
		return false; 
	});

/**/
	$('#example1').fbWall({ id:'CaffeRomaBeverlyHills',accessToken:'AAAC7gAoWDQ0BABwFfMLht2AseL3C71zLQlOlL9fZBhg9p3tHEoZCCCeu0XT5ZBvUvkf0EIWN6t6RbE1LWPvdfXZARGsIlRKXYZAo9gNIwSAZDZD'});



/*focus outline*/
	$('a').each(function(){
		  this.hideFocus = true;
	});
/* popup */
    $('#twitter a,a.newWin').click(function(){
        window.open(this.href);
        return false;
    });





/*lightbox*/
Shadowbox.init();
});











$.fn.cycle.transitions.fadeBG = function($cont, $slides, opts) {
		$slides.delay(700).not(':eq('+opts.currSlide+')').css('opacity',0);
		opts.before.push(function(curr,next,opts) {
			$.fn.cycle.commonReset(curr,next,opts);
			opts.cssBefore.opacity = 0;
		});
		opts.animIn	   = { opacity: 1 };
		opts.animOut   = { opacity: 0 };
		opts.cssBefore = { top: 0, left: 0 };
};



/*twitter*/
var jqt_vCurrent = 4;
var jqt_vTotal = 0;
var jqt_vDuration = 8000;
var jqt_intInterval = 0;

jQuery(document).ready(function() {	
	jqt_vTotal = $("#twitter_update_list").children().size() -1;
	jqt_intInterval = setInterval(jqt_fnLoop, jqt_vDuration);
	jqt_fnLoop();
});

function jqt_fnLoop(){
	jqt_vCurrent == jqt_vTotal ? jqt_vCurrent = 0 : jqt_vCurrent++;
	$("#twitter_update_list").find("li").each(function(i) { 
		if(i == jqt_vCurrent){
			$(this).animate({left:40}, 1000);
		} else {
			$(this).animate({left:-500 }, 1000);
		}
	});
}

/*pngfix*/









//if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod'){
//
//	$('.tsb_scrollbar,.tsb_track,.tsb_thumb').remove();
//	
//	var galleryPage;
//	function loaded() {
//		aboutPage = new iScroll('aboutPage', {desktopCompatibility:true,scrollbarColor:'rgba(255,255,255,0.2)'});
//		privatePage = new iScroll('privatePage', {desktopCompatibility:true,scrollbarColor:'rgba(255,255,255,0.2)'});
//		
//	galleryPage = new iScroll('gallery', {
//		snap:true,
//		momentum:false,
//		hScrollbar:false,
//		onScrollEnd: function () {
//			document.querySelector('#indicator > li.active').className = '';
//			document.querySelector('#indicator > li:nth-child(' + (this.pageX+1) + ')').className = 'active';
//		}
//	 });
//	}
//
//	document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
//	document.addEventListener('DOMContentLoaded', loaded, false);
//
//
//}













