function addTypingTestWindow() {

	var x = (screen.width - 960) / 2;
	typingtestwindow = open("http://www.lawson-clark.co.uk/typingtest.shtml","TypingTest","directories=no,toolbar=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,width=960,height=660,top=10,left=" + x + "");

}

function addPDFWindow(doc) {

	var x = (screen.width - 960) / 2;
	if (doc == "bank"){
		typingtestwindow = open("http://www.lawson-clark.co.uk/downloads/mandate.pdf","Downloads","directories=no,toolbar=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,width=960,height=660,top=10,left=" + x + "");
	}
	else if (doc == "p46"){
		typingtestwindow = open("http://www.lawson-clark.co.uk/downloads/p46.pdf","Downloads","directories=no,toolbar=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,width=960,height=660,top=10,left=" + x + "");
	}
	else if (doc == "p38"){
		typingtestwindow = open("http://www.lawson-clark.co.uk/downloads/p38.pdf","Downloads","directories=no,toolbar=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,width=960,height=660,top=10,left=" + x + "");
	}

}


function getTypingTestApplet()
{

    Test=Math.floor(Math.random()*26)

    document.write("<BODY TOPMARGIN=\"0\" LEFTMARGIN=\"0\">");
    document.write("<APPLET ARCHIVE=\"OnlineTest.jar\" CODE=\"OnlineTest\" WIDTH=960 HEIGHT=660>");
    document.write("<PARAM NAME=\"ID\" value=\"" + Test + "\">");
    document.write("</APPLET>");

}

