$(document).ready(function(){

// css and animation

$("#news-nav li:first, #portfolio-side li:first").addClass("first");
$("a").swish();	
$("#featured a").swish({hoverclass: "featuredhover"});	
$("#nav a, #footer a").swish({hoverclass: "navhover"});
$(".caption a").swish({hoverclass: "caphov"});
$("#nav img").hide();
$("#nav li.active img").show();
$("#nav a").hover(
function () {
	$(this).find('img').stop('true').fadeIn('200');
},
function () {
	$(this).find('img').fadeOut('400');
});         

// scroll to
$("#inline-nav a, #top").click(function(){
	$.scrollTo($(this).attr('href'), 300);
	return false;
}); 

// gallery
$('.caption').hide();
setTimeout(function() {
        $('.caption:first').fadeIn(2000);
        $("#gallery").cycle({
			cleartype:  1,
			timeout: 9000,
		    pager:  '#featured',
		 	before: onBefore,
			after: onAfter,
		    pagerAnchorBuilder: function(idx, slide) { 
		        // return selector string for existing anchor 
		        return '#featured li:eq(' + idx + ') a'; 
		    }
		});
    }, 1000);

function onAfter(curr, next, opts) {
    $('.caption').fadeIn('fast');
}
function onBefore(curr, next, opts) {
	$('.caption').hide();
}


window.setTimeout('$.scrollTo($(window.location.hash))',1000);

});