// default

//
$.postJSON = function (url, data, callback) {
	$.post(url, data, callback, 'json');
};

//
$(function(){

	// css navigation dropdown/flyout replacement for ie 6
	if($.browser.msie && $.browser.version < 7){
		$('#nav ul>li').hover(/*over*/function(){ $(this).children('ul:first').css({display:'block'})},/*out*/function(){ $(this).children('ul:first').css({display:'none'})});
		$('li>a').hover(/*over*/function(){$(this).parent('li').addClass('hover')},/*out*/function(){$(this).parent('li').removeClass('hover')});
	}
	
	// event tracker for outgoing links/file downloads
	$('a').each(function(){
		var path;
		
		if(path = $(this).attr('href')){
			var outgoing 	= /^(http|https)/i;
			var ext 		= /[^/].(?:doc|eps|jpg|jpeg|png|svg|xls|ppt|pdf|xls|zip|txt|vsd|vxd|js|css|rar|exe|wma|mov|avi|wmv|mp3|mp4)/i;
			
			if (path.match(outgoing) && !path.match(document.domain) ) {
				$(this).click(function(){
					// old ga code
					//pageTracker._trackEvent('Link', 'Outgoing', $(this).attr('href'));
					
					// new ga code
					_gaq.push(['_trackEvent', 'Link', 'Outgoing', $(this).attr('href')]);
				});
			} else if(path.match(ext)){
				$(this).click(function(){
					// old ga code
					//pageTracker._trackEvent('File', 'Download', $(this).attr('href'));
					
					// new ga code
					_gaq.push(['_trackEvent', 'File', 'Download', $(this).attr('href')]);
				});	
			}
		}
	});
	
	//
	$('#photos').cycle({ 
		fx:    'fade', 
		speed:	3000,
		timeout: 3000,
		pause:	0
	});
	
	//
	$('.hide').hide();
	
});

function slideBio(id){
	$(id).slideToggle();
	$('.slide:not('+id+')').slideUp();
}
