// JavaScript Document
function checkTheBox()
{
	var letters=/^\d+(?:\.\d+)?$/;
	if(document.getElementById('dust_wgt').value=='')
	{
		alert('Please Enter Recovery Weight');  
		document.getElementById('dust_wgt').focus();  
		return false; 
	}
	else if(letters.test(document.getElementById('dust_wgt').value)==false)  
	{
		alert('Recovery Weight Should have only Decimal');  
		document.getElementById('dust_wgt').focus();  
		return false;  
	}
			
	var where_to= confirm("Do you really want to Submit the Data?");
	 if (where_to== true)
	 {
		 document.checklist.submit();	   
	 }
	 else
	 {
		 return false;	  
	 }
}


function form_rest() //this is for reset the forms
{
	var where_to= confirm("Do you really want to Reset the Data?");
	if (where_to== true)
	{
		window.location.reload();
	}
	else
	{
	 	return false;	
	}
}

function foc(ids)
{
	document.getElementById(ids).style.border="2px solid #0099FF";	
}

function stnon(ids)
{
	document.getElementById(ids).style.border="thin solid #CCCCCC";
}

function reload_page() //this is for reloadin the page when selecting the comapny code
{	
	if(document.getElementById('hdes_name').value!='' && document.getElementById('sol_date').value!='')
	{		
		var des_id = document.getElementById('hdes_name').value;
		var sol_dt = encodeURIComponent(document.getElementById('sol_date').value);
		window.location = 'dust_tally_add.php?des_name='+des_id+'&sol_dt='+sol_dt;
	}	
}

function wastge_cal(ids)
{
	if(ids.trim()!='')
	{
		var v1 = document.getElementById('tot_wgt').value;
		if(v1!='')
		{
			var tot_wght = parseFloat(v1);
		}
		else
		{
			var tot_wght = 0;
		}
		var reslt = parseFloat(tot_wght)-parseFloat(ids);
		document.getElementById('fin_wgt').value = reslt.toFixed(2);
		document.getElementById('tot_wes').value = reslt.toFixed(2);
		var lod_wght = document.getElementById('tot_lod').value;
		var perc = parseFloat(reslt)/parseFloat(lod_wght)*100;
		document.getElementById('wes_per').value = perc.toFixed(2);
	}
	else
	{
		document.getElementById('wes_per').value = "0.00";
		document.getElementById('fin_wgt').value = "0.00";
		document.getElementById('tot_wes').value = "0.00";
	}
}
