function prevnext(page) {
	mF = this.document.myForm;
	mF.page.value=page;
	transfer();
	return false;
}
function init() {
	clearFields();
	mF = this.document.myForm;
	mF.naamveld.kop = naamveldorg;
	mF.naamveld.value = naamveld;
	mF.titelveld.kop = titelveldorg;
	mF.titelveld.value = titelveld;
	mF.aspveld.kop = aspveldorg;
	mF.aspveld.value = aspveld;
	mF.trefwoordveld.kop = trefwoordveldorg;
	mF.trefwoordveld.value = trefwoordveld;
	mF.selBez.kop = selBezorg;
	mF.selBez.value = selBez;
    mF.doncon.checked=false;
    mF.doncon.kop = doncon;
    if(doncon == "1") {
       mF.doncon.checked=true;
    }
	mF.nrbcon.checked=false;
	mF.doncon.kop = nrbcon;
	if(nrbcon == "1") {
       mF.nrbcon.checked=true;
    }
    mF.liccon.checked=false;
    mF.doncon.kop = liccon;
    if(liccon == "1") {
       mF.liccon.checked=true;
    }
	g=parseInt(genre);
	s=parseInt(selBez);
	if (g == 1 || g == 2 || g == 3 || g == 4 || g == 5 || g == 6 ) {
		populate(g,this.mF.selBez,s);
	}

}
function resetSelboxes () {
	mF.genre.style.color = 'gray';
	mF.genre.options[0].text = mF.genre.kop;
	mF.genre.options[0].selected=true;
        clearSelect(this.document.myForm.selBez);
	mF.selBez.options[0] = new Option(selBezorgstr,'',true);
	mF.selBez.disabled = true;
	mF.selBez.style.color = 'gray';
}
function resetform() {
	mF = this.document.myForm;
	mF.naamveld.value = naamveldorg;
	mF.titelveld.value = titelveldorg;
	mF.aspveld.value = aspveldorg;
	mF.trefwoordveld.value = trefwoordveldorg;
	mF.genre.value = genrestr;
	mF.selBez.value = selBezorg;
	mF.doncon.checked = true;
	mF.nrbcon.checked = true;
	mF.liccon.checked = true;
	resetSelboxes();
}
	

function act(listBox) {
	listBox.style.color = 'black';
	listBox.options[0].text = '';
}

function deact(listBox) {
	if (listBox.value == '') {
		listBox.style.color = 'gray';
		listBox.options[0].text = listBox.kop;
	}
}

function activate(genre) {
	if (genre.value == "") { init(); return; }
        if (genre.value == "1") {
		populate(1,this.document.myForm.selBez,-1);
	}
        if (genre.value == "2") {
		populate(2,this.document.myForm.selBez,-1);
	}
    if (genre.value == "3") {
		populate(3,this.document.myForm.selBez,-1);
	}
    if (genre.value == "4") {
		populate(4,this.document.myForm.selBez,-1);
	}
    if (genre.value == "5") {
		populate(5,this.document.myForm.selBez,-1);
	}

	//if (genre.value == "4") {
	//        clearSelect(this.document.myForm.selBez);
	//	mF.selBez.options[0] = new Option(selBezorgstr,'',true);
	//	mF.selBez.disabled = true;
	//	mF.selBez.style.color = 'gray';
	//}
	//if (genre.value == "5") {
	 //       clearSelect(this.document.myForm.selBez);
	//	mF.selBez.options[0] = new Option(selBezorgstr,'',true);
	//	mF.selBez.disabled = true;
	//	mF.selBez.style.color = 'gray';
	//}
    if (genre.value == "6") {
		populate(6,this.document.myForm.selBez,-1);
	}
}

function populate(inArr,slct,sel) {
	doselect=0;
        clearSelect(this.document.myForm.selBez);
	slct.options[0] = new Option(selBezorgstr,'',false)
    if (typeof genreArray[inArr] != 'undefined') {
	  for (i=0; i < genreArray[inArr].length; i++) {
		a=parseInt(genreArray[inArr][i][0]);
		slct.options[slct.length] = new Option(genreArray[inArr][i][1],genreArray[inArr][i][0])
		if (a == sel) {
			doselect=i+1;
		}
	  }
    }
	slct.options[doselect].selected = true;
	this.document.myForm.selBez.disabled = false;
	this.document.myForm.selBez.style.color = 'black';
	doIt(slct);
}

function clearFields() {
	mF = this.document.myForm;
}

function clearSelect(selector) {
	for (var i = 0; i < selector.options.length; i ++) {
		selector.options[i] = null;
	}
	selector.options.length = 0;
}

function doIt(box) {
}

function searchStr(that) {
	if (that.value == that.kop) {
		that.value="";
		that.style.color = 'black';
	} else if (that.value == "") {
		that.value = that.kop;
		that.style.color = 'gray';
	}
}

function transfer() {
	mF = this.document.myForm
	postSearch();
}

function postSearch() {
	this.document.myForm.submit();
}
/*
* In Firefox this is no problem because the popped-out drop down will 
* dynamically change it's width to accomodate whatever is in the menu. 
* However, IE refuses to do the same.To solve this problem we introduced 
* this two functions which adjust the width based on the dropdown content,so we can 
* use onfocus=exapandSELECT(this),
* onblur=contractSELECT(this) whenever required.
*/
function expandSELECT(sel) {
    sel.style.width = "auto";
}

function contractSELECT(sel) {
    sel.style.width = "200px";
}

