	var inhr ;
		inhr = 0;
	var minI;
		minI = 0;
	var minO;
		minO = 0;
	var minin;
		minin = 0;
	var hrin;
		hrin = 0;
	var hrout;
		hrout = 0;
	var hr;
		hr = 0;
	var t_minin;
		t_minin = 0;
	var t_minout;
		t_minout = 0;
	var minout2;
		minout2 = 0;
	var thr;
		thr = 0;
	var tmin;
		tmin = 0;
	var gtmin;
		gtmin = 0;
	var gthr;
		gthr = 0;
	var InAM;
		InAM = 0;
	var OutAM;
		OutAM = 0;
	var InPM;
		InPM = 0;
	var OutPM;
		OutPM = 0;
	var AMAdd;
		AMAdd = 0;
	var PMAdd;
		PMAdd = 0;
	var subcount;
		subcount = 1 ;
	var trick ;
		trick = 0;
	var trick2;
		trick2 = 0;
	var gt_hr ;
		gt_hr = 0;
	var gt_min ;
		gt_min = 0;
	var MIn ;
		MIn = 0 ;
function help_window() {
	TARGET="_top" ;
	helpWindow=window.open('','','toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=300,height=400');
	helpWindow.document.write( "<HTML><HEAD><TITLE>Help</TITLE></HEAD><BODY  TARGET='_top'   bgcolor='F0D69F'><FORM NAME='form1'>");
	helpWindow.document.write( "<FONT SIZE=5 FACE='arial' COLOR='BLUE'>") ;
	helpWindow.document.write( "<b>Hour Calculator Help</b></FONT><P>" );
	helpWindow.document.write( "Begin by clicking on each picklist under <i>Time In</i>. You'll need to select the <u>Hour</u>, the <u>Minutes</u>, and whether the time is <u>AM</u>, or <u>PM</u>. Next, do the same under <i> Time Out</i>. <P>Next, click on the <i>Total</i> button." );
	helpWindow.document.write( "You'll see the first sub-total displayed. Near the bottom of the screen you'll also be given a grand-total. ");

	helpWindow.document.write( "<P><b>IMPORTANT: </b>If you have multiple entries, click on the <i><b>Clear</b></i> button <u>once</u> to clear your last entry from the picklists, and retain the preceding sub-totals. If you want to clear all entries, click on the <b><i>Clear</i></b> button a second time. " );

	helpWindow.document.write( "<P>You can also click on the browser's <i>Print</i> button to obtain a printout (record) of your calculations.<br><br><br><br>" );

	helpWindow.document.write( "<P><FONT SIZE=5 FACE='arial' COLOR='BLUE'><b>NOTE:</b></FONT><P>" );

	helpWindow.document.write( "If you discover this page making any mis-calculations, please e-mail that information to:<P>" );
	helpWindow.document.write( "mrkent.com@gmail.com");
	helpWindow.document.write( "<P>Please include the times entered that caused the error." );
	helpWindow.document.write( "<P>Thanks!" );
	helpWindow.document.write( "<CENTER>" );
	helpWindow.document.write( "<INPUT TYPE=button NAME=closeBtn VALUE=Close onClick='window.close()'></CENTER></INPUT><P></FORM></BODY></HTML>" );
}
function clear_it() {
	if ( document.form1.display1.value == "" && document.form1.display2.value == "" ) {
		subcount = 1 ;
		document.form1.sub1.value = "";
		document.form1.sub2.value = "";
		document.form1.sub3.value = "";
		document.form1.sub4.value = "";
		document.form1.sub5.value = "";
		document.form1.grand.value = "";
		gt_hr = 0 ;
		gt_min = 0 ;
		gtmin = 0 ;
	}
	document.form1.HrIn.selectedIndex = 0 ;
	document.form1.MIn.selectedIndex = 0 ;
	document.form1.PAin.selectedIndex = 0 ;
	document.form1.HrOut.selectedIndex = 0 ;
	document.form1.MOut.selectedIndex = 0;
	document.form1.PAo.selectedIndex = 0;
	minI = 0 ;
	minO = 0 ;
	InAM = 0 ;
	OutAM = 0 ;
	InPM = 0 ;
	OutPM = 0 ;
	minin = 0 ;
	HourIn = 0 ;
	minout = 0 ;
	hrout = 0 ;
	trick = 0 ;
	trick2 = 0;
	document.form1.display1.value = "" ;
	document.form1.display2.value = "" ;
}
function AMPMIn () {
	aorp = form1.PAin.selectedIndex ;
		if (aorp == 1) {
			ap = " AM" ;
			InAM = 1 ;
		}
		if (aorp == 2) {
			ap = " PM" ;
			InPM = 1 ;
		}
	form1.display1.value = form1.display1.value + ap ;
}
function AMPM () {			//AM-PM out
	Apa = document.form1.PAo.selectedIndex ;
		if (Apa == 1) {
			Apo = " AM" ;
			OutAM = 1 ;
		}
		if (Apa == 2) {
			Apo = " PM" ;
			OutPM = 1 ;
		}

	document.form1.display2.value = document.form1.display2.value + Apo
}
function in_time_min() {		//Minutes coming in ;
	MIn = (document.form1.MIn.selectedIndex ) * 5 ;
		if (MIn == 60 ) {
			MIn = 0 ;

		} 		
		if (MIn < 10 ) {
			Fill = "0" ;
		} else {
			Fill = "" ;
		}
		document.form1.display1.value = document.form1.display1.value + ":" + Fill + MIn ;
		if (trick == 12 ) {
			document.form1.display1.value = trick + ":" + Fill + MIn;
		}
		MinI = 1 ;
}
function out_time_min() {		//Minutes leaving ;
	minout2 = (document.form1.MOut.selectedIndex ) * 5 ;
		if (minout2 == 60 ) {
			minout2 = 0 ;

		} 
		if (minout2 < 10) {
			Fill = "0" ;
		} else {
			Fill = "" ;
		}
	document.form1.display2.value = document.form1.display2.value + ":" + Fill + minout2 ;
}
function in_time_hr() {						//Hour coming in ;
	HourIn = document.form1.HrIn.selectedIndex  ;
	document.form1.display1.value = HourIn ;
	if (HourIn == 12) {
		HourIn = 0 ;
		trick = 12;
		}
	t_minin = HourIn * 60 ;
}
function out_time_hr() {						//Hour leaving ;
	hrout = document.form1.HrOut.selectedIndex ;
	document.form1.display2.value = hrout ;
	t_minout = hrout * 60 ;	
	if (hrout == 12) {
		hrout = 0 ;
		trick2 = 12 ;
	}
}
function find_dif() {						//Find difference;
	if (document.form1.display1.value == "" || document.form1.display2.value == "") {
		alert("Must complete selection of hours, minutes, AM/PM, for both 'Time In' and 'Time Out'.");
		subcount = subcount - 1 ;
	}
	t_minin = t_minin + MIn;
	t_minout = t_minout + minout2;
	diff_min =  t_minout - t_minin  ;
	diff_hr = Math.floor(diff_min / 60) ;
		if (( InPM == 1 || OutPM == 1 ) && ( InAM == 1 || OutAM ==1 )) {
			diff_hr = diff_hr + 12 ;
				if (diff_hr > 12 && (InAM != 1 && OutPM != 1)) {
					diff_hr = diff_hr - 12 ;
				}
		}
		if ( trick2 == 12 && diff_hr > 11 ) {
			diff_hr = diff_hr - 12 ;
		}
	x_min = diff_min % 60 ;
		if (( InPM == 1 || OutPM == 1 ) && ( InAM == 1 || OutAM == 1 )) {
			x_min = x_min + 60 ;
			if ( x_min == 60 ) {
				x_min = 0 ;
			}
		}
		if (x_min > 60 ) {
			x_min = x_min - 60 ;
		}
	if ( x_min < 10 ) {
			fill = "0";
		} else {
			fill = "";
		}
	if (diff_hr < 0) {
		alert("The data entered has created a negative number. The result will not be accurate, and your grand total will not be correct. Click the 'Clear' button twice and begin again.") ;
	}
	if ( subcount == 1 ) {
		document.form1.sub1.value = diff_hr + ":" + fill + x_min;
		gtmin = gtmin + ( diff_hr * 60 ) + x_min ;
	}
	if ( subcount == 2 ) {
		document.form1.sub2.value = diff_hr + ":" + fill + x_min;
		gtmin = gtmin + ( diff_hr * 60 ) + x_min ;
	}
	if ( subcount == 3 ) {
		document.form1.sub3.value = diff_hr + ":" + fill + x_min;
		gtmin = gtmin + ( diff_hr * 60 ) + x_min ;
	}
	if ( subcount == 4 ) {
		document.form1.sub4.value = diff_hr + ":" + fill + x_min;
		gtmin = gtmin + ( diff_hr * 60 ) + x_min ;
	}
	if ( subcount == 5 ) {
		document.form1.sub5.value = diff_hr + ":" + fill + x_min;
		gtmin = gtmin + ( diff_hr * 60 ) + x_min ;
	}
	gt_hr = Math.floor(gtmin / 60) ;
	gt_min = gtmin % 60 ;
		if ( gt_min < 10 ) {
			fill = "0";
		} else {
			fill = "";
		}
	document.form1.grand.value = gt_hr + ":" + fill + gt_min ;
	minI = 0 ;
	minO = 0 ;
	inAM = 0 ;
	inPM = 0 ;
	outAM = 0 ;
	outPM = 0 ;
	amAdd = "" ;
	pmAdd = "" ;
	trick = 0 ;
	subcount = subcount + 1 ;
		if ( subcount > 5 ) {
			subcount = 5 ;
		}
}
function help_() {
	response = confirm("Click 'OK' to clear all entries. . .   Click 'CANCEL' for HELP.");
	if (response == true) {
		document.form1.display1.value = "" ;
		document.form1.display2.value = "" ;
		clear_it() ;
	} 
	alert("For the time signed in, click the hour and minutes under the 'IN' column. You must also indicate whether 'AM' or 'PM.' Next, under 'OUT' click the hour and minutes signed out, and 'AM' or 'PM.' Then click the 'Total' button. You can process as many as five separate sessions and display each sub-total. The 'Clear' button must be pressed between each calculation. To clear all calculations click the 'Clear' button a second time.") ;
}
function first_window() {
	TARGET="_top" ;
	window.open('../Calculators/first_window.htm','','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,copyhistory=no,width=200,height=90');
}
