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

//
// JSでtarget=”_blank”みたいに別ウィンドウにする方法
// 使い方 http:// で始まるリンク先に、自動的に target="_blank" を追加します。
//

$(function(){
     //$("a[href^='http://']").attr("target","_blank");
});


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

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


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

$(document).ready(function(){
$('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";
}
}

