jQuery(window).load(function() {
	jQuery('#slider').nivoSlider({ effect:'slideInRight', pauseTime:6000, keyboardNav:false, directionNav:false });

	jQuery(".attachment-work").click( function () {
		jQuery(".attachment-work").css ("background", "white");
		jQuery(this).css ("background", "blue");
		jQuery(".wp-post-image").attr("src", jQuery(this).attr("src"));
		jQuery(".wp-post-image").hide();
		jQuery(".wp-post-image").fadeIn('slow');
		
	});

	jQuery('.gototop').click( function(){
        	jQuery('html, body').animate({scrollTop:0}, 'slow');
        	return false;
 		});

	jQuery(".portfolio").hover( function () {
		jQuery(this).find("p").slideDown('slow');
	});
	jQuery(".portfolio").mouseleave( function () {
		jQuery(this).find("p").slideUp('slow');
	});


	setInterval(homepage , 8000);

})
 
function homepage () {
	howmany = jQuery(".sliderup").size();
	for (i = 1; i <= howmany; i++) {
		if(jQuery("#welcomeholder"+ i).css('display') == 'block') {
			current = i;
			if (current == howmany) {
				next = 1;
			}
			else {
				next = i+1;
			}
			break;
		}
	}
	jQuery("#welcomeholder" + current).slideUp(1000);
	jQuery("#welcomeholder" + next).slideDown(1000);
}

