/* Copyright  2007 - 2010 YOOtheme GmbH, YOOtheme Proprietary Use License (http://www.yootheme.com/license) */

var Warp=Warp||{};
Warp.Spotlight=new Class({initialize:function(f,c){var a=this;this.setOptions({effect:"fade",effectOptions:{duration:10}},c);this.element=$(f);this.slides=this.element.getChildren();this.slides.each(function(d){var b=new Element("div");b.adopt(d);a.element.adopt(b)});this.slides=this.element.getChildren();this.slides.each(function(d,b){d.setStyles({position:"absolute",width:"100%",visibility:b==0?"visible":"hidden"}).addClass("spotlight"+b)});this.element.setStyles({position:"relative",overflow:"hidden",
height:a.slides[0].getSize().size.y});this.element.addEvents({mouseenter:function(){a.fx.stop();switch(a.options.effect){case "right":a.slides[1].setStyles({right:a.slides[1].getSize().size.x*-1,visibility:"visible"});a.fx.start({right:[a.slides[1].getSize().size.x*-1,0]});break;case "left":a.slides[1].setStyles({left:a.slides[1].getSize().size.x*-1,visibility:"visible"});a.fx.start({left:[a.slides[1].getSize().size.x*-1,0]});break;case "top":a.slides[1].setStyles({left:0,top:a.slides[1].getSize().size.y*
-1,visibility:"visible"});a.fx.start({top:[a.slides[1].getSize().size.y*-1,0]});break;case "bottom":a.slides[1].setStyles({left:0,bottom:a.slides[1].getSize().size.y*-1,visibility:"visible"});a.fx.start({bottom:[a.slides[1].getSize().size.y*-1,0]});break;default:a.fx.start({opacity:[0,1]})}},mouseleave:function(){a.fx.stop();switch(a.options.effect){case "right":a.fx.start({right:[0,a.slides[1].getSize().size.x*-1]});break;case "left":a.fx.start({left:[0,a.slides[1].getSize().size.x*-1]});break;case "top":a.fx.start({top:[0,
a.slides[1].getSize().size.y*-1]});break;case "bottom":a.fx.start({bottom:[0,a.slides[1].getSize().size.y*-1]});break;default:a.fx.start({opacity:[1,0]})}}});this.fx=new Fx.Styles(this.slides[1],this.options.effectOptions)}});Warp.Spotlight.implement(new Options);
Warp.Spotlight.attach=function(f,c){c=c||{};c=$extend({right:300,left:300,top:300,bottom:300,fade:300},c);document.getElements(f).each(function(a){var d="fade",b=c[d];String(a.getProperty("class")).split(" ").each(function(e){if(["right","left","top","bottom","fade"].contains(e)){d=e;b=c[d]}if(e.test("duration-"))b=e.split("-")[1].toInt()});new Warp.Spotlight(a,{effect:d,effectOptions:{duration:b}})})};

