/**
 * name:          jquery-foxislide-0.1.min.js
 * author:        Stefan Benicke - www.opusonline.at
 * version:       0.1
 * last update:   19.08.2009
 * category:      jQuery plugin
 * copyright:     (c) 2009 Stefan Benicke (www.opusonline.at)
 * license:       GNU GPLv3 <http://www.gnu.org/licenses/>
 * documentation: http://www.opusonline.at/foxitools/foxislide/
 */
(function(a){a.fn.foxislide=function(g){g=jQuery.extend({speed:"normal",title:true,callback:function(){}},g);r();h();a(window).scroll(function(){h()});a(window).resize(function(){r()});var f;var q;var m;var k;var n=false;var e=false;var l;var d=0;var c=0;var o=[];var b=0;a(this).each(function(){o[o.length]=this;a(this).bind("click",function(){i(this);return false});b++;var t="#foxislide"+b;var v=a(this).find("img");var u=v.offset().top;var w=v.offset().left;var s=v.width();var y=v.height();var x='<div id="foxislide'+b+'" class="foxislide" style="display:none;width:'+s+"px;height:"+y+"px;top:"+u+"px;left:"+w+'px;cursor:pointer"><img src="" style="display:none" />';if(g.title&&a(this).attr("title")){x+='<div class="foxislide_title" style="display:none">'+a(this).attr("title")+"</div>"}x+='<span class="foxislide_origin" style="display:none">'+(b-1)+'</span><div class="foxislide_loader" style="display:none;width:'+s+"px;height:"+y+'px"></div></div>';a("body").append(x);a(this).attr("rel",t);a(t).bind("mousedown",function(z){n=true;e=false;l=this;d=z.pageX-a(this).offset().left;c=z.pageY-a(this).offset().top;a(this).css({"z-index":j(this),cursor:"move"});return false}).bind("mousemove",function(A){if(n){e=true;var B=Math.round(A.pageY-c);var z=Math.round(A.pageX-d);if(B<0){B=0}if(z<0){z=0}a(l).css({top:B,left:z})}return false}).bind("mouseup",function(){if(n){n=false;l="";a(this).css({cursor:"pointer"});if(!e){p(this)}}})});a(document).bind("mousemove",function(t){if(e){var u=Math.round(t.pageY-c);var s=Math.round(t.pageX-d);if(u<0){u=0}if(s<0){s=0}a(l).css({top:u,left:s})}});a(document).keydown(function(s){if(s.keyCode==27){a("body").find('div[id^="foxislide"]').each(function(){if(a(this).css("display")!="none"){p(this)}})}});function i(u){var t=a(u).attr("rel");var v=a(t).find("img");a(t).show().find(".foxislide_loader").show();var s=new Image();s.onload=function(){a(u).css("visibility","hidden");a(t).find(".foxislide_loader").hide();var y=s.width;var w=s.height;v.attr("src",s.src).width(a(t).width()).height(a(t).height()).show();var x=q/2+m-w/2;var z=f/2+k-y/2;if(x<0){x=0}if(z<0){z=0}v.animate({width:y,height:w,top:x,left:z},g.speed);a(t).animate({width:y,height:w,top:x,left:z},g.speed,function(){if(g.title&&a(u).attr("title")){var A=a(t).find(".foxislide_title");a(t).animate({height:(A.outerHeight()+w)},g.speed);A.fadeIn(g.speed)}});a(t).css({"z-index":j(t)})};s.src=a(u).attr("href")}function p(v){var t=a(o[a(v).find(".foxislide_origin").text()]);var u=t.find("img");var w=u.width();var x=u.height();var y=u.offset().top;var s=u.offset().left;a(v).find(".foxislide_title").fadeOut(g.speed);a(v).animate({width:w,height:x,top:y,left:s},g.speed);a(v).find("img").animate({width:w,height:x,top:y,left:s},g.speed,function(){a(o[a(v).find(".foxislide_origin").text()]).css("visibility","visible");a(v).hide().find("img").hide()})}function j(t){var s=a(t).css("z-index");a("body").find('div[id^="foxislide"]').each(function(){if(a(this).css("display")!="none"){var u=a(this).css("z-index");s=(s>u)?s:u}});return ++s}function h(){m=a(document).scrollTop();k=a(document).scrollLeft()}function r(){q=a(window).height();f=a(window).width()}}})(jQuery);

