/*
 update 2009.04.01
 H.Nishioka
*/


/*
別ウィンドウリンク指定
<a href="target.html" onclick="return openNewWindow(this);">target</a> 
*/
function blankWin(el) { 
	window.open(el.href); 
	return false; 
} 


/*rollover*/
function imgRollOver() {
	if(document.getElementsByTagName) {
	var images = document.getElementsByTagName("img");
	for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_out.")){
				images[i].onmouseover = function() {this.setAttribute("src", this.getAttribute("src").replace("_out.", "_over."));}
				images[i].onmouseout = function() {this.setAttribute("src", this.getAttribute("src").replace("_over.", "_out."));}
			}
		}
	}
}
if(window.addEventListener) {window.addEventListener("load", imgRollOver, false);}
else if(window.attachEvent) {window.attachEvent("onload", imgRollOver);}



/*ポップアップメニュー*/


jQuery.noConflict();
var j$ = jQuery;


// jQuery drop down menu
var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open() {
    jsddm_canceltimer();
    jsddm_close();
    ddmenuitem = j$(this).find('ul').css('visibility', 'visible');
}

function jsddm_close() {
    if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');
}

function jsddm_timer() {
    closetimer = window.setTimeout(jsddm_close, timeout);
}

function jsddm_canceltimer() {
    if(closetimer) {
        window.clearTimeout(closetimer);
        closetimer = null;
    }
}

j$(document).ready(function() {
    j$('#jsddm > li').bind('mouseover', jsddm_open)
    j$('#jsddm > li').bind('mouseout',  jsddm_timer)
});

document.onclick = jsddm_close;



/*--------------------------------------------------------------------------
 *  Smooth Scroller Script, version 1.0.1
 *  (c) 2007 Dezinerfolio Inc. <midart@gmail.com>
 *
 *  For details, please check the website : http://dezinerfolio.com/
 *
 *  Modified by revulo : http://www.revulo.com/
 *              rocky  : http://ht07.com/division/pukiwiki/
/*--------------------------------------------------------------------------*/

Scroller = {
	// control the speed of the scroller.
	// dont change it here directly, please use Scroller.speed=50;
	speed:7,

	// returns the Y position of the div
	gy: function (d) {
		gy = d.offsetTop
		if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop
		return gy
	},

	// returns the current scroll position
	scrollTop: function (){
		body=document.body
		d=document.documentElement
		if (body && body.scrollTop) return body.scrollTop
		if (d && d.scrollTop) return d.scrollTop
		if (window.pageYOffset) return window.pageYOffset
		return 0
	},

	// attach an event for an element
	// (element, type, function)
	add: function(event, body, d) {
		if (event.addEventListener) return event.addEventListener(body, d,false)
		if (event.attachEvent) return event.attachEvent('on'+body, d)
	},

	// kill an event of an element
	end: function(e){
		if (window.event) {
			window.event.cancelBubble = true
			window.event.returnValue = false
	  		return;
		}
		if (e.preventDefault && e.stopPropagation) {
		  e.preventDefault()
		  e.stopPropagation()
		}
	},
	
	// move the scroll bar to the particular div.
	scroll: function(d){
		i = window.innerHeight || document.documentElement.clientHeight;
		h=document.body.scrollHeight;
		a = Scroller.scrollTop()
		if (d>a) {
			if (d>h-i) d = h-i;
			a += Math.ceil((d-a)/Scroller.speed);
		}
		else
			a = a+(d-a)/Scroller.speed;
		window.scrollTo(0,a)
	  	if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval)
	  	Scroller.offsetTop=a
	},
	// initializer that adds the renderer to the onload function of the window
	init: function(){
		Scroller.add(window,'load', Scroller.render)
	},

	// this method extracts all the anchors and validates then as # and attaches the events.
	render: function(){
		a = document.getElementsByTagName('a');
		Scroller.end(this);
		window.onscroll
		for (i=0;i<a.length;i++) {
			l = a[i];
			p1 = l.href.replace(/#.*/, "");
			p2 = location.href.replace(/#.*/, "");
			if(l.href && l.href.indexOf('#') != -1 && ((p1==p2) || ('/'+p1==p2)) ){
				Scroller.add(l,'click',Scroller.end)
				l.onclick = function(){
					Scroller.end(this);
					l=this.hash.substr(1);
					a = document.getElementById(l);
					if (a) {
						clearInterval(Scroller.interval);
						Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(a)+')',10);
					}
				}
			}
		}
	}
}
// invoke the initializer of the scroller
Scroller.init();



/*------------------------------------------------------------
 *						END OF CODE
/*-----------------------------------------------------------*/





