var ctr=0;
var qno="";
function qfoc()
{
	document.form.survey_date.focus();
}
//------------------- c2 change div settings
function changeDiv(the_div,the_change)
{
  var the_style = getStyleObject(the_div);
  if (the_style != false)
  {
    the_style.display = the_change;
  }
}

function hideAll()
{
  document.form.c2q1_birth[0].checked=false;
  document.form.c2q1_birth[1].checked=false;
  document.form.c2q1_birth[2].checked=false;
  document.form.c2q1_birth[3].checked=false;
  document.form.c2q1_birth[4].checked=false;
  document.form.c2q2_resuscitation[0].checked=false;
  document.form.c2q2_resuscitation[1].checked=false;  
  document.form.c2q2_method_a.checked=false;
  document.form.c2q2_method_b.checked=false;
  document.form.c2q2_method_c.checked=false;
  document.form.c2q2_gas.checked=false;
  document.form.c2q3_resuscitator[0].checked=false;
  document.form.c2q3_resuscitator[1].checked=false;
  document.form.c2q3_resuscitator[2].checked=false;
  document.form.c2q4_1_apgar.value="";
  document.form.c2q4_unknown.checked=false;
  document.form.c2q5_5_apgar.value="";
  document.form.c2q5_unknown.checked=false;  
  document.form.c2q6_birthweight.value="";
  document.form.c2q6_unknown.checked=false;   
  document.form.c2q7_gestational_age.value="";
  document.form.c2q7_unknown.checked=false;
  document.form.c2q8_immunisation[0].checked=false;  
  document.form.c2q8_immunisation[1].checked=false; 
  document.form.c2q8_immunisation[2].checked=false; 
  document.form.c2q9_stillbirth[0].checked=false; 
  document.form.c2q9_stillbirth[1].checked=false;
  document.form.c2q9_cause.value="";
  document.form.c2q10_death_before_discharge[1].checked=false;
  document.form.c2q10_death_before_discharge[1].checked=false;
  document.form.c2q10_cause.value="";
  changeDiv("c2details","none");
}

function hideAll2()
{
  document.form.c3q1_birth[0].checked=false;
  document.form.c3q1_birth[1].checked=false;
  document.form.c3q1_birth[2].checked=false;
  document.form.c3q1_birth[3].checked=false;
  document.form.c3q1_birth[4].checked=false;
  document.form.c3q2_resuscitation[0].checked=false;
  document.form.c3q2_resuscitation[1].checked=false;  
  document.form.c3q2_method_a.checked=false;
  document.form.c3q2_method_b.checked=false;
  document.form.c3q2_method_c.checked=false;
  document.form.c3q2_gas.checked=false;
  document.form.c3q3_resuscitator[0].checked=false;
  document.form.c3q3_resuscitator[1].checked=false;
  document.form.c3q3_resuscitator[2].checked=false;
  document.form.c3q4_1_apgar.value="";
  document.form.c3q4_unknown.checked=false;
  document.form.c3q5_5_apgar.value="";
  document.form.c3q5_unknown.checked=false;  
  document.form.c3q6_birthweight.value="";
  document.form.c3q6_unknown.checked=false;   
  document.form.c3q7_gestational_age.value="";
  document.form.c3q7_unknown.checked=false;
  document.form.c3q8_immunisation[0].checked=false;  
  document.form.c3q8_immunisation[1].checked=false; 
  document.form.c3q8_immunisation[2].checked=false; 
  document.form.c3q9_stillbirth[0].checked=false; 
  document.form.c3q9_stillbirth[1].checked=false;
  document.form.c3q9_cause.value="";
  document.form.c3q10_death_before_discharge[1].checked=false;
  document.form.c3q10_death_before_discharge[1].checked=false;
  document.form.c3q10_cause.value="";
  changeDiv("c3details","none");
}

function getStyleObject(objectId) {
  if (document.getElementById && document.getElementById(objectId)) {
    return document.getElementById(objectId).style;
  } else if (document.all && document.all(objectId)) {
    return document.all(objectId).style;
  } else {
    return false;
  }
}
//------------------end of c2 change div settings
//------------------javascript for the c2 section

function c1apgar1()
		{
			if (document.form.c2q4_1_apgar.value == 0)
			{
				alert("One Minute APGAR Score cant be blank");
				document.form.c2q4_1_apgar.focus();	
			}
		  else if((!isnumber(document.form.c2q4_1_apgar) || !isbetween(document.form.c2q4_1_apgar,0,10)))
			alert("One Minute APGAR score must be a nubmer between 0 and 10");
		}
		function c1apgarc5()
		{
			if (document.form.c2q5_5_apgar.value == 0)
			{
				alert("One Minute APGAR Score cant be blank");
				document.form.c2q5_5_apgar.focus();	
			}
		  else if((!isnumber(document.form.c2q5_5_apgar) || !isbetween(document.form.c2q5_5_apgar,0,10)))
			alert("One Minute APGAR score must be a nubmer between 0 and 10");
		}
		function c1bweight()
		{

			if (document.form.c2q6_birthweight.value == "")
			{
				alert("Birth Weight cant be blank");
				document.form.c2q6_birthweight.focus();	
			}
		else if (document.form.c2q6_birthweight.value != "uk")
			{
				if(!isnumber(document.form.c2q6_birthweight))
					alert("Birth weight must be a number");
			}			
		}
		function c1bage()
		{
			if (document.form.c2q7_gestational_age.value == "")
			{
				alert("Gestational Age cant be blank");
				document.form.c2q7_gestational_age.focus();	
			}
		else if(document.form.c2q7_gestational_age.value !="uk")
	
			{
				if(!isnumber(document.form.c2q7_gestational_age) || !isbetween(document.form.c2q7_gestational_age,20,45))
					alert("gestational age must be a number between 20 and 45");
			}	

		}
		
function c2q4yesno()
{
   if(document.form.c2q4_unknown.checked)
	{
	document.form.c2q4_1_apgar.value="uk";
	}
   else
	{
	document.form.c2q4_1_apgar.value="";
	document.form.c2q4_1_apgar.focus();
	}
}
function c2q5yesno()
{
   if(document.form.c2q5_unknown.checked)
	{
	document.form.c2q5_5_apgar.value="uk";
	}
   else
	{
	document.form.c2q5_5_apgar.value="";
	document.form.c2q5_5_apgar.focus();
	}
}
function c2q6yesno()
{
   if(document.form.c2q6_unknown.checked)
	{
	document.form.c2q6_birthweight.value="uk";
	}
   else
	{
	document.form.c2q6_birthweight.value="";
	document.form.c2q6_birthweight.focus();
	}
}
function c2q7yesno()
{
   if(document.form.c2q7_unknown.checked)
	{
	document.form.c2q7_gestational_age.value="uk";
	}
   else
	{
	document.form.c2q7_gestational_age.value="";
	document.form.c2q7_gestational_age.focus();
	}
}
function c2q9yes()
		{
			document.form.c2q9_cause.disabled=false;
			document.form.c2q9_cause.focus();
		}
function c2q9no()
		{
			document.form.c2q9_cause.disabled=true;
			document.form.c2q9_cause.value="";
		}
function c2q10yes()
		{
			document.form.c2q10_cause.disabled=false;
			document.form.c2q10_cause.focus();
		}
function c2q10no()
		{
			document.form.c2q10_cause.disabled=true;
			document.form.c2q10_cause.value="";
		}
function disablec2q2()
{
	document.form.c2q2_method_a.disabled=true;   document.form.c2q2_method_a.checked=false;
	document.form.c2q2_method_b.disabled=true;   document.form.c2q2_method_b.checked=false;
	document.form.c2q2_method_c.disabled=true;   document.form.c2q2_method_c.checked=false;
	document.form.c2q2_gas.disabled=true;		 document.form.c2q2_gas.checked=false;
		}
function enablec2q2()
		{
			document.form.c2q2_method_a.disabled=false;
			document.form.c2q2_method_b.disabled=false;
			document.form.c2q2_method_c.disabled=false;
			document.form.c2q2_gas.disabled=false;
		}
		
		

//------------------end of c2 section

//------------------javascript for the c3 section

function c3apgar1()
		{
			if (document.form.c3q4_1_apgar.value == 0)
			{
				alert("One Minute APGAR Score cant be blank");
				document.form.c3q4_1_apgar.focus();	
			}
		  else if((!isnumber(document.form.c3q4_1_apgar) || !isbetween(document.form.c3q4_1_apgar,0,10)))
			alert("One Minute APGAR score must be a nubmer between 0 and 10");
		}
		function c3apgarc5()
		{
			if (document.form.c3q5_5_apgar.value == 0)
			{
				alert("One Minute APGAR Score cant be blank");
				document.form.c3q5_5_apgar.focus();	
			}
		  else if((!isnumber(document.form.c3q5_5_apgar) || !isbetween(document.form.c3q5_5_apgar,0,10)))
			alert("One Minute APGAR score must be a nubmer between 0 and 10");
		}
		function c3bweight()
		{

			if (document.form.c3q6_birthweight.value == "")
			{
				alert("Birth Weight cant be blank");
				document.form.c3q6_birthweight.focus();	
			}
		else if (document.form.c3q6_birthweight.value != "uk")
			{
				if(!isnumber(document.form.c3q6_birthweight))
					alert("Birth weight must be a number");
			}			
		}
		function c3bage()
		{
			if (document.form.c3q7_gestational_age.value == "")
			{
				alert("Gestational Age cant be blank");
				document.form.c3q7_gestational_age.focus();	
			}
		else if(document.form.c3q7_gestational_age.value !="uk")
	
			{
			if(!isnumber(document.form.c3q7_gestational_age) || !isbetween(document.form.c3q7_gestational_age,20,45))
					alert("gestational age must be a number between 20 and 45");
			}	

		}
		
function c3q4yesno()
{
   if(document.form.c3q4_unknown.checked)
	{
	document.form.c3q4_1_apgar.value="uk";
	}
   else
	{
	document.form.c3q4_1_apgar.value="";
	document.form.c3q4_1_apgar.focus();
	}
}
function c3q5yesno()
{
   if(document.form.c3q5_unknown.checked)
	{
	document.form.c3q5_5_apgar.value="uk";
	}
   else
	{
	document.form.c3q5_5_apgar.value="";
	document.form.c3q5_5_apgar.focus();
	}
}
function c3q6yesno()
{
   if(document.form.c3q6_unknown.checked)
	{
	document.form.c3q6_birthweight.value="uk";
	}
   else
	{
	document.form.c3q6_birthweight.value="";
	document.form.c3q6_birthweight.focus();
	}
}
function c3q7yesno()
{
   if(document.form.c3q7_unknown.checked)
	{
	document.form.c3q7_gestational_age.value="uk";
	}
   else
	{
	document.form.c3q7_gestational_age.value="";
	document.form.c3q7_gestational_age.focus();
	}
}
function c3q9yes()
		{
			document.form.c3q9_cause.disabled=false;
			document.form.c3q9_cause.focus();
		}
function c3q9no()
		{
			document.form.c3q9_cause.disabled=true;
			document.form.c3q9_cause.value="";
		}
function c3q10yes()
		{
			document.form.c3q10_cause.disabled=false;
			document.form.c3q10_cause.focus();
		}
function c3q10no()
		{
			document.form.c3q10_cause.disabled=true;
			document.form.c3q10_cause.value="";
		}
function disablec3q2()
{
	document.form.c3q2_method_a.disabled=true;   document.form.c3q2_method_a.checked=false;
	document.form.c3q2_method_b.disabled=true;   document.form.c3q2_method_b.checked=false;
	document.form.c3q2_method_c.disabled=true;   document.form.c3q2_method_c.checked=false;
	document.form.c3q2_method_d.disabled=true;   document.form.c3q2_method_d.checked=false;
		}
function enablec3q2()
		{
			document.form.c3q2_method_a.disabled=false;
			document.form.c3q2_method_b.disabled=false;
			document.form.c3q2_method_c.disabled=false;
			document.form.c3q2_method_d.disabled=false;
		}
		
		

//------------------end of c3 section

function q3yesno()
{
   if(document.form.q4_weight_unknown.checked)
	{
	document.form.q4_weight.value="uk";
	document.form.q4_age.value="uk";
	}
   else
	{
	document.form.q4_weight.value="";
	document.form.q4_age.value="";
	document.form.q4_weight.focus();
	}
}
function q1yesno()
{
   if(document.form.q1_date_unknown.checked)
	{
	document.form.q1_date.value="uk";
	}
   else
	{
	document.form.q1_date.value="";
	document.form.q1_date.focus();
	}
}
function q1byesno()
{
   if(document.form.q1_time_unknown.checked)
	{
	document.form.q1_time.value="uk";
	}
   else
	{
	document.form.q1_time.value="";
	document.form.q1_time.focus();
	}
}
function q40yesno()
{
   if(document.form.q40_date_unknown.checked)
	{
	document.form.q40_date.value="uk";
	}
   else
	{
	document.form.q40_date.value="";
	document.form.q40_date.focus();
	}
}
function q40byesno()
{
   if(document.form.q40_time_unknown.checked)
	{
	document.form.q40_time.value="uk";
	}
   else
	{
	document.form.q40_time.value="";
	document.form.q40_time.focus();
	}
}

function c2q11yesno()
{
   if(document.form.c2q11_date_unknown.checked)
	{
	document.form.c2q11_date.value="uk";
	}
   else
	{
	document.form.c2q11_date.value="";
	document.form.c2q11_date.focus();
	}
}
function c2q11byesno()
{
   if(document.form.c2q11_time_unknown.checked)
	{
	document.form.c2q11_time.value="uk";
	}
   else
	{
	document.form.c2q11_time.value="";
	document.form.c2q11_time.focus();
	}
}

