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

(function($){var Plugin=function(){};$.extend(Plugin.prototype,{name:"spotlight",options:{effect:"fade",duration:300,transition:"swing",cls:"spotlight",overlaySelector:".overlay",overlayDefault:"overlay-default"},initialize:function(element,options){options=$.extend({},this.options,options,element.data());if(element.attr("data-spotlight")){$.each(element.attr("data-spotlight").split(";"),function(i,option){var opt=option.match(/\s*([A-Z_]*?)\s*:\s*(.+)\s*/i);if(opt)options[opt[1]]=opt[2]})}var overlay=element.children(options.overlaySelector).first();if(!overlay.length){overlay=$("<div>").addClass(options.overlayDefault).appendTo(element)}overlay.css({position:"absolute",visibility:"hidden",display:"block"}).wrapInner("<div>");element.css({position:"relative",overflow:"hidden"}).addClass(options.cls);element.bind({mouseenter:function(){overlay.stop().css({visibility:"visible",width:element.width(),height:options.effect=="top"||options.effect=="bottom"?"auto":element.height()});switch(options.effect){case"right":overlay.css({right:overlay.width()*-1,top:0,bottom:0}).animate({right:0},options.duration,options.transition);break;case"left":overlay.css({left:overlay.width()*-1,top:0,bottom:0}).animate({left:0},options.duration,options.transition);break;case"top":overlay.css({left:0,top:overlay.height()*-1}).animate({top:0},options.duration,options.transition);break;case"bottom":overlay.css({left:0,bottom:overlay.height()*-1}).animate({bottom:0},options.duration,options.transition);break;case"fade":default:overlay.show().css({opacity:0,top:0,left:0}).animate({opacity:1},options.duration,options.transition,function(){if(!$.support.opacity){overlay.get(0).filter="";overlay.attr("style",String(overlay.attr("style")).replace(/alpha\(opacity=([\d.]+)\)/i,""))}})}},mouseleave:function(){overlay.stop();switch(options.effect){case"right":overlay.animate({right:overlay.width()*-1},options.duration,options.transition);break;case"left":overlay.animate({left:overlay.width()*-1},options.duration,options.transition);break;case"top":overlay.animate({top:overlay.height()*-1},options.duration,options.transition);break;case"bottom":overlay.animate({bottom:overlay.height()*-1},options.duration,options.transition);break;case"fade":default:overlay.animate({opacity:0},options.duration,options.transition,function(){overlay.hide()})}}})}});$.fn[Plugin.prototype.name]=function(){var args=arguments;var method=args[0]?args[0]:null;return this.each(function(){var element=$(this);if(Plugin.prototype[method]&&element.data(Plugin.prototype.name)&&method!="initialize"){element.data(Plugin.prototype.name)[method].apply(element.data(Plugin.prototype.name),Array.prototype.slice.call(args,1))}else if(!method||$.isPlainObject(method)){var plugin=new Plugin;if(Plugin.prototype["initialize"]){plugin.initialize.apply(plugin,$.merge([element],args))}element.data(Plugin.prototype.name,plugin)}else{$.error("Method "+method+" does not exist on jQuery."+Plugin.name)}})}})(jQuery);