// retioSlider v0.4 - simple box slider based on jQuery
// Copyright (c) 2011 Mateusz Lerczak - kiki.diavo@gmail.com
// http://mateuszlerczak.com/retioslider/
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

(function(a){a.fn.retioSlider=function(f){var t=jQuery.extend({action:"hover",direction:"left",openLenght:0,closeLenght:0,openTime:500,closeTime:500,startOpacity:0.75,openOpacity:1,closeOpacity:0.75,type:"slider"},f);var o=a(this);var u=a(this).children(".slider-content");var s=a(this).children(".slider-logo");var h=(t.type=="slider")?s.children():s.children().children();var p=jQuery.browser.msie;var i=t.direction;var k=t.openLenght;var r=t.closeLenght;var c=t.openTime;var l=t.closeTime;var m=t.openOpacity;var n=t.closeOpacity;var e=t.startOpacity;var q=t.action;var g={};var j={};var b={};o.addClass("slider-"+i);switch(i){case"left":case"right":if(t.type=="slider"){u.addClass("slider-float-"+i);r=-(o.width()+1)}break;case"top":case"bottom":if(t.type=="slider"){r=-(o.height()+1)}break}if(h.width()&&h.height()){var d=(-h.width()+"px");var v=(-h.height()+"px");switch(i){case"left":s.css("right",d);break;case"right":s.css("left",d);break;case"top":s.css("bottom",v);break;case"bottom":s.css("top",v);break}}switch(i){case"left":case"right":if(t.logoPosition>=0){s.css("top",t.logoPosition+"px")}break;case"top":case"bottom":if(t.logoPosition>=0){s.css("left",t.logoPosition+"px")}break}if(!p){b.opacity=e;g.opacity=m;j.opacity=n}if(t.type=="slider"){g[i]=k;j[i]=r}switch(i){case"left":case"right":if(t.topPosition>=0){b.top=t.topPosition+"px"}break;case"top":case"bottom":if(t.leftPosition>=0){b.left=t.leftPosition+"px"}break}b[i]=r;a(this).css(b);s.bind({click:function(){o.toggleClass("slider-clicked");if(o.hasClass("slider-clicked")){o.stop().animate(g,c)}else{o.stop().animate(j,l)}}});o.bind({mouseenter:function(){o.stop().animate(g,c)},mouseleave:function(){o.stop().animate(j,l)}});switch(q){case"click":o.unbind("mouseenter");o.unbind("mouseleave");break;case"hover":s.unbind("click");break}o.show();return this}})(jQuery);
