(function(n){n.fn.kinMaxShow=function(t){var u={height:400,intervalTime:6,switchTime:1e3,hoverPause:!0,easing:"linear",imageAlign:"center center",button:{switchEvent:"click",showIndex:!1,normal:{width:"5px",height:"5px",lineHeight:"5px",right:"150px",bottom:"50px",fontSize:"10px",background:"#000",textAlign:"center",marginRight:"8px",fontFamily:"Verdana",float:"left"},focus:{background:"url(../images/icon_p.png)"}},callback:function(){}},r;if(options=jQuery.extend(!0,{},u,t),r={},r.selector=n(this).selector,n(this).length>1)return n.error("kinMaxShow error[More than one selected object]"),!1;r.self=this;r.index=0;r.lindex=0;r.size=n(r.self).children("div").size();r.prename="KMSPrefix_"+r.selector.replace(/\W/ig,"")+"_";r.data={};r.fn={};r.onload=function(){n(r.self).css({width:"100%",height:options.height,overflow:"hidden",position:"relative"}).children("div").addClass(r.prename+"image_item").hide();r.init()};r.init=function(){r.setLayout();r.setAnimate()};r.setLayout=function(){if(n(r.self).children("div").wrapAll('<div class="'+r.prename+'image_box"><\/div>'),n("."+r.prename+"image_item",r.self).each(function(){var t=n(this).children("a"),i,u;t.length?(i=t.children("img").attr("src"),u=t.children("img").attr("title"),t.children("img").remove(),t.addClass(r.prename+"coverlink")):(i=n(this).children("img").attr("src"),u=n(this).children("img").attr("title"),n(this).children("img").remove());n(this).css({background:"url("+i+") no-repeat "+options.imageAlign,"z-index":1});n(this).attr("title",u)}),n("."+r.prename+"image_item",r.self).eq(0).css("z-index","2"),options.button.normal.display!="none"){var t="";for(i=1;i<=r.size;i++)t+=options.button.showIndex?"<li>"+i+"<\/li>":"<li> <\/li>";n(r.self).append('<ul class="'+r.prename+'button">'+t+"<\/ul>");n("."+r.prename+"button li",r.self).eq(0).addClass(r.prename+"focus")}r.setCSS();n("."+r.prename+"image_item:gt(0)",r.self).css("z-index",1).css({opacity:0});n("."+r.prename+"image_item",r.self).show();n(r.self).css({overflow:"visible",visibility:"visible",display:"block"})};r.setCSS=function(){var t='<style type="text/css">';t+=r.selector+" *{ margin:0;padding:0;} ";t+=r.selector+" ."+r.prename+"image_box{width:100%;height:"+parseInt(options.height)+"px;position:relative;z-index:1;} ";t+=r.selector+" ."+r.prename+"image_box ."+r.prename+"image_item{width:100%;height:"+parseInt(options.height)+"px;position:absolute;overflow:hidden;} ";t+=r.selector+" ."+r.prename+"image_box ."+r.prename+"image_item a."+r.prename+"coverlink{width:100%;height:"+parseInt(options.height)+"px;display:block;text-decoration:none;padding:0;margin:0;background:transparent;text-indent:0;outline:none;hide-focus:expression(this.hideFocus=true);} ";options.button.normal.display!="none"&&(t+=r.selector+" ."+r.prename+"button{"+r.fn.objToCss(options.button.normal,["top","right","bottom","left"],!0)+";position:absolute;list-style:none;z-index:2;overflow:hidden;_zoom:1;}",t+=r.selector+" ."+r.prename+"button li{"+r.fn.objToCss(options.button.normal,["top","right","bottom","left"])+";cursor:pointer;-webkit-text-size-adjust:none;}",t+=r.selector+" ."+r.prename+"button li."+r.prename+"focus{"+r.fn.objToCss(options.button.focus,["top","right","bottom","left"])+";cursor:default;}");t+="<\/style>";n(r.self).prepend(t)};r.setAnimate=function(){options.callback.call(n("."+r.prename+"image_item:eq("+r.index+")",r.self),r.index,"fadeIn");var t;n("."+r.prename+"button",r.self).delegate("li",options.button.switchEvent,function(){function i(){r.index=n(_this).index();r.setOpacity()}_this=this;options.button.switchEvent=="mouseover"?t=setTimeout(i,200):i()});options.button.switchEvent=="mouseover"&&n("."+r.prename+"button",r.self).delegate("li","mouseout",function(){clearTimeout(t)});r.index=1;r.lindex=0;r.data.moveTimer=setInterval(r.setOpacity,options.intervalTime*1e3+options.switchTime);options.hoverPause&&n(r.self).hover(function(){clearInterval(r.data.moveTimer)},function(){r.data.moveTimer=setInterval(r.setOpacity,options.intervalTime*1e3+options.switchTime)})};r.setOpacity=function(){r.size>1&&(options.callback.call(n("."+r.prename+"image_item:eq("+r.lindex+")",r.self),r.lindex,"fadeOut"),options.button.normal.display!="none"&&(n("ul."+r.prename+"button li",r.self).removeClass(r.prename+"focus"),n("ul."+r.prename+"button li",r.self).eq(r.index).addClass(r.prename+"focus")),n("."+r.prename+"image_item:animated",r.self).stop(!0,!1),n("."+r.prename+"image_item",r.self).css("z-index",1),n("."+r.prename+"image_item",r.self).eq(r.index).css({opacity:0,"z-index":2}),n("."+r.prename+"image_item",r.self).eq(r.index).animate({opacity:1},options.switchTime,options.easing,function(){n("."+r.prename+"image_box ."+r.prename+"image_item:not(:eq("+r.index+"))",r.self).css({opacity:0});options.callback.call(n("."+r.prename+"image_item:eq("+r.index+")",r.self),r.index,"fadeIn");r.lindex=r.index;r.index==r.size-1?r.index=0:r.index++}))};r.run=function(){r.onload()};r.fn.objToCss=function(t,i,r){function o(n){return"-"+n.toLowerCase()}var e,f,u;if(r=r?!0:!1,e=navigator.userAgent.indexOf("MSIE")!=-1,f="",r)for(u in t)n.inArray(u,i)!=-1&&(pKey=u.replace(/([A-Z])/,o),f+=pKey=="opacity"&&e?"filter:alpha(opacity="+t[u]*100+");":pKey+":"+t[u]+";");else for(u in t)n.isArray(i)?n.inArray(u,i)==-1&&(pKey=u.replace(/([A-Z])/,o),f+=pKey=="opacity"&&e?"filter:alpha(opacity="+t[u]*100+");":pKey+":"+t[u]+";"):(pKey=u.replace(/([A-Z])/,o),f+=pKey=="opacity"&&e?"filter:alpha(opacity="+t[u]*100+");":pKey+":"+t[u]+";");return f};r.run()}})(jQuery)