function getScrollTop() {
    
    if (window.pageYOffset > 0) {
        return window.pageYOffset;
    }
    else if(document.getElementById("__SCROLLPOSITIONY") != null)
    {
        if(document.getElementById("__SCROLLPOSITIONY").value > 0)
        {
            return Number(document.getElementById("__SCROLLPOSITIONY").value);
        }
    }
    return 0;
}

function launchWindow(id, title, content) {
		jQuery(".ModalTitle .Title").text(title);
		jQuery(".ModalContent .ContentModal").html(content);
	
		//Set heigth and width to mask to fill up the whole screen
		jQuery('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		jQuery('#mask').fadeIn(300);
		jQuery('#mask').fadeTo("fast", 0.8);	
	
		//Get the window height and width
		var winH = jQuery(window).height();
		var winW = jQuery(window).width();

		//Set the popup window to center

		jQuery(id).css('top', Number(getScrollTop()) + 200);
		jQuery(id).css('left', winW/2-jQuery(id).width()/2);
		//Get the screen height and width
		var maskHeight = jQuery(document).height();
		var maskWidth = jQuery(window).width();
		
		//Set heigth and width to mask to fill up the whole screen
		jQuery('#mask').css({'width':maskWidth,'height':maskHeight});

	
		//transition effect
		jQuery(id).fadeIn(500);

}


function closeWindow() {
	jQuery('#mask').fadeOut(500);
	jQuery('.window').hide();
}
