//POP Up Modal Script


$(document).ready(function() {	
	//select all the a tag with name equal to modal
	$('a[name=modal2]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		//Get the A tag
		var id = $(this).attr('href');
	
		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set height and width to mask to fill up the whole screen
		$('#modalBox-mask2').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect
		$('#modalBox-mask2').fadeIn(20);	
		$('#modalBox-mask2').fadeTo("fast",0.2);
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
			  
		//-->Set the popup window to center
		$(id).css('top',  maskHeight/2-$(id).height()/2);
		$(id).css('left', maskWidth/2-$(id).width()/2);
	
		//transition effect
		$(id).fadeIn(500); 
	
	});
	
	//if close button is clicked
	$('.window2 .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		$('#modalBox-mask2, .window2').hide();
	});		
	
	//if mask is clicked
	//$('#modalBox-mask2').click(function () {
		//$(this).hide();
		//$('.window2').hide();
	//});
	
});
