// JavaScript Document

/*************************************validation********************************/
function branch_validation()
{
    var branch_name = document.getElementById("branch_name").value;
	if(branch_name=='')
	{
		document.getElementById("branch_validation_div").innerHTML="* This field is Required.";
		document.getElementById("branch_name").focus();
		return false;
	}
}

function branch_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("branch_validation_div").innerHTML="";
	}
}
/*************************************Main list add********************************/

function branch_mainlist_add(branch_no,branch_name,branch_address,edit_id,action)
{ 	
if((branch_name!=''))
 {
        jQuery.ajax({
		type: "POST",
		url: "branch_entry_db.php",
		data: "branch_no="+branch_no+"&branch_name="+branch_name+"&branch_address="+branch_address+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#branch_list_div").html(msg);	
		alert(msg);
		window.close();
		window.opener.location.reload(true);
		
 }
		});
 }
else
{
    branch_validation();
}
}

/******************************* Branch Sublist**********************************************/
function brach_place_list(branch_no,branch_name,branch_address,booking_place,action)
{ 
if((branch_name!=''))
 {
        jQuery.ajax({
		type: "POST",
		url: "branch_entry_db.php",
		data: "branch_no="+branch_no+"&branch_name="+branch_name+"&branch_address="+branch_address+"&booking_place="+booking_place+"&action="+action,
		success: function(msg){jQuery("#branch_place_list_div").html(msg);	
		//alert(msg);
		//window.close();
		//window.opener.location.reload(true);
		
 }
		});
 }
else
{
    //branch_validation();
}
}

/***********************************delete************************************/
function branch_delete_row(id,branch_no)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "master_entry/branch_creation/branch_entry_db.php",
		data: "id="+id+"&branch_no="+branch_no+"&action=delete_branch",
		success: function(msg){jQuery("#branch_list_div").html(msg);
	}
	});
    }
}

/***********************************Delete Branch Sublist************************************/
function del_branch_sub(id,branch_no)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "branch_entry_db.php",
		data: "id="+id+"&branch_no="+branch_no+"&action=delete_branch_sub",
		success: function(msg){jQuery("#branch_place_list_div").html(msg);
	}
	});
    }
}


