// Place your application-specific JavaScript functions and classes here


$(document).ready(function(){
		
	//This is the hover effect for the top four images	
	$('#1a').mouseover(function () {
		$('#1b.overlay').fadeIn(500).mouseout(function () {
			$(this).fadeOut(250);
		});
	});
	
	$('#2a').mouseover(function () {
		$('#2b.overlay').fadeIn(500).mouseout(function () {
			$(this).fadeOut(250);
		});
	});
	
	$('#3a').mouseover(function () {
		$('#3b.overlay').fadeIn(500).mouseout(function () {
			$(this).fadeOut(250);
		});
	});
	
	$('#4a').mouseover(function () {
		$('#4b.overlay').fadeIn(500).mouseout(function () {
			$(this).fadeOut(250);
		});
	});

	//Drop down menus
	$('UL.nav LI').hover(function(){
			$(this).children('.submenu').stop(true, true).slideDown(100).children('li').show();
		},function(){
			$(this).children('.submenu').children('li').hide().end().stop(true, true).slideUp(400);
		});

		$('UL.nav UL LI').hover(function(){
			$(this).children('UL').stop(true, true).slideToggle(200);								 
		});
		
	$('UL.portal_nav LI').hover(function(){
			$(this).children('.submenu').stop(true, true).slideDown(100).children('li').show();
		},function(){
			$(this).children('.submenu').children('li').hide().end().stop(true, true).slideUp(400);
		});

		$('UL.portal_nav UL LI').hover(function(){
			$(this).children('UL').stop(true, true).slideToggle(200);								 
		});
		
		$('#links a').attr('target', '_blank').attr('title', 'This link will open in a new window');
	
		$('#edu_menu a').click(function(e) {
			e.preventDefault();
			var class_name = $(this).attr("class");
			//alert(class_name);
			$('#'+ class_name).show().siblings().hide();
		});
		
		$('.individuals a').click(function(e){
			e.PreventDefault;
		});
		$('.individuals').hover(function(){
			$(this).siblings('p').show();
		});

		$('.individuals').hover(function(){
	  	$(this).children('.bio_img').toggle();       
		});
		
		//Modal Window for consent and privacy policy
		//select all the a tag with name equal to modal
			$('a[name=modal]').click(function(e) {
				//Cancel the link behavior
				e.preventDefault();
        //Hide this because it messes things up
        $('#content').css({'position' : 'static'});
        $('#apple').hide();

				//Get the A tag
				var id = $(this).attr('href');

				//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.8);	

				//Get the window height and width
				var winH = $(window).height();
				var winW = $(window).width();

				//Set the popup window to center
				$(id).css('top',  winH/2-$(id).height()/2);
				$(id).css('left', winW/2-$(id).width()/2);

				//transition effect
				$(id).fadeIn(2000); 

			});

			//if close button is clicked
			$('.window .close').click(function (e) {
				//Cancel the link behavior
				e.preventDefault();

				$('#mask').hide();
				$('.window').hide();
				$('#content').css({'position' : 'relative'});
        $('#apple').show();
			});		

			//if mask is clicked
			$('#mask').click(function () {
				$(this).hide();
				$('.window').hide();
				$('#content').css({'position' : 'relative'});
        $('#apple').show();
			});
});


