$(function() {
	// GlobalNavigation	
		$("#ski-bus li#g_navi_ski-bus img").attr({"src":"/white/common/img/header/g_navi_01_on.png"});
		$("#rental li#g_navi_rental img").attr({"src":"/white/common/img/header/g_navi_02_on.png"});
		$("#asahiyama li#g_navi_asahiyama img").attr({"src":"/white/common/img/header/g_navi_03_on.png"});
		$("#taxi li#g_navi_taxi img").attr({"src":"/white/common/img/header/g_navi_04_on.png"});
		$("#bus-charter li#g_navi_bus-chater img").attr({"src":"/white/common/img/header/g_navi_05_on.png"});
});



$(function() {
	//smartRollover
	var imgCount = 0;
	var images_pre = new Array();
	$('img[src*="_off."],input[src*="_off."]').each (function(){
		images_pre[imgCount] = new Image();
		images_pre[imgCount].src = $(this).attr("src").replace("_off.", "_on.");
		$(this).hover(
			function () {
				$(this).attr("src", $(this).attr("src").replace("_off.", "_on."));
			},
			function () {
				$(this).attr("src", $(this).attr("src").replace("_on.", "_off."));
			}
		);
		imgCount ++;
	});
		
		
// opacity Rollover
	if($.browser.msie){
		}else{
    	$('img[src*="_op."],input[src*="_op."]').hover(
			function () {
				$(this).css('opacity', 0.6);
			},
			function () {
				$(this).css('opacity', 1);
			}
		);
	}

// smoothScroll
	$('a[href^="#"], a[href^="' + location.pathname + '#"]').each (function(){
		var hash = this.hash;
		if(hash.length > 1 && !this['rel']){
			$(this).click(function() {
				smoothScroll(hash);
				return false;
			})
		}
	});
	
// areaNavigation
// bookingHere
	$("li[id^='bg']").hover(function(){
        $("img.hide",this).fadeTo(300,0);
    },
    function(){
        $("img.hide",this).fadeTo(300,1);
    });
	
	
	$(function() {
    	$('#area_navi').droppy();
    	$('#bookhere').droppy();
  	});
	$('#bookhere').mouseenter(function(){
        $(this).css("z-index", 30);
    },
	function(){
			$(this).css("z-index", 10);
		    });
	});


function smoothScroll(hash) {
	var target = $(hash).offset().top;

	$(($.browser.safari) ? 'body' : 'html')
		.animate({scrollTop: target >= 15 ? target - 15 : target}, 600, 'swing', function(){$(this).unbind("mousewheel DOMMouseScroll");})
		.bind("mousewheel DOMMouseScroll",function(){
			$(this).queue([]).stop();
			$(this).unbind("mousewheel DOMMouseScroll");
		});
};

(function($) {

	$(function() {
		$.css3.stripe();
		$.css3.css3class();
	});

	//---------------------------------------------------------------------

	$.css3 = {
		//奇数、偶数を自動追加
		stripe: function(options) {
			var c = $.extend({
				oddClass:'odd',
				evenClass:'even'
			}, options);
			$('ul, ol').each(function(){
				//JSでは0から数えるのでevenとaddを逆に指定
				$(this).children('li:odd').addClass(c.evenClass);
				$(this).children('li:even').addClass(c.oddClass);
			});
			$('#plan').each(function(){
				$(this).children('dl:odd').addClass(c.evenClass);
				$(this).children('dl:even').addClass(c.oddClass);
			});
		},
		//css3のクラスを追加
		css3class: function() {
			//:first-child, :last-childをクラスとして追加
			$('body :first-child').addClass('firstChild');
			$('body :last-child').addClass('lastChild');
			//css3の:emptyをクラスとして追加
			$('body :empty').addClass('empty');
		}
	};
})(jQuery);
