// JavaScript Document

function popupSetup()
{
	
//select all the a tag with name equal to modal
	$('a[name=popup]').click(function(e) {
		//Cancel the link behavior
		e.preventDefault();
		
		//Get the A tag
		var id = '#dialog'; // $(this).attr('href');
		var url = "src/" + $(this).attr('href') + '.html';

		//Get the screen height and width
		var maskHeight = $(document).height();
		var maskWidth = $(window).width();
	
		//Set heigth and width to mask to fill up the whole screen
		$('#mask').css({'width':maskWidth,'height':maskHeight});
		
		//transition effect		
		$('#mask').fadeIn(1000);	
		$('#mask').fadeTo("slow",0.7);	
	
		//Get the window height and width
		var winH = $(window).height();
		var winW = $(window).width();
        
		$(id).css('top', 0);
		$(id).css('left', 0);
	
		//Set the popup window to center
		
		var scroll = $(window).scrollTop();
		var scrollLeft = $(window).scrollLeft();
	
		$(id).css('top', scroll+20);
		$(id).css('left',winW/7);

	//	$(id).css('margin', '0 auto');
	
		if($(this).attr('href') == 'InsuranceList' || $(this).attr('href') == 'PatientInformationSheet' || $(this).attr('href') == 'HIPPAForm' || $(this).attr('href') == 'RecordsReleaseAuthorization' || $(this).attr('href') == 'HistoryQuestionairet' || $(this).attr('href') == "PrivacyForm")
		{
			$(id).css('height',winH-100);
			$(id).css('width','900px');
		}
		else
		{
			$(id).css('height','400px');
			$(id).css('width','800px');
		}
		
		var output = '';
		
		$.ajax({url:url, success:function(result){
			$('#content').html(result);
  		}});

		//	$(id).load("src/DeenaBiography.html");
		$(id).fadeIn(2000); 
	});
	
	//if close button is clicked
	$('.window .close').click(function (e) {
		//Cancel the link behavior
		e.preventDefault();
		$('#mask').hide();
		$('.window').hide();
	});		
	
	//if mask is clicked
	$('#mask').click(function () {
		$(this).hide();
		$('.window').hide();
	});
}



