// JavaScript Document
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

<!-- Blinking Text
spe=500;
na=document.all.tags("blink");
swi=1;
bringBackBlinky();

function bringBackBlinky() {

if (swi == 1) {
sho="visible";
swi=0;
}
else {
sho="hidden";
swi=1;
}

for(i=0;i<na.length;i++) {
na[i].style.visibility=sho;
}

setTimeout("bringBackBlinky()", spe);
}

function submitform()
{
  document.ePayment.submit();
}

function IsNumeric(strString)
//  check for valid numeric strings	
{
	var strValidChars = "0123456789.-";
	var strChar;
	var blnResult = true;

	if (strString.length == 0) return false;

	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
			blnResult = false;
		}
	}
	return blnResult;
}

function validateForm()
{
	var toSubmit = true;
	if (document.forms["myForm"]["patientname"].value == null || document.forms["myForm"]["patientname"].value == "")
	{
		alert("Please enter Patient Name. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientname.focus()}, 10);
		return false;
	}
	if (!IsNumeric(document.forms["myForm"]["dd"].value) || document.forms["myForm"]["dd"].value>31)
	{
		alert("Please enter a valid day of the month for your date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.dd.focus()}, 10);
		return false;
	}

	if (!IsNumeric(document.forms["myForm"]["mm"].value) || document.forms["myForm"]["dd"].value>12)
	{
		alert("Please enter a valid month for your date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.mm.focus()}, 10);
		return false;
	}

	var d = new Date();
	thisYear = d.getFullYear();
	
	if (!IsNumeric(document.forms["myForm"]["yyyy"].value) || document.forms["myForm"]["yyyy"].value>thisYear)
	{
		alert("Please enter a valid year for your date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.yyyy.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientic"].value == null || document.forms["myForm"]["patientic"].value == "")
	{
		alert("Please enter Patient IC/Passport Number. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientic.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientadd"].value == null || document.forms["myForm"]["patientadd"].value == "")
	{
		alert("Please enter Patient Address. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientadd.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientadd2"].value == null || document.forms["myForm"]["patientadd2"].value == "")
	{
		alert("Please enter Patient City, State and Postcode. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientadd2.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patienttel"].value == null || document.forms["myForm"]["patienttel"].value == "")
	{
		alert("Please enter Patient Telephone number. This is a compulsory field.");
		setTimeout(function(){document.myForm.patienttel.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientemail"].value == null || document.forms["myForm"]["patientemail"].value == "")
	{
		alert("Please enter Patient Email address. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientemail.focus()}, 10);
		return false;
	}
	
	var checkedBox=false;
	if(document.forms["myForm"]["HU_LB1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_PH1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_MO1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_HC1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_WG1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_CS1"].checked)
	{
		checkedBox = true;
	}
	if(!checkedBox)
	{
		alert("You must select at least 1 test.");
		setTimeout(function(){document.myForm.HU_LB1.focus()}, 10);
		return false;
	}

	return true;
}

function validateFormGuardian()
{
	var toSubmit = true;

	if (document.forms["myForm"]["guardianname"].value == null || document.forms["myForm"]["guardianname"].value == "")
	{
		alert("Please enter your child's name. This is a compulsory field.");
		setTimeout(function(){document.myForm.guardianname.focus()}, 10);
		return false;
	}
	if (!IsNumeric(document.forms["myForm"]["gdd"].value) || document.forms["myForm"]["gdd"].value>31)
	{
		alert("Please enter a valid day of the month for your child's date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.gdd.focus()}, 10);
		return false;
	}

	if (!IsNumeric(document.forms["myForm"]["gmm"].value) || document.forms["myForm"]["gdd"].value>12)
	{
		alert("Please enter a valid month for your child's date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.gmm.focus()}, 10);
		return false;
	}

	var d = new Date();
	thisYear = d.getFullYear();
	
	if (!IsNumeric(document.forms["myForm"]["gyyyy"].value) || document.forms["myForm"]["gyyyy"].value>thisYear)
	{
		alert("Please enter a valid year for your child's date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.gyyyy.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["guardianic"].value == null || document.forms["myForm"]["guardianic"].value == "")
	{
		alert("Please enter your IC/Passport Number. This is a compulsory field.");
		setTimeout(function(){document.myForm.guardianic.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["guardianadd"].value == null || document.forms["myForm"]["guardianadd"].value == "")
	{
		alert("Please enter your address. This is a compulsory field.");
		setTimeout(function(){document.myForm.guardianadd.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["guardianadd2"].value == null || document.forms["myForm"]["guardianadd2"].value == "")
	{
		alert("Please enter your City, State and Postcode. This is a compulsory field.");
		setTimeout(function(){document.myForm.guardianadd2.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["guardiantel"].value == null || document.forms["myForm"]["guardiantel"].value == "")
	{
		alert("Please enter your Telephone number. This is a compulsory field.");
		setTimeout(function(){document.myForm.guardiantel.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["guardianemail"].value == null || document.forms["myForm"]["guardianemail"].value == "")
	{
		alert("Please enter Patient Email address. This is a compulsory field.");
		setTimeout(function(){document.myForm.guardianemail.focus()}, 10);
		return false;
	}

	if (document.forms["myForm"]["patientname"].value == null || document.forms["myForm"]["patientname"].value == "")
	{
		alert("Please enter Patient Name. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientname.focus()}, 10);
		return false;
	}
	if (!IsNumeric(document.forms["myForm"]["dd"].value) || document.forms["myForm"]["dd"].value>31)
	{
		alert("Please enter a valid day of the month for your date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.dd.focus()}, 10);
		return false;
	}

	if (!IsNumeric(document.forms["myForm"]["mm"].value) || document.forms["myForm"]["dd"].value>12)
	{
		alert("Please enter a valid month for your date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.mm.focus()}, 10);
		return false;
	}

	var d = new Date();
	thisYear = d.getFullYear();
	
	if (!IsNumeric(document.forms["myForm"]["yyyy"].value) || document.forms["myForm"]["yyyy"].value>thisYear)
	{
		alert("Please enter a valid year for your date of birth. This is a compulsory field.");
		setTimeout(function(){document.myForm.yyyy.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientic"].value == null || document.forms["myForm"]["patientic"].value == "")
	{
		alert("Please enter Patient IC/Passport Number. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientic.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientadd"].value == null || document.forms["myForm"]["patientadd"].value == "")
	{
		alert("Please enter Patient Address. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientadd.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientadd2"].value == null || document.forms["myForm"]["patientadd2"].value == "")
	{
		alert("Please enter Patient City, State and Postcode. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientadd2.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patienttel"].value == null || document.forms["myForm"]["patienttel"].value == "")
	{
		alert("Please enter Patient Telephone number. This is a compulsory field.");
		setTimeout(function(){document.myForm.patienttel.focus()}, 10);
		return false;
	}
	
	if (document.forms["myForm"]["patientemail"].value == null || document.forms["myForm"]["patientemail"].value == "")
	{
		alert("Please enter Patient Email address. This is a compulsory field.");
		setTimeout(function(){document.myForm.patientemail.focus()}, 10);
		return false;
	}
	
	var checkedBox=false;
	if(document.forms["myForm"]["HU_LB1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_PH1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_MO1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_HC1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_WG1"].checked)
	{
		checkedBox = true;
	}
	else if(document.forms["myForm"]["HU_CS1"].checked)
	{
		checkedBox = true;
	}
	if(!checkedBox)
	{
		alert("You must select at least 1 test.");
		setTimeout(function(){document.myForm.HU_LB1.focus()}, 10);
		return false;
	}

	return true;
}
-->
