// smooth scroll
$(document).ready(function(){
    $('.gotop a').click(function(){
        var target;
        target = $( $(this).attr('href') );
        if (target.length == 0) {
            return;
        }
        $('html, body').animate({scrollTop: target.offset().top},600, 'easeOutExpo');
        return false;
    });
});


$(function() {
	// Select all links whose attribute rel starts with lightbox
	$('a[rel^=lightbox]').lightBox();
});


// fade img over //
$(function(){
	var postfix = '_on';
	$('#g-navi ul li img, .fade-over').not('[src*="'+ postfix +'."]').each(function() {
		var src = $(this).attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$(this).after('<img src="' + src_on + '" class="fade-on" />');

		$(this).parent()
		.css({'position' : 'relative'})
		.css({'display' : 'block'});

		$('.fade-on')
		.css({'display' : 'block'});

		$(this)
		.css({'display' : 'block'})
		.css({'position' : 'absolute'})
		.css({'top' : '0'});

		$(this).hover(
			function(){
				$(this).fadeTo(300,0);
			},
			function(){
				$(this).fadeTo(300,1);
			}
		);
	});
});







