function update_countries() {
	selected_continent = jQuery("select#user_property_continent").val();

	jQuery.post(
    	"http://www.bed-and-breakfast.org/smarty_content/ajax/updateCountries.php", 
        { 
        	'value':    selected_continent
        },
	    function(result) {
           jQuery("div#select_countries").html(result);
	    }, 
	    "text"
	);
}

function doQuicksearch() {
	query = jQuery("input#mod_search_searchword").val();
	
	location.href = "/index.php?p_module=p_article&id=16&query=" + query;
}

function ratesChangeCurrency() {
	selected_currency 	= jQuery("select#rates_currency").val();
	original_currency	= jQuery("input#rate_currency").val(); 
	curr_singleroom 	= jQuery("input#rate_value_singleroom").val();
	curr_doubleroom 	= jQuery("input#rate_value_doubleroom").val();
	curr_familyroom 	= jQuery("input#rate_value_familyroom").val();
	
	jQuery.post(
    	"http://www.bed-and-breakfast.org/smarty_content/ajax/changeCurrency.php", 
        { 
        	'value':    		selected_currency,
        	'value_original':	original_currency,
        	'curr_singleroom':	curr_singleroom,
        	'curr_doubleroom':	curr_doubleroom,
        	'curr_familyroom':	curr_familyroom
        },
	    function(result) {
           jQuery("div#currency_frame").html(result);
	    }, 
	    "text"
	);
}

function update_regions_and_cities_home() {
	selected_continent = jQuery("select#search_countries").val();

	jQuery.post(
    	"http://www.bed-and-breakfast.org/smarty_content/ajax/updateRegion.php", 
        { 
        	'value':    selected_continent
        },
	    function(result) {
           jQuery("div#search_home_regions").html(result);
	    }, 
	    "text"
	);   

	jQuery.post(
    	"http://www.bed-and-breakfast.org/smarty_content/ajax/updateCities.php", 
        { 
        	'value':    selected_continent
        },
	    function(result) {
           jQuery("div#search_home_cities").html(result);
	    }, 
	    "text"
	);
}        

function doDetailsearch() {        
	query = "";
	
	/* Define vars */
	detail_country 	= jQuery("select#search_countries").val(); 
	detail_region 	= jQuery("select#search_regions").val(); 
	detail_city 	= jQuery("select#search_cities").val(); 
	
	detail_ga_wheelchair		= jQuery("input#user_property_wheelchair").val();		
	detail_ga_businesstraveller	= jQuery("input#user_property_businesstraveller").val();
	detail_ga_smoking			= jQuery("input#user_property_smoking").val();
	detail_ga_children			= jQuery("input#user_property_children").val();
	detail_ga_pets  			= jQuery("input#user_property_pets").val();
	detail_ga_carparking 		= jQuery("input#user_property_carparking").val();
	
	/* Define query */
	if(detail_country != "") {
		query += "detail_country=" + detail_country;
	}                                               
	if(detail_region != "") {
		query += "&detail_region=" + detail_region;
	}
	if(detail_city != "") {
		query += "&detail_city=" + detail_city;
	}  
	
	if(jQuery("input#user_property_wheelchair").is(':checked')) {
		query += "&detail_ga_wheelchair=" + detail_ga_wheelchair;
	}                      
	if(jQuery("input#user_property_businesstraveller").is(':checked')) {
		query += "&detail_ga_businesstraveller=" + detail_ga_businesstraveller;
	}
	if(jQuery("input#user_property_smoking").is(':checked')) {
		query += "&detail_ga_smoking=" + detail_ga_smoking;
	}              
	if(jQuery("input#user_property_children").is(':checked')) {
		query += "&detail_ga_children=" + detail_ga_children;
	}
	if(jQuery("input#user_property_pets").is(':checked')) {
		query += "&detail_ga_pets=" + detail_ga_pets;
	}
	if(jQuery("input#user_property_carparking").is(':checked')) {
		query += "&detail_ga_carparking=" + detail_ga_carparking;
	}
	
	/* Go to search */
	location.href = "/index.php?p_module=p_article&id=32&" + query;
}

function searchboxSwitch(value) {
	if(jQuery("div#" + value + "_content").is(":hidden")) {
		jQuery("div#" + value + "_content").show();        
		jQuery("span#" + value).html('<a href="javascript:;" onclick="searchboxSwitch(\'searchbox_general_amenities\')">-</a>');
	}
	else {
		jQuery("div#" + value + "_content").hide();
		jQuery("span#" + value).html('<a href="javascript:;" onclick="searchboxSwitch(\'searchbox_general_amenities\')">+</a>');
	}
}

function chgTextsize(textsize) {
	if(textsize == "normal") {
		var size = "14px";
	}
	else if(textsize == "big") {
		var size = "18px";
	}
	else {
		var size = "22px";
	}

	jQuery("body").css("font-size", size);
}

function bookDay(day) {
	if(jQuery("input#a_calendar_day_" + day).val() == "") {
		jQuery("a#a_calendar_day_" + day).css("background", "#ff0000");
		jQuery("input#a_calendar_day_" + day).val("booked");
	}
	else {
		jQuery("a#a_calendar_day_" + day).css("background", "#3b8f32"); 
		jQuery("input#a_calendar_day_" + day).val("");
	}
}

function calendarSelectMonth(month_id) {
	if(jQuery("input#a_calendar_checkbox_" + month_id).is(":checked")) {
		jQuery('a[id^="a_calendar_day_' + month_id + '-"]').css("background", "#ff0000");        
		jQuery('input[id^="a_calendar_day_' + month_id + '-"]').val("booked");
	}
	else {           
		jQuery('a[id^="a_calendar_day_' + month_id + '-"]').css("background", "#3b8f32");        
		jQuery('input[id^="a_calendar_day_' + month_id + '-"]').val("");        
	}
}
