/*
 * trimmedScroll - jQuery plugin
 *
 * Author Koji Kimura @ STARRYWORKS inc.
 * http://www.starryworks.co.jp/
 *
 * Licensed under the MIT License
 *
 */
 
 
/*SimpleLib*/
  var SimpleLib=SimpleLib||{},SimpleLibSettings=SimpleLibSettings||{};
SimpleLib=$.extend(true,{debug:false,jsDir:$("script[src*='trimmedScroll.js'],script[src*='trimmedScroll.js']").attr("src").replace(/simplelib\.js.*?$/,""),containsInArray:function(a,c){for(var b in c)if(c.hasOwnProperty(b)&&c[b]===a)return true;return false},queryToArray:function(a){var c=[];a=String(a).split("?");if(!a||a.length<2||!a[1])return c;a=String(a[1]).split(",");$.each(a,function(){this&&c.push(String(this))});return c},isIE:function(){return navigator.userAgent.indexOf("MSIE")!=-1},isIE6:function(){return ('\v'=='v')},loadCSS:function(a){SimpleLib.isIE()?
document.createStyleSheet(a):$("head").append('<link rel="stylesheet" type="text/css" href="'+a+'" />')},loadJS:function(a){$.ajax({type:"GET",url:a,dataType:"script",success:function(){},error:SimpleLib._onLoadError})},init:function(a,c){if(a){c=c||{};if(SimpleLib.jsDir=="")SimpleLib.jsDir="./";var b,d,e=a.length;for(b=0;b<e;b++)if(!(a[b].substr(0,3)=="ie6"&&!SimpleLib.isIE6()&&!SimpleLib.debug)){d=c[a[b]]||{};SimpleLib[a[b]]=SimpleLib[a[b]]||{};if(SimpleLib[a[b]].settings)d=$.extend(SimpleLib[a[b]].settings,
d);SimpleLib[a[b]].settings=d;if(!SimpleLib[a[b]]||!SimpleLib[a[b]].init)SimpleLib._load(a[b])}}},_load:function(a){SimpleLib.loadJS(SimpleLib.jsDir+"plugins/"+a+".js")},_onLoadError:function(){SimpleLib.debug&&alert("Load error.")},setup:function(){var a=SimpleLib.queryToArray($("script[src*='trimmedScroll.js']").attr("src"));a.length&&SimpleLib.init(a,SimpleLibSettings)},extend:function(a,c){if(typeof SimpleLib[a]=="undefined")SimpleLib[a]={};SimpleLib[a]=$.extend(true,c,SimpleLib[a]);typeof SimpleLib[a].init==
"function"&&SimpleLib[a].init()}},SimpleLib);

SimpleLib.setup();
/*SimpleLibここまで*/






/*trimedここから*/
(function(b){b.fn.trimmedScroll=function(h){var d=b.extend(true,{scrollTimePerPixcel:40,fadeTime:1E3,scrollImgClass:"scroll",scrollImgPostfix:"-scroll"},h);b(this).each(function(){var a=b(this).find("img");if(a.length){var f=a.attr("src");if(d.scrollImgAttribute){f=b(this).attr(d.scrollImgAttribute);b(this).attr(d.scrollImgAttribute,"")}else f=f.replace(/(\.[^\.]+)$/,d.scrollImgPostfix+"$1");a.width();a.height();var c=b('<span style="display:block;position:absolute;margin:0px;padding:0px;overflow:hidden"></span>').prependTo(a.parent()),
e=b('<img style="margin:0px;padding:0px;border:none;" />').attr("src",f).addClass(d.scrollImgClass).appendTo(c);b("<img />").attr("src",f);c.hide();b(this).css("cursor","pointer");b(this).hover(function(){if(c.css("display")=="none"){e.css({marginTop:"0"});c.animate({opacity:0},0)}c.css("left",a.offset().left+"px");c.css("top",a.offset().top+"px");c.width(a.attr("width")?parseInt(a.attr("width")):a.width());c.height(a.attr("height")?parseInt(a.attr("height")):a.height());c.stop().show().animate({opacity:1},
d.fadeTime);e.css("width","auto").css("height","auto");var g=a.height()-e.height();e.css("margin-top",0);var i=(g-parseInt(e.css("margin-top")))*d.scrollTimePerPixcel*-1;if(e.css("margin-top")==g+"px")g=0;e.stop().animate({marginTop:g},i,"linear")},function(){e.queue([]).stop();c.stop().animate({opacity:0},d.fadeTime,function(){b(this).hide()})})}});return this}})(jQuery);

/* SimpleLib Plugin */
SimpleLib&&SimpleLib.extend("trimmedScroll",{settings:{selector:".trimmedScroll"},init:function(){$(function(){$(SimpleLib.trimmedScroll.settings.selector).trimmedScroll(SimpleLib.trimmedScroll.settings)})}});
