

function updatePace() {
	this.getObj = function ( id ) {
		if (this.ie) { return document.all[id]; }
		else {	return document.getElementById(id);	}
	 }
	 //
	 this.ie = document.all; // true if ie
	 //get handles to the two fields that we want to use
	 //to calculate the pace
	 this.my_duration = this.getObj('tot_duration');
	 this.my_distance = this.getObj('tot_distance');
	 
	 //get a handle for the pace calculation
	 this.my_pace = this.getObj('tot_pace');
	 
	 //return the calculated the pace
	 //debug:
	 //alert("Got Here!");
	 if(this.my_pace) {
		 this.my_pace.value=parseInt(1000*parseDuration(this.my_duration.value)/parseFloat(this.my_distance.value))/1000;
	 }
}

function parseDuration(someTime) {
	 var myDura=someTime.replace('h',':');
	 myDura=myDura.replace('m',':');
	 myDura=myDura.replace('s','');
	 var mySplit=myDura.split(':');
	 return parseFloat(mySplit[0])*60+parseFloat(mySplit[1])+parseFloat(mySplit[2])/60;
}

