// JavaScript Document
//	==========================================================================
//	Custom Functions
//	==========================================================================

//	fadeToggle()
jQuery.fn.fadeToggle = function(speed, easing, callback) {
  return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};


//	==========================================================================
//	Add jQuery Scripts Below
//	==========================================================================

$(function() { //	Start below...
					 
//	Detect mozilla
if ($.browser.mozilla) {
	$('#content').addClass('mozilla');
	}
	
//	==========================================================================
//	Clickable <h1> Banner
//	This script makes the 'h1' element clickable despite CSS "hiding" the
//	child 'a' element.
//	==========================================================================
$('#som h1')
	.hover(function(){
									$(this).addClass('hover')
									},
									function(){
										$(this).removeClass('hover')
									});
$('#som h1')
	.click(function(){
									 //	Get URL from link w/in <h1> element
									 window.location = $(this).find("a").attr("href");
									 return false;
});

//	==========================================================================
//	Vid-thumb
//	This script makes the entire 'vid-thumb' container clickable, opening a
//	popup window displaying the video in a fixed size window.
//	The URL is retrieved from the <a> element in the container.
//	==========================================================================
var	poploc	=	$('#vid-thumb').find('a.popup').attr('href');
$('#vid-thumb').click(function(){
															 //	Get URL from link & store in variable "poploc"
															 // Open popup window with retrieved URL
															 window.open(poploc,'Video Popup', 'width=328,height=280');
															 return false;
});

//	Cancel out double-window problem... (a fix, not TRUE solution -MC)
$('.mozilla #vid-thumb a.popup').attr({href:'#'}).removeClass('popup');

//	==========================================================================
//	Show/hide effect for 'Applicant To-Do List'
//	==========================================================================
$('#to-do-list ul').hide();
$('#to-do-list h3').addClass('show-hide')
	.click(function()
									{
										$(this).toggleClass('show-hide').next().fadeToggle('fast');
										return false;
										});

//	==========================================================================
//	Show/hide effect for FAQ
//	==========================================================================
$('dl.faq dd').hide();
$('dl.faq dt').addClass('show-hide').append(' <span>Show Answer &raquo;</span>')
	.click(function()
									{
										$(this).toggleClass('show-hide').next().fadeToggle('fast');
										return false;
										});

// Added function to hide answer when answer is clicked
$('dl.faq dd').click(function()
															{
																$(this).fadeToggle('fast').prev().toggleClass('show-hide');
															});

//	==========================================================================
//	Add class to headings with anchors
//	==========================================================================
$(':header:has("a[name]")').addClass('anchor-heading');
$('a[name]').addClass('anchor');

//	==========================================================================
//	Return to Top Link Adder
//	==========================================================================
//	**** IN PROGRESS ****
/*$('a[name]').parent('#single-col h2,#single-col h3').next().not('h3').append('<a href="#toc" class="go-top">Top</a>');
*/

//	==========================================================================
//	Create zebra lists
//	==========================================================================
//	Add class to zebra list header(s)
$('ul.zebra').prev(':header').addClass('zebra-list-heading');

//	Specify which rows are odd/even
$('ul.zebra li:not():odd').addClass('even-row');
$('ul.zebra li:not():even').addClass('odd-row');

$('ul.zebra li').hover(function() {
																	 $(this).addClass('highlight');
																	 },function() {
																		 $(this).removeClass('highlight');
																		 }
																	 );

//	==========================================================================
//	Other Popups
//	==========================================================================
//	Preview Student Life
$('a#preview-student-life').click(function() {
																					 window.open(this.href, 'Preview Student Life', 'width=505,height=477');
																					 return false;
																					 });


/*poploc	=	$('#vid-thumb').find('a.popup').attr('href');
$('#vid-thumb').click(function(){
															 //	Get URL from link & store in variable "poploc"
															 // Open popup window with retrieved URL
															 window.open(poploc,'Video Popup', 'width=328,height=280');
															 return false;
});*/

$('dl.dean').prev('h3').addClass('dean');

//	==========================================================================
//	Stop here!
//	Do not enter any more script code
//	-MC
//	==========================================================================
}); // End jQuery stuff