// JavaScript Document
/*************************************validation********************************/
function company_validation()
{
    var company_name = document.getElementById("company_name").value;
	if(company_name=='')
	{
		document.getElementById("company_name_validation_div").innerHTML="* This field is Required.";
		document.getElementById("company_name").focus();
		return false;
	}
	var address1 = document.getElementById("address1").value;
	if(address1=='')
	{
		document.getElementById("address1_validation_div").innerHTML="* This field is Required.";
		document.getElementById("address1").focus();
		return false;
	}
	
	var cinno = document.getElementById("cinno").value;
	if(cinno=='')
	{
		document.getElementById("cinno_validation_div").innerHTML="* This field is Required.";
		document.getElementById("cinno").focus();
		return false;
	}
	
}

function company_clear_validation(str)
{
	if(str!='')
	{
		document.getElementById("company_name_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("address1_validation_div").innerHTML="";
	}
	if(str!='')
	{
		document.getElementById("cinno_validation_div").innerHTML="";
	}
}

/**************************MAin ADD******************************************/
function company_creation_add(company_name,address1,address2,address3,cinno,cstno,tinno,edit_id,action)
{
if((company_name!='')&&(address1!='')&&(cinno!=''))
 {
  jQuery.ajax({
		type: "POST",
		url: "company_entry_db.php",
		data: "company_name="+company_name+"&address1="+address1+"&address2="+address2+"&address3="+address3+"&cinno="+cinno+"&cstno="+cstno+"&tinno="+tinno+"&edit_id="+edit_id+"&action="+action,
		success: function(msg){jQuery("#company_entry_div").html(msg);	
		alert(msg);
		window.close();
		window.opener.location.reload(true);
		
 }
		});
 }
else
{
    company_validation();
}
}

/***********************************delete************************************/
function company_delete_row(id)
{
	if(confirm('Are You Sure! You Want To Delete?'))
	{
		jQuery.ajax({
		type: "POST",
		url: "master_entry/company_name_creation/company_entry_db.php",
		data: "id="+id+"&action=delete_customer",
		success: function(msg){jQuery("#company_entry_div").html(msg);
	}
	});
    }
}