function c3q11yesno()
{
   if(document.form.c3q11_date_unknown.checked)
	{
	document.form.c3q11_date.value="uk";
	}
   else
	{
	document.form.c3q11_date.value="";
	document.form.c3q11_date.focus();
	}
}
function c3q11byesno()
{
   if(document.form.c3q11_time_unknown.checked)
	{
	document.form.c3q11_time.value="uk";
	}
   else
	{
	document.form.c3q11_time.value="";
	document.form.c3q11_time.focus();
	}
}
function q5yesno()
{
   if(document.form.q5_height_unknown.checked)
	{
	document.form.q5_height.value="uk";
	}
   else
	{
	document.form.q5_height.value="";
	document.form.q5_height.focus();
	}
}

function q19yesno()
{
   if(document.form.q19_unknown.checked)
	{
	document.form.q19_1_apgar.value="uk";
	}
   else
	{
	document.form.q19_1_apgar.value="";
	document.form.q19_1_apgar.focus();
	}
}

function q20yesno()
{
   if(document.form.q20_unknown.checked)
	{
	document.form.q20_5_apgar.value="uk";
	}
   else
	{
	document.form.q20_5_apgar.value="";
	document.form.q20_5_apgar.focus();
	}
}
function q21yesno()
{
   if(document.form.q21_unknown.checked)
	{
	document.form.q21_birthweight.value="uk";
	}
   else
	{
	document.form.q21_birthweight.value="";
	document.form.q21_birthweight.focus();
	}
}
function q22yesno()
{
   if(document.form.q22_unknown.checked)
	{
	document.form.q22_gestational_age.value="uk";
	}
   else
	{
	document.form.q22_gestational_age.value="";
	document.form.q22_gestational_age.focus();
	}
}
function q23yesno()
{
   if(document.form.q23_unknown.checked)
	{
	document.form.q23_blood_loss.value="uk";
	}
   else
	{
	document.form.q23_blood_loss.value="";
	document.form.q23_blood_loss.focus();
	}
}
function addslash(e)
{
   e.cancelBubble=true;
ctr=e.srcElement.value.length;
if(e.keyCode==8)
	{

		if(e.srcElement.value.length==3  || e.srcElement.value.length==6 )
		{
		 e.srcElement.value=e.srcElement.value.substring(0,e.srcElement.value.length-1)
		 e.srcElement.focus();
		 ctr-=1;
		 return true;
		}
	}

 if((ctr/2)==1 || (ctr/5)==1)
   {

	e.srcElement.value+="/";
	e.srcElement.focus();
	ctr+=1;
	return true;
  }
   return false;
}
function addslash1(e)
{
e.cancelBubble=true;

ctr=e.srcElement.value.length;
if( e.keyCode==8 || e.keyCode==37 || e.keyCode==39 )
	{
		ctr=0;
		return true;
		
	}
  if((ctr/3)==1 )
  {
	e.srcElement.value+="/";
	e.srcElement.focus();
	ctr+=1;
	return true;
  }
   return false;
}

function addcolon(e)
{
e.cancelBubble=true;

ctr=e.srcElement.value.length;
if( e.keyCode==8 || e.keyCode==37 || e.keyCode==39 )
	{
		ctr=0;
		return true;
		
	}
  if((ctr/2)==1 )
  {
	e.srcElement.value+=":";
	e.srcElement.focus();
	ctr+=1;
	return true;
  }
   return false;
}

function dateonly(e)
	{
	
		var key,keychar;
		e.cancelBubble=true;
		key=
		document.layers ? e.which :
    		document.all ? event.keyCode :
    		document.getElementById ? e.keyCode : 0;
		keychar=String.fromCharCode(key);

		if((key==null) || (key==0) || (key==8) || (key==9) || (key==13) )
			{

			   return true;
			}
		else if ((("0123456789").indexOf(keychar) > -1))
			{
			if(e.srcElement.name=="q19_1_apgar" || e.srcElement.name=="q20_5_apgar")
				{
					
					if(  parseInt(e.srcElement.value+=keychar) > 10 )
					alert(" APGAR score must be a nubmer between 0 and 10");	
					return false;
				}
					
				ctr+=1;
				return true;
			
			}
		else
			{  
			   if(e.srcElement.name=="survey_date" || e.srcElement.name=="mothers_bday" || e.srcElement.name=="q1_date" || e.srcElement.name=="q40_date")
				{
					if((("/").indexOf(keychar) > -1))
					return true;
				}		 	
			   	return false;
			}
	}
function hosrecno(e)
	{
		var key,keychar;
		e.cancelBubble=true;
		
		key=
		document.layers ? e.which :
    		document.all ? event.keyCode :
    		document.getElementById ? e.keyCode : 0;
		keychar=String.fromCharCode(key);
		
		
		if((key==null) || (key==0) || (key==7) || (key==9) || (key==13) )
			{
			        event.cancelBubble=true;
			        return true;
			}
		else if ((ctr<=3) && (("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ").indexOf(keychar) > -1))
			{
			
				ctr+=1;
				
				return true;
			
			}
		else if ((ctr>3) && (("0123456789/").indexOf(keychar) > -1))
			{
				
				ctr+=1;
				
				return true;
			
			}
		else
			{
				
			   return false;
			}
	}

function valrecno(dt)
	{
		var dat= dt.value;
		if (dat.length == 8)
		return true;
	}

function whenformloaded()
	{
		document.form.survey_date.focus()
		disableq6a();disableq6b();disableq7a();disableq7b();
		disableq15a();disable15();disable22();disable14();
		q16disable();disableq16abc();
		disableq23();disableq29a();disableq29b();disableq30();
		disableq31();disableq32();disableq33();q34no();
		disableq36c();disableq36c();q37no();q38no();disable27b;
		q39no();c2q9no();c2q10no();disablec2q2();disablec3q2();
		c3q9no();c3q10no();hideAll();hideAll2();
	}	
function isempty(field)
		{
			if (field.value=="")
				return true;
				return false;		
		}
function isnumber(nostrfield)
	{
		var i,c;
		var s= nostrfield.value;
		
		for(i = 0 ; i < s.length; i++)
			{
				c=s.charAt(i);
				if(!isdigit(c))
					{
						return false;
					}
			}
		return true;	
	}
function isbetween(field,lowest,highest)
		{
			fldval= parseInt(field.value);
			if(fldval >= lowest && fldval <= highest)
				return true;
				return false;
		}
function isdigit(c)
	{
		return((c >="0" ) && (c <= "9"))
	}
function valdate2(dt)
	{
		
		var dat= dt.value;
		if (dat.length != 8)
		return false;
		if(dat.charAt(2) !="/" || dat.charAt(5) !="/")
		return false;
		var dd1,dd2,mm1,mm2,yy1,yy2;
		dd1=dat.charAt(0) ; dd2=dat.charAt(1);
		mm1=dat.charAt(3) ; mm2=dat.charAt(4);
		yy1=dat.charAt(6) ; yy2=dat.charAt(7);
		if(!isdigit(dd1))
			return false;
		if(!isdigit(dd2))
			return false; 
		if(!isdigit(mm1))
			return false; 
		if(!isdigit(mm2))
			return false; 
		if(!isdigit(yy1))
			return false; 
		if(!isdigit(yy2))
			return false;  
		var dd,mm,yy;
		dd=dat.charAt(0)+dat.charAt(1)
		mm=dat.charAt(3)+dat.charAt(4)
		yy=dat.charAt(6)+dat.charAt(7)
		if ((parseInt(dd) > 31) || ( parseInt(mm) > 12) )
		return false;
		switch(mm)
			{
				case "01" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "02" :
						if(parseInt(dd) > 29)
							return false;
							break;
				case "03" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "04" :
						if(parseInt(dd) > 30)
							return false;
							break;  
				case "05" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "06" :
						if(parseInt(dd) > 30)
							return false;
							break;
				case "07" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "08" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "09" :
						if(parseInt(dd) > 30)
							return false;
							break;
				case "10" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "11" :
						if(parseInt(dd) > 30)
							return false;
							break;
				case "12" :
						if(parseInt(dd) > 31)
							return false;
							break;
				
				
				default : 
			}
		return true;			
	}
	
function valdate(dt)
	{
		
		var dat= dt.value;
		if (dat.length != 8)
		return false;
		if(dat.charAt(2) !="/" || dat.charAt(5) !="/" || dat.charAt(6) !="0")
		return false;
		if(dat.charAt(7) =="0" || dat.charAt(7) =="1" || dat.charAt(7) =="2" || dat.charAt(7) =="3" || dat.charAt(7) =="4" || dat.charAt(7) =="5" || dat.charAt(7) =="6" || dat.charAt(7) =="9")
		return false;
		var dd1,dd2,mm1,mm2,yy1,yy2;
		dd1=dat.charAt(0) ; dd2=dat.charAt(1);
		mm1=dat.charAt(3) ; mm2=dat.charAt(4);
		yy1=dat.charAt(6) ; yy2=dat.charAt(7);
		if(!isdigit(dd1))
			return false;
		if(!isdigit(dd2))
			return false; 
		if(!isdigit(mm1))
			return false; 
		if(!isdigit(mm2))
			return false; 
		if(!isdigit(yy1))
			return false; 
		if(!isdigit(yy2))
			return false;  
		var dd,mm,yy;
		dd=dat.charAt(0)+dat.charAt(1)
		mm=dat.charAt(3)+dat.charAt(4)
		yy=dat.charAt(6)+dat.charAt(7)
		if ((parseInt(dd) > 31) || ( parseInt(mm) > 12) )
		return false;
		switch(mm)
			{
				case "01" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "02" :
						if(parseInt(dd) > 29)
							return false;
							break;
				case "03" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "04" :
						if(parseInt(dd) > 30)
							return false;
							break;  
				case "05" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "06" :
						if(parseInt(dd) > 30)
							return false;
							break;
				case "07" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "08" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "09" :
						if(parseInt(dd) > 30)
							return false;
							break;
				case "10" :
						if(parseInt(dd) > 31)
							return false;
							break;
				case "11" :
						if(parseInt(dd) > 30)
							return false;
							break;
				case "12" :
						if(parseInt(dd) > 31)
							return false;
							break;
				
				
				default : 
			}
		return true;			
	}
	
function valtime(dt)
	{
		
		var dat= dt.value;
		if (dat.length != 5)
		return false;
		if(dat.charAt(2) !=":")
		return false;
		var hh1,hh2,ss1,ss2;
		hh1=dat.charAt(0) ; hh2=dat.charAt(1);
		ss1=dat.charAt(3) ; ss2=dat.charAt(4);
		if(!isdigit(hh1))
			return false;
		if(!isdigit(hh2))
			return false; 
		if(!isdigit(ss1))
			return false; 
		if(!isdigit(ss2))
			return false; 
		var hh,ss;
		hh=dat.charAt(0)+dat.charAt(1)
		ss=dat.charAt(3)+dat.charAt(4)
		if ((parseInt(hh) > 23) || ( parseInt(ss) > 59) )
		return false;	
		switch(hh)
			{
				case "01" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "02" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "03" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "04" :
						if(parseInt(ss) > 59)
							return false;
							break;  
				case "05" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "06" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "07" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "08" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "09" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "10" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "11" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "12" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "13" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "14" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "15" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "16" :
						if(parseInt(ss) > 59)
							return false;
							break;  
				case "17" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "18" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "19" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "20" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "21" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "22" :
						if(parseInt(ss) > 59)
							return false;
							break;
				case "23" :
						if(parseInt(ss) > 59)
							return false;
							break;	
				
				default : 
			}
		return true;	
	}

         
function surdate()
	{
		if (document.form.survey_date.value == 0)
			{
				alert("Survey date cant be blank");
				document.form.survey_date.focus();
					
			}
		else if (!valdate(document.form.survey_date))
			{
				alert("Invalid SURVEY DATE !! Please try again..")
				document.form.survey_date.focus();
			}						
	}
function hosprecno()
	{
			
		if (document.form.patient_name.value == 0)
			{
				alert("patient name cant be blank");
				document.form.patient_name.focus();	
			}		
	}
function reconum(e)
	{
		        e.cancelBubble=true;
			if (document.form.hospital_number.value == 0)
			{
				alert("record nubmer cant be blank");
				document.form.hospital_number.focus();	
			}
		
			document.form.mothers_bday.focus();				
	}
function Adday()
	{
		if (document.form.q1_date.value == 0)
			{
				alert("Admission date cant be blank");
				document.form.q1_date.focus();	
			}
		else if (!valdate(document.q1_date))
			{
				alert("Invalid Admission Date !! Please try again..")
				document.form.q1_date.focus();
			}		
	}  
function Adtime()
	{
		if (document.form.q1_time.value == 0)
			{
				alert("Admission Time cant be blank");
				document.form.q1_time.focus();	
			}
		else if (!valtime(document.q1_time))
			{
				alert("Invalid Admission Time !! Please try again..")
				document.form.q1_time.focus();
			}		
	}
function mbday()
	{
		if (document.form.mothers_bday.value == 0)
			{
				alert("mothers birth date cant be blank");
				document.form.mothers_bday.focus();	
			}
		else if (!valdate(document.form.mothers_bday))
			{
				alert("Invalid BIRTH DATE !! Please try again..")
				document.form.mothers_bday.focus();
			}		
	}                                      
function mweight()
	{	
		if (document.form.q4_weight.value == 0)
			{
				alert("Mother's Weight cant be blank");
				document.form.q4_weight.focus();	
			}
	}
function mweeks()
	{
		if (document.form.q4_age.value == 0)
			{
				alert("Mothers Age cant be blank");
				document.form.q4_age.focus();	
			}
	}
function mheight()
	{
		if (document.form.q5_height.value == 0)
			{
				alert("Mother's Height cant be blank");
				document.form.q5_height.focus();	
			}
	}
function disableq6a()
{
	document.form.q6_antibiotics[0].disabled=true; document.form.q6_antibiotics[0].checked=false;
	document.form.q6_antibiotics[1].disabled=true; document.form.q6_antibiotics[1].checked=false;
	document.form.q6_antibiotics[2].disabled=true; document.form.q6_antibiotics[2].checked=false;
	}
