﻿/*

SISTEMA:        Internet - MONTE TABOR - HOSPITAL SÃO RAFAEL
DATA:           22/11/2007
DESCRIÇÃO:      Arquivo JavaScript responsável por armazenar as funções necessárias para o funcionamento da Internet

HISTÓRICO:

DATA                IMPLEMENTADOR                           DESCRIÇÃO

23/07/2010          Ricardo Luiz P. Carneiro                Criação da função starlist.

*/



/* SCRIPT PARA EXECUTAR JANELAS POP-UPS */

startList = function() 
{
	if (document.all&&document.getElementById) 
	{
    if (document.getElementById("nav") == null) 
	{
	navRoot = document.getElementById("nav2");
	}
	else
	{
	navRoot = document.getElementById("nav");
	}
		
		
		for (i=0; i<navRoot.childNodes.length; i++) 
		{
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") 
			{
				node.onmouseover=function() 
				{
					this.className+=" over";
		 		}
  				node.onmouseout=function() 
				{
  					this.className=this.className.replace(" over", "");
   				}
   			}
  		}
 	}
}
window.onload=startList;


$(document).ready(function() {	

	$('a[name=modal]').click(function(e) {
		e.preventDefault();
		
		var id = $(this).attr('href');
	
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		$('#mask').css({'width':maskWidth,'height':maskHeight});

		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.8);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
              
		$(id).css('top',  winH/2-$(id).height()/2);
		$(id).css('left', winW/2-$(id).width()/2);
	
		$(id).fadeIn(2000); 
	
	});
	
	$('.window .close').click(function (e) {
		e.preventDefault();
		
		$('#mask').hide();
		$('.window').hide();
	});		
	
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});			
	
});


