
// Alpha Rollover

$(document).ready(function() {
    $("a:not(.twit-box a)").fadeTo(1,1)
    .hover( 
        function(){// mouse_over
            $(this).fadeTo(150, 0.5);
        },
        function(){// mouse_out
            $(this).fadeTo(300, 1);
        }
    );
});


$(document).ready(function() {
    $(".alhover").fadeTo(1,1)
    .hover( 
        function(){// mouse_over
            $(this).fadeTo(150, 0.5);
        },
        function(){// mouse_out
            $(this).fadeTo(300, 1);
        }
    );
});



// dropdown menu

$(document).ready(function() {
		$('#h-navi').droppy();
    $('#g-navi').droppy();
});



// Smooth Scroll

$(document).ready(function() {
	$('a[href*=#]:not(a[href*=#suisen],a[href*=#jiko-suisen],a[href*=#ippan],a[href*=#highschool],a[href*=#international],a[href*=#outside])').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this.hash);
			target = target.length && target;
			if (target.length) {
				var sclpos = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
});



// Place holder

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