// JavaScript Document
function valServicetyp(){
	var f = window.document.servicetyp;
	var checked = false;
	for(i=0; i<f.service_id.length; i++)
		if(f.service_id[i].checked == true)
			checked = true;
	if(!checked){
		alert(select_service);
		return false;
	}
	var ret = validate(f.booking_date,'string',select_booking_date);
	return ret;
}

function valBilinfo(){
	var f = window.document.bilinfo;
	f.car_model.value = (f.car_model.value == 'Bilmodell') ? '' : f.car_model.value ;
f.mileage.value = (f.mileage.value == '0') ? ' ' : f.mileage.value ;
	var ret = validate(f.car_model,'string',select_car_model)
						&&validate(f.car_year,'string',select_car_year)
						&&validate(f.mileage,'number',select_mileage)
						;
	return ret;
}

function valPersoninfo(){
	var f = window.document.personinfo;
	var ret = validate(f.firstname,'string',select_firstname)
						&&validate(f.lastname,'string',select_lastname)
						&&validate(f.mobile,'string',select_mobile)
						&&validate(f.phone,'string',select_phone)
						&&validate(f.email,'string',select_email);
	return ret;
}

function changeState(){
	var f = window.document.bilinfo;
	var state = 0;
	for(i=0; i<f.company_car.length; i++){
		if(f.company_car[i].checked == true){
			state = f.company_car[i].value;
		}
	}
	if(state != 0){
		f.company.readOnly = false;
		f.car_responsible.readOnly = false;
		f.company.className = 'input-text';
		f.car_responsible.className = 'input-text';
	}
	else{
		f.company.readOnly = true;
		f.car_responsible.readOnly = true;
		f.company.className = 'input-text-disabled';
		f.car_responsible.className = 'input-text-disabled';
	}
}

function changeDiv(){
	var txt = getRef('eml_txt');
	var inp = getRef('eml_inp');
	if(txt.style.display == 'block'){
		txt.style.display = 'none';
		inp.style.display = 'block';
	}
	else{
		txt.style.display = 'block';
		inp.style.display = 'none';
	}
}
