				var action 					=	$('#main_action').val();
				var types 					=	$('#main_type').val(); 
				if((action=="edit" || action=="view")&& types=="employee_type"){
					load_employee_type();
				}
//SAVING EMPLOYEE TYPE
function save_employee_type(){
				var mods 					=	$('#main_page').val();
				var types 					=	$('#main_type').val(); 
				var action 					=	$('#main_action').val();
				var mainid					=	$('#main_id').val();
				var myform 					=	$('#employee_type_form');

				myform.find('select:disabled').removeAttr('disabled');
				myform.find(':input:disabled').removeAttr('disabled');
				var employee_type_details	=	$('#employee_type_form').serialize(); 
				var dataString		=	employee_type_details+"&action="+encodeURIComponent(action)+"&mainid="+encodeURIComponent(mainid);
						$.post('./ajax/employee_type.php', dataString, function(msg){
								var obj	= $.parseJSON(msg);
								if(obj.output==true){
									bootbox.alert("Successfully Saved ..."); 
									window.setTimeout(function() { window.location.href = 'index.php?pg='+mods+'&type='+types; }, 1000);
								}else{
									bootbox.alert("Failed in saving.");
								}
						});
}

  
function delete_employee_type(id){
		var transaction		=	"reference";
		var mods 			=	$('#main_page').val();
		var types 			=	$('#main_type').val(); 
		var dataString		=	"mainid="+encodeURIComponent(id)+"&transaction="+encodeURIComponent(transaction)+"&types="+encodeURIComponent(types);
						$.post('./ajax/delete_transaction.php', dataString, function(msg){
								var obj	= $.parseJSON(msg);
								if(obj.output==true){
									bootbox.alert("Successfully Deleted ..."); 
									window.setTimeout(function() { window.location.href = 'index.php?pg='+mods+'&type='+types; }, 1000);
								}else{
									bootbox.alert("Failed in Deleting ..."); 
									window.setTimeout(function() { window.location.href = 'index.php?pg='+mods+'&type='+types; }, 1000);
								}	
						});
} 


//LOADING EMPLOYEE TYPE  
function load_employee_type(){
				var mods 			=	$('#main_page').val();
				var types 			=	$('#main_type').val(); 
				var action 			=	$('#main_action').val();
				var mainid			=	$('#main_id').val(); 
				var dataString		=	"action="+encodeURIComponent(action)+"&mainid="+encodeURIComponent(mainid); 
						$.post('./ajax/load_employee_type.php', dataString, function(msg){ 
								var obj	= $.parseJSON(msg);
								var employee_type	=	obj.data[0].employee_type;  
								$('#employee_type').val(employee_type);  
								
								if(action=="view"){
									$('input').attr("disabled", true);
									$('textarea').attr("disabled", true);
									$('select').attr("disabled", true); 
									$('.glyphicon-trash').hide();
									$('.glyphicon-plus').hide();  
								}
								 
						});						
}