function GetTotals()
{


 // Create the XML object
 var xml = false;
 
 if (window.XMLHttpRequest){

          // If IE7, Mozilla, Safari, etc: Use native object
          var xml = new XMLHttpRequest()

 }
 else 
 {
 if (window.ActiveXObject){

          // ...otherwise, use the ActiveX control for IE5.x and IE6
          var xml = new ActiveXObject("Microsoft.XMLHTTP"); 
          }

 }

  
 var strStart1 = '00:00';
 var strStart2 = '00:00';
 var strStart3 = '00:00';
 var strStart4 = '00:00';
 var strStart5 = '00:00';
 var strStart6 = '00:00';
 var strStart7 = '00:00';
 

 strStart1 = document.getElementById('Day1StartTime').value;
 strStart2 = document.getElementById('Day2StartTime').value;
 strStart3 = document.getElementById('Day3StartTime').value;
 strStart4 = document.getElementById('Day4StartTime').value;
 strStart5 = document.getElementById('Day5StartTime').value;
 strStart6 = document.getElementById('Day6StartTime').value;
 strStart7 = document.getElementById('Day7StartTime').value;
 
 var strEnd1 = '00:00';
 var strEnd2 = '00:00';
 var strEnd3 = '00:00';
 var strEnd4 = '00:00';
 var strEnd5 = '00:00';
 var strEnd6 = '00:00';
 var strEnd7 = '00:00';
 
 strEnd1 = document.getElementById('Day1EndTime').value;
 strEnd2 = document.getElementById('Day2EndTime').value;
 strEnd3 = document.getElementById('Day3EndTime').value;
 strEnd4 = document.getElementById('Day4EndTime').value;
 strEnd5 = document.getElementById('Day5EndTime').value;
 strEnd6 = document.getElementById('Day6EndTime').value;
 strEnd7 = document.getElementById('Day7EndTime').value;

 
 // Perform the postback
 if (xml) {
  xml.open("post", "timesheet-totals.asp", true);
  xml.onreadystatechange = function() {
   if (xml.readyState == 4) {
	if (xml.responseText) {
	 
	 myarray = xml.responseText.split("~")	 
	 document.getElementById('total1').innerHTML=myarray[0]
	 document.getElementById('total2').innerHTML=myarray[1]
	 document.getElementById('total3').innerHTML=myarray[2]
	 document.getElementById('total4').innerHTML=myarray[3]
	 document.getElementById('total5').innerHTML=myarray[4]
	 document.getElementById('total6').innerHTML=myarray[5]
	 document.getElementById('total7').innerHTML=myarray[6]
	 document.getElementById('basicHours').innerHTML=myarray[7]
	 document.getElementById('overtimeHours').innerHTML=myarray[8]
	 document.getElementById('totalHours').innerHTML=myarray[9]
	}
   }
  }
	xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xml.send("rand=" + Math.random() + "&s1=" + strStart1 + "&s2=" + strStart2 + "&s3=" + strStart3 + "&s4=" + strStart4 + "&s5=" + strStart5 + "&s6=" + strStart6 + "&s7=" + strStart7 + "&e1=" + strEnd1 + "&e2=" + strEnd2 + "&e3=" + strEnd3 + "&e4=" + strEnd4 + "&e5=" + strEnd5 + "&e6=" + strEnd6 + "&e7=" + strEnd7);
 }

}

function timeonblur(input)
{
	if (input.value == "") {
		return true;
	}

	var re = /^(\d{1,2}):(\d{1,2})$/
	var rc = re.exec(input.value);
	if (rc == null) {
		alert('Please enter a time in hh:mm format.');
		input.focus();
		return false;
	} else {
		if (parseInt(rc[1], 10) > 23) {
			alert('Please enter a time in hh:mm format.');
			input.focus();
			return false;
		}

		if (parseInt(rc[2], 10) > 59) {
			alert('Please enter a time in hh:mm format.');
			input.focus();
			return false;
		}
	
		input.value = "";
		if (parseInt(rc[1], 10) < 10) {
			input.value += "0";
		}
		input.value += parseInt(rc[1], 10) + ":";
		if (parseInt(rc[2], 10) < 10) {
			input.value += "0";
		}
		input.value += parseInt(rc[2], 10);
	}
}

function moneyonblur(input)
{
	if (input.value == "") {
		return true;
	}

	var re = /^(\d{1,7}).(\d{1,2})$/
	var rc = re.exec(input.value);
	if (rc == null) {
		alert('Please enter a numeric value in 0.00 format.');
		input.focus();
		return false;
	} else {
	
		input.value = "";
		//parse the value so we add the dot to separate the value
		input.value += parseInt(rc[1], 10) + ".";
		//get the bit after the dot
		//input.value += parseInt(rc[2], 10);
		//if it's zero characters long add two zeros on the end eg. 1 = 1.00 not 1.0
		if (rc[2].length==0) {
			input.value += "00";
		}
		//if it's only one character long add a zero on the end eg. 1.5 = 1.50 not 1.05
		if (rc[2].length==1) {
			if (parseInt(rc[2], 10) < 10) {
				input.value += rc[2] + "0";
			}
		}
		//if it's two characters long leave it as it is
		if (rc[2].length==2) {
			input.value += rc[2];
		}		
	}
}

