(function(A){A.extend(A,{mosaicO:"",imJQMosaic:function(D,E){var B=this;var C=new Image();C.src=D.image;mosaicO={image:C,target:D.target,frameWidth:D.frameWidth?parseInt(D.frameWidth):C.width,frameHeight:D.frameHeight?parseInt(D.frameHeight):C.height,imageOffsetX:0,imageOffsetY:0,numberOfTilesX:D.numberOfTilesX?parseInt(D.numberOfTilesX):-1,numberOfTilesY:D.numberOfTilesY?parseInt(D.numberOfTilesY):-1,tileMargin:D.tileMargin?parseInt(D.tileMargin):0,tileBorder:D.tileBorder?parseInt(D.tileBorder):0,tileBorderColor:D.tileBorderColor,tileBorderRadius:parseInt(D.tileBorderRadius),effect:D.effect?D.effect:"flash",effectIntensity:(D.effectIntensity&&parseFloat(D.effectIntensity)<1)?D.effectIntensity:"show",effectColor:D.effectColor?D.effectColor:"#fff",menuFont:(E&&E.menuStyle&&E.menuStyle.font)?E.menuStyle.font:"Lucida Grande",menuFontSize:(E&&E.menuStyle&&E.menuStyle.fontSize)?E.menuStyle.fontSize:"1.0em",menuBackground:(E&&E.menuStyle&&E.menuStyle.background)?E.menuStyle.background:"none",menuFontColor:(E&&E.menuStyle&&E.menuStyle.fontColor)?E.menuStyle.fontColor:"#000",menuEffect:(E&&E.menuEffect)?E.menuEffect:"zoom",menuItems:(E&&E.menu)?E.menu:""};if(mosaicO.numberOfTilesX==-1){mosaicO.numberOfTilesX=10}B.renderMosaic();if(E){B.renderMenu()}B.postRender()},renderMosaic:function(){var M=this;var H='<div id="imjqmosaic" style="width:'+mosaicO.frameWidth+"px;height:"+mosaicO.frameHeight+'px;position:relative;clear:both;"></div>';A("#"+mosaicO.target).append(H);var C=0,G,F,L,K;var D=mosaicO.frameWidth-(mosaicO.numberOfTilesX*2*(mosaicO.tileMargin+mosaicO.tileBorder));if(D<0){return false}var B=mosaicO.frameHeight-(mosaicO.numberOfTilesY*2*(mosaicO.tileMargin+mosaicO.tileBorder));if(B<0){return false}G=Math.floor(D/mosaicO.numberOfTilesX);L=3*(mosaicO.tileMargin+mosaicO.tileBorder)+G;F=G;K=L;if(mosaicO.numberOfTilesY!=-1){F=Math.floor(B/mosaicO.numberOfTilesY);K=3*(mosaicO.tileMargin+mosaicO.tileBorder)+F}for(var I=mosaicO.imageOffsetY;I<mosaicO.frameHeight;I+=K){for(var J=mosaicO.imageOffsetX;J<mosaicO.frameWidth;J+=L){C++;var E="";E+='<div id="imjqmosaic_tile_'+C+'" class="imjqmosaic_tile" style="background-image:url('+mosaicO.image.src+");background-repeat:no-repeat;background-position:"+(-1*J)+"px "+(-1*I)+"px;width:"+G+"px;height:"+F+"px;float:left;border:"+mosaicO.tileBorder+"px solid "+mosaicO.tileBorderColor+";margin:"+mosaicO.tileMargin+"px;-moz-border-radius:"+mosaicO.tileBorderRadius+"px;-webkit-border-radius:"+mosaicO.tileBorderRadius+'px;"><div class="e" style="background-color:'+mosaicO.effectColor+";text-align:center;vertical-align:middle;width:100%;height:100%;opacity:0.0;filter:alpha(opacity=0);width:"+G+"px;height:"+F+"px;-moz-border-radius:"+mosaicO.tileBorderRadius+"px;-webkit-border-radius:"+mosaicO.tileBorderRadius+'px;"></div></div>';A("#"+mosaicO.target).find("#imjqmosaic").append(E)}}},renderMenu:function(){var D=this;for(i=0;i<mosaicO.menuItems.length;i++){var G=mosaicO.menuItems[i].tileNumber;var H=mosaicO.menuItems[i].title;var B=mosaicO.menuItems[i].href;var F=mosaicO.menuItems[i].alt;var C="";var E=A("#"+mosaicO.target+" #imjqmosaic #imjqmosaic_tile_"+G).find(".e");if(typeof (B)!="undefined"){E.attr("title",F)}if(typeof (B)!="undefined"){C='<a href="'+B+'" style="text-decoration:none;color:'+mosaicO.menuFontColor+";font-family:"+mosaicO.menuFont+";font-size:"+mosaicO.menuFontSize+'"></a>';E.html(H).css({"opacity":"0.6","cursor":"pointer","background":mosaicO.menuBackground}).wrap(C)}else{E.html(H).css({"opacity":"0.6","background":mosaicO.menuBackground,"color":mosaicO.menuFontColor,"fontSize":mosaicO.menuFontSize,"fontFamily":mosaicO.menuFont})}}},postRender:function(){var B=this;A("#"+mosaicO.target+" #imjqmosaic .imjqmosaic_tile").hover(function(){if(A(this).find(".e").html()==""){if(mosaicO.effect=="flash"){A(this).find(".e").animate({"opacity":mosaicO.effectIntensity},"fast").animate({"opacity":"0.0"},"fast")}}else{if(mosaicO.menuEffect=="zoom"){A(this).find(".e").animate({"opacity":mosaicO.effectIntensity},"fast").animate({"opacity":"0.6"},"fast")}}},function(){})}})})(jQuery)