function enableq6a()
{
	document.form.q6_antibiotics[0].disabled=false;
	document.form.q6_antibiotics[1].disabled=false;
	document.form.q6_antibiotics[2].disabled=false;
}
function disableq6b()
{
	document.form.q6_drugs_a.disabled=true; document.form.q6_drugs_a.checked=false;
	document.form.q6_drugs_b.disabled=true; document.form.q6_drugs_b.checked=false;
	document.form.q6_drugs_c.disabled=true; document.form.q6_drugs_c.checked=false;
	document.form.q6_drugs_d.disabled=true; document.form.q6_drugs_d.value="";
	document.form.q6_drugs_other.disabled=true; document.form.q6_drugs_other.checked=false;
}
function enableq6b()
{
	document.form.q6_drugs_a.disabled=false;
	document.form.q6_drugs_b.disabled=false;
	document.form.q6_drugs_c.disabled=false;
	document.form.q6_drugs_d.disabled=false;
	document.form.q6_drugs_other.disabled=false;
}

function q6bselect()
{
   if(document.form.q6_drugs_other.checked)
	{
	document.form.q6_drugs_d.disabled=false;
	document.form.q6_drugs_d.focus();
	}
   else
	{
	document.form.q6_drugs_d.disabled=true; document.form.q6_drugs_d.value="";
	}
}
function disableq7a()
{
	document.form.q7_ecv_offered[0].disabled=true; document.form.q7_ecv_offered[0].checked=false;
	document.form.q7_ecv_offered[1].disabled=true; document.form.q7_ecv_offered[1].checked=false;
	document.form.q7_ecv_offered[2].disabled=true; document.form.q7_ecv_offered[2].checked=false;			
}
function enableq7a()
{	
	document.form.q7_ecv_offered[0].disabled=false;
	document.form.q7_ecv_offered[1].disabled=false;
	document.form.q7_ecv_offered[2].disabled=false;
}
function disableq7b()	
{
	document.form.q7_ecv_performed[0].disabled=true; document.form.q7_ecv_performed[0].checked=false;
	document.form.q7_ecv_performed[1].disabled=true; document.form.q7_ecv_performed[1].checked=false;
	document.form.q7_ecv_performed[2].disabled=true; document.form.q7_ecv_performed[2].checked=false;	
}
function enableq7b()	
{
	document.form.q7_ecv_performed[0].disabled=false;
	document.form.q7_ecv_performed[1].disabled=false;
	document.form.q7_ecv_performed[2].disabled=false;	
}
function gotoq8()
{
		
	document.form.q7_ecv_offered[0].disabled=true; document.form.q7_ecv_offered[0].checked=false;
	document.form.q7_ecv_offered[1].disabled=true; document.form.q7_ecv_offered[1].checked=false;
	document.form.q7_ecv_offered[2].disabled=true; document.form.q7_ecv_offered[2].checked=false;
     document.form.q7_ecv_performed[0].disabled=true;  document.form.q7_ecv_performed[0].checked=false; 
     document.form.q7_ecv_performed[1].disabled=true;  document.form.q7_ecv_performed[1].checked=false;
     document.form.q7_ecv_performed[2].disabled=true;  document.form.q7_ecv_performed[2].checked=false;
     document.form.q8_shaving[0].focus();
}
function q11select()
{
	document.form.q11_specify.disabled=false;
	if(document.form.q11_other[0].checked)
		document.form.q11_specify.focus();
		
}
function q11bselect()
{
	document.form.q11_specify.disabled=false;
	if(document.form.q11_other[1].checked)
		document.form.q11_specify.focus();
		
}
function q11bdisable()
{
	document.form.q11b_specify.disabled=true; document.form.q11b_specify.value="";
}
function q11disable()
{
	document.form.q11_specify.disabled=true; document.form.q11_specify.value="";
}
function disableq15a()
{
	document.form.q15_material_use_a.disabled=true; document.form.q15_material_use_a.checked=false;
	document.form.q15_material_use_b.disabled=true; document.form.q15_material_use_b.checked=false;
	document.form.q15_material_use_c.disabled=true; document.form.q15_material_use_c.checked=false;
	document.form.q15_material_use_other.disabled=true; document.form.q15_material_use_other.checked=false;
	document.form.q15_material_use_unknown.disabled=true; document.form.q15_material_use_unknown.checked=false;
	document.form.q15_material_use_d.disabled=true; document.form.q15_material_use_d.value="";
	document.form.q15_technique_a.disabled=true;    document.form.q15_technique_a.checked=false;
	document.form.q15_technique_b.disabled=true;    document.form.q15_technique_b.checked=false;
	document.form.q15_technique_c.disabled=true;    document.form.q15_technique_c.checked=false;
}
function q15select()
{
   if(document.form.q15_material_use_other.checked)
	{
	document.form.q15_material_use_d.disabled=false;
	document.form.q15_material_use_d.focus();
	}
   else
	{
	document.form.q15_material_use_d.disabled=true; document.form.q15_material_use_d.value="";
	}
}
function enableq15a()
		{
		document.form.q15_material_use_a.disabled=false;
		document.form.q15_material_use_b.disabled=false;
		document.form.q15_material_use_c.disabled=false;
		document.form.q15_material_use_other.disabled=false; 
		document.form.q15_material_use_d.disabled=false;
		document.form.q15_material_use_unknown.disabled=false;
		document.form.q15_technique_a.disabled=false;
		document.form.q15_technique_b.disabled=false;
		document.form.q15_technique_c.disabled=false;
		}

function enableq15()
{
  		document.form.q15_sutured[0].disabled=false;
		document.form.q15_sutured[1].disabled=false;
		document.form.q15_sutured[2].disabled=false;
}
function disableq15()
{
document.form.q15_sutured[0].disabled=true; document.form.q15_sutured[0].checked=false;
document.form.q15_sutured[1].disabled=true; document.form.q15_sutured[1].checked=false;
document.form.q15_sutured[2].disabled=true; document.form.q15_sutured[2].checked=false;
}
function q14select()
{
		if(document.form.q14_trauma[4].checked)
			document.form.q14_trauma_other.focus();
}
function q14enable()
{
		document.form.q14_trauma_other.disabled=false;
		if(document.form.q14_trauma[4].checked)
			document.form.q14_trauma_other.focus();
}
function q14disable()
{
	document.form.q14_trauma_other.disabled=true;     document.form.q14_trauma_other.value="";
}
function enable11to13()
	{
		document.form.q13_episiotomy[0].disabled=false;
		document.form.q13_episiotomy[1].disabled=false;
		document.form.q13_episiotomy[2].disabled=false;
		document.form.q14_trauma[0].disabled=false;
		document.form.q14_trauma[1].disabled=false;
		document.form.q14_trauma[2].disabled=false;
		document.form.q14_trauma[3].disabled=false;
		document.form.q14_trauma[4].disabled=false;
		document.form.q14_trauma[5].disabled=false;
		document.form.q15_sutured[0].disabled=false;
		document.form.q15_sutured[1].disabled=false;
		document.form.q15_sutured[2].disabled=false;

	}
function disable11to13()
{
	document.form.q13_episiotomy[0].disabled=true; document.form.q13_episiotomy[0].checked=false;
	document.form.q13_episiotomy[1].disabled=true; document.form.q13_episiotomy[1].checked=false;
	document.form.q13_episiotomy[2].disabled=true; document.form.q13_episiotomy[2].checked=false;
	document.form.q14_trauma[0].disabled=true;     document.form.q14_trauma[0].checked=false;
	document.form.q14_trauma[1].disabled=true;     document.form.q14_trauma[1].checked=false;
	document.form.q14_trauma[2].disabled=true;     document.form.q14_trauma[2].checked=false;
	document.form.q14_trauma[3].disabled=true;     document.form.q14_trauma[3].checked=false;
	document.form.q14_trauma[4].disabled=true;     document.form.q14_trauma[4].checked=false;
	document.form.q14_trauma[5].disabled=true;     document.form.q14_trauma[5].checked=false;
	document.form.q14_trauma_other.disabled=true;     document.form.q14_trauma_other.value="";
	document.form.q15_sutured[0].disabled=true;    document.form.q15_sutured[0].checked=false;
	document.form.q15_sutured[1].disabled=true;    document.form.q15_sutured[1].checked=false;
	document.form.q15_sutured[2].disabled=true;    document.form.q15_sutured[2].checked=false;

	}    
function stayin10()
		{
			enable11to13();
			disable14();
			disableq15a();
		}
function gotoq16()
	{	
		disable11to13();
		enable14();
		disableq15a();
		document.form.q16_indication[0].focus();
	}
function disable14()
{	
	document.form.q16_indication[0].disabled=true; 		document.form.q16_indication[0].checked=false;
	document.form.q16_indication[1].disabled=true; 		document.form.q16_indication[1].checked=false;
	document.form.q16_indication[2].disabled=true; 		document.form.q16_indication[2].checked=false;
	document.form.q16_indication[3].disabled=true; 		document.form.q16_indication[3].checked=false;
	document.form.q16_indication[4].disabled=true; 		document.form.q16_indication[4].checked=false;
	document.form.q16_indication[5].disabled=true; 		document.form.q16_indication[5].checked=false;
	document.form.q16_indication[6].disabled=true; 		document.form.q16_indication[6].checked=false;
	document.form.q16_indication[7].disabled=true; 		document.form.q16_indication[7].checked=false;
	document.form.q16_indication[8].disabled=true; 		document.form.q16_indication[8].checked=false;
	document.form.q16_indication[9].disabled=true; 		document.form.q16_indication[9].checked=false;
	document.form.q16_indication[10].disabled=true; 	document.form.q16_indication[10].checked=false;
	document.form.q16_indication[11].disabled=true; 	document.form.q16_indication[11].checked=false;
    document.form.q16_indication_other.disabled=true; 	document.form.q16_indication_other.value="";
    document.form.q16_antibiotics[0].disabled=true;   	document.form.q16_antibiotics[0].checked=false;
    document.form.q16_antibiotics[1].disabled=true;   	document.form.q16_antibiotics[1].checked=false;
    document.form.q16_antibiotics[2].disabled=true;   	document.form.q16_antibiotics[2].checked=false;
	disableq16abc();
		}
function enable14()
{
			
	document.form.q16_indication[0].disabled=false;
	document.form.q16_indication[1].disabled=false;
	document.form.q16_indication[2].disabled=false;
	document.form.q16_indication[3].disabled=false;
	document.form.q16_indication[4].disabled=false;
	document.form.q16_indication[5].disabled=false;
	document.form.q16_indication[6].disabled=false;
	document.form.q16_indication[7].disabled=false;
	document.form.q16_indication[8].disabled=false;
	document.form.q16_indication[9].disabled=false;
	document.form.q16_indication[10].disabled=false;
	document.form.q16_indication[11].disabled=false;
	document.form.q16_antibiotics[0].disabled=false;
	document.form.q16_antibiotics[1].disabled=false;
	document.form.q16_antibiotics[2].disabled=false;
			
}
function enableq16abc()
		{			document.form.q16_administered[0].disabled=false;
			document.form.q16_administered[1].disabled=false;
			document.form.q16_administered[2].disabled=false;
			document.form.q16_administered[3].disabled=false;
			document.form.q16_drugs_given_a.disabled=false;
			document.form.q16_drugs_given_b.disabled=false;
			document.form.q16_drugs_given_c.disabled=false;
			document.form.q16_drugs_other.disabled=false;
			document.form.q16_drugs_given_other.disabled=false;
			document.form.q16_dosage[0].disabled=false;
			document.form.q16_dosage[1].disabled=false;
			document.form.q16_dosage[2].disabled=false;
		}
function disableq16abc()
{
			
document.form.q16_administered[0].disabled=true;     document.form.q16_administered[0].checked=false;
document.form.q16_administered[1].disabled=true;     document.form.q16_administered[1].checked=false;
document.form.q16_administered[2].disabled=true;     document.form.q16_administered[2].checked=false;
document.form.q16_administered[3].disabled=true;     document.form.q16_administered[3].checked=false;
document.form.q16_drugs_given_a.disabled=true;       document.form.q16_drugs_given_a.checked=false;
document.form.q16_drugs_given_b.disabled=true;       document.form.q16_drugs_given_b.checked=false;
document.form.q16_drugs_given_c.disabled=true;       document.form.q16_drugs_given_c.checked=false;
document.form.q16_drugs_other.disabled=true;         document.form.q16_drugs_other.checked=false;
document.form.q16_drugs_given_other.disabled=true;   document.form.q16_drugs_given_other.value="";
document.form.q16_dosage[0].disabled=true;           document.form.q16_dosage[0].checked=false;
document.form.q16_dosage[1].disabled=true;           document.form.q16_dosage[1].checked=false;
document.form.q16_dosage[2].disabled=true;           document.form.q16_dosage[2].checked=false;
		}
function q16enable()
{
		document.form.q16_indication_other.disabled=false;
		if(document.form.q16_indication[11].checked)
			document.form.q16_indication_other.focus();
}
function q16disable()
{
	document.form.q16_indication_other.disabled=true;     document.form.q16_indication_other.value="";
}
function q16select()
{
   if(document.form.q16_drugs_other.checked)
	{
	document.form.q16_drugs_given_other.disabled=false;
	document.form.q16_drugs_given_other.focus();
	}
   else
	{
	document.form.q16_drugs_given_other.disabled=true; document.form.q16_drugs_given_other.value="";
	}
}
function disable15()
{
	disable15b();
    document.form.q17_method_a.disabled=true;   document.form.q17_method_a.checked=false;
	document.form.q17_method_b.disabled=true;   document.form.q17_method_b.checked=false;
	document.form.q17_method_c.disabled=true;   document.form.q17_method_c.checked=false;
}
function enable15()
		{
			document.form.q17_method_a.disabled=false;
			document.form.q17_method_b.disabled=false;
			document.form.q17_method_c.disabled=false;
		}
