/**
 * jQuery Slidy - A Transition Plugin - http://wbotelhos.com/slidy
 * 
 * @author	Washington Botelho dos Santos
 * @twitter @wbotelhos
 * 
 * Licensed under The MIT License
 * http://opensource.org/licenses/mit-license.php
 * 
 */

(function(b){b.fn.slidy=function(r){var e=b.extend({},b.fn.slidy.defaults,r);if(this.length==0){a("Invalid selector!");return;}else{if(this.length>1){return this.each(function(){b.fn.slidy.apply(b(this),[r]);});}}$global=b(this);$global.css({cursor:e.cursor,height:e.height+"px",overflow:"hidden",position:"relative",width:e.width+"px"});var n=$global.children(e.children),h=$global,k=0,f=false;n.each(function(v){b(this).css({position:"absolute","z-index":n.length-v}).attr("id",$global.attr("id")+"-"+(v+1)).hide();});$global.find("img").attr({height:e.height,width:e.width});if(e.children=="a"&&e.target!=""){n.attr("target",e.target);}n.first().show().end().find("img").css("border","0");q(n,e,0);var p=function(){var x=b(this),v,w;clearTimeout(k);if(x.is("li")){v=x.index();w=x.parent().children(".slidy-link-selected").index();}else{v=h.next("ul").children(".slidy-link-selected").index();w=v;}if(v!=w){x.addClass("slidy-link-selected").parent().children().eq(w).removeClass("slidy-link-selected");j(n,e,v,w);}},g=function(){var v=h.next("ul").children(".slidy-link-selected").index(),w;if(!b(this).is("li")){w=true;}q(n,e,v,w);};if(e.menu){var o=n.find("img"),c="",t=(e.target!="")?'target="'+e.target+'"':"",i,u;o.each(function(){u=b(this);i=u.parent(e.children);c+='<li><a href="'+i.attr(i.is("a")?"href":"title")+'" '+t+">"+u.attr("title")+"</a></li>";});$global.after('<ul class="slidy-menu">'+c+"</ul>");var s=parseInt((e.width/o.length)+(o.length-1)),m=e.width-(s*o.length),d=b("ul.slidy-menu").children("li");d.css("width",s).hover(p,g).mousemove(p).first().addClass("slidy-link-selected").end().last().css({"border-right":"0",width:(s+m)-(o.length-1)});}if(e.pause){$global.hover(p,g);}function q(x,w,v,y){j(x,w,v,v-1);if(y==undefined){l(v);}v=(v<x.length-1)?v+1:0;k=setTimeout(function(){q(x,w,v);},w.time);}function j(y,w,v,x){if(!f){f=true;if(w.animation=="fade"){y.eq(x).fadeOut(w.speed);y.eq(v).fadeIn(w.speed,function(){l(v);f=false;});}else{if(w.animation=="slide"){y.css("z-index",0).eq(v).css("z-index",y.length).slideDown(w.speed,function(){y.eq(x).hide();l(v);f=false;});}else{y.eq(x).hide();y.eq(v).show();f=false;}}}}function l(v){h.next("ul").children().removeClass("slidy-link-selected").eq(v).addClass("slidy-link-selected");}return $global;};function a(c){if(window.console&&window.console.log){window.console.log(c);}}b.fn.slidy.defaults={children:"img",cursor:"default",height:200,menu:false,pause:false,speed:600,target:"",time:3600,animation:"normal",width:500};})(jQuery);

		$(function() {

			$('#default').slidy();

			$('#pause').slidy({
				cursor:		'wait',
				pause:		true,
				animation:	'fade'
			});

			$('#items_fixture').slidy({
				children:	'a',
				menu:		true,
				pause:		true,
				speed:		500,
				time:		5000,
				animation:	'fade',
				width:		296,
				height:		200
			});

			$('.group').slidy({
				height:		160,
				animation:	'fade',
				width:		135,
				speed:		600,
				time:		5000,
			});
			
			$('.group2').slidy({
				height:		250,
				animation:	'fade',
				width:		280,
				speed:		600,
				time:		5000,
			});

		});
