$(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();
		//
		
			var xScroll, yScroll;
			if (self.pageYOffset) {//firefox
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;			
			} else if (document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;			
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;					
			}
			arrayPageScroll2 = new Array(xScroll,yScroll);	
		
//if(navigator.appName=="Microsoft Internet Explorer"){
//}
//}else{
//$(id).css('position', 'fixed');
//$(id).css('top', (yScroll + 10));
//}
//$(id).css('top', winH/2-$(id).height()/2);
$(id).css('position', 'fixed');
$(id).css('top',(10));
$(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();
	});	
	function fecharModal(){
		$(this).hide();
		$('.window').hide();		
	}
	
});
//
	function CadastroModal(_e){
		//e.preventDefault();
		
		var id = _e;
	
		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();
		//
		
			var xScroll, yScroll;
			if (self.pageYOffset) {//firefox
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;			
			} else if (document.documentElement && document.documentElement.scrollTop) {// Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;			
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;					
			}
			arrayPageScroll2 = new Array(xScroll,yScroll);	
		
$(id).css('position', 'fixed');
$(id).css('top',(10));
$(id).css('left', winW/2-$(id).width()/2);
$(id).fadeIn(2000); 
	
	};