function goto15()
		{
			disable15();
			document.form.q18_resuscitator[0].focus();
		}
function stayin15()
		{
			enable15();
		}
function click15b()
		{
					if (!document.form.q17_method_a.checked && !document.form.q17_method_b.checked)
					{ disable15b();
					}else  { enable15b(); }
		}
function disable15b()
	{
	document.form.q17_gas[0].disabled=true;		document.form.q17_gas[0].checked=false;
	document.form.q17_gas[1].disabled=true;		document.form.q17_gas[1].checked=false;
	document.form.q17_gas[2].disabled=true;		document.form.q17_gas[2].checked=false;
	}
function enable15b()
	{
	document.form.q17_gas[0].disabled=false;
	document.form.q17_gas[1].disabled=false;
	document.form.q17_gas[2].disabled=false;
	}

//-- q27
function click27b()
		{
					if (!document.form.q27_uterine_massage_a.checked && !document.form.q27_uterine_massage_b.checked)
					{ disable27b();
					}else  { enable27b(); }
		}
function disable27b()
	{
	document.form.q27_massage[0].disabled=true;		document.form.q27_massage[0].checked=false;
	document.form.q27_massage[1].disabled=true;		document.form.q27_massage[1].checked=false;
	document.form.q27_massage[2].disabled=true;		document.form.q27_massage[2].checked=false;
	}
function enable27b()
	{
	document.form.q27_massage[0].disabled=false;
	document.form.q27_massage[1].disabled=false;
	document.form.q27_massage[2].disabled=false;
	}
//-- q27 end
//-- second child resus
function disablec2q2()
{
	disablec2q2b();
    document.form.c2q2_method_a.disabled=true;   document.form.c2q2_method_a.checked=false;
	document.form.c2q2_method_b.disabled=true;   document.form.c2q2_method_b.checked=false;
	document.form.c2q2_method_c.disabled=true;   document.form.c2q2_method_c.checked=false;
}
function enablec2q2()
		{
			document.form.c2q2_method_a.disabled=false;
			document.form.c2q2_method_b.disabled=false;
			document.form.c2q2_method_c.disabled=false;
		}
function gotoc2q2()
		{
			disablec2q2();
			document.form.c2q3_resuscitator[0].focus();
		}
function stayinc2q2()
		{
			enablec2q2();
		}
function clickc2q2b()
		{
					if (!document.form.c2q2_method_a.checked && !document.form.c2q2_method_b.checked)
					{ disablec2q2b();
					}else  { enablec2q2b(); }
		}
function disablec2q2b()
	{
	document.form.c2q2_gas[0].disabled=true;		document.form.c2q2_gas[0].checked=false;
	document.form.c2q2_gas[1].disabled=true;		document.form.c2q2_gas[1].checked=false;
	document.form.c2q2_gas[2].disabled=true;		document.form.c2q2_gas[2].checked=false;
	}
function enablec2q2b()
	{
	document.form.c2q2_gas[0].disabled=false;
	document.form.c2q2_gas[1].disabled=false;
	document.form.c2q2_gas[2].disabled=false;
	}
//-- second child resus end
//-- third child resus
function disablec3q2()
{
	disablec3q2b();
    document.form.c3q2_method_a.disabled=true;   document.form.c3q2_method_a.checked=false;
	document.form.c3q2_method_b.disabled=true;   document.form.c3q2_method_b.checked=false;
	document.form.c3q2_method_c.disabled=true;   document.form.c3q2_method_c.checked=false;
}
function enablec3q2()
		{
			document.form.c3q2_method_a.disabled=false;
			document.form.c3q2_method_b.disabled=false;
			document.form.c3q2_method_c.disabled=false;
		}
function gotoc3q2()
		{
			disablec3q2();
			document.form.c2q3_resuscitator[0].focus();
		}
function stayinc3q2()
		{
			enablec3q2();
		}
function clickc3q2b()
		{
					if (!document.form.c3q2_method_a.checked && !document.form.c3q2_method_b.checked)
					{ disablec3q2b();
					}else  { enablec3q2b(); }
		}
function disablec3q2b()
	{
	document.form.c3q2_gas[0].disabled=true;		document.form.c3q2_gas[0].checked=false;
	document.form.c3q2_gas[1].disabled=true;		document.form.c3q2_gas[1].checked=false;
	document.form.c3q2_gas[2].disabled=true;		document.form.c3q2_gas[2].checked=false;
	}
function enablec3q2b()
	{
	document.form.c3q2_gas[0].disabled=false;
	document.form.c3q2_gas[1].disabled=false;
	document.form.c3q2_gas[2].disabled=false;
	}
//-- third child resus end
function apgar1()
		{
			if (document.form.q19_1_apgar.value == 0)
			{
				alert("One Minute APGAR Score cant be blank");
				document.form.q19_1_apgar.focus();	
			}
		  else if((!isnumber(document.form.q19_1_apgar) || !isbetween(document.form.q19_1_apgar,0,10)))
			alert("One Minute APGAR score must be a nubmer between 0 and 10");
		}
function apgar5()
		{
			if (document.form.q20_5_apgar.value == 0)
			{
				alert("Five Minute APGAR Score cant be blank");
				document.form.q20_1_apgar.focus();	
			}
		  else if((!isnumber(document.form.q20_5_apgar) || !isbetween(document.form.q20_5_apgar,0,10)))
			alert("Five Minute APGAR score must be a nubmer between 0 and 10");
		}
function bweight()
		{

			if (document.form.q21_birthweight.value == "")
			{
				alert("Birth Weight cant be blank");
				document.form.q21_birthweight.focus();	
			}
		else if (document.form.q21_birthweight.value != "uk")
			{
				if(!isnumber(document.form.q21_birthweight))
					alert("Birth weight must be a number");
			}			
		}
function bage()
		{
			if (document.form.q22_gestational_age.value == "")
			{
				alert("Gestational Age cant be blank");
				document.form.q22_gestational_age.focus();	
			}
		else if(document.form.q22_gestational_age.value !="uk")
	
			{
				if(!isnumber(document.form.q22_gestational_age)  || !isbetween(document.form.q22_gestational_age,20,45))
					alert("gestational age must be a number between 20 and 45");
			}	
				
		}
function bloss()
		{
			if (document.form.q23_blood_loss.value == "")
			{
				alert("Estimate Blood Loss cant be blank");
				document.form.q23_blood_loss.focus();	
			}
		else if(document.form.q23_blood_loss.value !="uk")
			{
				if(!isnumber(document.form.q23_blood_loss))
					alert("Blood loss must be number -- uk if not known");
			}	
				
		}
function disable22()
{
document.form.q24_prophylactic_drug[0].disabled=true;      document.form.q24_prophylactic_drug[0].checked=false;
document.form.q24_prophylactic_drug[1].disabled=true;      document.form.q24_prophylactic_drug[1].checked=false;
document.form.q24_prophylactic_drug[2].disabled=true;      document.form.q24_prophylactic_drug[2].checked=false;
document.form.q25_cord_clamping[0].disabled=true;	    document.form.q25_cord_clamping[0].checked=false;	
document.form.q25_cord_clamping[1].disabled=true;	    document.form.q25_cord_clamping[1].checked=false;
document.form.q25_cord_clamping[2].disabled=true;	    document.form.q25_cord_clamping[2].checked=false;
document.form.q26_cord_traction[0].disabled=true;	    document.form.q26_cord_traction[0].checked=false;	
document.form.q26_cord_traction[1].disabled=true;	    document.form.q26_cord_traction[1].checked=false;
document.form.q26_cord_traction[2].disabled=true;	    document.form.q26_cord_traction[2].checked=false;
disableq23();
enable14();
}
function enable22()
{
	document.form.q24_prophylactic_drug[0].disabled=false;
	document.form.q24_prophylactic_drug[1].disabled=false;
	document.form.q24_prophylactic_drug[2].disabled=false;
	document.form.q25_cord_clamping[0].disabled=false;			
	document.form.q25_cord_clamping[1].disabled=false;	
	document.form.q25_cord_clamping[2].disabled=false;	
	document.form.q26_cord_traction[0].disabled=false;	
	document.form.q26_cord_traction[1].disabled=false;		
	document.form.q26_cord_traction[2].disabled=false;
	disable14();
}
function disableq23()
{
document.form.q24_when_given[0].disabled=true;      document.form.q24_when_given[0].checked=false;
document.form.q24_when_given[1].disabled=true;      document.form.q24_when_given[1].checked=false;
document.form.q24_when_given[2].disabled=true;      document.form.q24_when_given[2].checked=false;
document.form.q24_when_given[3].disabled=true;      document.form.q24_when_given[3].checked=false;
document.form.q24_when_given_other.disabled=true;   document.form.q24_when_given_other.value="";
document.form.q24_drugs_given[0].disabled=true;	    document.form.q24_drugs_given[0].checked=false;	
document.form.q24_drugs_given[1].disabled=true;	    document.form.q24_drugs_given[1].checked=false;
document.form.q24_drugs_given[2].disabled=true;	    document.form.q24_drugs_given[2].checked=false;
document.form.q24_drugs_given[3].disabled=true;	    document.form.q24_drugs_given[3].checked=false;	
document.form.q24_drugs_given[4].disabled=true;	    document.form.q24_drugs_given[4].checked=false;
document.form.q24_drugs_given_other.disabled=true;  document.form.q24_drugs_given_other.value="";		
		}
function enableq23()
{
	document.form.q24_when_given[0].disabled=false;
	document.form.q24_when_given[1].disabled=false;
	document.form.q24_when_given[2].disabled=false;
	document.form.q24_when_given[3].disabled=false;
	document.form.q24_drugs_given[0].disabled=false;			
	document.form.q24_drugs_given[1].disabled=false;	
	document.form.q24_drugs_given[2].disabled=false;	
	document.form.q24_drugs_given[3].disabled=false;	
	document.form.q24_drugs_given[4].disabled=false;		
}
function q24aenable()
{
		document.form.q24_when_given_other.disabled=false;
		if(document.form.q24_when_given[2].checked)
			document.form.q24_when_given_other.focus();
}
function q24adisable()
{
	document.form.q24_when_given_other.disabled=true;     document.form.q24_when_given_other.value="";
}
function q24benable()
{
		document.form.q24_drugs_given_other.disabled=false;
		if(document.form.q24_drugs_given[4].checked)
			document.form.q24_drugs_given_other.focus();
}
function q24bdisable()
{
	document.form.q24_drugs_given_other.disabled=true;     document.form.q24_drugs_given_other.value="";
}
function gotoq26()
		{
			disableq23();
		}
function stayinq23()
		{
			enableq23();
		}
function disableq29a()
{
document.form.q28_oxytocic_drug[0].disabled=true; document.form.q28_oxytocic_drug[0].checked=false;
document.form.q28_oxytocic_drug[1].disabled=true; document.form.q28_oxytocic_drug[1].checked=false;
document.form.q28_oxytocic_drug[2].disabled=true; document.form.q28_oxytocic_drug[2].checked=false;
}
function enableq29a()
{
document.form.q28_oxytocic_drug[0].disabled=false;
document.form.q28_oxytocic_drug[1].disabled=false;
document.form.q28_oxytocic_drug[2].disabled=false;
		}
function disableq29b()
{
document.form.q28_drugs_given_a.disabled=true; document.form.q28_drugs_given_a.checked=false;
document.form.q28_drugs_given_b.disabled=true; document.form.q28_drugs_given_b.checked=false;
document.form.q28_drugs_given_c.disabled=true; document.form.q28_drugs_given_c.checked=false;
document.form.q28_drugs_given_d.disabled=true; document.form.q28_drugs_given_d.checked=false;
document.form.q28_drugs_given_e.disabled=true; document.form.q28_drugs_given_e.checked=false;	
}
function enableq29b()
{
	document.form.q28_drugs_given_a.disabled=false;
	document.form.q28_drugs_given_b.disabled=false;
	document.form.q28_drugs_given_c.disabled=false;
	document.form.q28_drugs_given_d.disabled=false;
	document.form.q28_drugs_given_e.disabled=false;	
}
function stayinq29()
	{
		enableq29a();
		enableq29b();
	}
function gotoq30()
	{
		disableq29a();
		disableq29b();
	}
function disableq30()
{
document.form.q30_when_observed[0].disabled=true; document.form.q30_when_observed[0].checked=false;
document.form.q30_when_observed[1].disabled=true; document.form.q30_when_observed[1].checked=false;
document.form.q30_when_observed[2].disabled=true; document.form.q30_when_observed[2].checked=false;
		}
function enableq30()
{
			document.form.q30_when_observed[0].disabled=false;
			document.form.q30_when_observed[1].disabled=false;
			document.form.q30_when_observed[2].disabled=false;
}
function stayinq30()
{
	enableq30();
}
function gotoq31()
{
						
	disableq30();
}
//-------------------------
function disableq31()
{
document.form.q31_administered[0].disabled=true; document.form.q31_administered[0].checked=false;
document.form.q31_administered[1].disabled=true; document.form.q31_administered[1].checked=false;
document.form.q31_administered[2].disabled=true; document.form.q31_administered[2].checked=false;
}
function enableq31()
		{
			document.form.q31_administered[0].disabled=false;
			document.form.q31_administered[1].disabled=false;
			document.form.q31_administered[2].disabled=false;
		}
function stayinq31()
		{
			enableq31();
		}
function gotoq32()
		{
						
			disableq31();
		}
function disableq32()
{
document.form.q32_observed[0].disabled=true;   document.form.q32_observed[0].checked=false;
document.form.q32_observed[1].disabled=true;   document.form.q32_observed[1].checked=false;
document.form.q32_observed[2].disabled=true;   document.form.q32_observed[2].checked=false;
}
function enableq32()
		{
			document.form.q32_observed[0].disabled=false;
			document.form.q32_observed[1].disabled=false;
			document.form.q32_observed[2].disabled=false;
		
		}
function stayinq32()
		{
			enableq32();
		}
