// JavaScript Document
function tot_count()
{
	var sum_bll	= document.getElementById('tot_net_amt').value
	var sum_res	= document.getElementById('tot_tax_amt').value
	var sum_dis	= document.getElementById('tot_cor_amt').value
	var tot_sm_pen	= document.getElementById('tot_rnd_amt').value
	var tot_sm_adv	= document.getElementById('tot_bil_amt').value
	
	document.getElementById('stot_bl').value = sum_bll;
	document.getElementById('stot_rec').value = sum_res;
	document.getElementById('stot_dis').value = sum_dis;
	document.getElementById('stot_pe').value = tot_sm_pen;
	document.getElementById('stot_adv').value = tot_sm_adv;
}

function fom_validate()
{
	var em_name = '';
	/*if(document.getElementById('flag_js').value!='0')
	{
		var em_name = document.getElementById('em_name').value;
	}*/

	var flag = 0;
	var letters=/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
	if(document.getElementById('fdate').value!='')
	{		
		if(letters.test(document.getElementById('fdate').value)==false)  
		{
			alert('From Date must be in the given Format');  
			document.getElementById('fdate').focus();  
			return false;  
		}
		else
		{
			flag = 1;
		}
	}
	
	if(document.getElementById('fdate').value!='' && document.getElementById('todate').value=='')
	{
		alert('please Enter the To Date');  
		document.getElementById('todate').focus();  
		return false; 
	}
	var letters=/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
	if(document.getElementById('todate').value!='')
	{		
		if(letters.test(document.getElementById('todate').value)==false)  
		{
			alert('To Date must be in the given Format');  
			document.getElementById('todate').focus();  
			return false;  
		}
		else
		{
			flag = 1;
		}
	}
	
	if(flag==0)
	{		
		alert('Please Enter Any One of the Date');  
		document.getElementById('todate').focus();  
		return false;  
	}
	
	var where_to= confirm("Do you really want to Submit the Data?");
	if (where_to== true)
	{
		
		var sta_name = document.getElementById('sta_name').value;
		var fdate = document.getElementById('fdate').value;
		var todate = document.getElementById('todate').value;
		
		if(document.getElementById('yea_r').checked == true){ var yea_r = document.getElementById('yea_r').value; }else{ var yea_r=''; }
		
		if(document.getElementById('mont_h').checked == true){ var mont_h = document.getElementById('mont_h').value; }else{ var mont_h=''; }
		
		if(document.getElementById('da_y').checked == true){ var da_y = document.getElementById('da_y').value; }else{ var da_y = ''; }
		
		
		if(document.getElementById('flag_js').value!='0')
		{
			window.location = 'acc_analize.php?sta_name='+ sta_name + '&em_name=' +em_name+ '&fdate='+ fdate+'&todate='+todate+'&yea_r='+yea_r+'&mont_h='+mont_h+'&da_y='+da_y;			
		}
		else
		{
			window.location = 'acc_analize.php?sta_name='+ sta_name + '&fdate='+ fdate+'&todate='+todate+'&yea_r='+yea_r+'&mont_h='+mont_h+'&da_y='+da_y;	
		}
	}
	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 = 'acc_analize.php';
	}
	else
	{
	 	return false;	
	}
}


function reload_page() //this is for reloadin the page when selecting the comapny code
{
	var sta_name = document.getElementById('sta_name').value;
	//var fin_dt = encodeURIComponent(document.getElementById('fin_dt').value);
	
	window.location = 'acc_analize.php?sta_name='+ sta_name;
}
function fm_submit(ids) //this is for reloadin the page when selecting the comapny code
{
	var sta_name = document.getElementById('part_ids'+ids).value;
	
	document.getElementById('par_id').value = sta_name;
	
	document.acc_dat.submit();	
}
function foc(ids)
{
	document.getElementById(ids).style.border="2px solid #0099FF";
	
}

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


