// JavaScript Document
/*function reload_page() //this is for reloadin the page when selecting the comapny code
{
	var po_no = document.getElementById('po_no').value;	
	window.location = 'po_multi_finishing_add.php?po_id='+ po_no ;
}
function hide_show_div()
{
	if(document.getElementById("fin_type_0").checked==true)
	{
		document.getElementById("pac_id").style.display='block';
		document.getElementById("cut_id").style.display='block';
		document.getElementById("dt_id").style.display='block';
		document.getElementById("def_fin").style.display='none';
		document.getElementById("stoc_fin").style.display='none';
		document.getElementById("mul_fin").style.display='block';
	}
	else if(document.getElementById("fin_type_1").checked==true)
	{
		document.getElementById("pac_id").style.display='none';
		document.getElementById("cut_id").style.display='none';
		document.getElementById("dt_id").style.display='none';
		document.getElementById("def_fin").style.display='none';
		document.getElementById("stoc_fin").style.display='block';
		document.getElementById("mul_fin").style.display='none';
	}
}*/
function checkTheBox()
{
	/*if(document.getElementById('co_cod').value=='')
	{
		alert('Please Select the Company Code');  
		window.scrollTo(10,10);
		document.getElementById('co_cod').focus();  
		return false; 
	}*/
	
	/*if(document.getElementById('fin_type_0').checked==false && document.getElementById('fin_type_1').checked==false)
	{
		alert('Please Choose any One Finish Type');
		return false; 
	}*/
	if(document.getElementById('pagg_id').value==1)
	{
		if(document.getElementById('pack_name').value=='')
		{
			alert('Please Select the Packer Name');  
			document.getElementById('pack_name').focus();
			window.scroll(0,100);  
			return false; 
		}
		var letters=/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
		if(document.getElementById('cut_dt').value=='')
		{
			alert('Please Enter Packing Date');  
			document.getElementById('cut_dt').focus();  
			return false; 
		}
		else if(letters.test(document.getElementById('cut_dt').value)==false)  
		{
			alert('Packing Date must be in the given Format');  
			document.getElementById('cut_dt').focus();  
			return false;  
		}
		if(document.getElementById('cut_name').value=='')
		{
			alert('Please Select the Cutter Name');  
			document.getElementById('cut_name').focus(); 
			window.scroll(0,100); 
			return false; 
		}
		var letters=/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
		if(document.getElementById('fin_dt').value=='')
		{
			alert('Please Enter Cutting Date');  
			document.getElementById('fin_dt').focus();  
			return false; 
		}
		else if(letters.test(document.getElementById('fin_dt').value)==false)  
		{
			alert('Cutting Date must be in the given Format');  
			document.getElementById('fin_dt').focus();  
			return false;  
		}		
	}
		
	var chk = document.getElementsByName("category[]");
	var len = chk.length;
	//alert(len);
	var flag = 0;
	if(len==1)
	{
		if(document.check_list["category[]"].checked)
		{
			flag++;			
		}
		else
		{
			flag=0;
		}
	}
	else
	{
	for (var i = 0; i < len; i++)
	{
		if(document.check_list["category[]"][i].checked)
		{
			flag ++;			
		}
	}
	}
	
	if (flag <1)
	{
		alert ("Please Select the items");
		return false;
	}
	else
	{
		var item1="";
		if(flag==1)
		{
			item1="Item";
		}
		else
		{
			item1="Items";
		}
		var where_to= confirm("You Have Selected "+ flag +" "+item1+"\n Do you really want to Submit the selected items?");
		if (where_to== true)
		{
			document.check_list.submit();
		}
		else
		{
			return false;		
		}
	}	
	/*}
	else
	{
		var chk = document.getElementsByName("category_stoc[]");
		var len = chk.length;
		//alert(len);
		var flag = 0;
		if(len==1)
		{
			if(document.check_list["category_stoc[]"].checked)
			{
				flag++;			
			}
			else
			{
				flag=0;
			}
		}
		else
		{
		for (var i = 0; i < len; i++)
		{
			if(document.check_list["category_stoc[]"][i].checked)
			{
				flag ++;			
			}
		}
		}
		
		if (flag <1)
		{
			alert ("Please Select the items");
			return false;
		}
		else
		{		
			var item1="";
			if(flag==1)
			{
				item1="Item";
			}
			else
			{
				item1="Items";
			}
			var where_to= confirm("You Have Selected "+ flag +" "+item1+"\n Do you really want to Submit the selected items?");
			if (where_to== true)
			{
				document.check_list.submit();
			}
			else
			{
				return false;		
			}
		}
	}*/
}

/*function reload_page() //this is for reloadin the page when selecting the comapny code
{
	var po_no = document.getElementById('po_no').value;	
	window.location = 'po_multi_finishing_add.php?po_id='+ po_no ;
}*/

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";
}