Event.observe(window, 'load', init, false);
	
function init()
{
	if( $('group_id') )
	{
  		Event.observe( 'group_id', 'change', get_product, false);
	}
	if( $('product') )
	{
  		Event.observe( 'product', 'change', get_type, false);
	}
}

function get_product( )
{
	var url = '/ajax/get_product.php';
	var pars = 'group_id='+escape($F('group_id'));
	var target = 'div_product';
	var myAjax = new Ajax.Updater(target, url, {	method: 'get',	parameters: pars, evalScripts:true});
	if( $F('type') == 0 )
	{
		$('aantal').disabled = true;
		$('aantal').value 	 = 0;
		$('opties').disabled = true;
		$('opties').value 	 = 0;	
		document.getElementById('div_totaal').innerHTML='&euro; 0,00 excl btw';
		document.getElementById('div_totaal2').innerHTML='&euro; 0,00 incl btw';
		document.getElementById('div_korting').innerHTML='&euro; 0,00 excl btw';
		document.getElementById('div_korting2').innerHTML='&euro; 0,00 incl btw';
	}
}

function get_type( )
{
	var url = '/ajax/get_type.php';
	var pars = 'product='+escape($F('product'));
	var target = 'div_type';
	var myAjax = new Ajax.Updater(target, url, {	method: 'get',	parameters: pars, evalScripts:true});
	if( $F('type') == 0 )
	{
		$('aantal').disabled = true;
		$('aantal').value 	 = 0;
		$('opties').disabled = true;
		$('opties').value 	 = 0;	
		document.getElementById('div_totaal').innerHTML='&euro; 0,00 excl btw';
		document.getElementById('div_totaal2').innerHTML='&euro; 0,00 incl btw';
		document.getElementById('div_korting').innerHTML='&euro; 0,00 excl btw';
		document.getElementById('div_korting2').innerHTML='&euro; 0,00 incl btw';
	}
}

function get_aantal( )
{
	var url = '/ajax/get_aantal.php';
	var pars = 'product='+escape($F('product'))+ '&type='+escape($F('type'));
	var target = 'div_aantal';
	var myAjax = new Ajax.Updater(target, url, {	method: 'get',	parameters: pars, evalScripts:true});
	if( $F('aantal') == 0 )
	{
		$('opties').disabled = true;
		$('opties').value 	 = 0;		
		document.getElementById('div_totaal').innerHTML='&euro; 0,00 excl btw';
		document.getElementById('div_totaal2').innerHTML='&euro; 0,00 incl btw';
		document.getElementById('div_korting').innerHTML='&euro; 0,00 excl btw';
		document.getElementById('div_korting2').innerHTML='&euro; 0,00 incl btw';
	}
}

function get_opties()
{
	var url = '/ajax/get_opties.php';
	var pars = 'product='+escape($F('product'))+ '&type='+escape($F('type'))+ '&aantal='+escape($F('aantal'));
	var target = 'div_opties';
	var myAjax = new Ajax.Updater(target, url, {	method: 'get',	parameters: pars, evalScripts:true});
}

function get_price( )
{
	var url = '/ajax/get_prijs.php';
	var pars = 'product='+escape($F('product'))+ '&type='+escape($F('type'))+ '&aantal='+escape($F('aantal'))+ '&opties='+escape($F('opties'));
	var target = 'div_totaal';
	var myAjax = new Ajax.Updater(target, url, {	method: 'get',	parameters: pars, evalScripts:true});
}