// JavaScript Document


function Vastgoed(total,start,current_page,pages,previous,next,order,sorts,javascript_navigation) {
		this.keyword = '';
		this.total = total;
		this.current_page = current_page;
		this.pages = pages;
		this.previous = previous;
		this.next = next;
		this.order = (order > '')?order:1;
		this.sorts = (sorts > '')?sorts:1;
		this.start = start;
		this.javascript_navigation = javascript_navigation;
		this.filter = '';		
}

Vastgoed.prototype.Update = function(total,start,current_page,pages,previous,next,order,sorts,javascript_navigation) {
		this.total = total;
		this.current_page = current_page;
		this.pages = pages;
		this.previous = previous;
		this.next = next;
		this.order = order;
		this.sorts = sorts;
		this.start = start;
		this.javascript_navigation = javascript_navigation;	
		
		this.Show();
}

Vastgoed.prototype.setFilter = function(filter) {
		this.filter = filter;
}

Vastgoed.prototype.Filter = function(filter) {
	this.filter = filter;
	xajax_listObjects(this.order, this.sorts, '0', this.filter);
	return false;
}

Vastgoed.prototype.Show = function() {
	
	document.getElementById('pr_total').innerHTML = this.total;
	document.getElementById('pr_current_page').innerHTML = this.current_page;
	document.getElementById('pr_pages').innerHTML = this.pages;
	document.getElementById('navigatie_producten').innerHTML = this.javascript_navigation;
	
	
	document.getElementById('pr_total_2').innerHTML = this.total;
	document.getElementById('pr_current_page_2').innerHTML = this.current_page;
	document.getElementById('pr_pages_2').innerHTML = this.pages;
	document.getElementById('navigatie_producten_2').innerHTML = this.javascript_navigation;
	
	
	//document.getElementById('previous_link').style.display = (this.previous > '')?'block':'none';
	//document.getElementById('next_link').style.display = (this.next > '')?'block':'none';
}

Vastgoed.prototype.Next = function() {
	if (this.next) {
		xajax_listProducts(this.content_id, this.order, this.sorts, this.next, this.filter);
	}
	return false;
}

Vastgoed.prototype.goTo = function(start) {
	xajax_listObjects(start, this.order, this.sorts, this.filter);
	return false;
}

Vastgoed.prototype.Previous = function() {
	if (this.previous) {
		xajax_listObjects(this.previous, this.order, this.sorts, this.filter);
	}
	return false;
}

Vastgoed.prototype.Sort = function(waarde) {
	if (waarde == this.order) {
		
		if (this.sorts != 2) {
			this.sorts = 2;
		}
		else {
			this.sorts = 1;
		}
	}
	else {
		this.order = waarde;
	}
	
	xajax_listObjects(this.start, this.order, this.sorts, this.filter);
	return false;
}

function Filter(keyword, plaatsnaam,prijs_categorie, prijs_start, prijs_stop, type, soort_bouw, special_view) {
	this.keyword = keyword;
	this.plaatsnaam = plaatsnaam;
	this.prijs_categorie = prijs_categorie;
	this.prijs_start = prijs_start;
	this.prijs_stop = prijs_stop;
	this.type = type;
	this.soort_bouw = soort_bouw;
	this.special_view = special_view;
}

Filter.prototype.Update = function (keyword,plaatsnaam,prijs_categorie, prijs_start, prijs_stop, type, soort_bouw, special_view) {
	this.keyword = keyword;
	this.plaatsnaam = plaatsnaam;
	this.prijs_categorie = prijs_categorie;
	this.prijs_start = prijs_start;
	this.prijs_stop = prijs_stop;
	this.type = type;
	this.soort_bouw = soort_bouw;
	this.special_view = special_view;
}

Filter.prototype.setSearchForm = function() {
	var plaatsnaam = document.getElementById('plaatsnaam');
	if (plaatsnaam) {
		for (var i =0;i<plaatsnaam.options.length;i++) {
			if (plaatsnaam.options[i].value == this.plaatsnaam) {
				plaatsnaam.selectedIndex = i;
			}
		}
	}
	
	var type = document.getElementById('type');
	if (type) {
		for (var i =0;i<type.options.length;i++) {
			if (type.options[i].value == this.type) {
				type.selectedIndex = i;
			}
		}
	}
}


Filter.prototype.setKeyword = function(keyword) {
	this.keyword = keyword;
}

Filter.prototype.setPlaats = function(plaatsnaam) {
	this.plaatsnaam = plaatsnaam;
}

Filter.prototype.setPrijsCategorie = function(prijs_categorie) {
	this.prijs_categorie = prijs_categorie;
}

Filter.prototype.setPrijsStart = function(prijs_start) {
	if (parseInt(prijs_start) == 0) {
			prijs_start = '';
	}
	else {
		prijs_start = parseInt(prijs_start);
	}
	
	this.prijs_start = prijs_start;
	return prijs_start;
}

Filter.prototype.setPrijsStop = function(prijs_stop) {
	if (parseInt(prijs_stop) == 0) {
			prijs_stop = '';
	}
	else {
		prijs_stop = parseInt(prijs_stop);
	}
	
	this.prijs_stop = prijs_stop;
	return prijs_stop;
}


Filter.prototype.setType = function(type) {
	this.type = type;
}

Filter.prototype.setSoortBouw = function(soort_bouw) {
	this.soort_bouw = soort_bouw;
}
