var tb_pathToImage = "images/loadingAnimation.gif";

$(document).ready(
  function(){
  	set_position__cmp_photo();
	set_position__menu();
	set__breakfast();
	
	$('div#new_dishes__left').cycle({delay:2000, speed:1000});
	$('div#new_dishes__right').cycle({delay:3000, speed:1000});
	$('div#box__breakfast').cycle({delay:3000, speed:1000});
	
	$('div#safflogo').click(
		function(){
			location.href = 'http://www.safaroff.az';
		}
	);
	
	$('div#facebook').click(
		function(){
			location.href = 'http://www.facebook.com/#!/duplexcafe?ref=mf';
		}
	);
	
	$('div#menu_click, div#download_menu').click(
		function(){
			location.href = 'Duplexcafe_menu.pdf';
		}
	);
	
	
	tb_init('a.thickbox, area.thickbox, input.thickbox, div.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
	
	//get current domain
    current_domain = 'http://'+document.domain+'/pictures/lightbox/';

	//==========================
	// Initialize lightbox
	//==========================
	$('div.lightbox, a.lightbox').lightBox({
		overlayBgColor: '#000',
		overlayOpacity: 0.6,
		imageLoading: current_domain+'loading.gif',
		imageBtnClose: current_domain+'close.gif',
		imageBtnPrev: current_domain+'prev.gif',
		imageBtnNext: current_domain+'next.gif',
		imageBlank: current_domain+'blank.gif',
		containerResizeSpeed: 350,
		txtImage: 'Картинка',
		txtOf: 'из'
   });
	
   //===============================
   // Second lightbox
   //===============================
   $('div.lightbox_2, a.lightbox_2').lightBox({
	  overlayBgColor: '#000',
	  overlayOpacity: 0.6,
	  imageLoading: current_domain+'loading.gif',
	  imageBtnClose: current_domain+'close.gif',
	  imageBtnPrev: current_domain+'prev.gif',
	  imageBtnNext: current_domain+'next.gif',
	  imageBlank: current_domain+'blank.gif',
	  containerResizeSpeed: 350,
	  txtImage: 'Картинка',
	  txtOf: 'из'
   });
  }
);

$(window).resize(
  function(){
  	set_position__cmp_photo();
	set_position__menu();
	set__breakfast();
  }
);

function set_position__cmp_photo(){
	position = $('div#main').position();	 
	$('div#cmp_photo').css('left',position['left']+400); 
	$('div#cmp_photo').css('top',position['top']+580);
}

function set_position__menu(){
	var width = $(window).width()-243;
	
	$('div#menu_click').css({'left':width});
}

function set__breakfast(){
	position = $('div#main').position();
	position['top']+= 690;
	position['left']-= 2;
	
	$('div#box__breakfast').css({'top':position['top'], 'left':position['left']});	
	
	
}