/********************************** Validation *******************************************************/
function store_validation()
{
    var store_name = document.getElementById("store_name").value;
	if(store_name=='')
	{
		document.getElementById("store_name_validation_div").innerHTML="* This field is Required.";
		document.getElementById("store_name").focus();
		return false;
	}
	
	var branch_id = document.getElementById("branch_id").value;
	if(branch_id=='')
	{
		document.getElementById("branch_name_validation_div").innerHTML="* This field is Required.";
		document.getElementById("branch_id").focus();
		return false;
	}
}

function store_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("store_name_validation_div").innerHTML="";
	}
	
	if(str!='')
	{
		document.getElementById("branch_name_validation_div").innerHTML="";
	}
	
	
}

/********************************** Mainlist Add *******************************************************/
function store_entry_add(store_name,branch_id,description,edit_id,action)
{
if((store_name!='')&&(branch_id!=''))
 {
  jQuery.ajax({
		type: "POST",
		url: "store_creation_db.php",
		data: "store_name="+store_name+"&branch_id="+branch_id+"&description="+description+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#store_list_div").html(msg);	
		alert(msg);
		window.close();
		window.opener.location.reload(true);
 }
		});
 }
else
{
    store_validation();
}
}

/********************************** Mainlist Delete *******************************************************/
function store_delete_row(id)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "master_entry/store_creation/store_creation_db.php",
		data: "id="+id+"&action=delete_store",
		success: function(msg){jQuery("#store_list_div").html(msg);
	}
	});
    }
}


