// This file is part of Shutter Reloaded WordPress plugin. For standalone version visit http://www.laptoptips.ca/javascripts/shutter-reloaded/ if (typeof shutterOnload == 'function') { var shutterLinks = {}, shutterSets = {}; oldonload = window.onload; if( typeof window.onload != 'function' ) window.onload = shutterOnload; else window.onload = function(){shutterOnload();if(oldonload){oldonload();}}; } shutterReloaded = { I : function (a) { return document.getElementById(a); }, L10n : shL10n, imageCount : shImageCount, textBtns : shTextBtns, shImgDir : shImgDir, Init : function (a) { var L, T, shtype, i, setid, inset, shfile, shMenuPre, k, img; for ( i = 0; i < document.links.length; i++ ) { L = document.links[i]; shtype = L.href.slice(-4).toLowerCase(); if ( shtype != '.jpg' && shtype != '.png' && shtype != '.gif' && shtype != 'jpeg' ) continue; if ( a == 'sh' && L.className.toLowerCase().indexOf('shutter') == -1 ) continue; if ( a == 'lb' && L.rel.toLowerCase().indexOf('lightbox') == -1 ) continue; if ( L.className.toLowerCase().indexOf('shutterset') != -1 ) setid = ( L.className.indexOf(' ') != -1 ) ? L.className.slice(0,L.className.indexOf(' ')) : L.className; else if ( L.rel.toLowerCase().indexOf('lightbox[') != -1 ) setid = L.rel; else setid = 0, inset = -1; if( setid ) { if ( ! shutterSets[setid] ) shutterSets[setid] = []; inset = shutterSets[setid].push(i); } shfile = L.href.slice(L.href.lastIndexOf('/')+1); T = ( L.title && L.title != shfile ) ? L.title : ''; shutterLinks[i] = {link:L.href,num:inset,set:setid,title:T} L.onclick = new Function('shutterReloaded.Make("'+i+'");return false;'); } if ( ! this.textBtns ) { shMenuPre = ['close.gif','prev.gif','next.gif','resize1.gif','resize2.gif','loading.gif']; for ( k = 0; k < shMenuPre.length; k++ ) { img = new Image(); img.src = this.shImgDir+shMenuPre[k]; } } }, Make : function(ln,fs) { var prev, next, prevlink = '', nextlink = '', previmg, nextimg, prevbtn, nextbtn, D, S, W, NB, fsarg = '', imgNum, closebtn, fsbtn, fsLink; if ( ! this.Top ) { if ( typeof window.pageYOffset != 'undefined' ) this.Top = window.pageYOffset; else this.Top = (document.documentElement.scrollTop > 0) ? document.documentElement.scrollTop : document.body.scrollTop; } if ( typeof this.pgHeight == 'undefined' ) this.pgHeight = Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); if ( fs ) this.FS = true; else this.FS = null; if ( this.resizing ) this.resizing = null; window.onresize = new Function('shutterReloaded.Resize("'+ln+'");'); document.documentElement.style.overflowX = 'hidden'; if ( ! this.VP ) { this._viewPort(); this.VP = true; } if ( ! (S = this.I('shShutter')) ) { S = document.createElement('div'); S.setAttribute('id','shShutter'); document.getElementsByTagName('body')[0].appendChild(S); this.hideTags(); } if ( ! (D = this.I('shDisplay')) ) { D = document.createElement('div'); D.setAttribute('id','shDisplay'); D.style.top = this.Top + 'px'; document.getElementsByTagName('body')[0].appendChild(D); } S.style.height = this.pgHeight + 'px'; var dv = this.textBtns ? ' | ' : ''; if ( shutterLinks[ln].num > 1 ) { prev = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num - 2]; prevbtn = this.textBtns ? this.L10n[0] : ''; prevlink = ''+prevbtn+''+dv; previmg = new Image(); previmg.src = shutterLinks[prev].link; } if ( shutterLinks[ln].num != -1 && shutterLinks[ln].num < (shutterSets[shutterLinks[ln].set].length) ) { next = shutterSets[shutterLinks[ln].set][shutterLinks[ln].num]; nextbtn = this.textBtns ? this.L10n[1] : ''; nextlink = ''+nextbtn+''+dv; nextimg = new Image(); nextimg.src = shutterLinks[next].link; } closebtn = this.textBtns ? this.L10n[2] : ''; imgNum = ( (shutterLinks[ln].num > 0) && this.imageCount ) ? ' '+this.L10n[5]+' '+shutterLinks[ln].num+' '+this.L10n[6]+' '+shutterSets[shutterLinks[ln].set].length : ''; if ( this.FS ) { fsbtn = this.textBtns ? this.L10n[4] : ''; } else { fsbtn = this.textBtns ? this.L10n[3] : ''; fsarg = ',1'; } fsLink = ''+fsbtn+''+dv+''; if ( ! (NB = this.I('shNavBar')) ) { NB = document.createElement('div'); NB.setAttribute('id','shNavBar'); document.getElementsByTagName('body')[0].appendChild(NB); } NB.innerHTML = dv+prevlink+''+closebtn+''+dv+nextlink+fsLink+imgNum; D.innerHTML = '