// JavaScript Document

//¥¿¥Ö¥Ê¥Ó
/* tabIndex ~ Sean Catchpole - Version 2.2 - MIT/GPL */
(function(){var dep={"jQuery":"http://code.jquery.com/jquery-latest.min.js"};var init=function(){(function($){$.fn.tabIndex=function(){var s={};for(var i=0;i<arguments.length;++i){var a=arguments[i];switch(a.constructor){case Object:$.extend(s,a);break;case Boolean:s.change=a;break;case Number:s.start=a;break;case Function:s.click=a;break;case String:if(a.charAt(0)=='.')s.active=a;else if(a.charAt(0)=='!')s.event=a;else s.start=a;break;}}
if(typeof s['return']=="function")
s.change=s['return'];return this.each(function(){$.tabIndex(this,s);});}
$.tabIndex=function(tabs,options){var meta=($.metadata)?$(tabs).metadata():{};var s=$.extend({},$.tabIndex.settings,meta,options);if(s.active.charAt(0)=='.')s.active=s.active.substr(1);if(s.event.charAt(0)=='!')s.event=s.event.substr(1);if(s.start==null)s.start=-1;var showId=function(){if($(this).is('.'+s.active))
return s.change;var id="#"+this.href.split('#')[1];var aList=[];var idList=[];$("a",tabs).each(function(){if(this.href.match(/#/)){aList.push(this);idList.push("#"+this.href.split('#')[1]);}});if(s.click&&!s.click.apply(this,[id,idList,tabs,s]))return s.change;for(i in aList)$(aList[i]).removeClass(s.active);for(i in idList)$(idList[i]).hide();$(this).addClass(s.active);$(id).fadeIn(500);return s.change;}
var list=$("a[href*='#']",tabs).unbind(s.event,showId).bind(s.event,showId);list.each(function(){$("#"+this.href.split('#')[1]).hide();});var test=false;if((test=list.filter('.'+s.active)).length);else if(typeof s.start=="number"&&(test=list.eq(s.start)).length);else if(typeof s.start=="string"&&(test=list.filter("[href*='#"+s.start+"']")).length);if(test){test.removeClass(s.active);test.trigger(s.event);}
return s;}
$.tabIndex.settings={start:0,change:false,click:null,active:".active",event:"!click"};$.tabIndex.version="2.2";$(function(){$(".tabIndex").tabIndex();});})(jQuery);}
var check=function(o,s){s=s.split('.');while(o&&s.length)o=o[s.shift()];return o;}
var head=document.getElementsByTagName("head")[0];var add=function(url){var s=document.createElement("script");s.type="text/javascript";s.src=url;head.appendChild(s);}
var s=document.getElementsByTagName('script');var src=s[s.length-1].src;var ok=true;for(d in dep){if(check(this,d))continue;ok=false;add(dep[d]);}if(ok)return init();add(src);})();


$(document).ready(function(){
	$(".tab_01 a").click(function(){
		$("#tab").css({"background":"url(/index/img/tab_01.gif) no-repeat left top"})
	});
	$(".tab_02 a").click(function(){
		$("#tab").css({"background":"url(/index/img/tab_02.gif) no-repeat left top"})
	});
	$(".tab_03 a").click(function(){
		$("#tab").css({"background":"url(/index/img/tab_03.gif) no-repeat left top"})
	});
});
$(document).ready(function(){
	$(".tab_01_L a").click(function(){
		$("#tab2").css({"background":"url(/news/img/tab_L_01.gif) no-repeat left top"})
	});
	$(".tab_02_L a").click(function(){
		$("#tab2").css({"background":"url(/news/img/tab_L_02.gif) no-repeat left top"})
	});
	$(".tab_03_L a").click(function(){
		$("#tab2").css({"background":"url(/news/img/tab_L_03.gif) no-repeat left top"})
	});
});

$.fn.slideScroll = function(options){
	
	var c = $.extend({
		interval: 18,
		easing: 2, 
		comeLink: false
	},options);
	var d = document;
	
	var timer;
	var pos;
	
	function currentPoint(){
		var current = {
			x: d.body.scrollLeft || d.documentElement.scrollLeft,
			y: d.body.scrollTop || d.documentElement.scrollTop
		}
		return current;
	}
	
	function setPoint(){
		
		var h = d.documentElement.clientHeight;
		var w = d.documentElement.clientWidth;
		
		var maxH = d.documentElement.scrollHeight;
		var maxW = d.documentElement.scrollWidth;
		
		pos.top = ((maxH-h)<pos.top && pos.top<maxH) ? maxH-h : pos.top;
		pos.left = ((maxW-w)<pos.left && pos.left<maxW) ? maxW-w : pos.left;
	}
	
	function nextPoint(){
		var x = currentPoint().x;
		var y = currentPoint().y;
		var sx = Math.ceil((x - pos.left)/(4*c.easing));
		var sy = Math.ceil((y - pos.top)/(4*c.easing));
		var next = {
			x: x - sx,
			y: y - sy,
			ax: sx,
			ay: sy
		}
		return next;
	}
	
	function scroll(href){
		var movedHash = href;
		timer = setInterval(function(){
			nextPoint();
			
			if(Math.abs(nextPoint().ax)<1 && Math.abs(nextPoint().ay)<1){
				clearInterval(timer);
				window.scroll(pos.left,pos.top);
				location.href = movedHash;
			}
			window.scroll(nextPoint().x,nextPoint().y);
		},c.interval);
	}
	
	function comeLink(){
		if(location.hash){
			if($(location.hash) && $(location.hash).length>0){
				pos = $(location.hash).offset();
				setPoint();
				window.scroll(0,0);
				if($.browser.msie){
					setTimeout(function(){
						scroll(location.hash);
					},50);
				}else{
					scroll(location.hash);
				}
			}
		}
	}
	if(c.comeLink) comeLink();
	
	$(this).each(function(){
		if(this.hash && $(this.hash).length>0 
			&& this.href.match(new RegExp(location.href.split("#")[0]))){
			var hash = this.hash;
			$(this).click(function(){
								   				
				pos = $(hash).offset();
				
				clearInterval(timer);
				
				setPoint();
				scroll(this.href);
				return false;
			});
		}
	});
}
$(function(){
	$("a[href*='#']").filter(function(){
		return !$(this).parent().parent().parent().hasClass("tabIndex");
		})
	.slideScroll();
});


function initRollovers() {
	if (!document.getElementById) return
	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');
	for (var i = 0; i < aImages.length; i++) {		
		if (aImages[i].className == 'ro') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, '_o'+ftype);
			aImages[i].setAttribute('hsrc', hsrc);
			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;
			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}	
			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_o'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}
window.onload = initRollovers;

 $(document).ready(function(){
$(".NewsContent #NEWS dl:last,#INFO dl:last,.IRNews dl:last").addClass("last");
});


$(function() {
	$(".popup").click(function(){
		window.open(this.href, "WindowName","width=980,height=800,resizable=no,scrollbars=yes");
		return false;
	});
	$(".popupMap").click(function(){
		window.open(this.href, "WindowName","width=750,height=750,resizable=no,scrollbars=yes");
		return false;
	});
	$(".popupStock").click(function(){
		window.open(this.href, "WindowName","width=520,height=500,resizable=yes,scrollbars=yes");
		return false;
	});
});

