$(document).ready(function() {
	$('a.button-add1').click(function(){
		animatemain('index.php?id=128');
		return false;
	});
	$('a.button-add2').click(function(){
		animatemain('index.php?id=129');
		return false;
	});
	$('a.button-add3').click(function(){
		animatemain('index.php?id=130');
		return false;
	});
	$('a.button-add4').click(function(){
		animatemain('index.php?id=131');
		return false;
	});
	$('a.button-add5').click(function(){
		animatemain(this);
		return false;
	});
	
	$('#searchsubmit').click(function(){
		$('#searchform').submit();
		return false;
	});
	
	
	$('.photo-box-int div').innerfade({ 
		animationtype: 'fade', 
		speed: 750, 
		timeout: 5000, 
		type: 'sequence', 
		containerheight: '341px' 
	}); 
	
});


/* home page ajax and animation functions */
function animatemain(theurl) {
	setprev();
	window.drawerurl = theurl + '&type=11';
	hidedrawer();
}
function hidedrawer() {
	$('#slider').animate({
		right: -800
	}, 500, 'swing', loaddrawer );
}
function showdrawer() {
	if (window.prevdrawerurl != window.drawerurl) {
		$('#slider').animate({
			right: 0
		}, 500, 'swing' );
	}
}
function loaddrawer() {
	$('#slider').html('');
	$('#slider').load(drawerurl, null, showdrawer());
}
function setprev() {
	if (window.prevdrawerurl != window.drawerurl) {
		window.prevdrawerurl = window.drawerurl;
	}
	else {
		window.prevdrawerurl = '';
	}
}

