function calculate()
	{
	C20=0;
	C21=0;
	C17=0;
	C18=0;
	C5	=	document.getElementById('product_cost').value;
	C6	=	document.getElementById('products_distributed').value;
	C7	=	document.getElementById('product_lifespan').value;
	C9	=	document.getElementById('days_used').value;
	C10	=	document.getElementById('product_exposure').value;
	C11	=	document.getElementById('percentage_recipients').value;
	C12	=	document.getElementById('percentage_others').value;
	C14	=	document.getElementById('average_sales').value;
	C15	=	document.getElementById('profit_margin').value;
	
	if(C5=="")	{ C5=0.0; }
	if(C6=="")  { C6=0.0; }
	if(C7=="")  { C7=0.0; }
	if(C9=="")	{ C9=0.0; }	
	if(C10=="")	{ C10=0.0; }
	if(C11=="")	{ C11=0.0; }
	if(C12=="")	{ C12=0.0; }
	if(C14=="")	{ C14=0.0; }
	if(C15=="")	{ C15=0.0;}
 	C5	=	parseFloat(C5);
	C6	=	parseFloat(C6);
	C7	=	parseFloat(C7);
	C9	=	parseFloat(C9);
	C10	=	parseFloat(C10);
	C11	=	parseFloat(C11);
	C12	=	parseFloat(C12);
	C14	=	parseFloat(C14);
	C15	=	parseFloat(C15);
	C20=C6+(C6*C10)*(C7*C9);//Total number of people exposed to your product or brand.
	if(C20!=0)
	C21=C5/C20;
	//C17=(C6*(C11/100)*C14)+((C6*C10)*(C7*C9)*(C12/100)*C14);
    C17=((C6*(C11/100)*C14)+((C6*C10)*(C7*C9)*(C12/100)*C14))*C15/100;
	if(C5!=0)
	C18=((C17-C5)/C5)*100;
	C18=Math.round(C18*100)/100;
	document.getElementById('td1').innerHTML='$'+" "+C17;
	document.getElementById('td2').innerHTML=C18+" "+'%' ;
	document.getElementById('td3').innerHTML=C20;
	
	C21= C21.toFixed(4);
	document.getElementById('td4').innerHTML='$'+" "+C21;

}
  var count = 0;
  function check(this1)
    {
		 str    = this1.value;
         newstr = "";

           for(var i=0;i<= str.length; i++)
            {
              if(!isNaN(str.charAt(i)) || (str.charAt(i)=="."))
               {
                  newstr += str.charAt(i);
				}
			   this1.value = newstr;
            }
	  }
function checkdate()
	{
		day=document.getElementById('days_used').value;
		if(day!="")
		{
			if(!(day>=0 && day<=7)){
		alert("Number of days per week that the recipient will use or view the product must be between 0 and 7 ");
			document.getElementById('days_used').value="";
			document.getElementById('days_used').focus();
			return false;
			}
		}

	}
