// JavaScript Document<script type="text/javascript">

jQuery.event.add(window, "load", function(){
/* ここに処理を書く

　デザインはCSSで整えます。注意点は、パネルを設定しているdd要素にpaddingとmarginを設定しないことです。パネル開閉のアニメーションではdd要素のCSSプロパティを変更するため、paddingやmarginを設定しているとパネル内の文字の位置がずれてしまいます。余白を取りたい場合は、dd要素の内側の要素（p要素）にpaddingやmarginを設定しましょう。

http://ascii.jp/elem/000/000/466/466410/

*/
	$("#typ dd").not(".proc_now").css("display","none");
	
    $("#typ dt").click(function(){
		// alert("hello");
        if($("+dd",this).css("display")=="none"){
            $("dd").slideUp("slow");
            $("+dd",this).slideDown("slow");
        }
    });
 });

/* CSSハック用 */
/* ----------------------------------------------------- */
var css_browser_selector = function() {
	var 
		ua=navigator.userAgent.toLowerCase(),
		is=function(t){ return ua.indexOf(t) != -1; },
		h=document.getElementsByTagName('html')[0],
		b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('gecko/')? 'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',
		os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';
	var c=b+os+' js';
	h.className += h.className?' '+c:c;
}();

/* ----------------------------------------------------- */
/* jquery ロード*/
/* ----------------------------------------------------- */
$(function(){

	/* aタグクリック時の枠線無効に */
	/* ----------------------------------------------------- */
	$('a').focus(
		function(){
		this.blur();
	});

	/* 関数Call */
	/* ----------------------------------------------------- */
	
	
	/* ロールオーバー */
	/* ----------------------------------------------------- */
	$('img.over').not('[src*="-o."]').hover(function()
	{
		Rollover($(this),$(this).attr('src'));	
	},function() {
		Rollover($(this),$(this).attr('src'));	
	});	

	/* ページ内スクロール */
	/* ----------------------------------------------------- */
  $('a[href^=#]').click(function(event) {
    var hash = this.hash;
		if(hash!==''){
			var tarPosition = $(hash).offset().top;
			if(undefined !== window.opera && "function" === typeof window.opera.version){ // opera
				$('html').animate({scrollTop: tarPosition}, 400, 'easeOutQuad'); 
			}
			else{
				$('html, body').animate({scrollTop: tarPosition}, 400, 'easeOutQuad');
			}
			return false;
		}
  });

	/* addclass */
	/* ----------------------------------------------------- */
	/*$('#gnav li:last-child').addClass('last-c');*/

});

/* ----------------------------------------------------- */
/*　ページ内スクロール用　*/
/* ----------------------------------------------------- */
jQuery.easing.easeOutQuad = function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
};

/* ----------------------------------------------------- */
/*　ロールオーバー　*/
/* ----------------------------------------------------- */
var Rollover = function(obj,thisSrc) {
	/* 変数宣言 */
	var sTempSrc = thisSrc;
	var ftype = thisSrc.substring(thisSrc.lastIndexOf('.'), thisSrc.length);
	var hsrc = thisSrc.replace(ftype, '-o'+ftype);	
	var aPreLoad = new Image();

	/* プリロード */
	aPreLoad.src = hsrc;

	re = new RegExp('-o');
	
	if(!sTempSrc.match(re)){
		$(obj).attr('src', hsrc);
	}
	
	if (sTempSrc.match(re)) {
		sTempSrc = $(obj).attr('src').replace('-o'+ftype, ftype);
		$(obj).attr('src', sTempSrc);
	}
}
