/*
* Site Name : de sign de > | デザインでつながる。
*
* File Name : common.js [use jquery]
*
* Date : 2011.03.13
*
* Copyright : Copyright © de sign de . All rights reserved.
*/


$(function() {
    // ヌルヌルスクロール
    var ua = $.browser;
	$("a").click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			$(this).blur();
			var t = navigator.appName.match(/Opera/) ? "html" : "html,body";
			$(t).queue([]).stop();
			var $targetElement = $(this.hash);
			var scrollTo = $targetElement.offset().top;
			if (window.scrollMaxY) {
				var maxScroll = window.scrollMaxY;
			} else {
				var maxScroll = document.documentElement.scrollHeight - document.documentElement.clientHeight;
			}
			if (scrollTo > maxScroll){
				scrollTo = maxScroll;
			}
			$(t).animate({ scrollTop: scrollTo }, 600, 'easeOutExpo');
			return false;
		}
	});
    
    // vGrid セットアップ
	var vg = $("#gridContent").vgrid({
        easeing: "easeOutQuint",
        useLoadImageEvent: true,
        useFontSizeListener: true,
        time: 400,
        delay: 20,
        fadeIn: {
                time: 500,
                delay: 50
        }
	});
});

$(window).load(function(){
	var url = location.hash;
	var hash = url.substring( 1, url.length );

	if(hash == 'infoContact'){
		var targetContact = $('#infoContact').offset().top;
		$('html,body').delay(1000).animate({scrollTop: targetContact}, 600, 'easeOutExpo');
		
	} else if(hash == 'infoAccess') {
		var targetAccess = $('#infoAccess').offset().top;
		$('html,body').delay(1000).animate({scrollTop: targetAccess}, 600, 'easeOutExpo');
		
	} else if(hash == 'mailmagazine') {
		var targetMailmagazine = $('#mailmagazine').offset().top;
		$('html,body').delay(1000).animate({scrollTop: targetMailmagazine}, 600, 'easeOutExpo');
		
	} else if(hash == 'membership') {
		var targetMembership = $('#membership').offset().top;
		$('html,body').delay(1000).animate({scrollTop: 350}, 600, 'easeOutExpo');
		//alert(targetMembership)
	}
	
	// vGrid セットアップ
	var vg = $("#gridContent").vgrid({
        easeing: "easeOutQuint",
        useLoadImageEvent: true,
        useFontSizeListener: true,
        time: 400,
        delay: 20,
        fadeIn: {
                time: 500,
                delay: 50
        }
	});
	
	
	
});
