function changemois(direction,mois,annee){
	killAjax()
	ret = function() {
		if(ajaxOk()){
			document.getElementById('calendrier').innerHTML=objAjax.responseText;
			cleanCal();
		}
	}
	callAjax('/script/ajax.php?what=calendrier&dir='+direction+'&mois='+mois+'&annee='+annee,ret,null);
}

function cleanCal(){
	var a = document.getElementById('calendrier').getElementsByTagName('td');
	for(i=0;i<a.length;i++){
		if(a[i].innerHTML=='' || a[i].innerHTML=='&nbsp;'){a[i].className='vide';}
	}
}

function autoTab(input,len, e) {
	ctouppercase(input);
	var keyCode = e.keyCode;
	var filter = [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
}

function containsElement(arr, ele) {
	var found = false, index = 0;
	while(!found && index < arr.length){
		if(arr[index] == ele)
			found = true;
		else
			index++;
	}
	return found;
}

function getIndex(input) {
	var index = true, i = 0, found = false;
	while (i < input.form.length && index == true){
		if (input.form[i] == input)index = i;
		else i++;
	}
	return index;
}

function ctouppercase(el){
	el.value = el.value.toUpperCase();
}

function validInteger(fStr){
	myReg = new RegExp("[0-9]+");
	if(myReg.exec(fStr)!=fStr){return false};
	return true;
}


function updatefees()
{
	iccproshifter = $('qty_icc_pro_shifter').value;
	if(!validInteger(iccproshifter)){iccproshifter=0;$('qty_icc_pro_shifter').value=0;}
	
	rotaxdd2 = $('qty_rotax_dd2').value;
	if(!validInteger(rotaxdd2)){rotaxdd2=0;$('qty_rotax_dd2').value=0;}
	
	rotaxmini = $('qty_rotax_minimax').value;
	if(!validInteger(rotaxmini)){rotaxmini=0;$('qty_rotax_minimax').value=0;}
	
	honda = $('qty_honda').value;
	if(!validInteger(honda)){honda=0;$('qty_honda').value=0;}
	
	transponder = $('qty_transponder').value;
	if(!validInteger(transponder)){transponder=0;$('qty_transponder').value =0;}
	
	/*
	preevent = $('qty_preevent').value;
	if(!validInteger(preevent)){preevent=0;$('qty_preevent').value=0;}
	*/
	
	fridaypractice = $('qty_fridaypractice').value;
	if(!validInteger(fridaypractice)){fridaypractice=0;$('qty_fridaypractice').value=0;}
	
	satpracticerotax = $('qty_satpracticerotax').value;
	if(!validInteger(satpracticerotax)){satpracticerotax=0;$('qty_satpracticerotax').value=0;}
	
	satpracticehonda = $('qty_satpracticehonda').value;
	if(!validInteger(satpracticehonda)){satpracticehonda=0;$('qty_satpracticehonda').value=0;}
	
	total = 0;
	total+=(iccproshifter*125);
	total+=(rotaxdd2*125);
	total+=(rotaxmini*100);
	total+=(honda*100);
	total+=(transponder*15);
	total+=(fridaypractice*25);
	total+=(satpracticerotax*35);
	total+=(satpracticehonda*35);
	$('totalfees').value='$'+total+'.00';
}