// 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 loginBox = $(this).attr('href');
		view_emp(userid);
		//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 = ($(loginBox).height() + 24) / 2; 
		var popMargLeft = ($(loginBox).width() + 24) / 2; 
		
		$(loginBox).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		// Add the mask to body
		$('body').append('<div id="popupid"></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_emp(empid){
		//alert(empid);
		//alert('http://localhost/CandF/popajax.php?val='+empid);
		$.ajax({
		method: 'POST',
		url: 'http://www.explorekeralatours.com/candf/trippopajaxtrip.php?val='+empid,
		success: function(msg){
			$("#popupid").html(msg).show();
			
		}
		});
	}