toursList = new ToursList();

function ToursList() {
	
	// this.filterCountryId = 0;
	
	this.switchTourDatesBlock = function(blockId) {
		
		var blockObj = $('tourDatesBlock'+blockId);		
		var showBlockBtnObj = $('tourDatesShowBtn'+blockId);		
		var hideBlockBtnObj = $('tourDatesHideBtn'+blockId);		
		
		var showStatus = blockObj.style.display;
			
		if(showStatus == 'block'){
			blockObj.style.display = 'none';
			showBlockBtnObj.style.display = 'block';	
			hideBlockBtnObj.style.display = 'none';			
		} else {
			blockObj.style.display = 'block';
			showBlockBtnObj.style.display = 'none';	
			hideBlockBtnObj.style.display = 'block';			
						
		}						
	}



	this.applyFilter = function() {
					
	}
		
}







jQuery(document).ready(function() {

	// Region is selected action	
   jQuery("#applyFilterButton").click(function() { 

		var currentPage = jQuery("#currentPage").val();	
		var filterCountryId = jQuery("#toursFilterCountry").val();		
		var filterMaxPrice = jQuery("#toursFilterMaxPrice").val();
		var filterMonthYear = jQuery("#toursFilterMonth").val();				
		var predefinedCountry = jQuery("#predefinedCountry").val();		

		highlightListItem('toursCountriesList', 'country'+filterCountryId);

		jQuery(this).ajaxStart(function(){	
			jQuery("#filterSatusIndicator").attr("style", "display:block;");

				jQuery("#toursList").css({
					"opacity": "0.4"					
				});
												
		});
	
		jQuery(this).ajaxStop(function(){
			jQuery("#filterSatusIndicator").attr("style", "display:none;");												
		});
	
	
		jQuery.ajax({
		 	type: "POST",			
		 	url: "/ajax.php",
		 	data: "lng="+ sysCurrentLanguage +"&com=tours&task=applyFilter&currentPage=" + currentPage + "&country=" + filterCountryId + "&predefinedCountry=" + predefinedCountry + "&month=" + filterMonthYear + "&maxPrice=" + filterMaxPrice,
		
			success: function(response){
				jQuery("#toursList").html(response)
				jQuery("#toursList").css({
					"opacity": "1"
				});					 			
			}					   
							   	 				
		});	

	});
	
});