// CONFIRMS THE USERS DELETE
function confirmDelete(){
var agree=confirm("Are you sure you wish to delete this record?");
if (agree)
	return true ;
else
	return false ;
}

// CONFIRMS THE USERS DELETE
function confirmCopy(){
var agree=confirm("Are you sure you wish to copy ALL Performing Estimates for this CWC?");
if (agree)
	return true ;
else
	return false ;
}

// Uncheck/Check all checkboxes
function checkUncheckAll(theElement) {
     var theForm = theElement.form, z = 0;
	 for(z=0; z<theForm.length;z++){
      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall'){
	  theForm[z].checked = theElement.checked;
	  }
     }
    }

//Check All -CWC
//function checkAll(field)
//{
//for (i = 0; i < field.length; i++)
//	field[i].checked = true ;
//}


function checkAll(checkname, exby) 
{
  for (i = 0; i < checkname.length; i++)
  checkname[i].checked = exby.checked? true:false
}

		
// Calulates Performing Totals (average)
function recalc1(){

			total=parseFloat(document.form1.number1.value);
			nov=parseFloat(document.form1.nov.value);
			dec=parseFloat(document.form1.dec.value);
			jan=parseFloat(document.form1.jan.value);
			feb=parseFloat(document.form1.feb.value);
			mar=parseFloat(document.form1.mar.value);
			apr=parseFloat(document.form1.apr.value);
			may=parseFloat(document.form1.may.value);
			jun=parseFloat(document.form1.jun.value);
			jul=parseFloat(document.form1.jul.value);
			aug=parseFloat(document.form1.aug.value);
			sep=parseFloat(document.form1.sep.value);

			if (isNaN(oct)){ oct=parseFloat(0);}
			if (isNaN(nov)){ nov=parseFloat(0);}
			if (isNaN(dec)){ dec=parseFloat(0);}
			if (isNaN(jan)){ jan=parseFloat(0);}
			if (isNaN(feb)){ feb=parseFloat(0);}
			if (isNaN(mar)){ mar=parseFloat(0);}
			if (isNaN(apr)){ apr=parseFloat(0);}
			if (isNaN(may)){ may=parseFloat(0);}
			if (isNaN(jun)){ jun=parseFloat(0);}
			if (isNaN(jul)){ jul=parseFloat(0);}
			if (isNaN(aug)){ aug=parseFloat(0);}
			if (isNaN(sep)){ sep=parseFloat(0);}
			
			var result = (oct+nov+dec+jan+feb+mar+apr+may+jun+jul+aug+sep)/12;
			document.form1.tot.value = result.toFixed(1);		
		}
		
// Calulates Performing Totals (sum)
function recalc2(){

			number1=parseFloat(document.form1.number1.value);
			number2=parseFloat(document.form1.number2.value);
			
			if (isNaN(number1)){ number1=parseFloat(0);}
			if (isNaN(number2)){ number2=parseFloat(0);}
			
			var result = (number1+number2);
			document.form1.total.value = result.toFixed(1);		
		}
		
/*function calcTotal(){

			number2=parseFloat(document.registration.number2.value);
			sub1=parseFloat(document.registration.sub1.value);
			sub2=parseFloat(document.registration.sub2.value);
			
			
			if (isNaN(sub1)){ sub1=parseFloat(0);}
			if (isNaN(sub2)){ sub2=parseFloat(0);}
			if (isNaN(number2)){ number2=parseFloat(0);}
			
			var result = sub1+(sub2*number2);
			document.registration.total.value = result.toFixed(2);		
		}	*/	

function balanceDue(){
			amount_due=parseFloat(document.camp_clinic_view.amount_due.value);
			payment=parseFloat(document.camp_clinic_view.payment.value);
			balance_due=parseFloat(document.camp_clinic_view.balance_due.value);

			if (isNaN(amount_due)){ amount_due=parseFloat(0);}
			if (isNaN(payment)){ payment=parseFloat(0);}
			if (isNaN(balance_due)){ balance_due=parseFloat(0);}
			
			var result = amount_due - payment;
			
			document.camp_clinic_view.balance_due.value = result;	
		}	

function validateMyCFSelect(message) {
if (document.myform.event_description.value != "")
{
   return true;
}
else
{
  alert(message);
   return false;
}
}