function gotoq33()
		{
						
			disableq32();
	
		}
//-------------------------
function disableq33()
{
document.form.q33_administered[0].disabled=true;  document.form.q33_administered[0].checked=false;
document.form.q33_administered[1].disabled=true;  document.form.q33_administered[1].checked=false;
document.form.q33_administered[2].disabled=true;  document.form.q33_administered[2].checked=false;
}
function enableq33()
		{
			document.form.q33_administered[0].disabled=false;
			document.form.q33_administered[1].disabled=false;
			document.form.q33_administered[2].disabled=false;
		}
function stayinq33()
		{
			enableq33();
		}
function gotoq34()
		{
						
			disableq33();
		
		}
function q34yes()
		{
			document.form.q34_age.disabled=false;
			document.form.q34_age.focus();
		}
function q34no()
		{
			document.form.q34_age.value="";
			document.form.q34_age.disabled=true;
		}
function disableq36c()
{
document.form.q36_prescribed_a.disabled=true;     document.form.q36_prescribed_a.checked=false;
document.form.q36_prescribed_b.disabled=true;     document.form.q36_prescribed_b.checked=false;
document.form.q36_prescribed_c.disabled=true;     document.form.q36_prescribed_c.checked=false;
document.form.q36_prescribed_d.disabled=true;     document.form.q36_prescribed_d.checked=false;
document.form.q36_prescribed_e.disabled=true;     document.form.q36_prescribed_e.checked=false;
document.form.q36_prescribed_f.disabled=true;     document.form.q36_prescribed_f.checked=false;
document.form.q36_prescribed_g.disabled=true;     document.form.q36_prescribed_g.checked=false;
document.form.q36_prescribed_h.disabled=true;     document.form.q36_prescribed_h.checked=false;
document.form.q36_prescribed_i.disabled=true;     document.form.q36_prescribed_i.checked=false;
document.form.q36_prescribed_i2.disabled=true;     document.form.q36_prescribed_i2.checked=false;
document.form.q36_prescribed_j.disabled=true;     document.form.q36_prescribed_j.checked=false;
document.form.q36_other.disabled=true;		  document.form.q36_other.checked=false;
document.form.q36_prescribed_other.disabled=true; document.form.q36_prescribed_other.value="";
		}
function enableq36c()
		{
			document.form.q36_prescribed_a.disabled=false;
			document.form.q36_prescribed_b.disabled=false;
			document.form.q36_prescribed_c.disabled=false;
			document.form.q36_prescribed_d.disabled=false;
			document.form.q36_prescribed_e.disabled=false;
			document.form.q36_prescribed_f.disabled=false;
			document.form.q36_prescribed_g.disabled=false;
			document.form.q36_prescribed_h.disabled=false;
			document.form.q36_prescribed_i.disabled=false;
			document.form.q36_prescribed_i2.disabled=false;
			document.form.q36_prescribed_j.disabled=false;
			document.form.q36_other.disabled=false;
			document.form.q36_prescribed_other.disabled=false;
		}
function q36select()
{
   if(document.form.q36_other.checked)
	{
	document.form.q36_prescribed_other.disabled=false;
	document.form.q36_prescribed_other.focus();
	}
   else
	{
	document.form.q36_prescribed_other.disabled=true; document.form.q36_prescribed_other.value="";
	}
}
function stayinq36c()
		{
			enableq36c();
		}
function gotoq37()
		{
						
			disableq36c();
		}
function q37yes()
		{
			document.form.q37_cause.disabled=false;
			document.form.q37_cause.focus();
		}
function q37no()
		{
			document.form.q37_cause.disabled=true;
			document.form.q37_cause.value="";
		}
function q38yes()
		{
			document.form.q38_cause.disabled=false;
			document.form.q38_cause.focus();
		}
function q38no()
		{
			document.form.q38_cause.disabled=true;
			document.form.q38_cause.value="";
		}
function q39yes()
		{
			document.form.q39_cause.disabled=false;
			document.form.q39_cause.focus();
		}
function q39no()
		{
			document.form.q39_cause.disabled=true;
			document.form.q39_cause.value="";
		}


function openindex()
      { 
OpenWindow=window.open("", "newwin", "height=600, width=800,toolbar=no,scrollbars="+scroll+",menubar=no");
OpenWindow.document.write("<TITLE>Title Goes Here</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=pink>")
OpenWindow.document.write("<h1>FORM CAN'T BE SUBMITTED PLEASE RE-ENTER THE FOLLOWING !</h2>")
OpenWindow.document.write("This text will appear in the window!")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")

OpenWindow.document.close()
self.name="main"
     }



