/********************************** Validation *******************************************************/
function measurement_validation()
{
    var measurement_name = document.getElementById("measurement_name").value;
	if(measurement_name=='')
	{
		document.getElementById("measurement_name_validation_div").innerHTML="* This field is Required.";
		document.getElementById("measurement_name").focus();
		return false;
	}
}

function measurement_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("measurement_name_validation_div").innerHTML="";
	}
}

/********************************** Mainlist Add *******************************************************/
function measurement_mainlist_add(measurement_name,measurement_remarks,edit_id,action)
{

if((measurement_name!=''))
 {
  jQuery.ajax({
		type: "POST",
		url: "measurement_entry_db.php",
		data: "measurement_name="+measurement_name+"&measurement_remarks="+measurement_remarks+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#measurement_list_div").html(msg);	
		alert(msg);
		window.close();
		window.opener.location.reload(true);
		
 }
		});
 }
else
{
    measurement_validation();
}
}

/********************************** Mainlist Delete *******************************************************/
function measurement_delete_row(id)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "measurement_creation/measurement_entry_db.php",
		data: "id="+id+"&action=delete_measurement",
		success: function(msg){jQuery("#measurement_list_div").html(msg);
	}
	});
    }
}


