$.change_top = function(image){
	$('#top').animate({opacity: 0.1}, 200, function(){
		$('#top').css('background', 'url(/images/'+image+') no-repeat');
		$('#top').animate({opacity: 1}, 200);
	});	
}

$(function(){
	
	$('a:not(.noajax)').live('click', function(){
		var a = $(this);
		$.ajax({
			type: 'GET',
			dataType: 'html',
			success: function(response){
				$('#content').html(response);
				$('#loader').hide();
				$('#content').css('opacity', '1');
			},
			beforeSend: function(){
				$('#content').css('opacity', '0.1');
				$('#loader').show();
			},
			url: a.attr('href')
		});
		return false;
	});
	
	$('.form').live('submit', function(){
		var form = $(this);		
		$.ajax({
			type: 'POST',
			data: form.serialize(),
			success: function(response){
				$('#content').html(response);
				$('#loader').hide();
				$('#content').css('opacity', '1');
			},
			beforeSend: function(){
				$('#content').css('opacity', '0.1');
				$('#loader').show();
			},
			url: form.attr('action')
		});
		return false;
	});
	
	$(".menu_top a").mouseover(function () {		
		$(this).stop().animate({ paddingLeft: "50px" }, 200 );
	});
	$(".menu_top a").mouseout(function () {		
		$(this).stop().animate({ paddingLeft: "10px" }, 200 );
	});
	$('#fade').cycle({
		speed:    1000, 
	    timeout:  3000,
	    random: true
	});
	$('#fade .slides').mouseover(function(){
		$('#fade').cycle('pause');
	});
	$('#fade .slides').mouseout(function(){
		$('#fade').cycle('resume');
	});
});