function fill_reg () {
	
document.getElementById('number_reg').value = document.getElementById('num_reg').value;  

var  numElem =  document.getElementById('number_reg').value ;
var sString ,i
sString = '';

numElem++ ;
			sString = sString + "&nbsp;<br><br>&nbsp;<table border='2' cellspacing='1' cellpadding='0' width='100%' >"
for (i = 1; i < numElem ; i++) 
		{
			sString = sString + "<tr><td colspan='4' align='left'><img src='images/PI_" + i +".jpg'  /><br />&nbsp;</td>"  
			sString = sString + "<tr><td align='left'>First Name</td>"
			sString = sString + "<td align='left'><input  type='text' name='fname_" + i +"' value='' size=25 maxlength=50 onblur='checkfields(this.form.fname_" + i +")' class='fbox'></td>"
			sString = sString + "<td align='left'>Last Name</td>"
			sString = sString + "<td align='left'><input  type='text' name='lname_" + i +"' value='' size=25 maxlength=50 onblur='checkfields(this.form.lname_" + i +")' class='fbox'></td>"
			sString = sString + "</tr><tr>"
			sString = sString +	"<td align='left'>Phone	</td> "					
			sString = sString +	"<td align='left'><input  type='text' name='phone_" + i +"' value='' size=25 maxlength=50 onblur='checkfields(this.form.phone_" + i +")' class='fbox'></td>"					
			sString = sString +	"<td align='left'>Email</td>"					
			sString = sString +	"<td align='left'><input  type='text' name='email_" + i +"' value='' size=25 maxlength=50 onblur='checkfields(this.form.email_" + i +")' class='fbox'></td>"							
			sString = sString +	"</tr><tr>"					
			sString = sString +	"<td  align='left' valign='top'>Emergency contact number</td>"				
			sString = sString +	"<td colspan='3' align='left'><input type='text' name='emphone_" + i +"' value='' size='25' maxlength='50' onblur='checkfields(this.form.emphone_" + i +")' class='fbox'/></td>"
			sString = sString +	"</tr><tr>"					
			sString = sString +	"<td  align='left' valign='top'>Date of Birth</td>"						
			sString = sString + "<td colspan='3' align='left'><input name='dob_day_" + i +"'  type='text' id='dob_day_" + i +"' onblur='checkfields(this.form.dob_" + i +")' value='' size=4 maxlength=2 class='fbox_d'>(dd)"
			sString = sString + "<input name='dob_month_" + i +"'  type='text' id='dob_month_" + i +"' onblur='checkfields(this.form.dob_" + i +")' value='' size='4' maxlength='2'  class='fbox_d'/>(mm)"
			sString = sString + "<input name='dob_year_" + i +"'  type='text' id='dob_year_" + i +"' onblur='checkfields(this.form.dob_" + i +")' value='' size='8' maxlength='4'  class='fbox_d'/>(yyyy)</td>"
			sString = sString + "</tr><tr>"
			sString = sString + "<td colspan='4' align='left'><br /><img src='images/FRI_" + i +".jpg' /><br />&nbsp;</td>" 
			sString = sString + "</tr><tr>"
			sString = sString + "<td  align='left' valign='top'>Distance (Please select):</td>"
			sString = sString + "<td colspan='3' align='left'>"
			sString = sString + "<input type='radio' name='distance_" + i +"'  value='1k'/>1k &nbsp;" 
			sString = sString + "<input type='radio' name='distance_" + i +"'  value='5k'  checked='checked'/>5k &nbsp; " 
			sString = sString + "<input type='radio' name='distance_" + i +"' value='10k' />10k</td>"
			sString = sString + "</tr><tr>"
			sString = sString + "<td colspan='4'  align='left' valign='top'><br /><br /><strong>CHARITY</strong> you would like to run for (Please tick)</td>"
			sString = sString + "</tr><tr>"
			sString = sString + "<td colspan='4'  align='left' valign='top'>"
			sString = sString + "<table width='100%' style='font-size:80%;'><tbody>"
			sString = sString + "<tr><td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Camp Simcha' type='checkbox'>Camp Simcha</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Chai Cancer Care' type='checkbox'>Chai Cancer Care</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Chana' type='checkbox'>Chana</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='CST' type='checkbox'>CST</td>"
			sString = sString + "</tr><tr>"
 			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Emunah' type='checkbox'>Emunah</td>"
                        sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Ezer Mizion' type='checkbox'>Ezer Mizion</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Gift' type='checkbox'> Gift</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='The GM Trust' type='checkbox'>The GM Trust</td>"
				
			sString = sString + "</tr><tr>"
                        sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Hadassah' type='checkbox'>Hadassah UK</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='JAMI' type='checkbox' />JAMI</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='JBCS' type='checkbox'>JBCS</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Jewish Blind &amp; Disabled' type='checkbox'> Jewish Blind &amp; Disabled</td>"
			
			sString = sString + "</tr><tr>"
                        sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Jewish Deaf Association' type='checkbox'>Jewish Deaf Association</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='JCD' type='checkbox'>JCD</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Jewish Care' type='checkbox'>Jewish Care</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Kisharon' type='checkbox'>Kisharon</td>"	
			sString = sString + "</tr><tr>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Maccabi GB' type='checkbox'>Maccabi GB</td>"
                        sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Magen David Adom' type='checkbox'>Magen David Adom</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='No Surrender' type='checkbox'>No Surrender</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Norwood' type='checkbox'>Norwood</td>"
			sString = sString + "</tr><tr>"
                        sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Oasis of Peace' type='checkbox'>Oasis of Peace</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='UJIA' type='checkbox'>UJIA</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='WIZO.uk' type='checkbox'>WIZO.uk</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Youth Aliyah' type='checkbox'>Youth Aliyah</td>"
			sString = sString + "</tr><tr>"
                        sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Zaka' type='checkbox'>Zaka</td>"

                       sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='Zichron Menachem' type='checkbox'>Zichron Menachem</td>"

			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input name='charity_" + i +"[]' value='No charity' type='checkbox'>No charity</td>"
			sString = sString + "</tr></table></td> "	
			sString = sString + "</tr><tr>"
			sString = sString + "<td colspan='4'  align='left' valign='top'><br /><br /><strong>T-SHIRT SIZE</strong> (Please tick)<br /></td>"	
			sString = sString + "</tr><tr>"
			sString = sString + "<td colspan='4'  align='left' valign='top'>"
			sString = sString + "<table width='100%'><tr>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input type='radio' name='tshirt_" + i +"' value='Youth Medium'  />Youth Medium</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input type='radio' name='tshirt_" + i +"' value='Youth Large'  />Youth Large</td>"
			sString = sString + "</tr><tr>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input type='radio' name='tshirt_" + i +"' value='Adult Small'  />Adult Small</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input type='radio' name='tshirt_" + i +"' value='Adult Medium'  />Adult Medium</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input type='radio' name='tshirt_" + i +"' value='Adult Large'  />Adult Large</td>"
			sString = sString + "<td width='25%' align='left' nowrap='nowrap'><input type='radio' name='tshirt_" + i +"' value='Adult XL'  /> Adult XL</td>"
			sString = sString + "</tr></table><br><br>&nbsp;"
			sString = sString + "</td></tr>"


}
	
sString = sString + "</table><br><br>&nbsp;"
document.getElementById('show_reg').innerHTML = sString ;
	
	
}