function obj (id) {
	return document.getElementById(id);
}

var swapstate = new Array();

function swap (id,state) {
	if (!swapstate[id])
		swapstate[id] = 0;
	if (swapstate[id] == state) {
		swapstate[id] = 'none';
		obj(id).style.display = 'none';
	} else {
/*
		while (i=0; obj ('submenu'+ i).style.display = 'none'; i++) {
		//	if (swapstate['submenu'+ i] != 'none') {
				swapstate['submenu'+ i] = 'none';
		//		obj ('submenu' + i).style.display = 'none';
			}
		}
*/
		swapstate[id] = state;
		obj(id).style.display = state;
	}
}

function setoption (option,ovalue) {
	obj('f_start').value = 0;
	if (option != '')
		obj(option).value = ovalue;
	obj('f').submit();
	return false;
}

function do_print() {
	window.print(); window.close();
}

//proefritten

function submitProefrit() {
	// iets met maar 3 auto's
	var i, counter = 0;
	for (i = 0; i < document.getElementById('f_proefrit').length; i++) {
		if (document.getElementById('f_proefrit').elements[i].checked)
			counter++;
	}

	if (counter > 3)
		alert ('U kan maximaal voor 3 auto\'s een proefrit aanvragen.');
	else if (counter == 0)
		alert ('U heeft nog geen auto(\'s) geselecteerd.');
	else
		document.getElementById('f_proefrit').submit();
}

function proefritDetails(id) {
	detailsWin = window.open ('/proefritten/details.html?id='+id, 
		'detailsWin','width=750,height=600,status=no,menubar=no,resizable=yes,scrollbars=no');
	detailsWin.focus();
}

// offertesysteem

function inruil() {
	if (document.getElementById('f_inruil').value == 1) {
		document.getElementById('inruil').style.display="block";
	} else {
		document.getElementById('inruil').style.display="none";
	}
}

/* pakketten popup */

function pakketten() {
        pakketWin = window.open ('/offertes/pakketten.html', 'pakketWin', 'width=1000,height=800,status=no,menubar=no,resizable=no,scrollbars=yes');
        pakketWin.focus();
}

/* proefrit hide */

function proefrit() {
	if (document.getElementById('f_proefrit').checked) {
		document.getElementById('f_rit').style.display="block";
		document.getElementById('f_rijbewijs').focus();
	}
	else
		document.getElementById('f_rit').style.display="none";
}

function printOfferte(id) {
	printWin = window.open ('/offertes/print.html?id='+id, 'printWin', 'width=500,height=600,status=no,menubar=no,resizable=yes,scrollbars=no');
	printWin.focus();
}


