// JavaScript Document
function tot_count()
{
	var stg = document.getElementById('mas_stg_id').value;
	var tot_cnt	= document.getElementById('tot_cnt').value;
	document.getElementById('tot_qty').value = tot_cnt;
	var explo = stg.split(",");
	if(explo[0] == 3)
	{
		var tot_pnts	= document.getElementById('tot_pn_cnt').value;
		document.getElementById('tot_pnts').value = tot_pnts;
		
		var tot_tims	= document.getElementById('tot_tm_cnt').value;
		document.getElementById('tot_tims').value = tot_tims;
	}
	else if(explo[0] == 10)
	{
		var tot_wgts	= document.getElementById('tot_wgt_cnt').value;
		document.getElementById('tot_wgts').value = tot_wgts;
	}
	if(explo[1]!=0)
	{
		var mas_die	= document.getElementById('mas_die').value;
		document.getElementById('tot_die').value = mas_die;
	}
}


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 = ''; }
		
		window.location = 'design_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
	{
		return false;	
	}
}
function foms_validate()
{
	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 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 = ''; }
		
		window.location = 'courier_list.php?fdate='+ fdate+'&todate='+todate+'&yea_r='+yea_r+'&mont_h='+mont_h+'&da_y='+da_y;
	}
	else
	{
		return false;	
	}
}

function fom_validate1()
{
	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 = ''; }
		
		window.location = 'design_analize_view.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
	{
		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 = 'design_analize.php';
	}
	else
	{
	 	return false;	
	}
}
function forms_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 = 'courier_list.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 = 'design_analize.php?sta_name='+ sta_name;
}
function foc(ids)
{
	document.getElementById(ids).style.border="2px solid #0099FF";
	
}

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