function handleform()
		{	

			var strchklst=" ***   FORM CAN'T BE SUBMITTED PLEASE RE-ENTER THE FOLLOWING   ***\n";
			strchklst+="=====================================================\n\n";
			var arrow="--->>  "
			var checklist = new Array()
			var listctr=0;
			if(isempty(document.form.survey_date))
				{
					checklist[listctr]="Q 0."+arrow+"SURVEY DATE : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!valdate(document.form.survey_date))
				{
					checklist[listctr]="Q 0."+arrow+"SURVEY DATE : "+arrow+"INVALID SURVEY DATE"
					listctr+=1;
				}
			
			if(isempty(document.form.survey_recno))
				{
					checklist[listctr]="Q 0."+arrow+"SURVEY RECORD NUMBER : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(valrecno(document.form.survey_recno))
				{
					checklist[listctr]="Q 0."+arrow+"SURVEY RECORD NUMBER : "+arrow+"INVALID SURVEY NUMBER"
					listctr+=1;
				}				
			if(isempty(document.form.hospital_number))
				{
					checklist[listctr]="Q 0."+arrow+"HOSPITAL RECORD NUMBER : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			if (!document.form.q1_date_unknown.checked)
			{
					if(isempty(document.form.q1_date))
						{
						checklist[listctr]="Q 1."+arrow+"DATE OF ADMISSION : "+arrow+"CANNOT BE BLANK"
						listctr+=1;
						}
					else if(!valdate(document.form.q1_date))
						{
						checklist[listctr]="Q 1."+arrow+"DATE OF ADMISSION : "+arrow+"INVALID DATE"
						listctr+=1;
						}
			}
			if (!document.form.q1_time_unknown.checked)
			{
					if(isempty(document.form.q1_time))
						{
						checklist[listctr]="Q 1."+arrow+"TIME OF ADMISSION : "+arrow+"CANNOT BE BLANK"
						listctr+=1;
						}
					else if(!valtime(document.form.q1_time))
						{
						checklist[listctr]="Q 1."+arrow+"TIME OF ADMISSION : "+arrow+"INVALID TIME"
						listctr+=1;
						}
			}
				
			if(isempty(document.form.mothers_bday))
				{
					checklist[listctr]="Q 2."+arrow+"MOTHERS BIRTH DATE : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!valdate2(document.form.mothers_bday))
				{
					checklist[listctr]="Q 2."+arrow+"MOTHERS BIRTH DATE : "+arrow+"INVALID MOTHERS BIRTHDATE DATE"
					listctr+=1;
				}
			if(!document.form.q3_prev_preg[0].checked && !document.form.q3_prev_preg[1].checked
				&& !document.form.q3_prev_preg[2].checked)
			{
				
				checklist[listctr]="Q 3"+arrow+"PREVIOUS PREGNANCIES"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
		if(!document.form.q4_weight_unknown.checked)
		{
			if(isempty(document.form.q4_weight))
				{
					checklist[listctr]="Q 4."+arrow+"MOTHERS WEIGHT : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q4_weight))
				{
					checklist[listctr]="Q 4."+arrow+"MOTHERS WEIGHT : "+arrow+"MUST BE A NUMBER"
					listctr+=1;
				}
			if(isempty(document.form.q4_age))
				{
					checklist[listctr]="Q 4."+arrow+"MOTHERS AGE : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(document.form.q4_age.value != "uk")
				{
				if(!isnumber(document.form.q4_age))
						{
							checklist[listctr]="Q 4."+arrow+"MOTHERS AGE : "+arrow+"MUST BE A NUMBER"
							listctr+=1;
						}
				}	
		}
		if(!document.form.q5_height_unknown.checked)
		{
			if(isempty(document.form.q5_height))
				{
					checklist[listctr]="Q 5."+arrow+"MOTHERS HEIGHT : "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q5_height))
				{
					checklist[listctr]="Q 5."+arrow+"MOTHERS HEIGHT : "+arrow+"MUST BE A NUMBER"
					listctr+=1;
				}
		}
		if(document.form.q6_pprom[0].checked)  
{
	if(document.form.q6_antibiotics[0].checked)
		{
			if(document.form.q6_drugs_other.checked)
				{
					if(document.form.q6_drugs_d.value.length==0)
						{
					checklist[listctr]="Q6(b)."+arrow+"PRETERM DRUGS GIVEN OTHER:"+arrow+"CANNOT BE BLANK"
					listctr+=1;
						}
				}
		}
		else if((!document.form.q6_antibiotics[1].checked) && (!document.form.q6_antibiotics[2].checked))
		{
					checklist[listctr]="Q6(a)."+arrow+"PRETERM ANTIBIOTICS GIVEN :"+arrow+"NOT ANSWERED"
					listctr+=1;
		}
}
else if((!document.form.q6_pprom[1].checked) && (!document.form.q6_pprom[2].checked))
{
					
					checklist[listctr]="Q  6."+arrow+"RUPTURE OF MEMBRANES: "+arrow+"NOT ANSWERED"
					listctr+=1;
					
		
}	
if(document.form.q7_breech[0].checked)  
{
	if(document.form.q7_ecv_offered[0].checked)
		{
			if(!document.form.q7_ecv_performed[0].checked && !document.form.q7_ecv_performed[1].checked && !document.form.q7_ecv_performed[2].checked)
				{
						{
					checklist[listctr]="Q7(b)."+arrow+"ECV PERFORMED:"+arrow+"NOT ANSWERED"
					listctr+=1;
						}
				}
		}
		else if((!document.form.q7_ecv_offered[1].checked) && (!document.form.q7_ecv_offered[2].checked))
		{
					checklist[listctr]="Q7(a)."+arrow+"ECV OFFERED:"+arrow+"NOT ANSWERED"
					listctr+=1;
		}
}
else if((!document.form.q7_breech[1].checked) && (!document.form.q7_breech[2].checked))
{
					
					checklist[listctr]="Q  7."+arrow+"BABY BREECH PRESENTATION : "+arrow+"NOT ANSWERED"
					listctr+=1;							
}

if(!document.form.q8_shaving[0].checked && !document.form.q8_shaving[1].checked && !document.form.q8_shaving[2].checked)
{		
					checklist[listctr]="Q  8."+arrow+"SHAVING OF PUBIC HAIR:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q9_enema_use[0].checked && !document.form.q9_enema_use[1].checked && 
					!document.form.q9_enema_use[2].checked)
{		
					checklist[listctr]="Q  9."+arrow+"ENEMA USE:"+arrow+"NOT ANSWERED"
					listctr+=1;
}

if(!document.form.q10_labour_induced[0].checked && !document.form.q10_labour_induced[1].checked && 
					!document.form.q10_labour_induced[2].checked)
{		
					checklist[listctr]="Q 10."+arrow+"LABOUR INDUCED:"+arrow+"NOT ANSWERED"
					listctr+=1;
}

if(!document.form.q11_attendant[0].checked && !document.form.q11_attendant[1].checked && 
	!document.form.q11_attendant[2].checked && !document.form.q11_attendant[3].checked)
{
					checklist[listctr]="Q11(a)."+arrow+"SUPPORT DURING LABOUR BY ATTENDENT:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_husband[0].checked && !document.form.q11_husband[1].checked && 
	!document.form.q11_husband[2].checked && !document.form.q11_husband[3].checked)
{
					checklist[listctr]="Q11(b)."+arrow+"SUPPORT DURING LABOUR BY HUSBAND:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_mother[0].checked && !document.form.q11_mother[1].checked && 
	!document.form.q11_mother[2].checked && !document.form.q11_mother[3].checked)
{
					checklist[listctr]="Q11(c)."+arrow+"SUPPORT DURING LABOUR BY MOTHER:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_sister[0].checked && !document.form.q11_sister[1].checked && 
	!document.form.q11_sister[2].checked && !document.form.q11_sister[3].checked)
{
					checklist[listctr]="Q11(d)."+arrow+"SUPPORT DURING LABOUR BY SISTER:"+arrow+"NOT ANSWERED"
					listctr+=1;
}

if(!document.form.q11_family[0].checked && !document.form.q11_family[1].checked && 
	!document.form.q11_family[2].checked && !document.form.q11_family[3].checked)
{
					checklist[listctr]="Q11(e)."+arrow+"SUPPORT DURING LABOUR BY FAMILY:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_stranger[0].checked && !document.form.q11_stranger[1].checked && 
	!document.form.q11_stranger[2].checked && !document.form.q11_stranger[3].checked)
{
					checklist[listctr]="Q11(f)."+arrow+"SUPPORT DURING LABOUR BY STRANGER:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_friend[0].checked && !document.form.q11_friend[1].checked && 
	!document.form.q11_friend[2].checked && !document.form.q11_friend[3].checked)
{
					checklist[listctr]="Q11(g)."+arrow+"SUPPORT DURING LABOUR BY FRIEND"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_doula[0].checked && !document.form.q11_doula[1].checked && 
	!document.form.q11_doula[2].checked && !document.form.q11_doula[3].checked)
{
					checklist[listctr]="Q11(h)."+arrow+"SUPPORT DURING LABOUR BY DOULA"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_educator[0].checked && !document.form.q11_educator[1].checked && 
	!document.form.q11_educator[2].checked && !document.form.q11_educator[3].checked)
{
					checklist[listctr]="Q11(i)."+arrow+"SUPPORT DURING LABOUR BY EDUCATOR"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11_other[0].checked && !document.form.q11_other[1].checked && 
	!document.form.q11_other[2].checked && !document.form.q11_other[3].checked)
{
					checklist[listctr]="Q11(j)."+arrow+"SUPPORT DURING LABOUR BY OTHER"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(document.form.q11_other[0].checked && document.form.q11_specify.value.length==0)
{
						checklist[listctr]="Q11(j)."+arrow+"SUPPORT DURING LABOUR BY OTHER - specify"+arrow+"CANNOT BE BLANK"
					listctr+=1;
}
if(document.form.q11_other[1].checked && document.form.q11_specify.value.length==0)
{
						checklist[listctr]="Q11(j)."+arrow+"SUPPORT DURING LABOUR BY OTHER - specify"+arrow+"CANNOT BE BLANK"
					listctr+=1;
}
//--second stage
if(!document.form.q11b_attendant[0].checked && !document.form.q11b_attendant[1].checked && 
	!document.form.q11b_attendant[2].checked && !document.form.q11b_attendant[3].checked)
{
					checklist[listctr]="Q11b(a)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY ATTENDENT:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_husband[0].checked && !document.form.q11b_husband[1].checked && 
	!document.form.q11b_husband[2].checked && !document.form.q11b_husband[3].checked)
{
					checklist[listctr]="Q11b(b)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY HUSBAND:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_mother[0].checked && !document.form.q11b_mother[1].checked && 
	!document.form.q11b_mother[2].checked && !document.form.q11b_mother[3].checked)
{
					checklist[listctr]="Q11b(c)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY MOTHER:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_sister[0].checked && !document.form.q11b_sister[1].checked && 
	!document.form.q11b_sister[2].checked && !document.form.q11b_sister[3].checked)
{
					checklist[listctr]="Q11b(d)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY SISTER:"+arrow+"NOT ANSWERED"
					listctr+=1;
}

if(!document.form.q11b_family[0].checked && !document.form.q11b_family[1].checked && 
	!document.form.q11b_family[2].checked && !document.form.q11b_family[3].checked)
{
					checklist[listctr]="Q11b(e)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY FAMILY:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_stranger[0].checked && !document.form.q11b_stranger[1].checked && 
	!document.form.q11b_stranger[2].checked && !document.form.q11b_stranger[3].checked)
{
					checklist[listctr]="Q11b(f)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY STRANGER:"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_friend[0].checked && !document.form.q11b_friend[1].checked && 
	!document.form.q11b_friend[2].checked && !document.form.q11b_friend[3].checked)
{
					checklist[listctr]="Q11b(g)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY FRIEND"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_doula[0].checked && !document.form.q11b_doula[1].checked && 
	!document.form.q11b_doula[2].checked && !document.form.q11b_doula[3].checked)
{
					checklist[listctr]="Q11b(h)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY DOULA"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_educator[0].checked && !document.form.q11b_educator[1].checked && 
	!document.form.q11b_educator[2].checked && !document.form.q11b_educator[3].checked)
{
					checklist[listctr]="Q11b(i)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY EDUCATOR"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q11b_other[0].checked && !document.form.q11b_other[1].checked && 
	!document.form.q11b_other[2].checked && !document.form.q11b_other[3].checked)
{
					checklist[listctr]="Q11b(j)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY OTHER"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(document.form.q11b_other[0].checked && document.form.q11b_specify.value.length==0)
{
						checklist[listctr]="Q11b(j)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY OTHER - specify"+arrow+"CANNOT BE BLANK"
					listctr+=1;
}
if(document.form.q11b_other[1].checked && document.form.q11b_specify.value.length==0)
{
						checklist[listctr]="Q11b(j)."+arrow+"SECOND STAGE SUPPORT DURING LABOUR BY OTHER - specify"+arrow+"CANNOT BE BLANK"
					listctr+=1;
}
//--second stage end
if(!document.form.q12_birth[0].checked && !document.form.q12_birth[1].checked && 
!document.form.q12_birth[2].checked && !document.form.q12_birth[3].checked && !document.form.q12_birth[4].checked)
{
					checklist[listctr]="Q 12."+arrow+"MODE OF BIRTH"+arrow+"NOT ANSWERED"
					listctr+=1;
}
if(!document.form.q13_episiotomy[0].checked && !document.form.q13_episiotomy[1].checked && !document.form.q13_episiotomy[2].checked )
		{
			checklist[listctr]="Q 13."+arrow+"EPISIOTOMY PERFORMED"+arrow+"NOT ANSWERED"
					listctr+=1;
		}
	if(!document.form.q14_trauma[0].checked && !document.form.q14_trauma[1].checked && !document.form.q14_trauma[2].checked && !document.form.q14_trauma[3].checked 
		&& !document.form.q14_trauma[4].checked && !document.form.q14_trauma[5].checked)
		{
			checklist[listctr]="Q 14."+arrow+"LEVEL OF PERINEAL TRAUMA"+arrow+"NOT ANSWERED"
					listctr+=1;
		}
	if(document.form.q14_trauma[4].checked && document.form.q14_trauma_other.value.length==0)
				{
					checklist[listctr]="Q 14."+arrow+"LEVEL OF PERINEAL TRAUMA OTHER"+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
	if(document.form.q15_sutured[0].checked)
		{
			if(!document.form.q15_material_use_a.checked && !document.form.q15_material_use_b.checked && !document.form.q15_material_use_c.checked &&
				!document.form.q15_material_use_other.checked && !document.form.q15_material_use_unknown.checked)
				{
					checklist[listctr]="Q15(a)."+arrow+"SUTURE MATERIAL USED"+arrow+"NOT ANSWERED"
					listctr+=1;
				}
			if(document.form.q15_material_use_other.checked && document.form.q15_material_use_d.value.length==0)
				{
					checklist[listctr]="Q15(a)."+arrow+"SUTURE MATERIAL USED OTHER"+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			if(!document.form.q15_technique_a.checked && !document.form.q15_technique_b.checked && !document.form.q15_technique_c.checked)

				{
					checklist[listctr]="Q15(b)."+arrow+"TECHNIQUE USED FOR SKIN CLOSER"+arrow+"NOT ANSWERED"
					listctr+=1;
				}
		}
 	else if(!document.form.q15_sutured[0].checked && !document.form.q15_sutured[1].checked && !document.form.q15_sutured[2].checked)
		{
			checklist[listctr]="Q  15"+arrow+"PERINIUM SUTURED"+arrow+"NOT ANSWERED"
					listctr+=1;
		}		
if(document.form.q12_birth[4].checked)
	{
	if(!document.form.q16_indication[0].checked &&  !document.form.q16_indication[1].checked &&
	!document.form.q16_indication[2].checked && !document.form.q16_indication[3].checked &&	
	!document.form.q16_indication[4].checked && !document.form.q16_indication[5].checked && !document.form.q16_indication[6].checked && !document.form.q16_indication[7].checked && !document.form.q16_indication[8].checked && !document.form.q16_indication[9].checked && !document.form.q16_indication[10].checked && !document.form.q16_indication[11].checked)
		{
			checklist[listctr]="Q  16"+arrow+"MAIN INDICATION FOR CEASEREAN"+arrow+"NOT ANSWERED"
			listctr+=1;
		}
	if(document.form.q16_indication[11].checked && document.form.q16_indication_other.value.length==0)
		{
			checklist[listctr]="Q  16"+arrow+"INDICATION FOR CEASEREAN OTHER"+arrow+"CANNOT BE BLANK"
			listctr+=1;
		}
	if(!document.form.q16_antibiotics[0].checked &&	!document.form.q16_antibiotics[1].checked &&	
	!document.form.q16_antibiotics[2].checked)
		{
			checklist[listctr]="Q  16"+arrow+"ANTIBIOTICS GIVEN AT CEASAREAN"+arrow+"NOT ANSWERED"
			listctr+=1;
		}

		if(document.form.q16_antibiotics[0].checked)
				{
						if(!document.form.q16_administered[0].checked && !document.form.q16_administered[1].checked &&
						!document.form.q16_administered[2].checked && !document.form.q16_administered[3].checked)
							{
								checklist[listctr]="Q  16"+arrow+"WHEN ANTIBIOTICS GIVEN AT CEASAREAN"+arrow+"NOT ANSWERED"
								listctr+=1;
							}
						if(!document.form.q16_drugs_given_a.checked && !document.form.q16_drugs_given_b.checked &&
						!document.form.q16_drugs_given_c.checked && !document.form.q16_drugs_other.checked)
							{
								checklist[listctr]="Q  16"+arrow+"DRUGS GIVEN"+arrow+"NOT ANSWERED"
								listctr+=1;
							}
						if(document.form.q16_drugs_other.checked && document.form.q16_drugs_given_other.value.length==0)
							{
								checklist[listctr]="Q  16"+arrow+"DRUGS GIVEN OTHER"+arrow+"CANNOT BE BLANK"
								listctr+=1;
							}
						if(!document.form.q16_dosage[0].checked && !document.form.q16_dosage[1].checked && !document.form.q16_dosage[2].checked)
							{
								checklist[listctr]="Q  16"+arrow+"DOSAGE OF  DRUG GIVEN"+arrow+"NOT ANSWERED"
								listctr+=1;
							}
				}								
}
if(document.form.q17_method_a.checked || document.form.q17_method_b.checked )
			{
		if(!document.form.q17_gas[0].checked && !document.form.q17_gas[1].checked &&
		!document.form.q17_gas[2].checked  )
			{
				checklist[listctr]="Q17(b)"+arrow+"BABY RESUSCITATION GAS USED"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(document.form.q17_resuscitation[0].checked)
{
		if(!document.form.q17_method_a.checked && !document.form.q17_method_b.checked &&
		!document.form.q17_method_c.checked  )
			{
				checklist[listctr]="Q17(a)"+arrow+"BABY RESUSCITATION METHOD"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(!document.form.q17_resuscitation[0].checked && !document.form.q17_resuscitation[1].checked)
	{
		
				checklist[listctr]="Q 17"+arrow+"BABY RESUSCITATION"+arrow+"NOT ANSWERED"
					listctr+=1;
	}

if(!document.form.q18_resuscitator[0].checked && !document.form.q18_resuscitator[1].checked
		 && !document.form.q18_resuscitator[2].checked)
{
			{
				checklist[listctr]="Q 18"+arrow+"SKILLED RESUSCITATOR PRESENT"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
						
			if(!document.form.q19_unknown.checked) 
		{
			if(isempty(document.form.q19_1_apgar))
				{
					checklist[listctr]="Q 19."+arrow+"ONE MINUTE APGAR SCORE: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q19_1_apgar) || !isbetween(document.form.q19_1_apgar,0,10))
				{
					checklist[listctr]="Q 19."+arrow+"ONE MINUTE APGAR SCORE : "+arrow+"MUST BE A NUMBER BETWEEN 0 - 10"
					listctr+=1;
				}
		}
			if(!document.form.q20_unknown.checked)
		{
			if(isempty(document.form.q20_5_apgar))
				{
					checklist[listctr]="Q 20."+arrow+"FIVE MINUTE APGAR SCORE: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q20_5_apgar) || !isbetween(document.form.q20_5_apgar,0,10))
				{
					checklist[listctr]="Q 20."+arrow+"FIVE MINUTE APGAR SCORE : "+arrow+"MUST BE A NUMBER BETWEEN 0 - 10"
					listctr+=1;
				}
		}
			if(!document.form.q21_unknown.checked)
		{
			if(isempty(document.form.q21_birthweight))
				{
					checklist[listctr]="Q 21."+arrow+"BIRTH WEIGHT (GRAMS): "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q21_birthweight))
				{
					checklist[listctr]="Q 21."+arrow+"BIRTH WEIGHT : "+arrow+"MUST BE A NUMBER  "
					listctr+=1;
				}
		}
                        if(!document.form.q22_unknown.checked)
		{
			if(isempty(document.form.q22_gestational_age))
				{
					checklist[listctr]="Q 22."+arrow+"GESTATIONAL AGE AT BIRTH: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q22_gestational_age)  || !isbetween(document.form.q22_gestational_age,20,45))
				{
					checklist[listctr]="Q 22."+arrow+"GESTATIONAL AGE AT BIRTH: "+arrow+"MUST BE A NUMBER "
					listctr+=1;
				}
		}
			if(!document.form.q23_unknown.checked)
		{
			if(isempty(document.form.q23_blood_loss))
				{
					checklist[listctr]="Q 23."+arrow+"ESTIMATED BLOOD LOSS: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.q23_blood_loss))
				{
					checklist[listctr]="Q 23."+arrow+"ESTIMATED BLOOD LOSS: "+arrow+"MUST BE A NUMBER "
					listctr+=1;
				}
		}
	

//SPACE FOR QUESTION 23
if(document.form.q12_birth[0].checked || document.form.q12_birth[1].checked || 
document.form.q12_birth[2].checked || document.form.q12_birth[3].checked)
{

if(!document.form.q24_prophylactic_drug[0].checked  && !document.form.q24_prophylactic_drug[1].checked  && 
	!document.form.q24_prophylactic_drug[2].checked )
	{
				checklist[listctr]="Q 24"+arrow+"PROPHYLACTIC OXYTOCIC DRUG GIVEN FOR 3rd STAGE"+arrow+"NOT ANSWERED"
					listctr+=1;	}

	
if(document.form.q24_prophylactic_drug[0].checked)
	{
		if(!document.form.q24_when_given[0].checked &&	!document.form.q24_when_given[1].checked &&
		!document.form.q24_when_given[2].checked && !document.form.q24_when_given[3].checked)
			{
				checklist[listctr]="Q24(a)"+arrow+"WHEN PROPHYLACTIC OXYTOCIC DRUG GIVEN FOR 3rd STAGE"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
		if(document.form.q24_when_given[3].checked && document.form.q24_when_given_other.value.length==0)
			{
				checklist[listctr]="Q24(a)"+arrow+"PROPHYLACTIC OXYTOCIC DRUG GIVEN OTHER FOR 3rd STAGE"+arrow+"NOT ANSWERED"
					listctr+=1;
			}	

		if(!document.form.q24_drugs_given[0].checked &&	!document.form.q24_drugs_given[1].checked && !document.form.q24_drugs_given[2].checked &&
		!document.form.q24_drugs_given[3].checked && !document.form.q24_drugs_given[4].checked)
			{
				checklist[listctr]="Q24(b)"+arrow+"TYPE OF PROPHYLACTIC OXYTOCIC DRUGS GIVEN FOR 3rd STAGE"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
		if(document.form.q24_drugs_given[4].checked && document.form.q24_drugs_given_other.value.length==0)
			{
			  	
				checklist[listctr]="Q24(b)"+arrow+"TYPE OF PROPHYLACTIC OXYTOCIC DRUG GIVEN OTHER FOR 3rd STAGE"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
	}

if(!document.form.q25_cord_clamping[0].checked && !document.form.q25_cord_clamping[1].checked
		 && !document.form.q25_cord_clamping[2].checked)
{
			{
				checklist[listctr]="Q 25"+arrow+"EARLY CORD CLAMPING AND CUTTING"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}

if(!document.form.q26_cord_traction[0].checked && !document.form.q26_cord_traction[1].checked
		 && !document.form.q26_cord_traction[2].checked)
{
			{
				checklist[listctr]="Q 26"+arrow+"CONTROLLED CORD TRACTION"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
}

}

if(document.form.q27_uterine_massage_a.checked || document.form.q27_uterine_massage_b.checked)
{
		if(!document.form.q27_massage[0].checked && !document.form.q27_massage[1].checked &&
		!document.form.q27_massage[2].checked  )
			{
				checklist[listctr]="Q27(a)"+arrow+"MASSAGE METHOD"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(!document.form.q27_uterine_massage_a.checked && !document.form.q27_uterine_massage_b.checked && !document.form.q27_uterine_massage_c.checked && !document.form.q27_uterine_massage_d.checked)
	{
		
				checklist[listctr]="Q 27"+arrow+"POSTPARTUM PROPHYLACTIC UTERINE MASSAGE"+arrow+"NOT ANSWERED"
					listctr+=1;
	}


//	SPACE FOR 26
if(!document.form.q28_haemorrhage[0].checked && !document.form.q28_haemorrhage[1].checked)
	{
			checklist[listctr]="Q 28"+arrow+"POSTPARTUM HAEMORRHAGE"+arrow+"NOT ANSWERED"
				listctr+=1;
	}

if(!document.form.q28_oxytocic_drug[0].checked && !document.form.q28_oxytocic_drug[1].checked &&
!document.form.q28_oxytocic_drug[2].checked && document.form.q28_haemorrhage[0].checked)
	{
			checklist[listctr]="Q28(a)"+arrow+"OXYTOCIC DRUGS GIVEN"+arrow+"NOT ANSWERED"
			listctr+=1;
	}
if(document.form.q28_oxytocic_drug[0].checked)
	{
		if(!document.form.q28_drugs_given_a.checked && !document.form.q28_drugs_given_b.checked &&
		!document.form.q28_drugs_given_c.checked && !document.form.q28_drugs_given_d.checked &&
		!document.form.q28_drugs_given_e.checked)
		{
			checklist[listctr]="Q28(b)"+arrow+"TYPE OF OXYTOCIC DRUGS GIVEN"+arrow+"NOT ANSWERED"
			listctr+=1;
		}
	}
if(!document.form.q29_transfusion[0].checked && !document.form.q29_transfusion[1].checked
		 && !document.form.q29_transfusion[2].checked)
{
			{
				checklist[listctr]="Q 29"+arrow+"POSTPARTUM BLOOD TRANSFUSION"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
if(document.form.q30_pre_eclampsia[0].checked )
{
	if(!document.form.q30_when_observed[0].checked && !document.form.q30_when_observed[1].checked
		&& !document.form.q30_when_observed[2].checked)
			{
				checklist[listctr]="Q 30 (a)"+arrow+"DEVELOPED PRE-ECLAMPSIA OBSERVED"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
}
else if(!document.form.q30_pre_eclampsia[0].checked && !document.form.q30_pre_eclampsia[1].checked
		&& !document.form.q30_pre_eclampsia[2].checked)
			{
				
				checklist[listctr]="Q 30"+arrow+"DEVELOPED PRE-ECLAMPSIA"+arrow+"NOT ANSWERED"
				listctr+=1;
			}

if(document.form.q31_magnesium_sulphate[0].checked )
{
	if(!document.form.q31_administered[0].checked && !document.form.q31_administered[1].checked
		&& !document.form.q31_administered[2].checked)
			{
				checklist[listctr]="Q 31 (a)"+arrow+"MAGNESIUM SULPHATE ADMINISTERED"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
}
else if(!document.form.q31_magnesium_sulphate[0].checked && !document.form.q31_magnesium_sulphate[1].checked
		&& !document.form.q31_magnesium_sulphate[2].checked)
			{
				
				checklist[listctr]="Q 31"+arrow+"MAGNESIUM SULPHATE FOR PRE-ECLAMPSIA"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
if(document.form.q32_eclamptic_fit[0].checked )
{
	if(!document.form.q32_observed[0].checked && !document.form.q32_observed[1].checked
		&& !document.form.q32_observed[2].checked)
			{
			
				checklist[listctr]="Q 32 (a)"+arrow+"ECLAMPTIC FIT WHEN OBSERVED"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
}
else if(!document.form.q32_eclamptic_fit[0].checked && !document.form.q32_eclamptic_fit[1].checked
		&& !document.form.q32_eclamptic_fit[2].checked)
			{
				
				checklist[listctr]="Q 32"+arrow+"HAD AN ECLAMPTIC FIT"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
if(document.form.q33_magnesium_sulphate[0].checked )
{
	if(!document.form.q33_administered[0].checked && !document.form.q33_administered[1].checked
		&& !document.form.q33_administered[2].checked)
			{
			
				checklist[listctr]="Q 33 (a)"+arrow+"MAGNESIUM SULPHATE ADMINISTERED FOR ECLAMPSIA"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
}
else if(!document.form.q33_magnesium_sulphate[0].checked && !document.form.q33_magnesium_sulphate[1].checked
		&& !document.form.q33_magnesium_sulphate[2].checked)
			{
				
				checklist[listctr]="Q 33"+arrow+"GIVEN MAGNESIUM SULPHATE FOR ECLAMPSIA"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
if(document.form.q34_antenatal_corticosteriods[0].checked )
{
	if(document.form.q34_age.value.length==0)
			{
			
				checklist[listctr]="Q 34 (a)"+arrow+"ANTENATAL CORTICOSTERIODS AGE"+arrow+"CANNOT BE BLANK"
				listctr+=1;
			}
}
else if(!document.form.q34_antenatal_corticosteriods[0].checked && !document.form.q34_antenatal_corticosteriods[1].checked
		&& !document.form.q34_antenatal_corticosteriods[2].checked)
			{
				
				checklist[listctr]="Q 34"+arrow+"ANTENATAL CORTICOSTERIODS"+arrow+"NOT ANSWERED"
				listctr+=1;
			}

if(!document.form.q35_immunisation[0].checked && !document.form.q35_immunisation[1].checked
		&& !document.form.q35_immunisation[2].checked)
			{
				
				checklist[listctr]="Q 35"+arrow+"IMMUNISATION OF HEPATITIS B"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
if(!document.form.q36_morbidity[0].checked && !document.form.q36_morbidity[1].checked
		&& !document.form.q36_morbidity[2].checked)
			{
				
				checklist[listctr]="Q36(a)"+arrow+"PUERPERAL MORBIDITY"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
if(document.form.q36_postpartum[0].checked)
{
if(!document.form.q36_prescribed_a.checked && !document.form.q36_prescribed_b.checked && !document.form.q36_prescribed_c.checked && 
!document.form.q36_prescribed_d.checked && !document.form.q36_prescribed_e.checked && !document.form.q36_prescribed_f.checked  && !document.form.q36_prescribed_g.checked &&
!document.form.q36_prescribed_h.checked && !document.form.q36_prescribed_i.checked && !document.form.q36_prescribed_i2.checked && !document.form.q36_prescribed_j.checked && !document.form.q36_other.checked)
			{
				checklist[listctr]="Q36 (b)"+arrow+"ANTIBIOTICS POSTPARTUM PRESCRIBED"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
	if(document.form.q36_other.checked && document.form.q36_prescribed_other.value.length==0)
			{
				checklist[listctr]="Q36 (b)"+arrow+"ANTIBIOTICS POSTPARTUM PRESCRIBED OTHER"+arrow+"CANNOT BE BLANK"
					listctr+=1;
			}
}
else if(!document.form.q36_postpartum[0].checked.checked && !document.form.q36_postpartum[1].checked && 
!document.form.q36_postpartum[2].checked)
	{
		
				checklist[listctr]="Q 36(b)"+arrow+"ANTIBIOTICS POSTPARTUM"+arrow+"NOT ANSWERED"
					listctr+=1;
	}
if(document.form.q37_maternal_death[0].checked)
	{
		if(document.form.q37_cause.value.length==0)
			{
				checklist[listctr]="Q 37"+arrow+"CAUSE OF MATERNAL DEATH BEFORE DISCHARGE"+arrow+"CANNOT BE BLANK"
					listctr+=1; 
			}
	}
else if(!document.form.q37_maternal_death[0].checked && !document.form.q37_maternal_death[1].checked)
	{
		checklist[listctr]="Q 37"+arrow+"MATERNAL DEATH BEFORE DISCHARGE"+arrow+"NOT ANSWERED"
					listctr+=1; 
	}
if(document.form.q38_stillbirth[0].checked)
	{
		if(document.form.q38_cause.value.length==0)
			{
				checklist[listctr]="Q 38"+arrow+"CAUSE OF STILL BIRTH"+arrow+"CANNOT BE BLANK"
					listctr+=1; 
			}
	}
else if(!document.form.q38_stillbirth[0].checked && !document.form.q38_stillbirth[1].checked)
	{
		checklist[listctr]="Q 38"+arrow+"STILL BIRTH"+arrow+"NOT ANSWERED"
					listctr+=1; 
	}
if(document.form.q39_death_before_discharge[0].checked)
	{
		if(document.form.q39_cause.value.length==0)
			{
				checklist[listctr]="Q 39"+arrow+"CAUSE OF BORN ALIVE DEATH BEFORE DISCHARGE"+arrow+"CANNOT BE BLANK"
					listctr+=1; 
			}
	}
else if(!document.form.q39_death_before_discharge[0].checked && !document.form.q39_death_before_discharge[1].checked)
	{
		checklist[listctr]="Q 39"+arrow+"BORN ALIVE DEATH BEFORE DISCHARGE"+arrow+"NOT ANSWERED"
					listctr+=1; 
	}
if (!document.form.q40_date_unknown.checked)
			{
					if(isempty(document.form.q40_date))
						{
						checklist[listctr]="Q 40."+arrow+"DATE OF DISCHARGE : "+arrow+"CANNOT BE BLANK"
						listctr+=1;
						}
					else if(!valdate(document.form.q40_date))
						{
						checklist[listctr]="Q 40."+arrow+"DATE OF DISCHARGE : "+arrow+"INVALID DATE"
						listctr+=1;
						}
			}
			if (!document.form.q40_time_unknown.checked)
			{
					if(isempty(document.form.q40_time))
						{
						checklist[listctr]="Q 40."+arrow+"TIME OF DISCHARGE : "+arrow+"CANNOT BE BLANK"
						listctr+=1;
						}
					else if(!valtime(document.form.q40_time))
						{
						checklist[listctr]="Q 40."+arrow+"TIME OF DISCHARGE : "+arrow+"INVALID TIME"
						listctr+=1;
						}
			}
	
//--------------c2 details

if(document.form.q41_second_child[0].checked)
{
//---start statement	
if(!document.form.c2q1_birth[0].checked && !document.form.c2q1_birth[1].checked && 
!document.form.c2q1_birth[2].checked && !document.form.c2q1_birth[3].checked && !document.form.c2q1_birth[4].checked)
{
					checklist[listctr]="Q 1b."+arrow+"SECOND CHILD MODE OF BIRTH"+arrow+"NOT ANSWERED"
					listctr+=1;
}
//-- second child resus
if(document.form.c2q2_method_a.checked || document.form.c2q2_method_b.checked )
			{
		if(!document.form.c2q2_gas[0].checked && !document.form.c2q2_gas[1].checked &&
		!document.form.c2q2_gas[2].checked  )
			{
				checklist[listctr]="Q 2b(c)"+arrow+"SECOND CHILD RESUSCITATION GAS USED"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(document.form.c2q2_resuscitation[0].checked)
{
		if(!document.form.c2q2_method_a.checked && !document.form.c2q2_method_b.checked &&
		!document.form.c2q2_method_c.checked  )
			{
				checklist[listctr]="Q 2b(a)"+arrow+"SECOND CHILD RESUSCITATION METHOD"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(!document.form.c2q2_resuscitation[0].checked && !document.form.c2q2_resuscitation[1].checked)
	{
		
				checklist[listctr]="Q 2b"+arrow+"SECOND CHILD RESUSCITATION"+arrow+"NOT ANSWERED"
					listctr+=1;
	}
//-- second child resus end
/*
if(document.form.c2q2_resuscitation[0].checked)
{
		if(!document.form.c2q2_method_a.checked && !document.form.c2q2_method_b.checked &&
		!document.form.c2q2_method_c.checked && !document.form.c2q2_method_d.checked )
			{
				checklist[listctr]="Q 2b(a)"+arrow+"SECOND CHILD BABY RESUSCITATION METHOD"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(!document.form.c2q2_resuscitation[0].checked && !document.form.c2q2_resuscitation[1].checked)
	{
		
				checklist[listctr]="Q 2b"+arrow+"SECOND CHILD BABY RESUSCITATION"+arrow+"NOT ANSWERED"
					listctr+=1;
	}
*/
if(!document.form.c2q3_resuscitator[0].checked && !document.form.c2q3_resuscitator[1].checked
		 && !document.form.c2q3_resuscitator[2].checked)
{
			{
				checklist[listctr]="Q 3b"+arrow+"SECOND CHILD SKILLED RESUSCITATOR PRESENT"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
						
			if(!document.form.c2q4_unknown.checked) 
		{
			if(isempty(document.form.c2q4_1_apgar))
				{
					checklist[listctr]="Q 4b."+arrow+"SECOND CHILD ONE MINUTE APGAR SCORE: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.c2q4_1_apgar) || !isbetween(document.form.c2q4_1_apgar,0,10))
				{
					checklist[listctr]="Q 4b."+arrow+"SECOND CHILD ONE MINUTE APGAR SCORE : "+arrow+"MUST BE A NUMBER BETWEEN 0 - 10"
					listctr+=1;
				}
		}
			if(!document.form.c2q5_unknown.checked)
		{
			if(isempty(document.form.c2q5_5_apgar))
				{
					checklist[listctr]="Q 5b."+arrow+"SECOND CHILD FIVE MINUTE APGAR SCORE: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.c2q5_5_apgar) || !isbetween(document.form.c2q5_5_apgar,0,10))
				{
					checklist[listctr]="Q 5b."+arrow+"SECOND CHILD FIVE MINUTE APGAR SCORE : "+arrow+"MUST BE A NUMBER BETWEEN 0 - 10"
					listctr+=1;
				}
		}
			if(!document.form.c2q6_unknown.checked)
		{
			if(isempty(document.form.c2q6_birthweight))
				{
					checklist[listctr]="Q 6b."+arrow+"SECOND CHILD BIRTH WEIGHT (GRAMS): "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.c2q6_birthweight))
				{
					checklist[listctr]="Q 6b."+arrow+"SECOND CHILD BIRTH WEIGHT : "+arrow+"MUST BE A NUMBER  "
					listctr+=1;
				}
		}
                        if(!document.form.c2q7_unknown.checked)
		{
			if(isempty(document.form.c2q7_gestational_age))
				{
					checklist[listctr]="Q 7b."+arrow+"SECOND CHILD GESTATIONAL AGE AT BIRTH: "+arrow+"CANNOT BE BLANK"
					listctr+=1;
				}
			else if(!isnumber(document.form.c2q7_gestational_age) || !isbetween(document.form.c2q7_gestational_age,20,45))
				{
					checklist[listctr]="Q 7b."+arrow+"SECOND CHILD GESTATIONAL AGE AT BIRTH: "+arrow+"MUST BE A NUMBER BETWEEN 20 AND 45"
					listctr+=1;
				}
		}
		if(!document.form.c2q8_immunisation[0].checked && !document.form.c2q8_immunisation[1].checked
		&& !document.form.c2q8_immunisation[2].checked)
			{
				
				checklist[listctr]="Q 8b"+arrow+"SECOND CHILD IMMUNISATION OF HEPATITIS B"+arrow+"NOT ANSWERED"
				listctr+=1;
			}
if(document.form.c2q9_stillbirth[0].checked)
	{
		if(document.form.c2q9_cause.value.length==0)
			{
				checklist[listctr]="Q 9b(a)"+arrow+"SECOND CHILD CAUSE OF STILL BIRTH"+arrow+"CANNOT BE BLANK"
					listctr+=1; 
			}
	}
	else if(!document.form.c2q9_stillbirth[0].checked && !document.form.c2q9_stillbirth[1].checked)
	{
		checklist[listctr]="Q 9b"+arrow+"SECOND CHILD STILL BIRTH"+arrow+"NOT ANSWERED"
					listctr+=1; 
	}
if(document.form.c2q10_death_before_discharge[0].checked)
	{
		if(document.form.c2q10_cause.value.length==0)
			{
				checklist[listctr]="Q 10b(a)"+arrow+"SECOND CHILD CAUSE OF BORN ALIVE DEATH BEFORE DISCHARGE"+arrow+"CANNOT BE BLANK"
					listctr+=1; 
			}
	}
else if(!document.form.c2q10_death_before_discharge[0].checked && !document.form.c2q10_death_before_discharge[1].checked)
	{
		checklist[listctr]="Q 10b"+arrow+"SECOND CHILD BORN ALIVE DEATH BEFORE DISCHARGE"+arrow+"NOT ANSWERED"
					listctr+=1; 
	}
//-------c3 start statement

				if(document.form.q42_third_child[0].checked)
				{
				//---start statement	
				if(!document.form.c3q1_birth[0].checked && !document.form.c3q1_birth[1].checked && 
				!document.form.c3q1_birth[2].checked && !document.form.c3q1_birth[3].checked && !document.form.c3q1_birth[4].checked)
				{
									checklist[listctr]="Q 1c."+arrow+"THIRD CHILD MODE OF BIRTH"+arrow+"NOT ANSWERED"
									listctr+=1;
				}
//-- second child resus
if(document.form.c3q2_method_a.checked || document.form.c3q2_method_b.checked )
			{
		if(!document.form.c3q2_gas[0].checked && !document.form.c3q2_gas[1].checked &&
		!document.form.c3q2_gas[2].checked  )
			{
				checklist[listctr]="Q 2c(c)"+arrow+"THIRD CHILD RESUSCITATION GAS USED"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(document.form.c3q2_resuscitation[0].checked)
{
		if(!document.form.c3q2_method_a.checked && !document.form.c3q2_method_b.checked &&
		!document.form.c3q2_method_c.checked  )
			{
				checklist[listctr]="Q 2c(a)"+arrow+"THIRD CHILD RESUSCITATION METHOD"+arrow+"NOT ANSWERED"
					listctr+=1;
			}
}
else if(!document.form.c3q2_resuscitation[0].checked && !document.form.c3q2_resuscitation[1].checked)
	{
		
				checklist[listctr]="Q 2c"+arrow+"THIRD CHILD RESUSCITATION"+arrow+"NOT ANSWERED"
					listctr+=1;
	}
//-- second child resus end
/*
				if(document.form.c3q2_resuscitation[0].checked)
				{
						if(!document.form.c3q2_method_a.checked && !document.form.c3q2_method_b.checked &&
						!document.form.c3q2_method_c.checked && !document.form.c3q2_method_d.checked )
							{
								checklist[listctr]="Q 2c(a)"+arrow+"THIRD CHILD BABY RESUSCITATION METHOD"+arrow+"NOT ANSWERED"
									listctr+=1;
							}
				}
				else if(!document.form.c3q2_resuscitation[0].checked && !document.form.c3q2_resuscitation[1].checked)
					{
						
								checklist[listctr]="Q 2c"+arrow+"THIRD CHILD BABY RESUSCITATION"+arrow+"NOT ANSWERED"
									listctr+=1;
					}
*/				
				if(!document.form.c3q3_resuscitator[0].checked && !document.form.c3q3_resuscitator[1].checked
						 && !document.form.c3q3_resuscitator[2].checked)
				{
							{
								checklist[listctr]="Q 3c"+arrow+"THIRD CHILD SKILLED RESUSCITATOR PRESENT"+arrow+"NOT ANSWERED"
									listctr+=1;
							}
				}
										
							if(!document.form.c3q4_unknown.checked) 
						{
							if(isempty(document.form.c3q4_1_apgar))
								{
									checklist[listctr]="Q 4c."+arrow+"THIRD CHILD ONE MINUTE APGAR SCORE: "+arrow+"CANNOT BE BLANK"
									listctr+=1;
								}
							else if(!isnumber(document.form.c3q4_1_apgar) || !isbetween(document.form.c3q4_1_apgar,0,10))
								{
									checklist[listctr]="Q 4c."+arrow+"THIRD CHILD ONE MINUTE APGAR SCORE : "+arrow+"MUST BE A NUMBER BETWEEN 0 - 10"
									listctr+=1;
								}
						}
							if(!document.form.c3q5_unknown.checked)
						{
							if(isempty(document.form.c3q5_5_apgar))
								{
									checklist[listctr]="Q 5c."+arrow+"THIRD CHILD FIVE MINUTE APGAR SCORE: "+arrow+"CANNOT BE BLANK"
									listctr+=1;
								}
							else if(!isnumber(document.form.c3q5_5_apgar) || !isbetween(document.form.c3q5_5_apgar,0,10))
								{
									checklist[listctr]="Q 5c."+arrow+"THIRD CHILD FIVE MINUTE APGAR SCORE : "+arrow+"MUST BE A NUMBER BETWEEN 0 - 10"
									listctr+=1;
								}
						}
							if(!document.form.c3q6_unknown.checked)
						{
							if(isempty(document.form.c3q6_birthweight))
								{
									checklist[listctr]="Q 6c."+arrow+"THIRD CHILD BIRTH WEIGHT (GRAMS): "+arrow+"CANNOT BE BLANK"
									listctr+=1;
								}
							else if(!isnumber(document.form.c3q6_birthweight))
								{
									checklist[listctr]="Q 6c."+arrow+"THIRD CHILD BIRTH WEIGHT : "+arrow+"MUST BE A NUMBER  "
									listctr+=1;
								}
						}
										if(!document.form.c3q7_unknown.checked)
						{
							if(isempty(document.form.c3q7_gestational_age))
								{
									checklist[listctr]="Q 7c."+arrow+"THIRD CHILD GESTATIONAL AGE AT BIRTH: "+arrow+"CANNOT BE BLANK"
									listctr+=1;
								}
							else if(!isnumber(document.form.c2q7_gestational_age) || !isbetween(document.form.c2q7_gestational_age,20,45))
								{
									checklist[listctr]="Q 7c."+arrow+"THIRD CHILD GESTATIONAL AGE AT BIRTH: "+arrow+"MUST BE A NUMBER BETWEEN 20 AND 45"
									listctr+=1;
								}
						}
						if(!document.form.c3q8_immunisation[0].checked && !document.form.c3q8_immunisation[1].checked
						&& !document.form.c3q8_immunisation[2].checked)
							{
								
								checklist[listctr]="Q 8c"+arrow+"THIRD CHILD IMMUNISATION OF HEPATITIS B"+arrow+"NOT ANSWERED"
								listctr+=1;
							}
				if(document.form.c3q9_stillbirth[0].checked)
					{
						if(document.form.c3q9_cause.value.length==0)
							{
								checklist[listctr]="Q 9c(a)"+arrow+"THIRD CHILD CAUSE OF STILL BIRTH"+arrow+"CANNOT BE BLANK"
									listctr+=1; 
							}
					}
					else if(!document.form.c3q9_stillbirth[0].checked && !document.form.c3q9_stillbirth[1].checked)
					{
						checklist[listctr]="Q 9c"+arrow+"THIRD CHILD STILL BIRTH"+arrow+"NOT ANSWERED"
									listctr+=1; 
					}
				if(document.form.c3q10_death_before_discharge[0].checked)
					{
						if(document.form.c3q10_cause.value.length==0)
							{
								checklist[listctr]="Q 10c(a)"+arrow+"THIRD CHILD CAUSE OF BORN ALIVE DEATH BEFORE DISCHARGE"+arrow+"CANNOT BE BLANK"
									listctr+=1; 
							}
					}
				else if(!document.form.c3q10_death_before_discharge[0].checked && !document.form.c3q10_death_before_discharge[1].checked)
					{
						checklist[listctr]="Q 10c"+arrow+"THIRD CHILD BORN ALIVE DEATH BEFORE DISCHARGE"+arrow+"NOT ANSWERED"
									listctr+=1; 
					}
				
				
				//----- all statement
				}
				else if(!document.form.q42_third_child[0].checked && !document.form.q42_third_child[1].checked)
					{
						
								checklist[listctr]="Q 42"+arrow+"THIRD CHILD INFORMATION REQUIRED"+arrow+"NOT ANSWERED"
									listctr+=1;
					}
				
				
				
				//-------c3 end statement


//-----all statement
}
else if(!document.form.q41_second_child[0].checked && !document.form.q41_second_child[1].checked)
	{
		
				checklist[listctr]="Q 41"+arrow+"MULTIPLE CHILD INFORMATION REQUIRED"+arrow+"NOT ANSWERED"
					listctr+=1;
	}

//--------------c2 end

		if(checklist.length==0)
				{
					return true;
				}
OpenWindow=window.open("", "newwin", "height=600, width=800,toolbar=no,scrollbars=yes,menubar=no");
self.resizeTo(screen.width,screen.height); //THIS LINE RESIZES THE WINDOW BASED ON CURRENT SCREEN DIMS
//self.moveTo(0,0); 
OpenWindow.document.write("<HTML>")                         
OpenWindow.document.write("<HEAD>")
OpenWindow.document.write("<TITLE>SEAORCHID ERROR REPORT</TITLE>")
OpenWindow.document.write("<link href='orchidmain2.css' rel='stylesheet' type='text/css'>")
OpenWindow.document.write("</HEAD>")
OpenWindow.document.write("<BODY>")
OpenWindow.document.write("<span class='title'>Sorry! Form Cannot Be Submitted</span><br>")
OpenWindow.document.write("<span class='title2'>Please Re-enter The Following</span><br>")
OpenWindow.document.write("<input name='name' type='button' value='Go Back' onClick='window.close()'>")
OpenWindow.document.write("<hr size='1' noshade>"); 
	for(count=0; count<checklist.length; count++)
		{
			//strchklst+=checklist[count]+"\n";
			OpenWindow.document.write(checklist[count]+"<hr size='1' noshade>")
			//OpenWindow.document.write("<input name='name' type='button' class='small' value='Go To Question' onclick='window.close()'>")
			//OpenWindow.document.write("\n")
		}
			//alert(strchklst);
OpenWindow.document.write("</BODY >")
OpenWindow.document.write("</HTML>")
OpenWindow.document.close()
self.name="main"  				
return false;
}
