Bolero = {
	_id: 'Bolero',
	initialize: function(){
		Bolero.navigationPictures();
		Bolero.Location.init();
	},
	Location:{
		init: function(){
			var map = jQuery('.locations_map');
			if (map){
				var hIn = function(e){
					var id = e.target.id;
					id = id.split('menu-').join('');
					Bolero.Location.shine(id);
					jQuery('.child').hide();
					jQuery('#child-'+id).show();
				}
				
				var hOut = function(e){
					var id = e.target.id;
					id = id.split('menu-').join('');
					Bolero.Location.shine(id, true);
					jQuery('.child').hide();
					jQuery('#child-none').show();
				}
				
				jQuery('.location').hover(hIn, hOut);
			}
		},
		shine: function(id, hide){
			var shine = jQuery('#location_shine_'+id);
			var allShines = jQuery('.location_shine');
			var point = jQuery('#location_point_'+id);
			if(!hide) {
				allShines.hide();
				shine.show();
				//point.hide();
			} else {
				allShines.hide();
				//point.show();
				shine.hide();
			}
		}
		
	},
	
	
	navigationPictures: function(){
			
		jQuery('#header_wrapper').corner('top');
		jQuery('#footer_wrapper').corner('bottom');
		jQuery('#header_picture').corner();
		jQuery('.Headquarter.NavigationSide li a').corner();
		jQuery('a.reservation_inline').corner();		

		/*
		var images = jQuery("a.image_Navigation");
		if (images && images.fancybox){
			images.fancybox({"zoomOpacity": true,
				"zoomSpeedIn": 300,
				"zoomSpeedOut": 300,
				"overlayShow": false
			});
		}

		jQuery('#mask_top').mousemove(function(e){
			
			jQuery('#mask_top .navigation_picture').each(function(i, item){
				
				var el = jQuery(this);
				var position = el.position();
				var width = el.width();
				var height = 150;	// max 150
				var marginW = el.outerWidth(true)-width;
				var marginH = el.outerHeight(true)-height;
				
				var minX = position.left + marginW;
				var maxX = minX + width;
				
				var minY = 0;	// get this
				var maxY = minY + height;
				
				//console.log('MIN/MAX', e.pageX, e.pageY, minX, maxX, minY, maxY, marginH, el.height(), el.outerHeight(), el.outerHeight(true));
				
				if (e.pageX > minX && e.pageX < maxX && e.pageY > minY && e.pageY < maxY){
					el.css('z-index', 0);
				}else{
					el.css('z-index', -1);
				}
			});
		});
		
		
		
		jQuery('#mask_bottom').mousemove(function(e){
			
			jQuery('#mask_bottom .navigation_picture').each(function(i, item){
				
				var el = jQuery(this);
				var position = el.position();
				var width = el.width();
				var height = el.height();
				var marginW = el.outerWidth(true)-width;
				var marginH = el.outerHeight(true)-height;
				
				var minX = position.left + marginW;
				var maxX = minX + width;
				
				var minY = position.top+20;	// get this
				var maxY = jQuery(document).height() - 200;
				
				//console.log('POS', position.top, marginH);
				//console.log('MIN/MAX', e.pageX, e.pageY, minX, maxX, minY, maxY, marginH, el.height(), el.outerHeight(), el.outerHeight(true));
				
				if (e.pageX > minX && e.pageX < maxX && e.pageY > minY && e.pageY < maxY){
					el.css('z-index', 0);
				}else{
					el.css('z-index', -1);
				}
			});
		});
		*/
	}
};

jQuery(document).ready(Bolero.initialize);

