/* ---

R-co.ltd
jquery1.4 common file.

--------------------------------------- */

/* ---

--------------------------------------- */

$(document).ready(function(){

	// table hover background color change.
	$(function(){
		$('.basicTable table tbody tr').hover(function(){
			$(this).addClass("select");
		},function(){
			$(this).removeClass("select");
		});
	});

	// open new window.
	$(function() {
		$('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;
			}
		});
		$('a[href^="../pdf"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="pdf/"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="../blog"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="blog/"]').click(function() {
			window.open(this.href, '');
			return false;
		});
		$('a[href^="../nzoom"]').click(function() {
			window.open(this.href, '');
			return false;
		});
	});

	// easing
	$(function() {
		$('area[href*=#], a[href*=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
				var target = $(this.hash);
				target = target.length && target;

				if( $('#serviceStationList div ol li').hasClass("select") ) {
					$('#serviceStationList div ol li').removeClass("select");
				}
				$(target).addClass("select");

				if (target.length) {
					var sclpos = 24;
					var scldurat = 2400;
					var targetOffset = target.offset().top - sclpos;
					//$('html,body')
					$($.browser.opera ? $.support.boxModel == false ? 'body' : 'html' :'html,body')
						.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
					return false;
				}
			}
		});
	});

	// web catalog image change
	$(document).ready(function(){
		$(function(){
			$(".catNavi li").click(function(){
				if( $('.catNavi li').hasClass("select") ) {
					$('.catNavi li').removeClass("select");
				}
				$(this).addClass("select")
				
				$("#main img").attr("src",$(".catNavi li.select a").attr("href"));
				return false;
			});
		});
	});
	
	//lightBOX
	if( $('#OSS6thAnniversaryImage').size() > 0 ) {
		$(function() {
			$('#OSS6thAnniversaryImage a').lightBox();
		});
	};

});