filter2 = function(table, type, value1, value2, sqltype) {
	var param = "table=" + table + "&type=" + type + "&value1=" + value1 + "&value2=" + value2; 
	var element = "ajaxcontent";
	
	if(sqltype && sqltype != "")
		param += "&sqltype=" + sqltype;
	else
		param += "&sqltype=";
	
	$.ajax({
		type: "post",
		url: "/ajaxgeneriek/filters2.php",
		data: param,
		cache: false,
		async: true,	
		timeout: 8000,
		success: function(responseText){
			$('#ajaxcontent').html(responseText);
		}
	});
}

initSlider = function(table, naam, min, max, currentmin, currentmax, type) {
	minvalue = Math.log(min);
	maxvalue = Math.log(max);
	currentminvalue = Math.log(currentmin);
	currentmaxvalue = Math.log(currentmax);
	
	$(function() {
		$("#slider-range").slider({
			range: true,
			min: parseFloat(minvalue),
			max: parseFloat(maxvalue),
			values: [parseFloat(currentminvalue) , parseFloat(currentmaxvalue)],
			step: 0.0001,
			change: function(e, ui){				
				// table, type, value1, value2, sqltype
				filter2(table, naam, Math.ceil(Math.exp(ui.values[0])), Math.floor(Math.exp(ui.values[1])), type);
			},
			slide: function(event, ui) {
				$("#min-amount").html(Math.ceil(Math.exp(ui.values[0])));
				$("#max-amount").html(Math.ceil(Math.exp(ui.values[1])));
			}
		});
		$("#min-amount").html(Math.ceil(Math.exp($("#slider-range").slider("values", 0))));
		$("#max-amount").html(Math.ceil(Math.floor(Math.exp($("#slider-range").slider("values", 1)))));
	});
}
