jQuery(document).ready(function(){

	// table hover background color change.
	jQuery(function(){
		jQuery('.basicTable table tbody tr').hover(function(){
			jQuery(this).addClass("select");
		},function(){
			jQuery(this).removeClass("select");
		});
	});
	
	// open new window
	jQuery(function() {
		jQuery('a[href^="http://"]').not('a[href^="http://jigsaw.w3.org/"]').not('a[href^="http://validator.w3.org/"]').click(function() {
			if (!(location.hostname == this.hostname)) {
				this.target = "_blank";
				//window.open(this.href, '');
				//return false;
			}
		});
		jQuery('a[href$=.pdf]').click(function() {
			window.open(this.href, '');
			return false;
		});
		jQuery('a[href^="blog/"]', 'a[href^="../blog"]').click(function() {
			window.open(this.href, '');
			return false;
		});
	});

	// easing
	jQuery(function() {
		jQuery('area[href*=#], a[href*=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
				var target = jQuery(this.hash);
				target = target.length && target;

				//もし、class="select"があれば削除、リンク先の要素にclass="select"を入れる
				/*
				if( jQuery('#serviceStationList div ol li').hasClass("select") ) {
					jQuery('#serviceStationList div ol li').removeClass("select");
				}
				jQuery(target).addClass("select");
				*/

				if (target.length) {
					var sclpos = 6;	//スクロール後のtopからの距離　初期値：30
					var scldurat = 2400;	//スクロールスピードの調整ミリ秒　初期値：1200
					var targetOffset = target.offset().top - sclpos;
					//jQuery('html,body')
					jQuery(jQuery.browser.opera ? jQuery.support.boxModel == false ? 'body' : 'html' :'html,body')
						.animate({scrollTop: targetOffset});
					return false;
				}
			}
		});
	});

	// web catalog image change
	jQuery(function(){
		jQuery(".catNavi li").click(function(){
			if( jQuery('.catNavi li').hasClass("select") ) {
				jQuery('.catNavi li').removeClass("select");
			}
			jQuery(this).addClass("select")
			
			jQuery("#main img").attr("src",jQuery(".catNavi li.select a").attr("href"));
			return false;
		});
	});
	
	//blink
	(function(){
		var func = arguments.callee;
		jQuery(".blink, .blink0, .blink1, .blink2").fadeTo(750,(func.b = !!!func.b) ? 0.1 : 1,func);
	})();

});
