	
						
			function yards_tot(j, top)
			{
			    var hole;
			    var yards;
			    var total = 0;
			    var tot9;
			    var tot18;
						
				tot9 = document.forms.course_add["9out"].value;		
				tot18 = document.forms.course_add["18out"].value;
						    
			    for(i=j; i<=top; i++){
			       hole = "yards" + i;
			       yards = document.forms.course_add[hole].value;
			       total = (total*1)+(yards*1);
			          if(i==9){
			          tot9 = document.forms.course_add["9out"].value = total;
			          }
			          if(j>9){
			          tot18 = document.forms.course_add["18out"].value = total;
			          }
			          
			          document.forms.course_add["yardstot"].value = (1*tot9)+(1*tot18);
			          
			       
			      
			    }
			  
						
			}
			
			function par_tot(j, top)
			{
			    var hole;
			    var par;
			    var total = 0;
			    var tot9;
			    var tot18;
						
				tot9 = document.forms.course_add["9par"].value;		
				tot18 = document.forms.course_add["18par"].value;
						    
			    for(i=j; i<=top; i++){
			       hole = "par" + i;
			       par = document.forms.course_add[hole].value;
			       total = (total*1)+(par*1);
			          if(i==9){
			          tot9 = document.forms.course_add["9par"].value = total;
			          }
			          if(i>9){
			          tot18 = document.forms.course_add["18par"].value = total;
			          }
			          
			          document.forms.course_add["partot"].value = (1*tot9)+(1*tot18);
			          
			       
			      
			    }
			  
						
			}
			function putts_tot(j, top)
			{
			    var hole;
			    var putts;
			    var total = 0;
			    var tot9;
			    var tot18;
						
				tot9 = document.forms.score_add["putts_front"].value;		
				tot18 = document.forms.score_add["putts_back"].value;
						    
			    for(i=j; i<=top; i++){
			       hole = "putts" + i;
			       putts = document.forms.score_add[hole].value;
			       total = (total*1)+(putts*1);
			          if(i==9){
			          tot9 = document.forms.score_add["putts_front"].value = total;
			          }
			          if(i>9){
			          tot18 = document.forms.score_add["putts_back"].value = total;
			          }
			          
			          document.forms.score_add["puttstot"].value = (1*tot9)+(1*tot18);
			          
			       
			      
			    }
			  
						
			}
			
			
			
			function tot_Checked(j, top, field)
			{
				var fld, tot, tot9, tot18, what;
					tot = 0;
					
					
				tot9 = 	document.forms.score_add[field+"_front"].value;
				tot18 = document.forms.score_add[field+"_back"].value;
						    
			    for(i=j; i<=top; i++){
			       fld = field + i;
			       
			       if(document.forms.score_add[fld].checked == true)
			         {
			          tot = (tot * 1) + 1;
			         }
			      
			          if(i<=9){
			          tot9 = tot;
			          document.forms.score_add[field+"_front"].value = tot9;
			          }
			          if(i>9){
			          tot18 = tot;
			          document.forms.score_add[field+"_back"].value = tot18;
			          }
			          what = field+"tot";
			         //alert(tot+"?"+tot9+"?"+tot18);
			          document.forms.score_add[what].value = (1*tot9)+(1*tot18);
			          
			       
			      
			    }
			  
						
			}
			
			
			function hole_tot(j, top)
			{
			    var hole;
			    var hole;
			    var total = 0;
			    var tot9;
			    var tot18;
						
				tot9 = document.forms.score_add["9hole"].value;		
				tot18 = document.forms.score_add["18hole"].value;
						    
			    for(i=j; i<=top; i++){
			       hole = "hole" + i;
			       hole = document.forms.score_add[hole].value;
			       total = (total*1)+(hole*1);
			          if(i==9){
			          tot9 = document.forms.score_add["9hole"].value = total;
			          }
			          if(i>9){
			          tot18 = document.forms.score_add["18hole"].value = total;
			          }
			          
			          document.forms.score_add["holetot"].value = (1*tot9)+(1*tot18);
			          
			       
			      
			    }
			  
						
			}
			
			
			
			
			function check_hcp(i)
			{
			   var val = "hcp" + i;
			   var hcp = document.forms.course_add[val].value;
			   var cur_hcp;
			   
			   for(j=1; j<=18; j++)
			   {
					if(j!=i)
					{
			    
						val = "hcp" + j;
						cur_hcp = document.forms.course_add[val].value;
						//alert(val+"?"+cur_hcp+"?"+hcp);
						 if(hcp==cur_hcp && hcp!="")
						 {
						   val = "hcp" + i;
						   alert("Hole # "+j+" already has a "+hcp+" handicap!");
						   document.forms.course_add[val].value="";
						   
						 }
					}
			     
			   }
			
			
			}