// JavaScript Document
$(document).ready(function() {
						 
	$(document).on('click','a.login-update',function() {
		
        //Getting the variable's value from a link 
		var loginBox = $(this).attr('href');

		//Fade in the Popup
		$(loginBox).fadeIn(300);
		var userid = $(this).attr('data-id');
		
		edit_account(userid);
		//Set the center alignment padding + border see css style
		//var popMargTop = ($(loginBox).height() + 24) / 2; 
		//var popMargLeft = ($(loginBox).width() + 24) / 2; 
		var popMargTop = '202'; 
		var popMargLeft = '302'; 
		$(loginBox).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		// Add the mask to body
		$('body').append('<div id="mask"></div>');
		$('#mask').fadeIn(300);
		
		return false;
	});
	
	// When clicking on the button close or the mask layer the popup closed
	$('a.close, #mask').live('click', function() { 
	  $('#mask , .login-popup').fadeOut(300 , function() {
		$('#mask').remove();  
	}); 
	return false;
	});
});
function edit_account(id){
		
		$.ajax({
		method: 'POST',
		<!--url: 'http://192.168.1.43/FrameWorks/TravancoWebsite/TravancoAdmin/TravancoFinance/viewreceipt/'+empid,-->
		url:'http://www.aadhocc.com/oil_fill/ajax/addledger.php?editid='+id,
		success: function(msg){
			//alert(msg);
			if(msg){
				$("#view_emp").html(msg).show();
			}
		}
		});
	}