	function strtodate(str) {
		var i = 0;
		var j = 0;
		var arr = new Array();
		arr[0]="";
		if(str.length<8) return false;
		for(i=0;i<str.length;i++) {
			chr=str.charAt(i);
			if(chr!="-") arr[j]=arr[j]+chr;
			else { j++; arr[j]=""; }
		}
		if(j!=2) return false;
		return arr;
	} // end of strtodate()

	function unixtime(year,month,day) {
		var dat=new Date(year,month-1,day,0,0,0);
		return dat.valueOf();
	} // end of unixtime()

	function fulldays(datefrom,dateto) {
		var arrfrom=strtodate(datefrom);
		var arrto=strtodate(dateto);
		if(!arrfrom || !arrto) return 0;
		var utfrom=unixtime(arrfrom[0],arrfrom[1],arrfrom[2]);
		var utto=unixtime(arrto[0],arrto[1],arrto[2]);
		var period=utto-utfrom;
		var days1=period/86400000;
		var days=Math.floor(period/86400000);
		if((days1-days)>0.8) days++;
		days++;
		//
		return days;
	} // end of fulldays()

	function dayscalc() {
		document.p1.fulldays.value=fulldays(document.p1.terminfrom.value,document.p1.terminto.value);
	} // and of dayscalc()

	function trcostcalc() {
		document.p1.trr.value=document.p1.travelcost.value/100*5;
	} // end of trcostcalc()