text: /***
  Equal Heights function.
  ***/
  
  (function($) {
  	$.fn.equalHeights = function(browserWidth, additionalHeight) {
  		// Calculating width of the scrollbar for Firefox
  		var scrollbar = 0;
  		if (typeof document.body.style.MozBoxShadow === 'string') {
  			scrollbar = window.innerWidth - jQuery('body').width();
  		} 
  		// Getting number of blocks for height correction.
  		var blocks = jQuery(this).children().length;
  		// Setting block heights to auto.
  		jQuery(this).children().css('min-height', 'auto');
  		// Initializing variables.
  		var currentBlock = 1;
  		var equalHeight = 0;
  		// Finding the highest block in the selection.
  		while (currentBlock <= blocks) {
  			var currentHeight = jQuery(this).children(':nth-child(' + currentBlock.toString() + ')').height();
  			if (equalHeight <= currentHeight) {
  				equalHeight = currentHeight;
  			}
  			currentBlock = currentBlock + 1;
  		}
  		// Equalizing heights of columns.
  		if (jQuery('body').width() > browserWidth - scrollbar) {
  			jQuery(this).children().css('min-height', equalHeight + additionalHeight);
  		} else {
  			jQuery(this).children().css('min-height', 'auto');
  		}
  	};
  })(jQuery);
  
  /* global document */
  jQuery(document).ready(function(){
  
  	
  
  	/***
       3. Adding sliders for the advanced search form. Implementing switching between default and advanced search forms.
  	***/
  
  	/* Calling slider() function and setting slider options. */
  	jQuery('#slider-distance').slider({
  		range: 'min',
  		value: 100,
  		min: 2,
  		max: 700,
  		slide: function( event, ui ) {
  			jQuery('#distance').text( ui.value + ' m' );
  		}
  	});
  	/* Showing the default value on the page load. */
  	jQuery('#distance').text( jQuery('#slider-distance').slider('value') + ' m' );
  
  	
  	
  	/***
       4. Calling selectbox() plugin to create custom stylable select lists.
  	***/
  
  	jQuery('#category-selector-default').selectbox({
  		animationSpeed: "fast",
  		listboxMaxSize: 400
  	});
  	jQuery('#category-selector-advanced').selectbox({
  		animationSpeed: "fast",
  		listboxMaxSize: 400
  	});
  	jQuery('#country-selector-advanced').selectbox({
  		animationSpeed: "fast",
  		listboxMaxSize: 400
  	});
  
  	/***
       5. Custom logic for switching between search default/advanced forms and hiding/showing map.
  	***/
  
  	jQuery('#advanced-search').hide();
  	jQuery('#advanced-search-button').click(function(event) {
  		/* Preventing default link action */
  		event.preventDefault();
  		if ( jQuery('#hide-map-button').hasClass('map-collapsed') ) {
  			jQuery('#map').animate({ height: '620px' });
  			jQuery('#hide-map-button').text('Hide Map').removeClass('map-collapsed').addClass('map-expanded');
  		}
  		jQuery('#default-search').slideToggle('fast');
  		jQuery('#advanced-search').slideToggle('fast');
  		if (jQuery(this).text() === 'Show menu') {
  			jQuery(this).text('Hide menu');
  			jQuery(this).addClass('expanded');
  		} else {
  			jQuery(this).text('Show menu');
  			jQuery(this).removeClass('expanded');
  		}
  	});
  
  	/***
       7. Adding <input> placeholders (for IE 8-9).
  	***/
  
  	jQuery('.text-input-grey, .text-input-black').placeholder();
  
  	/***
       8. Adding autocomplete.
  	***/
  
  	jQuery(function() {
  		var autosuggestions = [
  			"Airport",
  			"Restaurant",
  			"Shop",
  			"Entertainment",
  			"Realestate",
  			"Sports",
  			"Cars",
  			"Education",
  			"Garden",
  			"Mechanic",
  			"Offices",
  			"Advertising",
  			"Industry",
  			"Postal",
  			"Libraries"
  		];
  		jQuery('#search-what').autocomplete({
  			source: autosuggestions
  		});
  	});
  
  });
  
  /* global window */
  jQuery(window).load(function(){
  
  	/***
  	12. Setting equal heights for required containers and elements on page load.
  	***/
  
  	jQuery('.equalize').equalHeights(767, 0);
  
  
  });
  
  jQuery(window).resize(function() {
  
  	/***
  	15. Setting equal heights for required containers and elements on page resize.
  	***/
  
  	jQuery('.zone-content.equalize').equalHeights(767, 0);
  	
  });
  