var selectedMerk='';
var viewType='';

function ResizeDivs(){

var the_height=0;

if(document.getElementById("center")){
	if(document.getElementById("left").offsetHeight > the_height) the_height=document.getElementById("left").offsetHeight;
	if(document.getElementById("center").offsetHeight > the_height) the_height=document.getElementById("center").offsetHeight;
	if(document.getElementById("right").offsetHeight > the_height) the_height=document.getElementById("right").offsetHeight;

	document.getElementById("left").style.height  = the_height+'px';
	document.getElementById("center").style.height= the_height+'px';
	document.getElementById("right").style.height = the_height+'px';
	}
else{
	if(document.getElementById("content").offsetHeight > the_height) the_height=document.getElementById("content").offsetHeight;
	if(document.getElementById("right").offsetHeight > the_height) the_height=document.getElementById("right").offsetHeight;
	document.getElementById("content").style.height= the_height+'px';
	document.getElementById("right").style.height = the_height+'px';
	}

}

function findPos(obj){var curleft=curtop=0;if(obj.offsetParent){curleft=obj.offsetLeft
curtop=obj.offsetTop
while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}}
return[curleft,curtop];}

function ShowDiversen(obj){

var pos=findPos(obj);

document.getElementById('menuit5').style.left=(pos[0]-91)+'px';
document.getElementById('menuit5').style.top=(pos[1]+22)+'px';
document.getElementById('menuit5').style.display='block';

}

function HideDiversen(){

document.getElementById('menuit5').style.display='none';

}

function SelectOptionInList(obj,dir){

var intIndex=0;
if(document.getElementById(obj))
	for(intIndex=0;intIndex<document.getElementById(obj).options.length;intIndex++){
		if(document.getElementById(obj).options[intIndex].value==dir){
			document.getElementById(obj).selectedIndex=intIndex;
			break;
			}
		}
}

function UpdateStock(updater){
// aan de updater weten we welke select-tag veranderde
selectedTrucks=document.getElementById('selTrucks').options[document.getElementById('selTrucks').selectedIndex].value;
selectedMerk=document.getElementById('selMerk').options[document.getElementById('selMerk').selectedIndex].value;
selectedCap=document.getElementById('selCapaciteit').options[document.getElementById('selCapaciteit').selectedIndex].value;
selectedHefhoogte=document.getElementById('selHefhoogte').options[document.getElementById('selHefhoogte').selectedIndex].value;
selectedBouwjaar=document.getElementById('selBouwjaar').options[document.getElementById('selBouwjaar').selectedIndex].value;
xajax_UpdateSelectTags(selectedTrucks, selectedMerk, selectedCap, selectedHefhoogte, selectedBouwjaar, updater);
}

// schrijf de originele waarden terug indien mogelijk

function ReinitSelectTags(){

SelectOptionInList('selTrucks',selectedTrucks);
SelectOptionInList('selMerk',selectedMerk);
SelectOptionInList('selCapaciteit',selectedCap);
SelectOptionInList('selHefhoogte',selectedHefhoogte);
SelectOptionInList('selBouwjaar',selectedBouwjaar);

xajax_RewriteStock(
document.getElementById('selTrucks').options[document.getElementById('selTrucks').selectedIndex].value,
document.getElementById('selMerk').options[document.getElementById('selMerk').selectedIndex].value,
document.getElementById('selCapaciteit').options[document.getElementById('selCapaciteit').selectedIndex].value,
document.getElementById('selHefhoogte').options[document.getElementById('selHefhoogte').selectedIndex].value,
document.getElementById('selBouwjaar').options[document.getElementById('selBouwjaar').selectedIndex].value,
1,
25,
viewType
);
}

function NavigateStock(pagina,
	selectedTypeTrucks,
	selectedMerk,
	selectedCap,
	selectedHefhoogte,
	selectedBouwjaar,
	limit,
	view){

xajax_RewriteStock(
	selectedTypeTrucks,selectedMerk,selectedCap,selectedHefhoogte,selectedBouwjaar,pagina,limit,view
	);
}
