﻿function photoGalleryButton(e, elm, nodeId) {	
	/*Cancel the link behavior  */
    e.preventDefault();  
    /*Get the A tag  */
    var id = elm.attr('href');  
  
    /*Get the screen height and width  */
    var maskHeight = $(document).height() < 800 ? 800 : $(document).height();  
    var maskWidth = $(window).width();  
  
    /*Set height and width to mask to fill up the whole screen  */
    $('#mask'+nodeId).css('height',Math.max($(document).height(),900));  
      
    /*transition effect       */
    $('#mask'+nodeId).fadeIn(1000);      
    $('#mask'+nodeId).fadeTo("slow",0.8);    
  
    /*Get the window height and width  */
    var winH = $(window).height();  
    var winW = $(window).width();  
	var newTop = Math.max(winH/2-$(id).height()/2,0);
	var newLeft = winW/2-$(id).width()/2;
    /*Set the popup window to center  
    $(id).css('top',  '50px');  
    $(id).css('left', '300px');*/
     $(id).css('top',  newTop > 0 ? newTop : 0);  
    $(id).css('left',  newLeft > 0 ? newLeft : 0);  
  
    /*transition effect  */
    $(id).fadeIn(2000);   
    scroll(0,0);
}
