var Debug=function(b,a){if(!$("#Debug")){$("body").append("<div id='Debug'></div>")}if(a){$("#Debug").html($("#Debug").html()+"<br/>"+b)}else{$("#Debug").html($("#Debug").html()+b)}};(function(a){a.fn.ImageSwitch=function(o,n){var l={Type:"FadeIn",NewImage:"",EffectOriginal:true,Speed:1000,StartLeft:50,StartTop:0,StartOpacity:0,EndLeft:-50,EndTop:0,EndOpacity:0,Direction:"RightLeft",Door1:"",Door2:""};var j=a.extend(l,o);var h=this;var f=0;var q;var p;var m;var k=function(){h.data("imageswitch",-1)};if(a.isFunction(n)){k=function(){n();h.data("imageswitch",-1)}}var i=function(){h.parent().append("<img class='GrpEffectImg' id='"+q.replace("#","")+"'/>");a(q).attr("src",h.attr("src"));a(q).css("position","absolute");a(q).css("top",h.position().top);a(q).css("left",h.position().left);a(q).css("opacity",1);h.attr("src",j.NewImage);if(j.EffectOriginal){h.css("opacity",j.StartOpacity);h.animate({opacity:1},j.Speed)}a(q).animate({opacity:0},j.Speed,function(){a(q).remove();k()})};var g=function(r){a("body").append("<img class='GrpEffectImg' id='"+q.replace("#","")+"'/>");a(q).css("position","absolute");if(r){a(q).attr("src",j.NewImage);a(q).css("top",h.offset().top+j.StartTop);a(q).css("left",h.offset().left+j.StartLeft);a(q).css("opacity",j.StartOpacity);EndTop=h.offset().top;EndLeft=h.offset().left;EndOpacity=1}else{a(q).attr("src",h.attr("src"));h.attr("src",j.NewImage);a(q).css("top",h.offset().top);a(q).css("left",h.offset().left);a(q).css("opacity",1);EndTop=h.offset().top+j.EndTop;EndLeft=h.offset().left+j.EndLeft;EndOpacity=j.EndOpacity}a(q).animate({opacity:EndOpacity,top:EndTop,left:EndLeft},j.Speed,function(){h.attr("src",j.NewImage);a(q).remove();k()})};var e=function(u){var t=h.clone(true);h.wrap("<div id='GrpViewport-"+f+"'></div>");a("#GrpViewport-"+f).css("overflow","hidden");a("#GrpViewport-"+f).width(h.width());a("#GrpViewport-"+f).height(h.height());a("#GrpViewport-"+f).append("<img class='GrpEffectImg' id='"+q.replace("#","")+"'/>");a(q).css("position","absolute");var s=0;var r=0;switch(j.Direction){case"RightLeft":r=-h.width();break;case"LeftRight":r=h.width();break;case"TopDown":s=-h.height();break;case"DownTop":s=h.height();break}if(u){a(q).attr("src",j.NewImage);a(q).css("top",s);a(q).css("left",r);a(q).css("opacity",j.StartOpacity);EndTop=0;EndLeft=0;EndOpacity=1}else{a(q).attr("src",h.attr("src"));a(q).css("left",0);a(q).css("top",0);h.attr("src",j.NewImage);EndTop=s;EndLeft=r;EndOpacity=j.EndOpacity}if(h.css("position")!="absolute"){a("#GrpViewport-"+f).css("position","relative");h.css("position","absolute")}else{a("#GrpViewport-"+f).css("position","absolute");a("#GrpViewport-"+f).css("left",h.css("left"));a("#GrpViewport-"+f).css("top",h.css("top"));h.css("top",0);h.css("left",0)}if(j.EffectOriginal&&u){h.animate({top:-s,left:-r},j.Speed)}a(q).animate({opacity:EndOpacity,top:EndTop,left:EndLeft},j.Speed,function(){t.attr("src",j.NewImage);t.removeAttr("imageswitch");a("#GrpViewport-"+f).replaceWith(t);k()})};var c=function(){var t=h.clone(true);h.wrap("<div id='GrpViewport'></div>");a("#GrpViewport").css("overflow","hidden");a("#GrpViewport").width(h.width());a("#GrpViewport").height(h.height());a("#GrpViewport").append("<div class='GrpEffectDiv' id='"+p.replace("#","")+"'/>");a(p).attr("src",j.NewImage);a(p).css("position","absolute");a(p).css("background-color","#FFF");if(j.Door1.length>0){a(p).css("background",j.Door1)}a(p).width(h.width());a(p).height(h.height());var s=0;var r=0;switch(j.Direction){case"RightLeft":r=-h.width();break;case"LeftRight":r=h.width();break;case"TopDown":s=-h.height();break;case"DownTop":s=h.height();break}a(p).css("top",s);a(p).css("left",r);if(h.css("position")!="absolute"){a("#GrpViewport").css("position","relative");h.css("position","absolute")}else{a("#GrpViewport").css("position","absolute");a("#GrpViewport").css("left",h.css("left"));a("#GrpViewport").css("top",h.css("top"));h.css("top",0);h.css("left",0)}a(p).animate({top:0,left:0},j.Speed,function(){h.attr("src",j.NewImage);a(p).animate({top:s,left:r},j.Speed,function(){t.attr("src",j.NewImage);t.removeAttr("imageswitch");a("#GrpViewport").replaceWith(t);k()})})};var d=function(){var v=h.css("position");var u=h.css("left");var t=h.css("top");h.wrap("<div id='GrpViewport'></div>");a("#GrpViewport").css("overflow","hidden");a("#GrpViewport").width(h.width());a("#GrpViewport").height(h.height());a("#GrpViewport").append("<div class='GrpEffectDiv' id='"+p.replace("#","")+"'/>");a(p).css("position","absolute");a(p).css("background-color","#FFF");if(j.Door1.length>0){a(p).css("background",j.Door1)}a(p).width(h.width());a(p).height(h.height());a("#GrpViewport").append("<div class='GrpEffectDiv1' id='"+m.replace("#","")+"'/>");a(m).css("position","absolute");a(m).css("background-color","#FFF");if(j.Door2.length>0){a(m).css("background",j.Door2)}a(m).width(h.width());a(m).height(h.height());var s=0;var r=0;switch(j.Direction){case"RightLeft":r=-h.width();break;case"LeftRight":r=h.width();break;case"TopDown":s=-h.height();break;case"DownTop":s=h.height();break}a(p).css("top",s);a(p).css("left",r);a(m).css("top",-s);a(m).css("left",-r);if(!j.EffectOriginal){a(p).css("background","#FFF url("+j.NewImage+") no-repeat "+-r/2+"px "+-s/2+"px");a(m).css("background","#FFF url("+j.NewImage+") no-repeat "+r/2+"px "+s/2+"px")}if(h.css("position")!="absolute"){a("#GrpViewport").css("position","relative");h.css("position","absolute")}else{a("#GrpViewport").css("position","absolute");a("#GrpViewport").css("left",u);a("#GrpViewport").css("top",t);h.css("position","absolute");h.css("top",0);h.css("left",0)}a(p).animate({top:s/2,left:r/2},j.Speed,function(){h.attr("src",j.NewImage);if(!j.EffectOriginal){h.css("position",v);h.css("top",t);h.css("left",u);a("#GrpViewport").replaceWith(h)}else{a(p).animate({top:s,left:r},j.Speed,function(){h.css("position",v);h.css("top",t);h.css("left",u);a("#GrpViewport").replaceWith(h)})}});a(m).animate({top:-s/2,left:-r/2},j.Speed,function(){h.attr("src",j.NewImage);if(!j.EffectOriginal){k()}else{a(m).animate({top:-s,left:-r},j.Speed,function(){k()})}})};var b=function(r){var s=h.clone(true);if(h.css("z-index")=="auto"){h.css("z-index",100)}if(h.css("position")!="absolute"){h.css("position","relative")}a("body").append("<img class='GrpEffectImg'  id='"+q.replace("#","")+"'/>");a(q).css("position","absolute");a(q).css("top",h.offset().top);a(q).css("left",h.offset().left);if(r){a(q).css("opacity",j.StartOpacity);a(q).css("z-index",h.css("z-index")-1);a(q).attr("src",j.NewImage)}else{a(q).css("opacity",1);a(q).css("z-index",h.css("z-index")+1);a(q).attr("src",h.attr("src"));h.attr("src",j.NewImage)}if(Math.abs(j.EndTop)<h.height()&&Math.abs(j.EndLeft)<h.width()){EndTop=h.offset().top;EndLeft=h.offset().left+h.width()}else{EndTop=h.offset().top+j.EndTop;EndLeft=h.offset().left+j.EndLeft}EndOpacity=1;a(q).animate({opacity:EndOpacity,top:EndTop,left:EndLeft},j.Speed,function(){if(r){a(q).css("z-index",101)}else{EndOpacity=j.EndOpacity;a(q).css("z-index",2)}a(q).animate({opacity:EndOpacity,top:h.offset().top,left:h.offset().left},j.Speed,function(){s.attr("src",j.NewImage);s.removeAttr("imageswitch");h.replaceWith(s);a(q).remove();k()})})};return this.each(function(){h=a(this);if(!h.ImageAnimating()){f=a.data(h);h.data("imageswitch",f);q="#GrpEffectImg-"+f;p="#GrpEffectDiv1-"+f;m="#GrpEffectDiv2-"+f;var r=new Image();r.src=j.NewImage;a.ImagePreload(j.NewImage,function(){switch(j.Type){case"FadeIn":i();break;case"FlyIn":g(true);break;case"FlyOut":g(false);break;case"FlipIn":b(true);break;case"FlipOut":b(false);break;case"ScrollIn":e(true);break;case"ScrollOut":e(false);break;case"SingleDoor":c();break;case"DoubleDoor":d();break}})}})}})(jQuery);(function(a){a.fn.ImageAnimating=function(){if(this.data("imageswitch")>0){return true}else{return false}}})(jQuery);(function(a){a.fn.ImageStop=function(d,c,b){return this.each(function(){if(a(this).ImageAnimating()){var e=a.data(this,"imageswitch");a("#GrpEffectImg-"+e).stop(d,c);a("#GrpEffectDiv-"+e).stop(d,c);a("#GrpEffectDiv1-"+e).stop(d,c);a(this).stop(d,c);a("#GrpEffectImg-"+e).remove();a("#GrpEffectDiv-"+e).remove();a("#GrpEffectDiv1-"+e).remove();if(a.isFunction(b)){b()}}})}})(jQuery);(function(a){a.ImageStopAll=function(d,c,b){a(".GrpEffectImg").stop(d,c);a(".GrpEffectDiv").stop(d,c);a(".GrpEffectDiv1").stop(d,c);a(this).stop(d,c);a(".GrpEffectImg").remove();a(".GrpEffectDiv").remove();a(".GrpEffectDiv1").remove();a.data(this,"imageswitch",-1);if(a.isFunction(b)){b()}}})(jQuery);(function(a){a.ImagePreload=function(c,d){var b=new Image();b.src=c;if(a.isFunction(d)){a(b).load(d())}}})(jQuery);