jQuery(function() {
	
	//アンカーリンク
	jQuery('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
		  var $target = jQuery(this.hash);
		  $target = $target.length && $target
		  || jQuery('[name=' + this.hash.slice(1) +']');
		  if ($target.length) {
			var targetOffset = $target.offset().top;
			jQuery('html,body').animate({scrollTop: targetOffset}, 'normal','swing');
		   return false;
		  }
		}
	});

//	jQuery("#page_nav li a").hover(function(){
//		jQuery(this).stop(true,false).fadeTo(100, 0);
//		},function(){
//		jQuery(this).stop(true,false).fadeTo(100, 1);
//	});
	
	//.swap マウスオーバー画像を入れ替え
	var postfix = '_o';
	jQuery('.swap').not('[src*="'+ postfix +'."]').each(function() {
		var img = jQuery(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.')) + postfix + src.substring(src.lastIndexOf('.'));
		jQuery('<img>').attr('src', src_on);
		img.hover(function() {img.attr('src', src_on);},function() {img.attr('src', src);});
	});
	
	//.trans マウスオーバー画像を透過
	jQuery('.trans').each(function() {
		jQuery(this).hover(function(){
			jQuery(this).stop(true,false).fadeTo(100, 0.7);
			},function(){
			jQuery(this).stop(true,false).fadeTo(100, 1);
		});
	});
	
	// input,textarea フォーカスで消える文字
	jQuery("input[type=text], textarea").each(function() {
        if (jQuery(this).val() == jQuery(this).attr("title")) {
            jQuery(this).addClass("default");
        }
    });
    jQuery("input[type=text], textarea").click(function() {
        if (jQuery(this).val() == jQuery(this).attr("title")) {
            jQuery(this).val("");
            jQuery(this).removeClass("default");
        }
    });

    jQuery("input[type=text], textarea").blur(function() {
        if (jQuery(this).val() == "") {
            jQuery(this).val(jQuery(this).attr("title"));
            jQuery(this).addClass("default");
        }
    });

	

});
