// 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(){
					_gaq.push(['_trackEvent', 'Link', 'Outgoing', $(this).attr('href')]);
				});
			} else if(path.match(ext)){
				$(this).click(function(){
					_gaq.push(['_trackEvent', 'File', 'Download', $(this).attr('href')]);
				});	
			}
		}
	});
	
	// homepage
	$('#home').cycle({ 
		fx:				'fade', 
		speed:			1500,
		timeout:		3000,
		pause:			0
	 });
	
	// paypal
	$('.cart-icon>a').fancybox({
		'overlayColor'		: '#6d615a',
		'overlayOpacity' 	: .5
	});

	
	$('#paypal>form>input[type=image]').attr('src','/img/layout/overlay-continue.gif');
	
	$('#websiteOverlay').alignCenter();
	
	//
	$('.hide').hide();
	
});
