function div_onLoad() {
	with (document.fReservation) {
sType.options[0] = new Option('A- Suzuki Alto 800 cc. Manual, Gasoline.');
sType.options[0].value = '129';
sType.options[1] = new Option('B-Nissan Tiida 1600 cc. Manual, Gasoline.');
sType.options[1].value = '147';
sType.options[2] = new Option('C- Nissan Tiida 1600 cc. Automatic, Gasoline');
sType.options[2].value = '131';
sType.options[3] = new Option('E- Suzuki Jimny 4X4,  1.300cc. Manual, Gasoline.');
sType.options[3].value = '132';
sType.options[4] = new Option('F- Suzuki Vitara  4x4,  2.000cc, Manual, Gasoline.');
sType.options[4].value = '134';
sType.options[5] = new Option('G- Suzuki Vitara 4x4,  2.000cc. Automatic, Gasoline.');
sType.options[5].value = '133';
sType.options[6] = new Option('H- Nissan X-Trail 4x4,  2.500cc, Manual, Gasoline.');
sType.options[6].value = '146';
sType.options[7] = new Option('I- Pick Up Nissan Frontier 4x4 Double Cab, 2.500cc, Manual, Turbo Diesel Engine.');
sType.options[7].value = '144';
sType.options[8] = new Option('J- Mitsubishi Montero Sport 4x4, 2.800cc, Manual, Turbo Diesel Engine.');
sType.options[8].value = '145';
sType.options[9] = new Option('K- Mitsubishi Montero Sport, 2800cc,  4x4 Automatic, Turbo Diesel Engine.');
sType.options[9].value = '128';
sType.options[10] = new Option('L- Mitsubishi Montero 7 Pax  4x4, 2.800c.c, Manual and Auto, Turbo Diesel Engine');
sType.options[10].value = '137';
sType.options[11] = new Option('M- Mitsubishi L-300 Van, 2.500cc, Manual,  Diesel Engine.');
sType.options[11].value = '138';
sType.options[12] = new Option('N- Mitsubishi Zinger Minivan, 2.800cc, Automatic, Gasoline');
sType.options[12].value = '148';
}
var req = new Request();
var id = req.getParameter('id');
if (id == null) {
sType_onChange();
}	
	Calendar.setup({
		inputField    : "fromDate",
		button        : "cal-button-1",
		align         : "Tr",
		ifFormat      : "%m-%d-%Y"
	});
	Calendar.setup({
		inputField    : "toDate",
		button        : "cal-button-2",
		align         : "Tr",
		ifFormat      : "%m-%d-%Y"
	});
}

function div_onSubmit() {
	document.fReservation.tRate.value = document.getElementById("rate").innerHTML;
	
	var f = document.fReservation;
	if (f.sType.value == 0 || f.sPickupLocation.value == 0 || f.sDropOffLocation.value == 0 || f.fromDate.value == "" || f.toDate.value == "" || f.tRate.value == "0" || f.tRate.value == "" || isNaN(f.tRate.value.split("$")[0])) {
		alert(lang.Dictionary.books[translator.getLang()].fillTheBoxMarked);
		return false;
	}
	return true;
}

function total(datos, onSend) {
	with (document.fReservation) {
		if (sType.value != 0 && sPickupLocation.value != 0 && sDropOffLocation.value != 0 && fromDate.value != "" && toDate.value != "") {
			
			getURL("clientes/calculation.php", "rate", datos, "POST", onSend);
		}
	}
}
function getRates2(){
	calcIns(99);
	getRates();
}
function getRates(onCalc) {
	/*Variables*/
	var car = document.fReservation.sType.value;
	//var aditionalDriver = document.fReservation.cbDriver.checked;
	var pickup = document.fReservation.sPickupLocation.value;
	var dropoff = document.fReservation.sDropOffLocation.value;
	var fromTime = document.fReservation.sFromHour.value;
	var fromDate = document.fReservation.fromDate.value.split("-");
	var toTime = document.fReservation.sToHour.value;
	var toDate = document.fReservation.toDate.value.split("-");
	var ticket = document.fReservation.tTicket.value;
	/**/
	
	var tTotalOpt = document.getElementById("tTotalOpt");
	var tTotalIns = document.getElementById("tTotalIns");
	
	var totalOpt = "";
	var totalIns = "";
	
	if (tTotalOpt != null && tTotalIns != null) {
		totalOpt = tTotalOpt.value;
		totalIns = tTotalIns.value;
		
		totalOpt = totalOpt.substring(1, totalOpt.length);
		totalIns = totalIns.substring(1, totalIns.length);
	}
	
	/*Formamos la cadena de datos*/
	fromDate = [fromDate[2], fromDate[0], fromDate[1]];
	toDate = [toDate[2], toDate[0], toDate[1]];
	var datos = "";
	datos += "car="+encodeURIComponent(car);
	datos += "&pickup="+encodeURIComponent(pickup);
	datos += "&dropoff="+encodeURIComponent(dropoff);
	datos += "&fromTime="+encodeURIComponent(fromTime);
	datos += "&fromDate="+encodeURIComponent(fromDate.join("-"));
	datos += "&toTime="+encodeURIComponent(toTime);
	datos += "&toDate="+encodeURIComponent(toDate.join("-"));
	datos += "&ticket="+encodeURIComponent(ticket);
	
	if (totalOpt != "" && totalIns != "") {
		datos += "&totalopt="+encodeURIComponent(totalOpt);
		datos += "&totalins="+encodeURIComponent(totalIns);
	}
	
	//+"&aditionalDriver="+encodeURIComponent(aditionalDriver)
	total(datos, onCalc);
}

