
	function adCalc(form){
	var ok = 0;
	var numloc = form.numloc.value;
	var vend_amt = 0;
	var endless = 0; //unformatted daily value 
	var prod_cost = 0; 
	var commission = 0; 
	var vends_per_day = form.vends_per_day.value;
	var daily = 0;
	var monthly = 0;
	var yearly = 0;

	for (i=0; i< form.vend_amt.length; i++) {
 		if (form.vend_amt[i].checked==true){
    		vend_amt=form.vend_amt[i].value;
  			break;
		}
	}


	for (i=0; i< form.prod_cost.length; i++) {
 		if (form.prod_cost[i].checked==true){
    		prod_cost=form.prod_cost[i].value;
  			break;
		}
	}


 	for (i = 0; i < form.commission.length; i++) {
		if (form.commission[i].selected) {
			commission = form.commission[i].value;
        	break;
		} 
 	}

	//Use this to test if the variables are being set.  
	//Uncomment the daily/monthly/yearly assignments belows
	//form.daily.value= vend_amt;
	//form.monthly.value = prod_cost;
	//form.yearly.value = commission;

	
	// You can use any of these variables to calculate the formula:
	//  vend_amt   prod_cost    commission  vends_per_day

	if (numloc < 1 || numloc > 1000)
		{
		alert("Please enter a number under 1000.");	
 		}
	else
	{	
 		if (vends_per_day < 1 || vends_per_day > 1000)
		{
		alert("Please enter a number under 1000");
		}
		else
		{
		endless = ((vend_amt - prod_cost-(vend_amt * commission)) * vends_per_day/100 * numloc);
		}
	}
	
		
	form.daily.value = Math.round (endless * 100)/100; 
	form.monthly.value = Math.round(form.daily.value * 30*100)/100 ;
	form.yearly.value = Math.round(form.daily.value * 365*100)/100 ;

}