function CalcTimeSheet() {

	var Start;
	var End;

	if(document.tsheet.Temp.value == ""){
		alert("Please enter your Name");
		return;
	}

	if(document.tsheet.Firm.value == ""){
		alert("Please enter the Name of the Firm");
		return;
	}

	if(document.tsheet.Wend.value == ""){
		alert("Please enter the Week Ending Date for the week worked");
		return;
	}
	
	Start = ConvT(document.tsheet.MonStart.value)
	End = ConvT(document.tsheet.MonEnd.value)

	if((Start == "0") || (End == "0")){
		var MonT = 0;
		document.tsheet.MonEnd.value = "Did not work";
		document.tsheet.MonStart.value = "Did not work";
		document.tsheet.MonLunch.value = "None";
		document.tsheet.MonOver1.value = "None";
		document.tsheet.MonOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Monday start or finish times are incorrect");
		return;
	}
	else {
		MonT = End - Start - ConvT(document.tsheet.MonLunch.value);
        if(MonT <= 0){                           
        	alert("Your Monday start or finish times are incorrect");
            return;
        }
	}

	Start = ConvT(document.tsheet.TueStart.value)
	End = ConvT(document.tsheet.TueEnd.value)

	if((Start == "0") || (End == "0")){
		var TueT = 0;
		document.tsheet.TueEnd.value = "Did not work";
		document.tsheet.TueStart.value = "Did not work";
		document.tsheet.TueLunch.value = "None";
		document.tsheet.TueOver1.value = "None";
		document.tsheet.TueOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Tuesday start or finish times are incorrect");
		return;
	}
	else {
		TueT = End - Start - ConvT(document.tsheet.TueLunch.value);
        if(TueT <= 0){                           
        	alert("Your Tuesday start or finish times are incorrect");
            return;
        }
	}

	Start = ConvT(document.tsheet.WedStart.value)
	End = ConvT(document.tsheet.WedEnd.value)

	if((Start == "0") || (End == "0")){
		var WedT = 0;
		document.tsheet.WedEnd.value = "Did not work";
		document.tsheet.WedStart.value = "Did not work";
		document.tsheet.WedLunch.value = "None";
		document.tsheet.WedOver1.value = "None";
		document.tsheet.WedOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Wednesday start or finish times are incorrect");
		return;
	}
	else {
		WedT = End - Start - ConvT(document.tsheet.WedLunch.value);
        if(WedT <= 0){                           
        	alert("Your Wednesday start or finish times are incorrect");
            return;
        }
	}

	Start = ConvT(document.tsheet.ThuStart.value)
	End = ConvT(document.tsheet.ThuEnd.value)

	if((Start == "0") || (End == "0")){
		var ThuT = 0;
		document.tsheet.ThuEnd.value = "Did not work";
		document.tsheet.ThuStart.value = "Did not work";
		document.tsheet.ThuLunch.value = "None";
		document.tsheet.ThuOver1.value = "None";
		document.tsheet.ThuOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Thursday start or finish times are incorrect");
		return;
	}
	else {
		ThuT = End - Start - ConvT(document.tsheet.ThuLunch.value);
        if(ThuT <= 0){                           
        	alert("Your Thursday start or finish times are incorrect");
            return;
        }
	}

	Start = ConvT(document.tsheet.FriStart.value)
	End = ConvT(document.tsheet.FriEnd.value)

	if((Start == "0") || (End == "0")){
		var FriT = 0;
		document.tsheet.FriEnd.value = "Did not work";
		document.tsheet.FriStart.value = "Did not work";
		document.tsheet.FriLunch.value = "None";
		document.tsheet.FriOver1.value = "None";
		document.tsheet.FriOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Friday start or finish times are incorrect");
		return;
	}
	else {
		FriT = End - Start - ConvT(document.tsheet.FriLunch.value);
        if(FriT <= 0){                           
        	alert("Your Friday start or finish times are incorrect");
            return;
        }
	}

	Start = ConvT(document.tsheet.SatStart.value)
	End = ConvT(document.tsheet.SatEnd.value)

	if((Start == "0") || (End == "0")){
		var SatT = 0;
		document.tsheet.SatEnd.value = "Did not work";
		document.tsheet.SatStart.value = "Did not work";
		document.tsheet.SatLunch.value = "None";
		document.tsheet.SatOver1.value = "None";
		document.tsheet.SatOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Saturday start or finish times are incorrect");
		return;
	}
	else {
		SatT = End - Start - ConvT(document.tsheet.SatLunch.value);
        if(SatT <= 0){                           
        	alert("Your Saturday start or finish times are incorrect");
            return;
        }
	}

	Start = ConvT(document.tsheet.SunStart.value)
	End = ConvT(document.tsheet.SunEnd.value)

	if((Start == "0") || (End == "0")){
		var SunT = 0;
		document.tsheet.SunEnd.value = "Did not work";
		document.tsheet.SunStart.value = "Did not work";
		document.tsheet.SunLunch.value = "None";
		document.tsheet.SunOver1.value = "None";
		document.tsheet.SunOver2.value = "None";
	}
	else if(eval(Start) >= eval(End)){
		alert("Your Sunday start or finish times are incorrect");
		return;
	}
	else {
		SunT = End - Start - ConvT(document.tsheet.SunLunch.value);
        if(SunT <= 0){                           
        	alert("Your Sunday start or finish times are incorrect");
            return;
        }
	}

	HourT = eval(MonT) + eval(TueT) + eval(WedT) + eval(ThuT) + eval(FriT) + eval(SatT) + eval(SunT);

	MonOT1 = ConvT(document.tsheet.MonOver1.value);
	TueOT1 = ConvT(document.tsheet.TueOver1.value);
	WedOT1 = ConvT(document.tsheet.WedOver1.value);
	ThuOT1 = ConvT(document.tsheet.ThuOver1.value);
	FriOT1 = ConvT(document.tsheet.FriOver1.value);
	SatOT1 = ConvT(document.tsheet.SatOver1.value);
	SunOT1 = ConvT(document.tsheet.SunOver1.value);

	HourOT1T = (eval(MonOT1) + eval(TueOT1) + eval(WedOT1) + eval(ThuOT1) + eval(FriOT1) + eval(SatOT1) + eval(SunOT1));
	
	MonOT2 = ConvT(document.tsheet.MonOver2.value);
	TueOT2 = ConvT(document.tsheet.TueOver2.value);
	WedOT2 = ConvT(document.tsheet.WedOver2.value);
	ThuOT2 = ConvT(document.tsheet.ThuOver2.value);
	FriOT2 = ConvT(document.tsheet.FriOver2.value);
	SatOT2 = ConvT(document.tsheet.SatOver2.value);
	SunOT2 = ConvT(document.tsheet.SunOver2.value);

	HourOT2T = eval(MonOT2) + eval(TueOT2) + eval(WedOT2) + eval(ThuOT2) + eval(FriOT2) + eval(SatOT2) + eval(SunOT2);
	
	document.tsheet.MonTot.value = MonT.toFixed(2);
	document.tsheet.TueTot.value = TueT.toFixed(2);
	document.tsheet.WedTot.value = WedT.toFixed(2);
	document.tsheet.ThuTot.value = ThuT.toFixed(2);
	document.tsheet.FriTot.value = FriT.toFixed(2);
	document.tsheet.SatTot.value = SatT.toFixed(2);
	document.tsheet.SunTot.value = SunT.toFixed(2);
	
	document.tsheet.MonOT1.value = MonOT1;
	document.tsheet.TueOT1.value = TueOT1;
	document.tsheet.WedOT1.value = WedOT1;
	document.tsheet.ThuOT1.value = ThuOT1;
	document.tsheet.FriOT1.value = FriOT1;
	document.tsheet.SatOT1.value = SatOT1;
	document.tsheet.SunOT1.value = SunOT1;

	document.tsheet.MonOT2.value = MonOT2;
	document.tsheet.TueOT2.value = TueOT2;
	document.tsheet.WedOT2.value = WedOT2;
	document.tsheet.ThuOT2.value = ThuOT2;
	document.tsheet.FriOT2.value = FriOT2;
	document.tsheet.SatOT2.value = SatOT2;
	document.tsheet.SunOT2.value = SunOT2;

	document.tsheet.HourTot.value = HourT.toFixed(2); 
	document.tsheet.Over1Tot.value = HourOT1T.toFixed(2);
	document.tsheet.Over2Tot.value = HourOT2T.toFixed(2);

	document.tsheet.submit();
	
}

function ConvT(strData){

	if(strData == "Did not work" || strData == "None"){
		tm = "0";
		return(tm);
	}
	if(strData.length == "4"){
        hh = strData.substring(0,1);
        mm = strData.substring(2,4);
    } else {
        hh = strData.substring(0,2);
        mm = strData.substring(3,5);
        if(hh.substring(0,1) == "0"){
			hh = hh.substring(1,2)
		}
   	}
		
	if(mm == "15"){
		mm = "25";
	} 
	else if(mm == "30"){
		mm = "50";
	}
	else if(mm == "45"){
		mm = "75";
	}
	tm = hh + "." + mm;
	return(tm);
}



