/* ------ コンテンツサイズ調整 ------ */

$(document).ready(function(){

	var thumssize = 95;
	var thumsmargin = 28;
	var thumstotalsize = thumssize+thumsmargin;

	function ReSizeAction() {
		var sizenow = $(".aoneworkbox").outerWidth();
		var thumscnt = Math.floor((sizenow-thumsmargin)/thumstotalsize);
		var aoneworkswidth = (thumscnt*thumstotalsize);
		$(".headerbox").css("width",aoneworkswidth);
		$(".aoneworks").css("width",aoneworkswidth);
		$(".aonemoreinfo").css("width",aoneworkswidth);
		$(".bottombox").css("width","100%");
		if(aoneworkswidth<867){ //最小サイズ
			$(".headerbox").css("width","867px");
			$(".aoneworks").css("width","867px");
			$(".aonemoreinfo").css("width","867px");
			$(".bottombox").css("width","867px");
		}
		$(".headerbox").css("margin","0 auto");
	};

	var resizeTimer = null;
	$(window).bind('resize', function() {
		if (resizeTimer) clearTimeout(resizeTimer);
		resizeTimer = setTimeout(ReSizeAction,100);
	});

	ReSizeAction();

});



/* ------ ツールチップ ------ */
	
$(function(){
	var index,texts,nam,t,l,tp = $(".tip"),bd = $("body"),spd = 200,op_01 = {"opacity":0},op_02 = {"opacity":0.8},out = {"top":-9999};

	function hover(nam,ele,atr,t,l){
		appSt(nam);
		var a = "."+nam+" "+ele,st = $("p.tip."+nam);
		$(a).hover(
			function(){
				index = $(a).index(this);
				onOver(a,st,atr,t,l);
				$(this).css("background","transparent url(images/newindex/spacer.png) no-repeat 0px 0px"); // アンカー明るさ(HOVER)
				$(this).css("borderColor","#d29d5a"); // アンカーボーダー(HOVER)
			},function(){
				st.animate(op_01,spd,function(){st.css(out)});
				$(this).css("background","transparent url(none) no-repeat 0px 0px"); // アンカー明るさ(OUT)
				$(this).css("borderColor","#aaaaaa"); // アンカーボーダー(OUT)
		});
	}
	function onOver(a,st,atr,t,l){
		texts = $(a+":eq("+index+")").attr(atr);
		st.stop(true, false).animate(op_02,spd).text(texts);
		$(a).mousemove(function(e){st.css({"top":e.pageY-t,"left":e.pageX-l});});
	}
	function appSt(nam){
		bd.prepend("<p class='tip "+nam+"'></p>");tp.css(op_01);
	}

	//ツールチップ実行
	hover("wthums","a","rel",-20,-10);
});



/* ------ hoverアクション ------ */

$(document).ready(function(){

	//メインナビ
	$("h2 .about a").hover(function(){
		$(this).css("background","transparent url(images/newindex/mainnavi.gif) no-repeat 0px bottom");
	},function(){
		$(this).css("background","transparent url(none) no-repeat 0 0");
	});
	$("h2 .designing a").hover(function(){
		$(this).css("background","transparent url(images/newindex/mainnavi.gif) no-repeat -85px bottom");
	},function(){
		$(this).css("background","transparent url(none) no-repeat 0 0");
	});
	$("h2 .branding a").hover(function(){
		$(this).css("background","transparent url(images/newindex/mainnavi.gif) no-repeat -170px bottom");
	},function(){
		$(this).css("background","transparent url(none) no-repeat 0 0");
	});
	$("h2 .digital a").hover(function(){
		$(this).css("background","transparent url(images/newindex/mainnavi.gif) no-repeat -279px bottom");
	},function(){
		$(this).css("background","transparent url(none) no-repeat 0 0");
	});
	$("h2 .promotion a").hover(function(){
		$(this).css("background","transparent url(images/newindex/mainnavi.gif) no-repeat -430px bottom");
	},function(){
		$(this).css("background","transparent url(none) no-repeat 0 0");
	});
	$("h2 .blog a").hover(function(){
		$(this).css("background","transparent url(images/newindex/mainnavi.gif) no-repeat -612px bottom");
	},function(){
		$(this).css("background","transparent url(none) no-repeat 0 0");
	});

	//プライバシー・ツイッターバナー
	$(".aonemoreinfo .pmthis").hover(function(){
		$(this).css("opacity","0.75");
	},function(){
		$(this).css("opacity","1");
	});
	$(".aonemoreinfo .twitter").hover(function(){
		$(this).css("opacity","0.85");
	},function(){
		$(this).css("opacity","1");
	});

});