jQuery(document).ready(function() {

	var o = {
		$win:jQuery(window),
		$meta:jQuery('.index_meta'),
		$thumbImgs:jQuery('.m img'),
		$thumbs:jQuery('.m a'),
		$ssize:jQuery('#supersize'),
		$ssizeImg:jQuery('#supersize img'),
		$hTitle:jQuery('#header_title h2'),
		$titles:jQuery('.work_title a'),
		$web:jQuery('.post-web h3'),
	};
	
	//深夜はフォントかわいく
	var d = new Date();
	if(1 < d.getHours() && d.getHours() < 7) {
		$('body, .index_meta, post-web p, #header, h1, h2, h3').css('fontFamily', '"Sniglet","Verdana","ヒラギノ角ゴ Pro W3","ＭＳ ゴシック","Osaka‐等幅"');
	}

	//intro
	o.$meta.show().fadeTo(0, 0);	
	o.$win.load(function(){
		o.$ssize.hide();
	  o.$thumbImgs.fadeIn(1000);
		o.$meta.animate({
			opacity: 1,
			paddingLeft: "0"
		}, 1000);
		
	});

	o.$thumbs.hover(
  	function(){
  		var index = o.$thumbs.index(this);
      o.$ssizeImg.attr("src",jQuery(this).children("img").attr("name"));
      o.$meta.hide().eq(Math.floor(index/2)).show()
      o.$hTitle.html(o.$titles.eq(Math.floor(index/2)).html());
      o.$thumbs.children("img").fadeTo(0, 0);
  		o.$ssize.fadeIn(0);
  		
  	},
  	function(){
      o.$thumbs.children("img").fadeTo(0, 1);
      o.$meta.show();
      o.$hTitle.html('');
  		o.$ssize.hide();
  });

  
  
  //for the page of client works
  $web = jQuery('.post-web h3');
  $web.hover(
  	function(){
  		jQuery(this).animate({
  			opacity: 0.5,
				paddingLeft: "10"
  		}, 100);
  	},
  	function(){
  		jQuery(this).animate({
  			opacity: 1,
				paddingLeft: "0"
  		}, 100);
  });
  
  o.$ssize.supersized();
  
});


