nubedo=function(){var featureTimeoutID,imgIndex2,img=false,imgID=false,parent=false;return{init:function(){if($("#imageFeature").length){nubedo.initSlideshow()}$(".enlargeImage").click(nubedo.enlargeImage)},enlargeImage:function(e,obj,img){var padding=20;obj=obj||this;if(!$("#loading").length){loading=document.createElement("div");loading.id="loading";document.body.appendChild(loading)}if(!img){img=new Image();img.src=obj.href}else{if(obj.href!==undefined){if(img.src!=obj.href){img=new Image();img.src=obj.href}}}if(!parent){parent=obj.parentNode}if(img.complete){if($("#imgViewer").length){parent=$("#imgViewer").parentNode;parent.removeChild($("#imgViewer"))}if($("loading").length){d=$("loading").parentNode;d.removeChild($("#loading"))}var viewer=document.createElement("div");var wrap=document.createElement("div");viewer.id="imgViewer";viewer.appendChild(wrap);var close=document.createElement("div");close.id="close";var image=document.createElement("img");$(viewer).css({position:"absolute",zIndex:"9999"});image.src=img.src;wrap.appendChild(image);wrap.appendChild(close);document.body.appendChild(viewer);offset=$(parent).position();pX=offset.left+(parent.offsetWidth/2);pY=offset.top+(parent.offsetHeight/2);imgX=pX-(img.width/2);imgY=pY-(img.height/2);imgR=imgX+img.width;imgB=imgY+img.height;scTop=$(window).scrollTop();scBottom=scTop+$(window).height();scLeft=$(window).scrollLeft();scRight=scLeft+$(window).width();imgX=(imgX<scLeft)?scLeft+20:imgX;imgY=(imgY<scTop)?scTop+20:imgY;imgX=(imgR>scRight)?scRight-20-img.width:imgX;imgY=(imgB>scBottom)?scBottom-20-img.height:imgY;imgX=(imgX<20)?20:imgX;imgY=(imgY<20)?20:imgY;$(viewer).css({left:imgX+"px",top:imgY+"px",visibility:"visible"});$(viewer).fadeIn(750);$(viewer).click(nubedo.killScreen);$(image).click(nubedo.killScreen);$(close).click(nubedo.killScreen);$("#loading").remove();parent=false;return false}else{var test=function(e,obj){return nubedo.enlargeImage(e,obj,img)};imgID=window.setTimeout(test,500)}return false},killScreen:function(){$("#imgViewer").remove();return false},initSlideshow:function(){$("#imageFeature li").each(function(imgIndex){if(imgIndex==0){$(this).css({display:"block",zIndex:"10"});$(this).attr("id","currentFeat")}else{$(this).css("display","none")}});nubedo.slideshowReset()},slideshow:function(){var current=$("#currentFeat"),next=current.next();if(!next.length){next=$("#imageFeature li:first")}next.css({display:"block",zIndex:"1"});current.fadeOut(500,function(){$(this).attr("id","");next.attr("id","currentFeat");next.css({zIndex:"10"})});nubedo.slideshowReset()},slideshowReset:function(){if(typeof featTimeoutID=="number"){window.clearTimeout(featTimeoutID);featTimeoutID=null}featTimeoutID=window.setTimeout(nubedo.slideshow,5000)}}}();$(document).ready(function(){nubedo.init()});