/********************************** Validation *******************************************************/
function fabric_type_validation()
{
    var fabric_type = document.getElementById("fabric_type").value;
	if(fabric_type=='')
	{
		document.getElementById("fabric_type_validation_div").innerHTML="* This field is Required.";
		document.getElementById("fabric_type").focus();
		return false;
	}
	
	 var contract_rate = document.getElementById("contract_rate").value;
	if(contract_rate=='')
	{
		document.getElementById("contract_rate_div").innerHTML="* This field is Required.";
		document.getElementById("contract_rate").focus();
		return false;
	}
	
	
	
}

function fabric_type_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("fabric_type_validation_div").innerHTML="";
	}
	
	if(str!='')
	{
		document.getElementById("contract_rate_div").innerHTML="";
	}
	
	
	
	
}

/********************************** Mainlist Add *******************************************************/
function fabric_type_entry_add(fabric_type,contract_rate,description,edit_id,action)
{
if((fabric_type!='')&&(contract_rate!=''))
 {
  jQuery.ajax({
		type: "POST",
		url: "fabric_type_creation_db.php",
		data: "fabric_type="+fabric_type+"&contract_rate="+contract_rate+"&description="+description+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#fabric_type_list_div").html(msg);	
		alert(msg);
		window.close();
		window.opener.location.reload(true);
 }
		});
 }
else
{
    fabric_type_validation();
}
}

/********************************** Mainlist Delete *******************************************************/
function fabric_type_delete(id)
{
	
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "fabric_type_creation/fabric_type_creation_db.php",
		data: "id="+id+"&action=delete",
		success: function(msg){jQuery("#fabric_type_list_div").html(msg);
	    window.opener.location.reload(true);

	}
	});
    }
}


