/*
Tiffany B. Brown for Armchair Media.
*/

$(document).ready(function(){
	
	// hides answers on how_to_apply.html page
	$('#faq .answer').css('display','none');
	
	var showAnswer = function(){
		$(this).addClass('vis');
		$(this).next('.answer').css('display','block');
	}
	var hideAnswer = function(){
		$(this).removeClass('vis');
		$(this).next('.answer').css('display','none');
	}
	
	var extLink = function(){
		var hrefy = $(this).attr('href');
		var newwin = window.open(hrefy,'external');
		return false;
	}
	
	var popup = function(){
		var hrefy = $(this).attr('href');
		var newwin = window.open(hrefy,'','width=550,height=700,status=no,menubar=no,location=yes,copyhistory=no,scrollbars=yes');
		return false;
	}
	
	// requires Google Analytics script to be called at the *top* of the page on pages where there is a file to download.
	var trackFile = function(){
		var pdfurl = $(this).attr('href');
		pageTracker._trackPageview(pdfurl); // passes the URL to google analytics
	}
	
	$('#faq .question').toggle(showAnswer,hideAnswer);
	$('.ext').bind('click',extLink);
	$('.popup').bind('click',popup);
	$('.trackfile').bind('click',trackFile);
	
});

