﻿		$(document).ready(function(){
			//LOGIN
			//select all the a tag with name equal to modal
			$('a[name=modal]').click(function(e) {
				//Cancel the link behavior
				e.preventDefault();
		
				//Get the A tag
				var id = $(this).attr('href');
				
				//Get the document height
				var maskHeight = $(document).height();
	
				//Set heigth to mask to fill up the whole document
				$('#mask').css('height',maskHeight+'px');
		
				//transition effect		
				$('#mask').fadeIn(200);	
				$('#mask').fadeTo("slow",0.7);	
	
				//Get the window width
				var winW = $(window).width();
              
				//Set the popup window to center in width
				$('#login-dialog').css('left',winW/2-$("#login-dialog").width()/2+'px');
	
				//transition effect
				$(id).fadeIn(200); 
	
			});
	
			//if mask is clicked
			$('#mask').click(function () {
				$(this).hide();
				$('#login-dialog').hide();
				$('.window').hide();
			});			
		});
