$(document).ready(function(){
    
	$(window).keyup(function(event){
		console.log(event.keyCode);
	});
	
    $(window).scroll(function(){
		var scrollPosition = $(window).scrollTop();
		//console.log(scrollPosition);
		if(scrollPosition == 0){
			$("#header").css("opacity","1").css("border-bottom","none");
		}else{
			$("#header").css("opacity","0.8").css("border-bottom","1px solid #ccc");
			$("#header").hover(
				function(){$(this).css("opacity","1")
			},
				function(){$(this).css("opacity","0.8")
			});
		}
	});
	
	
	/*ロード*/
	$("div#container").fadeIn("slow");

	/*ロゴ画像置換*/
	$(".jpng").jQIR("png", "wp-content/themes/busstop2/images/");//png、imageフォルダの指定
	$(".jjpg").jQIR("jpg", "wp-content/themes/busstop2/images/");//jpg
	$(".jgif").jQIR("gif", "wp-content/themes/busstop2/images/");//gif
	
	$("ul").find(">li:first").each(function(){
		$(this).addClass("first");
	});
	
	$("ul").find(">li:last").each(function(){
		$(this).addClass("last");
	});
	
	$("ul").find(">li:first").each(function(){
		$(this).children("a").addClass("first");
	});
	
	$("ul").find(">li:last").each(function(){
		$(this).children("a").addClass("last");
	});
	

	/*ロゴマウスオーバー*/
	$('div#container div.logspickup h2 a, div#container div.workspickup h2 a, div#container div.blog ul li a, div#container div.work ul li a').hover(
		function(){$(this).animate({opacity:"0.5"},500)
		},
		function(){$(this).animate({opacity:"1"},500)
		});

	/*外部リンク*/
	$('a[@href^="http"]').not('[@href*="www.studiobusstop.com"]').not('[href^=#]').click(
		function(){window.open(this.href,'_blank');
		return false;
		});
});