// 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')]);
				});	
			}
		}
	});
	
	// gallery
	$("#gallery>ul>li>a,a.image").fancybox({
		'titlePosition'		: 'over',
		'overlayColor'		: '#000000',
		'overlayOpacity' 	: .5
	});
	
	//
	$('.hide').hide();
	
});
