/* ------------------------------------------------------------------

 common.js
	
------------------------------------------------------------------ */

//
// TAB
//

$(document).ready(function(){
$(function(){
	$(".tabMenu > li").each(function(i){
		$(this).attr('id','tabMenu' + (i+1));
	});
});
		$(".tabArea > .tabMenu > li:first").addClass("select");
		$(".tabMenu > li").hover(function(){
			$(this).css("cursor","pointer");
		},function(){
			$(this).css("cursor","default");
		});

		$(".tabArea > div").hide();
		$(".tabArea > div:first").show();
		$('.tabArea li a[href]').click(function(e){e.preventDefault()});

	$(".tabMenu > li").click(function () {
		$(".tabMenu > li").removeClass("select");
		$(this).addClass("select");
		$(".tabArea > div").hide();
		$(".tabArea > div").eq($(".tabMenu > li").index(this)).show();
	});

});

$(function(){
	$(".tabMenu > li").hover(function() {
			$(this).addClass('over');
		}, 
		function() {
			$(this).removeClass('over');
			}
		);
});

//
// JSでtarget=”_blank”みたいに別ウィンドウにする方法
// 使い方 Class.blankLinkを付けると自動的に target="_blank" を追加します。
//
/*
$(function(){
$("a.blankLink").attr("target","_blank");
});

//
//div全体をリンクにする
//

$(function(){
$(".link_box").click(function(){
window.location=$(this).find("a").attr("href");
return false;
});
});
*/

//
//スムーズスクロール
//

$(document).ready(function(){
$('p.pagetop a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&& location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target
|| $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body')
.animate({scrollTop: targetOffset}, 1000, 'easeOutExpo');
return false;
}
}
});
});


//
//ロールオーバー
//
;(function($){
$(document).ready(function(){
$("a img[src*='_ov']").addClass("current");
$("a img[class!='current'],:image").mouseover(function(){
if ($(this).attr("src").match(/_ot./)){
$(this).attr("src",$(this).attr("src").replace("_ot.", "_ov."));
return;
}
}).mouseout(function(){
if ($(this).attr("src").match(/_ov./)){
$(this).attr("src",$(this).attr("src").replace("_ov.", "_ot."));
return;
}
}).click(function(){
if ($(this).attr("src").match(/_ov./)){
$(this).attr("src",$(this).attr("src").replace("_ov.", "_ot."));
return;
}
});


//preload images
var images = [];
$("a img,:image").each(function(index){
if($(this).attr("src").match(/_ot./)){
images[index]= new Image();
images[index].src = $(this).attr("src").replace("_ov.", "_ot.");
}
});
});
})(jQuery);

//フォームテキストエリア内
/*
function cText(obj){
if(obj.value==obj.defaultValue){
obj.value="";
obj.style.color="#000";
}
}
function sText(obj){
if(obj.value==""){
obj.value=obj.defaultValue;
obj.style.color="#999";
}
}


//IEにCSS3を適用する 

$(function(){
$('.addPie').each(function(){
PIE.attach(this);
});
});
*/

