// JavaScript Document
//$(document).ready(function() {
	$(document).on('click','a.login-window',function() {
					 
		
                //Getting the variable's value from a link 
				var userid = $(this).attr('data-id');
				var datachk = $(this).attr('data-chk');
				
				
		var loginBox = $(this).attr('href');
		view_sales(userid,datachk);
		//alert('http://localhost/CandF/popajax.php&val='+userid);
		
		
		//Fade in the Popup
		$(loginBox).fadeIn(300);
		
		//Set the center alignment padding + border see css style
			var popMargTop = '202'; 
  var popMargLeft = '402'; 
  $(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 view_sales(empid,datachk){
	
		$.ajax({
		method: 'POST',
		url: 'http://www.aadhocc.com/oil_fill/pop_return_sales.php',
		data: {'val' : empid,'chk' : datachk},
		cache: false,
		success: function(msg){
			
			
			$("#popupid_returnsales").html(msg).show();
			
		}
		});
	}