$(document).ready(function() {
	$("a.ajax").live("click", function (event) {
	    event.preventDefault();
	    $.get(this.href);
		return false;
	});
	
	$("form").live("submit", function(e) {
		$(this).ajaxSubmit();
		return false;
    });
	
	$("form :submit").live("click", function(e) {
		$(this).ajaxSubmit();
		return false;
    });
	
	$(".button, input[type='button'], input[type='submit']").live("mouseup", function() {
		$(this).removeClass("click");
	}).live("mousedown", function() {
		$(this).addClass("click");
	}).live("mouseleave", function() {
		$(this).removeClass("click");
	});
	
	$("a[rel='gallery']").fancybox({
		transitionIn: 'none',
		transitionOut: 'none',
		titlePosition: 'over',
		overlayColor: '#000',
		overlayOpacity: 0.4,
		titleFormat: function(title, currentArray, currentIndex, currentOpts) {
			return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
		}
	});

	$("#headerTools a.button").css({opacity: 0.7}).hover(function() {
		$(this).css({opacity: 1});
	}, function() {
		$(this).css({opacity: 0.7});
	});
});
function debug(field) {
	if (window.console && window.console.log) {
		window.console.log(field);
	}
}
