$(function(){

	scroll_anchor();
	set_copyright_year('#copyright .year');

	// onload --------------------------------------

	// onclick -------------------------------------
	$('.gnavi li').click(function () {
		url = $(this).find('a').attr('href');
		href(url);
	});

	// hover ---------------------------------------
	$(".btn_apply").hover(
		// mover
		function() {
			this.src = 'img/btn_apply_o.gif';
		},
		// mout
		function() {
			this.src = 'img/btn_apply.gif';
		}
	);

	init_lightbox();
});



/* functions { ************************************************************* */

function init_lightbox() {
	$("a[rel='fbp_sample']").colorbox();
	$("a[rel='site_sample']").colorbox();
	$("a[rel='sl_sample']").colorbox();
}

function scroll_anchor() {
	jQuery.easing.quart = function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	};
	jQuery('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = jQuery(this.hash);
			$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				jQuery('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart');
				return false;
			}
		}
	});
}

function href(uri) {
	window.location.href = uri;
}

// copyright year
function set_copyright_year(selector) {
	var dd = new Date();
	var y = dd.getFullYear();
	//document.write(y);
	$(selector).html(y);
}
/* } functions ************************************************************* */


