function err(){return true;}
// window.onerror = err;


$(document).ready(function(){
	$('input, select, textarea, label').tooltip({ 
	    track: true, 
	    delay: 0, 
	    showURL: false, 
	    //showBody: " - ", 
	    fade: 450 
	});
});


	var encoded_params = '';
	function load_file(address, destination, params, loader, callback){
		if(destination){
			if(!loader)loader = 'search';
			var div_loader = '<div class="loader" align="center"><div class="'+loader+'"></div></div>';
			$('#'+destination).html(div_loader);
			jQuery.post(address, params, function(data){
				$('#'+destination).html(data);
				if(callback) eval(callback);
//				make_replacements(destination,'white');
				return true;
			});
			return false;
		} else {
			jQuery.post(address, params, function(data){
				return data;
			});
			return false;
		}
	}

	function get_regions(country_id, selected_region_id){
		if(country_id){
			load_file('/get_locals.php','region_select', {country: country_id, selected_region:selected_region_id, 'ep':encoded_params},'search_small');
		} else {
		}
		$('#region_select').html('<select name="region" id="input_region" class="full"><option value=""> Region </option></select>');
		$('#town_select').html('<select name="town" id="input_town" class="full"><option value=""> Town </option></select>');
	}

	function get_towns(region_id, selected_town_id){
		if(region_id){
			load_file('/get_locals.php','town_select', {region: region_id, selected_town:selected_town_id,'ep':encoded_params},'search_small');
		} else {
			$('#town_select').html('<select name="town" id="input_town" class="full"><option value=""> Town </option></select>');
		}
	}

	function toggle_hidden_objects(container, object, status){
		if(status){
			$(object).slideDown(600);
		} else {
			$(object).slideUp(600);		
		}
	}



/*


	function get_regions(country_obj, selected_region){
		if(country_obj){
			if(!country_obj.options[country_obj.selectedIndex].value){
				$('#region_select').html('<select name="region" id="input_region" class="full"><option value=""> Region </option></select>');
				$('#town_select').html('<select name="town" id="input_town" class="full"><option value=""> Town </option></select>');
				return;
			}
			load_file('/get_locals.php','region_select', {country: country_obj.options[country_obj.selectedIndex].value, selected_region:selected_region, 'ep':encoded_params},'search_small');
		}		
	}

	function get_towns(region_obj, selected_town){
		if(region_obj){
			if(!region_obj.options[region_obj.selectedIndex].value){
				$('#town_select').html('<select name="town" id="input_town" class="full"><option value=""> Town </option></select>');
				return;
			}
			load_file('/get_locals.php','town_select', {region: region_obj.options[region_obj.selectedIndex].value, selected_town:selected_town,'ep':encoded_params},'search_small');
		}		
	}

	function toggle_hidden_objects(container, object, status){
		if(status){
			$(object).slideDown(600);
		} else {
			$(object).slideUp(600);		
		}
	}



*/

