text: /* JS Document */
  
  
  
  /******************************
  
  
  
  [Table of Contents]
  
  
  
  1. Vars and Inits
  
  2. Set Header
  
  3. Init Menu
  
  4. Init Search
  
  5. Init More Options
  
  6. Init Listing Slider
  
  7. Init Lightbox
  
  8. Init Google Map
  
  9. Init Search Form
  
  
  
  
  
  ******************************/
  
  
  
  $(document).ready(function()
  
  {
  
  	"use strict";
  
  
  
  	/* 
  
  
  
  	1. Vars and Inits
  
  
  
  	*/
  
  
  
  	var menu = $('.menu');
  
  	var menuActive = false;
  
  	var header = $('.header');
  
  	var map;
  
  	var searchActive = false;
  
  
  
  	setHeader();
  
  
  
  	$(window).on('resize', function()
  
  	{
  
  		setHeader();
  
  	});
  
  
  
  	$(document).on('scroll', function()
  
  	{
  
  		setHeader();
  
  	});
  
  
  
  	initMenu();
  
  	initSearch();
  
  	initMoreOptions();
  
  	initListingSlider();
  
  	initLightbox();
  
  	initGoogleMap();
  
  	initSearchForm();
  
  
  
  	/* 
  
  
  
  	2. Set Header
  
  
  
  	*/
  
  
  
  	function setHeader()
  
  	{
  
  		if(window.innerWidth < 992)
  
  		{
  
  			if($(window).scrollTop() > 100)
  
  			{
  
  				header.addClass('scrolled');
  
  			}
  
  			else
  
  			{
  
  				header.removeClass('scrolled');
  
  			}
  
  		}
  
  		else
  
  		{
  
  			if($(window).scrollTop() > 100)
  
  			{
  
  				header.addClass('scrolled');
  
  			}
  
  			else
  
  			{
  
  				header.removeClass('scrolled');
  
  			}
  
  		}
  
  		if(window.innerWidth > 991 && menuActive)
  
  		{
  
  			closeMenu();
  
  		}
  
  	}
  
  
  
  	/* 
  
  
  
  	3. Init Menu
  
  
  
  	*/
  
  
  
  	function initMenu()
  
  	{
  
  		if($('.hamburger').length && $('.menu').length)
  
  		{
  
  			var hamb = $('.hamburger');
  
  			var close = $('.menu_close_container');
  
  
  
  			hamb.on('click', function()
  
  			{
  
  				if(!menuActive)
  
  				{
  
  					openMenu();
  
  				}
  
  				else
  
  				{
  
  					closeMenu();
  
  				}
  
  			});
  
  
  
  			close.on('click', function()
  
  			{
  
  				if(!menuActive)
  
  				{
  
  					openMenu();
  
  				}
  
  				else
  
  				{
  
  					closeMenu();
  
  				}
  
  			});
  
  
  
  	
  
  		}
  
  	}
  
  
  
  	function openMenu()
  
  	{
  
  		menu.addClass('active');
  
  		menuActive = true;
  
  	}
  
  
  
  	function closeMenu()
  
  	{
  
  		menu.removeClass('active');
  
  		menuActive = false;
  
  	}
  
  
  
      /* 
  
  
  
  	4. Init Search
  
  
  
  	*/
  
  
  
  	function initSearch()
  
  	{
  
  		if($('.search_tab').length)
  
  		{
  
  			$('.search_tab').on('click', function()
  
  			{
  
  				$('.search_tab').removeClass('active');
  
  				$(this).addClass('active');
  
  				var clickedIndex = $('.search_tab').index(this);
  
  
  
  				var panels = $('.search_panel');
  
  				panels.removeClass('active');
  
  				$(panels[clickedIndex]).addClass('active');
  
  			});
  
  		}
  
  	}
  
  
  
  	/* 
  
  
  
  	5. Init More Options
  
  
  
  	*/
  
  
  
  	function initMoreOptions()
  
  	{
  
  		if($('.more_options').length)
  
  		{
  
  			var triggerEle = $('.more_options_trigger');
  
  			var ele = $('.more_options_list');
  
  
  
  			triggerEle.on('click', function(e)
  
  			{
  
  				e.preventDefault();
  
  				triggerEle.toggleClass('active');
  
  				ele.toggleClass('active');
  
  
  
  				var panel = ele;
  
  				var panelH = ele.prop('scrollHeight') + "px";
  
  				
  
  				if(panel.css('max-height') == "0px")
  
  				{
  
  					panel.css('max-height', panel.prop('scrollHeight') + "px");
  
  				}
  
  				else
  
  				{
  
  					panel.css('max-height', "0px");
  
  				} 
  
  			});
  
  		}
  
  	}
  
  
  
  	/* 
  
  
  
  	6. Init Listing Slider
  
  
  
  	*/
  
  
  
  	function initListingSlider()
  
  	{
  
  		if($('.hotel_slider').length)
  
  		{
  
  			var hotelSlider = $('.hotel_slider');
  
  
  
  			hotelSlider.owlCarousel(
  
  			{
  
  				loop:true,
  
  				nav:false,
  
  				dots:false,
  
  				margin:16,
  
  				responsive:
  
  				{
  
  					0:{items:2},
  
  					320:{items:3},
  
  					480:{items:4},
  
  					575:{items:5},
  
  					768:{items:7},
  
  					992:{items:8},
  
  					1199:{items:9}
  
  				}
  
  			});
  
  
  
  			/* Custom nav events */
  
  			if($('.hotel_slider_prev').length)
  
  			{
  
  				var prev = $('.hotel_slider_prev');
  
  
  
  				prev.on('click', function()
  
  				{
  
  					hotelSlider.trigger('prev.owl.carousel');
  
  				});
  
  			}
  
  
  
  			if($('.hotel_slider_next').length)
  
  			{
  
  				var next = $('.hotel_slider_next');
  
  
  
  				next.on('click', function()
  
  				{
  
  					hotelSlider.trigger('next.owl.carousel');
  
  				});
  
  			}
  
  		}
  
  	}
  
  
  
  	/*
  
  
  
  	7. Init Lightbox
  
  
  
  	*/
  
  
  
  	function initLightbox()
  
  	{
  
  		if($('.cboxElement').length)
  
  		{
  
  			$('.colorbox').colorbox(
  
  			{
  
  				rel:'colorbox'
  
  			});
  
  		}
  
  	}
  
  
  
  	/* 
  
  
  
  	8. Init Google Map
  
  
  
  	*/
  
  
  
  	function initGoogleMap()
  
  	{
  
  		var myLatlng = new google.maps.LatLng(36.132229, -5.351153);
  
      	var mapOptions = 
  
      	{
  
      		center: myLatlng,
  
  	       	zoom: 17,
  
  			mapTypeId: google.maps.MapTypeId.ROADMAP,
  
  			draggable: true,
  
  			scrollwheel: false,
  
  			zoomControl: true,
  
  			zoomControlOptions:
  
  			{
  
  				position: google.maps.ControlPosition.RIGHT_CENTER
  
  			},
  
  			mapTypeControl: false,
  
  			scaleControl: false,
  
  			streetViewControl: false,
  
  			rotateControl: false,
  
  			fullscreenControl: true,
  
  			styles:[]
  
      	}
  
  
  
      	// Initialize a map with options
  
      	map = new google.maps.Map(document.getElementById('map'), mapOptions);
  
     
  
  		// Re-center map after window resize
  
  		google.maps.event.addDomListener(window, 'resize', function()
  
  		{
  
  			setTimeout(function()
  
  			{
  
  				google.maps.event.trigger(map, "resize");
  
  				map.setCenter(myLatlng);
  
  			}, 1400);
  
  		});
  
  	}
  
  
  
  	/* 
  
  
  
  	9. Init Search Form
  
  
  
  	*/
  
  
  
  	function initSearchForm()
  
  	{
  
  		if($('.search_form').length)
  
  		{
  
  			var searchForm = $('.search_form');
  
  			var searchInput = $('.search_content_input');
  
  			var searchButton = $('.content_search');
  
  
  
  			searchButton.on('click', function(event)
  
  			{
  
  				event.stopPropagation();
  
  
  
  				if(!searchActive)
  
  				{
  
  					searchForm.addClass('active');
  
  					searchActive = true;
  
  
  
  					$(document).one('click', function closeForm(e)
  
  					{
  
  						if($(e.target).hasClass('search_content_input'))
  
  						{
  
  							$(document).one('click', closeForm);
  
  						}
  
  						else
  
  						{
  
  							searchForm.removeClass('active');
  
  							searchActive = false;
  
  						}
  
  					});
  
  				}
  
  				else
  
  				{
  
  					searchForm.removeClass('active');
  
  					searchActive = false;
  
  				}
  
  			});	
  
  		}
  
  	}
  
  });