/*
 * yuga.js 0.7.0 - 優雅なWeb制作のためのJS
 *
 * Copyright (c) 2007 Kyosuke Nakamura (kyosuke.jp)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Since:     2006-10-30
 * Modified:  2008-12-26
 *
 * jQuery 1.2.6
 * ThickBox 3.1
 */
(function(a){a(function(){a.yuga.rollover();a.yuga.scroll();a.yuga.tab()});a.yuga={Uri:function(f){var c=this;this.originalPath=f;this.absolutePath=(function(){var g=document.createElement("span");g.innerHTML='<a href="'+f+'" />';return g.firstChild.href})();var b={schema:2,username:5,password:6,host:7,path:9,query:10,fragment:11};var d=/^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath);for(var e in b){this[e]=d[b[e]]}this.querys={};if(this.query){a.each(c.query.split("&"),function(){var g=this.split("=");if(g.length==2){c.querys[g[0]]=g[1]}})}},rollover:function(d){var h=a.extend({hoverSelector:".btn, .allbtn img",groupSelector:".btngroup",postfix:"_on"},d);var g=a(h.hoverSelector).filter(e);g.each(function(){this.originalSrc=a(this).attr("src");this.rolloverSrc=this.originalSrc.replace(new RegExp("("+h.postfix+")?(.gif|.jpg|.png)$"),h.postfix+"$2");this.rolloverImg=new Image;this.rolloverImg.src=this.rolloverSrc});var b=a(h.groupSelector).find("img").filter(f);g.not(b).hover(function(){a(this).attr("src",this.rolloverSrc)},function(){a(this).attr("src",this.originalSrc)});a(h.groupSelector).hover(function(){a(this).find("img").filter(f).each(function(){a(this).attr("src",this.rolloverSrc)})},function(){a(this).find("img").filter(f).each(function(){a(this).attr("src",this.originalSrc)})});function e(c){return Boolean(!this.currentSrc)}function f(c){return Boolean(this.rolloverSrc)}},scroll:function(c){var b=(function(){var k=a.extend({easing:100,step:30,fps:60},c);k.ms=Math.floor(1000/k.fps);var d;var j={stepCount:0,startY:0,endY:0,lastY:0};function f(){if(j.stepCount==k.step){window.scrollTo(i(),j.endY)}else{if(j.lastY==g()){j.stepCount++;window.scrollTo(i(),e());j.lastY=e();d=setTimeout(f,k.ms)}}}function g(){return document.body.scrollTop||document.documentElement.scrollTop}function i(){return document.body.scrollLeft||document.documentElement.scrollLeft}function e(){return Math.floor(h(j.startY,j.endY,j.stepCount,k.step,k.easing))}function h(q,l,p,n,o){var m=p/n;return(l-q)*(m+o/(100*Math.PI)*Math.sin(Math.PI*m))+q}return{set:function(l){this.stop();if(l.startY==undefined){l.startY=g()}j=a.extend(j,l);j.lastY=j.startY;d=setTimeout(f,k.ms)},stop:function(){clearTimeout(d);j.stepCount=0}}})();a("a[href^=#], area[href^=#]").not("a[href=#], area[href=#]").each(function(){this.hrefdata=new a.yuga.Uri(this.getAttribute("href"))}).click(function(){var d=a("#"+this.hrefdata.fragment);if(d.length){b.set({endY:d.offset().top});return false}})},tab:function(b){var d=a.extend({tabNavSelector:".tabNav",activeTabClass:"active"},b);a(d.tabNavSelector).each(function(){var c=a(this).find("a[href^=#], area[href^=#]");var e;c.each(function(){this.hrefdata=new a.yuga.Uri(this.getAttribute("href"));var f="#"+this.hrefdata.fragment;if(e){e=e.add(f)}else{e=a(f)}a(this).unbind("click");a(this).click(function(){c.removeClass(d.activeTabClass);a(this).addClass(d.activeTabClass);e.hide();a(f).hide().fadeIn("slow");a.cookie("tabs",a(this).parents()[1].id,{expires:1,path:"/"});return false})});e.hide();if(a.cookie("tabs")==null){c.filter(":first").trigger("click")}})}}})(jQuery);