// マウスオーバーで画像が変わる
$(function(){
	$('a img').hover(function(){
		$(this).attr('src', $(this).attr('src').replace('_off', '_on'));
		}, function(){
			if (!$(this).hasClass('currentPage')) {
			$(this).attr('src', $(this).attr('src').replace('_on', '_off'));
		}
	});
});

// ページトップへの移動
$(function(){
     $("#toTop a").click(function(){
     $('html,body').animate({ scrollTop: $($(this).attr("href")).offset().top }, 'slow','swing');
     return false;
     })
});


// フォームの選択ラベルにフォーカス
$(function () {
	$("form :input").focus(function() {
	$("label[for='" + this.id + "']").addClass("labelfocus");
	});
	$("form :input").blur(function() {
	$("label[for='" + this.id + "']").removeClass("labelfocus");
	});
});

//フォームでのplaceholderをIE他に対応させる
$(function () {
  var supportsInputAttribute = function (attr) {
    var input = document.createElement('input');
    return attr in input;
  };
  if (!supportsInputAttribute('placeholder')) {
    $('[placeholder]').each(function () {
      var
        input = $(this),
        placeholderText = input.attr('placeholder'),
        placeholderColor = 'GrayText',
        defaultColor = input.css('color');
      input.
        focus(function () {
          if (input.val() === placeholderText) {
            input.val('').css('color', defaultColor);
          }
        }).
        blur(function () {
          if (input.val() === '') {
            input.val(placeholderText).css('color', placeholderColor);
          } else if (input.val() === placeholderText) {
            input.css('color', placeholderColor);
          }
        }).
        blur().
        parents('form').
          submit(function () {
            if (input.val() === placeholderText) {
              input.val('');
            }
          });
    });
  }
});

//ダイアログ用。　左から50、上から20の位置
$(function (){
    jQuery( '#jquery-ui-dialog' ) . dialog( {
        position: [ 50, 20 ],//ポジション
        show: 'drop',//show,clip,explode,blind,bounce,drop,fold,slide
        hide: 'drop'//↑いずれかでアニメーションが変わる。
    } );
} );
