				var action 					=	$('#main_action').val();
				var types 					=	$('#main_type').val(); 
				if((action=="edit" || action=="view")&& types=="construction_and_utilities"){
					load_construction_and_utilities();
				}
//SAVING CONSTRUCTION AND UTILITIES
function save_construction_and_utilities(){
				var mods 					=	$('#main_page').val();
				var types 					=	$('#main_type').val(); 
				var action 					=	$('#main_action').val();
				var mainid					=	$('#main_id').val(); 
				var myform 					=	$('#construction_and_utilities_form');

				myform.find('select:disabled').removeAttr('disabled');
				myform.find(':input:disabled').removeAttr('disabled');
				var construction_details	=	$('#construction_and_utilities_form').serialize(); 
				  
var roadval = $('#road').is(':checked'); 
var sidewalkval = $('#side_walk').is(':checked'); 
var meralcoval = $('#meralco').is(':checked'); 
var waterval = $('#water').is(':checked'); 
var houseconstructionval = $('#house_construction').is(':checked'); 
   
	var road 				= (roadval==true) ? "yes" : "no"; 
	var side_walk 			= (sidewalkval==true) ? "yes" : "no"; 
  	var meralco 			= (meralcoval==true) ? "yes" : "no"; 
  	var water 				= (waterval==true) ? "yes" : "no"; 
  	var house_construction 	= (houseconstructionval==true) ? "yes" : "no"; 

var house_construction_percentage = $('#house_construction_percentage').val();
var block 	=	$('#block').val();
var lot 	=	$('#lot').val();

				var dataString		= "action="+encodeURIComponent(action)+"&mainid="+encodeURIComponent(mainid)+"&house_construction="+encodeURIComponent(house_construction)+"&road="+encodeURIComponent(road)+"&side_walk="+encodeURIComponent(side_walk)+"&meralco="+encodeURIComponent(meralco)+"&water="+encodeURIComponent(water)+"&house_construction_percentage="+encodeURIComponent(house_construction_percentage)+"&block="+encodeURIComponent(block)+"&lot="+encodeURIComponent(lot);
						$.post('./ajax/construction_and_utilities.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_construction_and_utilities(id){
		var transaction		=	"construction_and_utilities";
		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 CONSTRUCTION AND UTILITIES  
function load_construction_and_utilities(){
				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_construction_and_utilities.php', dataString, function(msg){ 
								var obj	= $.parseJSON(msg);
								var block							=	obj.data[0].block;
								var lot								=	obj.data[0].lot;   
 
								var road							=	obj.data[0].road;   
								var side_walk	 					=	obj.data[0].side_walk_gutter;   
								var meralco							=	obj.data[0].meralco;   
								var water							=	obj.data[0].water;   
								var house_construction		 		=	obj.data[0].house_construction;   
								var house_construction_percentage 	=	obj.data[0].house_construction_percentage;   

								$('#block').val(block);  
								$('#lot').val(lot);  

								$('#road').val(road);  
								$('#side_walk').val(side_walk);  
								$('#meralco').val(meralco);  
								$('#water').val(water);  
								$('#house_construction').val(house_construction);  
								$('#house_construction_percentage').val(house_construction_percentage);  

								if(road=="yes"){
									$('#road').attr('checked',true);
								}

								if(side_walk=="yes"){
									$('#side_walk').attr('checked',true);
								}

								if(meralco=="yes"){
									$('#meralco').attr('checked',true);
								}

								if(water=="yes"){
									$('#water').attr('checked',true);
								}

								if(house_construction=="yes"){
									$('#house_construction').attr('checked',true);
								}


								if(action=="view"){
									$('input').attr("disabled", true);
									$('textarea').attr("disabled", true);
									$('select').attr("disabled", true); 
									$('.glyphicon-trash').hide();
									$('.glyphicon-plus').hide();  
								}
						});						
}