// JavaScript Document

function ExpendedSearch() {
	kassabon=document.getElementById('Expend');
	if (kassabon.className == "Slider"){
		kassabon.className = 'SliderOpen';
		kassabon.style.height = 1 + "px";
		height = getElementHeight('eSearch');
		foldout('Expend', 1, height);
		return true;
	} else {
		height = getElementHeight('Expend');
		foldin('Expend', height);
		return false;
	}
}		

function getElementHeight(Elem) {
 
  if(document.getElementById) {
   var elem = document.getElementById(Elem);
  } else if (document.all){
   var elem = document.all[Elem];
  }
  //alert(elem.id);
  //if (op5) { 
  // xPos = elem.style.pixelHeight;
  //} else {
   xPos = elem.offsetHeight;
  //}
  return xPos;
 }

function foldout(divid, curheight, maxheight, step) {
	if (!step) { 
		step = 20;
	}

	var divobj = document.getElementById(divid);
	
	curheight = curheight + step;
	
	if (curheight >= maxheight) {
		divobj.style.height = maxheight + 'px';
	}else{
		divobj.style.height = curheight + 'px';
		setTimeout('foldout("' + divid + '", ' + curheight + ',' + maxheight + ',' + step + ')', 100);
	}
}

function foldin(divid, curheight, step) {
	if (!step) { 
		step = 20;
	}

	var divobj = document.getElementById(divid);
	
	curheight = curheight - step;
	
	if (curheight < 0) {
		divobj.style.height = "1px";
		divobj.className = "Slider";
	
	}else{
		divobj.style.height = curheight + 'px';
		setTimeout('foldin("' + divid + '", ' + curheight + ', ' + step + ')', 100);
	}
}

//				Select next bouwjaar

function fSelectYear(){
	var d = new Date();
	var jaar = d.getFullYear();
	var sElement = document.getElementById('select4');
	
	for(var i = 0; i < sElement.options.length; i++){
		if(sElement.options[i].value == (jaar -2)){
			sElement.options[i].selected = true;
		}
	}
	fChangeTot(document.getElementById('select4'));
}

function fChangeTot(sElement){
	
	document.getElementById('select5').options.length = 0;
	
	var iTeller = 1;
	var iBegin = parseInt(sElement.options[sElement.selectedIndex].value);
	
	var d = new Date();
	
	document.getElementById('select5').options[0] = new Option('-- Tot bouwjaar --','');
	for(var i = iBegin; i <= d.getFullYear(); i++){
		document.getElementById('select5').options[iTeller] = new Option(i, i);
		iTeller++;
	}
}

function fChangePrijsTot(sElement){
	
	document.getElementById('FormsComboBox4').options.length = 0;
	
	var iTeller = 1;
	var iBegin = parseInt(sElement.options[sElement.selectedIndex].value) + 1000;
		
	document.getElementById('FormsComboBox4').options[0] = new Option('Geen voorkeur','');
	for(var i = iBegin; i <= 30000; i=i+1000){
		document.getElementById('FormsComboBox4').options[iTeller] = new Option(String.fromCharCode(0x20ac) + ' ' + i, i);
		iTeller++;
	}
	document.getElementById('FormsComboBox4').options[iTeller] = new Option(String.fromCharCode(0x20ac) + ' 100000', '100000');

}
