var expiryTimer;
var arr = [];

var ajax1Bestandpdf = new sack();
ajax1Bestandpdf.onCompletion = showDataBestandpdf;

function addOptionBestandpdf(selectbox,text,value )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}

function removeAllOptionsBestandpdf(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		selectbox.remove(i);
	}
}

function getDataBestandpdf(object)
{
	theField=document.getElementById(object);
	if (theField.value != "")
	{
		getAjaxFile(ajax1Bestandpdf,"../include/getdatabestandpdf.php?modelcode="+theField.value);
	}
}

function showDataBestandpdf()
{
	optionsElement = document.getElementById('groepcode');
	xmlValues = ajax1Bestandpdf.responseXML.getElementsByTagName("dataline");
	populateOptionsBestandpdf(optionsElement,xmlValues);
}

function populateOptionsBestandpdf()
{
	var len = xmlValues.length;
    if(len==0)
	{
		removeAllOptionsBestandpdf(optionsElement);
		//addOptionGroep(optionsElement, '[Groep]', '0');
    }
	else
	{
		removeAllOptionsBestandpdf(optionsElement);
		//addOptionGroep(optionsElement, '[Groep]', '0');
		for(var i=0; i<len; i++)
		{
			addOptionBestandpdf(optionsElement, xmlValues[i].getAttribute('waarde'), xmlValues[i].getAttribute('id'));
		}
    }
}
