// JavaScript Document
function form_submit()
{
	var lbl_titl = document.getElementById("lbl_titl").value;
	if(lbl_titl=='finished')
	{
		if(document.getElementById("radio1").checked==false && document.getElementById("radio3").checked==false)
		{
			alert("Please Choose the any one type");
			return false;		
		}
	}
	else if(lbl_titl!='finished')
	{
		if(document.getElementById("radio1").checked==false && document.getElementById("radio2").checked==false && document.getElementById("radio3").checked==false)
		{
			alert("Please Choose the any one type");
			return false;		
		}
	}
	if(document.getElementById("radio1").checked==true)
	{
		if(document.getElementById("re_radio1").checked==false && document.getElementById("re_radio2").checked==false)
		{
			alert("Please Choose the Rework Employee Type");
			return false;		
		}
		
		if(document.getElementById("re_radio2").checked==true)
		{
			if(document.getElementById("rework_reason").value=='')
			{
				alert("Please Select the Rework Reason");
				document.getElementById("rework_reason").focus();
				return false;
			}
			
			if(document.getElementById("hdes_name").value=='')
			{
				alert("Please Select the CAD Designer Name");
				document.getElementById("hdes_name").focus();
				return false;
			}
			var letters=/^\d+(?:\.\d+)?$/;
			if(document.getElementById('rework_pnts').value=='')
			{
				alert('Please Enter the Rework Points');    
				document.getElementById('rework_pnts').focus();
				return false;
			}		
			if(document.getElementById('rework_pnts').value!='')
			{
				if(letters.test(document.getElementById('rework_pnts').value)==false)  
				{
					alert('Rework Points Should have only Digits');  
					document.getElementById('rework_pnts').focus();
					return false;  
				}
				else
				{
					if(parseFloat(document.getElementById('rework_pnts').value)>parseFloat(document.getElementById('cad_pnts').value))
					{
						alert("Rework Points must be less than Cad Points");
						document.getElementById('rework_pnts').focus();
						return false;
					}
				}
			}
		}
	}
	var where_to= confirm("Do you really want to Submit the selected items?");
	if (where_to== true)
	{
		document.cur_des.submit();			 	
	}
	else
	{
		return false;	  
	}	
}

function rework_hid(ids)
{
	if(ids==1)
	{
		$("#rewk_div").show();
	}
	else
	{
		$("#rewk_div").hide();
		$("#other_emp").hide();
	}
}

function other_emp_hid(ids)
{
	if(ids==2)
	{
		$("#other_emp").show();
	}
	else
	{
		$("#other_emp").hide();
	}
}

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

function stnon(ids)
{
	//alert(ids+"_div");
	document.getElementById(ids+"_div").style.border="thin solid #EEFFFF";
}
