//**************************************************************************************************/ // lytebox v4.0 // // author: markus f. hay // website: http://www.dolem.com/lytebox // date: july 30, 2011 // license: creative commons attribution 3.0 license (http://creativecommons.org/licenses/by/3.0/) //**************************************************************************************************/ string.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); } function lytebox() { // below are the default settings that the lytebox viewer will inherit (look and feel, behavior) when displaying content. member // properties that start with "__" can be manipulated via the data-lyte-options attribute (i.e. data-lyte-options="theme:red"). /*** configure lytebox ***/ this.theme = 'black'; // themes: black (default), grey, red, green, blue, gold this.innerborder = true; // controls whether to show the inner border around image/html content this.outerborder = true; // controls whether to show the outer grey (or theme) border this.resizespeed = 8; // controls the speed of the image resizing (1=slowest and 10=fastest) this.maxopacity = 80; // higher opacity = darker overlay, lower opacity = lighter overlay this.bordersize = 12; // if you adjust the padding in the css, you will need to update this variable -- otherwise, leave this alone... this.__hideobjects = true; // controls whether or not objects (such as flash, java, etc.) should be hidden when the viewer opens this.__autoresize = true; // controls whether or not images should be resized if larger than the browser window dimensions this.__doanimations = true; // controls whether or not "animate" lytebox, i.e. resize transition between images, fade in/out effects, etc. this.__forcecloseclick = false; // if true, users are forced to click on the "close" button when viewing content this.__refreshpage = false; // force page refresh after closing lytebox this.__showprint = false; // true to show print button, false to hide this.__navtype = 3; // 1 = "prev/next" buttons on top left and left (default) // 2 = "<< prev | next >>" links next to image number // 3 = navtype_1 + navtype_2 (show both) /*** configure lyteframe (html viewer) options ***/ this.__width = '80%'; // default width of content viewer this.__height = '80%'; // default height of content viewer this.__scrollbars = 'auto'; // controls the content viewers scollbars -- options are auto|yes|no /*** configure lyteshow (slideshow) options ***/ this.__slideinterval = 4000; // change value (milliseconds) to increase/decrease the time between "slides" this.__shownavigation = false; // true to display next/prev buttons/text during slideshow, false to hide this.__showclose = true; // true to display the close button, false to hide this.__showdetails = true; // true to display image details (caption, count), false to hide this.__showplaypause = true; // true to display pause/play buttons next to close button, false to hide this.__autoend = true; // true to automatically close lytebox after the last image is reached, false to keep open this.__pauseonnextclick = false; // true to pause the slideshow when the "next" button is clicked this.__pauseonprevclick = true; // true to pause the slideshow when the "prev" button is clicked this.__loopslideshow = false; // true to continuously loop through slides, false otherwise /*** configure lytetip (tooltips) options ***/ this.changetipcursor = true; // true to change the cursor to 'help', false to leave default (inhereted) this.tipstyle = 'classic'; // sets the default tip style if none is specified via data-lyte-options. possible values are classic, info, help, warning, error /*** configure event callbacks ***/ this.__beforestart = ''; // function to call before the viewer starts this.__afterstart = ''; // function to call after the viewer starts this.__beforeend = ''; // function to call before the viewer ends (after close click) this.__afterend = ''; // function to call after the viewer ends if(this.resizespeed > 10) { this.resizespeed = 10; } if(this.resizespeed < 1) { this.resizespeed = 1; } this.resizeduration = (11 - this.resizespeed) * 0.15; // hash for navtype - by a.popov http://s3blog.org this.navtypehash = new object(); this.navtypehash['hover_by_type_1'] = true; this.navtypehash['display_by_type_1'] = false; this.navtypehash['hover_by_type_2'] = false; this.navtypehash['display_by_type_2'] = true; this.navtypehash['hover_by_type_3'] = true; this.navtypehash['display_by_type_3'] = true; this.resizewtimerarray = new array(); this.resizewtimercount = 0; this.resizehtimerarray = new array(); this.resizehtimercount = 0; this.showcontenttimerarray = new array(); this.showcontenttimercount = 0; this.overlaytimerarray = new array(); this.overlaytimercount = 0; this.imagetimerarray = new array(); this.imagetimercount = 0; this.timeridarray = new array(); this.timeridcount = 0; this.slideshowidarray = new array(); this.slideshowidcount = 0; this.imagearray = new array(); this.activeimage = null; this.slidearray = new array(); this.activeslide = null; this.framearray = new array(); this.activeframe = null; this.checkframe(); this.isslideshow = false; this.islyteframe = false; this.tipset = false; this.ie = this.ie6 = this.ie7 = this.ie8 = this.ie9 = false; this.setieversion(); this.classattribute = (((this.ie && this.doc.compatmode == 'backcompat') || this.ie6 || this.ie7) ? 'classname' : 'class'); this.classattribute = (this.ie && (document.documentmode == 8 || document.documentmode == 9)) ? 'class' : this.classattribute; // (07/20/2011) save last func for body.onscroll - fixed by a.popov http://s3blog.org this.bodyonscroll = document.body.onscroll; this.initialize(); } lytebox.prototype.setieversion = function() { var ver = -1; if (navigator.appname == 'microsoft internet explorer') { var ua = navigator.useragent; var re = new regexp("msie ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) { ver = parsefloat( regexp.$1 ); } this.ie = (ver > -1 ? true : false); this.ie6 = (ver == 6 ? true : false); this.ie7 = (ver == 7 ? true : false); this.ie8 = (ver == 8 ? true : false); this.ie9 = (ver == 9 ? true : false); } }; lytebox.prototype.initialize = function() { this.updatelyteboxitems(); var obody = this.doc.getelementsbytagname('body').item(0); var olauncher = this.doc.createelement('a'); olauncher.setattribute('id','lblauncher'); olauncher.style.display = 'none'; obody.appendchild(olauncher); if (this.doc.getelementbyid('lboverlay')) { obody.removechild(this.doc.getelementbyid('lboverlay')); obody.removechild(this.doc.getelementbyid('lbmain')); } var ooverlay = this.doc.createelement('div'); ooverlay.setattribute('id','lboverlay'); ooverlay.setattribute(this.classattribute, this.theme); if ((this.ie && this.ie6) || ((this.ie7 || this.ie8 || this.ie9) && this.doc.compatmode == 'backcompat')) { ooverlay.style.position = 'absolute'; } ooverlay.style.display = 'none'; obody.appendchild(ooverlay); var olytebox = this.doc.createelement('div'); olytebox.setattribute('id','lbmain'); olytebox.style.display = 'none'; obody.appendchild(olytebox); var ooutercontainer = this.doc.createelement('div'); ooutercontainer.setattribute('id','lboutercontainer'); ooutercontainer.setattribute(this.classattribute, this.theme); olytebox.appendchild(ooutercontainer); var oiframecontainer = this.doc.createelement('div'); oiframecontainer.setattribute('id','lbiframecontainer'); oiframecontainer.style.display = 'none'; ooutercontainer.appendchild(oiframecontainer); var oiframe = this.doc.createelement('iframe'); oiframe.setattribute('id','lbiframe'); oiframe.setattribute('name','lbiframe') oiframe.setattribute('frameborder','0'); if (this.innerborder) { oiframe.setattribute(this.classattribute, this.theme); } oiframe.style.display = 'none'; oiframecontainer.appendchild(oiframe); var oimagecontainer = this.doc.createelement('div'); oimagecontainer.setattribute('id','lbimagecontainer'); ooutercontainer.appendchild(oimagecontainer); var olyteboximage = this.doc.createelement('img'); olyteboximage.setattribute('id','lbimage'); if (this.innerborder) { olyteboximage.setattribute(this.classattribute, this.theme); } oimagecontainer.appendchild(olyteboximage); var oloading = this.doc.createelement('div'); oloading.setattribute('id','lbloading'); oloading.setattribute(this.classattribute, this.theme); ooutercontainer.appendchild(oloading); var odetailscontainer = this.doc.createelement('div'); odetailscontainer.setattribute('id','lbdetailscontainer'); odetailscontainer.setattribute(this.classattribute, this.theme); ooutercontainer.appendchild(odetailscontainer); var odetailsdata =this.doc.createelement('div'); odetailsdata.setattribute('id','lbdetailsdata'); odetailsdata.setattribute(this.classattribute, this.theme); odetailscontainer.appendchild(odetailsdata); var odetails = this.doc.createelement('div'); odetails.setattribute('id','lbdetails'); odetailsdata.appendchild(odetails); var ocaption = this.doc.createelement('span'); ocaption.setattribute('id','lbcaption'); odetails.appendchild(ocaption); var ohovernav = this.doc.createelement('div'); ohovernav.setattribute('id','lbhovernav'); oimagecontainer.appendchild(ohovernav); var obottomnav = this.doc.createelement('div'); obottomnav.setattribute('id','lbbottomnav'); odetailsdata.appendchild(obottomnav); var oprev = this.doc.createelement('a'); oprev.setattribute('id','lbprev'); oprev.setattribute(this.classattribute, this.theme); oprev.setattribute('href','javascript:void(0)'); ohovernav.appendchild(oprev); var onext = this.doc.createelement('a'); onext.setattribute('id','lbnext'); onext.setattribute(this.classattribute, this.theme); onext.setattribute('href','javascript:void(0)'); ohovernav.appendchild(onext); var onumberdisplay = this.doc.createelement('span'); onumberdisplay.setattribute('id','lbnumberdisplay'); odetails.appendchild(onumberdisplay); var onavdisplay = this.doc.createelement('span'); onavdisplay.setattribute('id','lbnavdisplay'); onavdisplay.style.display = 'none'; odetails.appendchild(onavdisplay); var oclose = this.doc.createelement('a'); oclose.setattribute('id','lbclose'); oclose.setattribute(this.classattribute, this.theme); oclose.setattribute('href','javascript:void(0)'); obottomnav.appendchild(oclose); var oprint = this.doc.createelement('a'); oprint.setattribute('id','lbprint'); oprint.setattribute(this.classattribute, this.theme); oprint.setattribute('href','javascript:void(0)'); oprint.style.display = 'none'; obottomnav.appendchild(oprint); var opause = this.doc.createelement('a'); opause.setattribute('id','lbpause'); opause.setattribute(this.classattribute, this.theme); opause.setattribute('href','javascript:void(0)'); opause.style.display = 'none'; obottomnav.appendchild(opause); var oplay = this.doc.createelement('a'); oplay.setattribute('id','lbplay'); oplay.setattribute(this.classattribute, this.theme); oplay.setattribute('href','javascript:void(0)'); oplay.style.display = 'none'; obottomnav.appendchild(oplay); }; lytebox.prototype.updatelyteboxitems = function() { // (07/20/2011) anchors = null fix provided by a.popov http://s3blog.org, slightly modified by markus hay var anchors = (this.isframe && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getelementsbytagname('a') : document.getelementsbytagname('a'); anchors = (this.isframe) ? anchors : document.getelementsbytagname('a'); var areas = (this.isframe) ? window.parent.frames[window.name].document.getelementsbytagname('area') : document.getelementsbytagname('area'); var lytelinks = this.combine(anchors, areas); var mylink = relattribute = classattribute = dataattribute = tipstyle = tipimage = tiphtml = asetting = sname = svalue = null; for (var i = 0; i < lytelinks.length; i++) { mylink = lytelinks[i]; relattribute = string(mylink.getattribute('rel')); classattribute = string(mylink.getattribute(this.classattribute)); if (mylink.getattribute('href')) { if (relattribute.tolowercase().match('lytebox')) { mylink.onclick = function () { mylytebox.start(this, false, false); return false; } } else if (relattribute.tolowercase().match('lyteshow')) { mylink.onclick = function () { mylytebox.start(this, true, false); return false; } } else if (relattribute.tolowercase().match('lyteframe')) { mylink.onclick = function () { mylytebox.start(this, false, true); return false; } } else if (classattribute.tolowercase().match('lytetip') && mylink.getattribute('title') != null && !this.tipsset) { if (this.changetipcursor) { mylink.style.cursor = 'help'; } dataattribute = string(mylink.getattribute('data-lyte-options')); if (dataattribute == 'null') { tipstyle = this.tipstyle; } else { asetting = dataattribute.split(':'); if (asetting.length > 1) { sname = string(asetting[0]).trim().tolowercase(); svalue = string(asetting[1]).trim().tolowercase(); tipstyle = (sname == 'tipstyle' ? (/classic|info|help|warning|error/.test(svalue) ? svalue : this.tipstyle) : this.tipstyle); } } switch(tipstyle) { case 'info': tipstyle = 'lbcustom lbinfo'; tipimage = 'lbtipimg lbinfoimg'; break; case 'help': tipstyle = 'lbcustom lbhelp'; tipimage = 'lbtipimg lbhelpimg'; break; case 'warning': tipstyle = 'lbcustom lbwarning'; tipimage = 'lbtipimg lbwarningimg'; break; case 'error': tipstyle = 'lbcustom lberror'; tipimage = 'lbtipimg lberrorimg'; break; case 'classic': tipstyle = 'lbclassic'; break; default: tipstyle = tipimage = ''; } if (this.ie6 || this.ie7 || (this.ie8 && this.doc.compatmode == 'backcompat')) { tipimage = ''; if (tipstyle != 'lbclassic' && tipstyle != '') { tipstyle += ' lbiefix'; } } tiphtml = mylink.innerhtml; mylink.innerhtml = ''; mylink.innerhtml = tiphtml + '' + (tipimage ? '
' : '') + mylink.getattribute('title') + '
'; mylink.setattribute('title',''); } } } this.tipsset = true; }; lytebox.prototype.start = function(olink, blyteshow, blyteframe) { this.setoptions(string(olink.getattribute('data-lyte-options'))); if (this.beforestart != '') { var callback = window[this.beforestart]; if (typeof callback === 'function') { if (!callback()) { return; } } } if (this.ie && this.ie6) { this.toggleselects('hide'); } if (this.hideobjects) { this.toggleobjects('hide'); } this.islyteframe = (blyteframe ? true : false); if (this.isframe && window.parent.frames[window.name].document) { window.parent.mylytebox.printid = (this.islyteframe ? 'lbiframe' : 'lbimage'); } else { this.printid = (this.islyteframe ? 'lbiframe' : 'lbimage'); } var pagesize = this.getpagesize(); var objoverlay = this.doc.getelementbyid('lboverlay'); var objbody = this.doc.getelementsbytagname("body").item(0); objoverlay.style.height = pagesize[1] + "px"; objoverlay.style.display = ''; this.appear('lboverlay', (this.doanimations ? 0 : this.maxopacity)); var anchors = (this.isframe && window.parent.frames[window.name].document) ? window.parent.frames[window.name].document.getelementsbytagname('a') : document.getelementsbytagname('a'); anchors = (this.isframe) ? anchors : document.getelementsbytagname('a'); var areas = (this.isframe) ? window.parent.frames[window.name].document.getelementsbytagname('area') : document.getelementsbytagname('area'); var lytelinks = this.combine(anchors, areas); if (this.islyteframe) { this.framearray = []; this.framenum = 0; if (olink.getattribute('rel') == 'lyteframe') { this.framearray.push(new array(olink.getattribute('href'), olink.getattribute('title'))); } else { if (olink.getattribute('rel') && olink.getattribute('rel').indexof('lyteframe') != -1) { for (var i = 0; i < lytelinks.length; i++) { var mylink = lytelinks[i]; if (mylink.getattribute('href') && mylink.getattribute('rel') == olink.getattribute('rel')) { this.framearray.push(new array(mylink.getattribute('href'), mylink.getattribute('title'))); } } this.framearray = this.removeduplicates(this.framearray); while(this.framearray[this.framenum][0] != olink.getattribute('href')) { this.framenum++; } } } } else { this.imagearray = []; this.imagenum = 0; this.slidearray = []; this.slidenum = 0; if (olink.getattribute('rel') == 'lytebox') { this.imagearray.push(new array(olink.getattribute('href'), olink.getattribute('title'))); } else { if (olink.getattribute('rel') && olink.getattribute('rel').indexof('lytebox') != -1) { for (var i = 0; i < lytelinks.length; i++) { var mylink = lytelinks[i]; if (mylink.getattribute('href') && mylink.getattribute('rel') == olink.getattribute('rel')) { this.imagearray.push(new array(mylink.getattribute('href'), mylink.getattribute('title'))); } } this.imagearray = this.removeduplicates(this.imagearray); while(this.imagearray[this.imagenum][0] != olink.getattribute('href')) { this.imagenum++; } } if (olink.getattribute('rel') && olink.getattribute('rel').indexof('lyteshow') != -1) { for (var i = 0; i < lytelinks.length; i++) { var mylink = lytelinks[i]; if (mylink.getattribute('href') && mylink.getattribute('rel') == olink.getattribute('rel')) { this.slidearray.push(new array(mylink.getattribute('href'), mylink.getattribute('title'))); } } this.slidearray = this.removeduplicates(this.slidearray); while(this.slidearray[this.slidenum][0] != olink.getattribute('href')) { this.slidenum++; } } } } var object = this.doc.getelementbyid('lbmain'); object.style.display = ''; // (07/20/2011) viewer will stay in fixed position if scrolling up/down - fixed by a.popov http://s3blog.org if (document.all && document.all.item && !window.opera) { object.style.top = (this.getpagescroll() + (pagesize[3] / 15)) + "px"; var ps = (pagesize[3] / 15); var handler = function(){ document.getelementbyid('lbmain').style.top = (mylytebox.getpagescroll() + ps) + 'px'; } this.bodyonscroll = document.body.onscroll; if (window.addeventlistener) { window.addeventlistener('scroll', handler, false); } else if (window.attachevent) { window.attachevent('onscroll', handler); } else { window.onload = handler_start; } object.style.position = "absolute"; } else { object.style.top = ((pagesize[3] / 15)) + "px"; object.style.position = "fixed"; } if (!this.outerborder) { this.doc.getelementbyid('lboutercontainer').style.border = 'none'; } else { this.doc.getelementbyid('lboutercontainer').setattribute(this.classattribute, this.theme); } if (this.forcecloseclick) { this.doc.getelementbyid('lboverlay').onclick = ''; } else { this.doc.getelementbyid('lboverlay').onclick = function() { mylytebox.end(); return false; } } this.doc.getelementbyid('lbmain').onclick = function(e) { var e = e; if (!e) { if (window.parent.frames[window.name] && (parent.document.getelementsbytagname('frameset').length <= 0)) { e = window.parent.window.event; } else { e = window.event; } } var id = (e.target ? e.target.id : e.srcelement.id); if ((id == 'lbmain') && (!mylytebox.forcecloseclick)) { mylytebox.end(); return false; } } this.doc.getelementbyid('lbprint').onclick = function() { mylytebox.printwindow(); return false; } this.doc.getelementbyid('lbclose').onclick = function() { mylytebox.end(); return false; } this.doc.getelementbyid('lbpause').onclick = function() { mylytebox.toggleplaypause("lbpause", "lbplay"); return false; } this.doc.getelementbyid('lbplay').onclick = function() { mylytebox.toggleplaypause("lbplay", "lbpause"); return false; } this.isslideshow = blyteshow; this.ispaused = (this.slidenum != 0 ? true : false); if (this.isslideshow && this.showplaypause && this.ispaused) { this.doc.getelementbyid('lbplay').style.display = ''; this.doc.getelementbyid('lbpause').style.display = 'none'; } if (this.islyteframe) { this.changecontent(this.framenum); } else { if (this.isslideshow) { this.changecontent(this.slidenum); } else { this.changecontent(this.imagenum); } } }; lytebox.prototype.launch = function(surl, soptions) { var sext = surl.split('.').pop().tolowercase(); var srel = 'lyteframe'; if (sext == 'png' || sext == 'jpg' || sext == 'jpeg' || sext == 'gif' || sext == 'bmp') { srel = 'lytebox'; } var olauncher = this.doc.getelementbyid('lblauncher'); olauncher.setattribute('href', surl); olauncher.setattribute('rel', srel); olauncher.setattribute('data-lyte-options', !soptions ? '' : soptions); this.updatelyteboxitems(); this.start(olauncher, false, (srel == 'lyteframe')); }; lytebox.prototype.changecontent = function(iimagenum) { if (this.isslideshow) { for (var i = 0; i < this.slideshowidcount; i++) { window.cleartimeout(this.slideshowidarray[i]); } } this.activeimage = this.activeslide = this.activeframe = iimagenum; if (!this.outerborder) { this.doc.getelementbyid('lboutercontainer').style.border = 'none'; } else { this.doc.getelementbyid('lboutercontainer').setattribute(this.classattribute, this.theme); } this.doc.getelementbyid('lbloading').style.display = ''; this.doc.getelementbyid('lbimage').style.display = 'none'; this.doc.getelementbyid('lbiframe').style.display = 'none'; this.doc.getelementbyid('lbprev').style.display = 'none'; this.doc.getelementbyid('lbnext').style.display = 'none'; this.doc.getelementbyid('lbprint').style.display = 'none'; this.doc.getelementbyid('lbiframecontainer').style.display = 'none'; this.doc.getelementbyid('lbdetailscontainer').style.display = 'none'; this.doc.getelementbyid('lbnumberdisplay').style.display = 'none'; if (this.navtypehash['display_by_type_' + this.navtype] || this.islyteframe) { object = this.doc.getelementbyid('lbnavdisplay'); object.innerhtml = '    || '; object.style.display = 'none'; } if (this.islyteframe) { var iframe = mylytebox.doc.getelementbyid('lbiframe'); var pagesize = this.getpagesize(); // (07/20/2011) if width/height are percentages, determine width in pixels before setting - fixed by a.popov http://s3blog.org var w = this.width.trim(); var h = this.height.trim(); if (/\%/.test(w)) { var percent = parseint(w); w = parseint((pagesize[2]-150)*percent/100); w = w+'px'; } if (/\%/.test(h)) { var percent = parseint(h); h = parseint((pagesize[3]-150)*percent/100); h = h+'px'; } iframe.height = h; iframe.width = w; iframe.scrolling = this.scrollbars.trim(); this.resizecontainer(parseint(iframe.width), parseint(iframe.height)); } else { imgpreloader = new image(); imgpreloader.onload = function() { var imagewidth = imgpreloader.width; var imageheight = imgpreloader.height; if (mylytebox.autoresize) { var pagesize = mylytebox.getpagesize(); var x = pagesize[2] - 150; var y = pagesize[3] - 150; if (imagewidth > x) { imageheight = math.round(imageheight * (x / imagewidth)); imagewidth = x; if (imageheight > y) { imagewidth = math.round(imagewidth * (y / imageheight)); imageheight = y; } } else if (imageheight > y) { imagewidth = math.round(imagewidth * (y / imageheight)); imageheight = y; if (imagewidth > x) { imageheight = math.round(imageheight * (x / imagewidth)); imagewidth = x; } } } var lbimage = mylytebox.doc.getelementbyid('lbimage') lbimage.src = (mylytebox.isslideshow ? mylytebox.slidearray[mylytebox.activeslide][0] : mylytebox.imagearray[mylytebox.activeimage][0]); lbimage.width = imagewidth; lbimage.height = imageheight; mylytebox.resizecontainer(imagewidth, imageheight); imgpreloader.onload = function() {}; } imgpreloader.src = (this.isslideshow ? this.slidearray[this.activeslide][0] : this.imagearray[this.activeimage][0]); } }; lytebox.prototype.resizecontainer = function(iwidth, iheight) { this.wcur = this.doc.getelementbyid('lboutercontainer').offsetwidth; this.hcur = this.doc.getelementbyid('lboutercontainer').offsetheight; this.xscale = ((iwidth + (this.bordersize * 2)) / this.wcur) * 100; this.yscale = ((iheight + (this.bordersize * 2)) / this.hcur) * 100; var wdiff = (this.wcur - this.bordersize * 2) - iwidth; var hdiff = (this.hcur - this.bordersize * 2) - iheight; if (!(hdiff == 0)) { this.hdone = false; this.resizeh('lboutercontainer', this.hcur, iheight + this.bordersize*2, this.getpixelrate(this.hcur, iheight)); } else { this.hdone = true; } if (!(wdiff == 0)) { this.wdone = false; this.resizew('lboutercontainer', this.wcur, iwidth + this.bordersize*2, this.getpixelrate(this.wcur, iwidth)); } else { this.wdone = true; } if ((hdiff == 0) && (wdiff == 0)) { if (this.ie){ this.pause(250); } else { this.pause(100); } } this.doc.getelementbyid('lbprev').style.height = iheight + "px"; this.doc.getelementbyid('lbnext').style.height = iheight + "px"; this.showcontent(); }; lytebox.prototype.showcontent = function() { if (this.wdone && this.hdone) { for (var i = 0; i < this.showcontenttimercount; i++) { window.cleartimeout(this.showcontenttimerarray[i]); } this.doc.getelementbyid('lbloading').style.display = 'none'; if (this.islyteframe) { this.doc.getelementbyid('lbiframe').style.display = ''; this.appear('lbiframe', (this.doanimations ? 0 : 100)); } else { this.doc.getelementbyid('lbimage').style.display = ''; this.appear('lbimage', (this.doanimations ? 0 : 100)); this.preloadneighborimages(); } if (this.isslideshow) { if(this.activeslide == (this.slidearray.length - 1)) { if (this.loopslideshow) { this.slideshowidarray[this.slideshowidcount++] = settimeout("mylytebox.changecontent(0)", this.slideinterval); } else if (this.autoend) { this.slideshowidarray[this.slideshowidcount++] = settimeout("mylytebox.end('slideshow')", this.slideinterval); } } else { if (!this.ispaused) { this.slideshowidarray[this.slideshowidcount++] = settimeout("mylytebox.changecontent("+(this.activeslide+1)+")", this.slideinterval); } } this.doc.getelementbyid('lbhovernav').style.display = (this.shownavigation && this.navtypehash['hover_by_type_' + this.navtype] ? '' : 'none'); this.doc.getelementbyid('lbclose').style.display = (this.showclose ? '' : 'none'); this.doc.getelementbyid('lbdetails').style.display = (this.showdetails ? '' : 'none'); this.doc.getelementbyid('lbpause').style.display = (this.showplaypause && !this.ispaused ? '' : 'none'); this.doc.getelementbyid('lbplay').style.display = (this.showplaypause && !this.ispaused ? 'none' : ''); this.doc.getelementbyid('lbnavdisplay').style.display = (this.shownavigation && this.navtypehash['display_by_type_' + this.navtype] ? '' : 'none'); } else { this.doc.getelementbyid('lbhovernav').style.display = (this.navtypehash['hover_by_type_' + this.navtype] && !this.islyteframe ? '' : 'none'); if ((this.navtypehash['display_by_type_' + this.navtype] && !this.islyteframe && this.imagearray.length > 1) || (this.framearray.length > 1 && this.islyteframe)) { this.doc.getelementbyid('lbnavdisplay').style.display = ''; } else { this.doc.getelementbyid('lbnavdisplay').style.display = 'none'; } this.doc.getelementbyid('lbclose').style.display = ''; this.doc.getelementbyid('lbdetails').style.display = ''; this.doc.getelementbyid('lbpause').style.display = 'none'; this.doc.getelementbyid('lbplay').style.display = 'none'; } this.doc.getelementbyid('lbprint').style.display = (this.showprint ? '' : 'none'); this.doc.getelementbyid('lbimagecontainer').style.display = (this.islyteframe ? 'none' : ''); this.doc.getelementbyid('lbiframecontainer').style.display = (this.islyteframe ? '' : 'none'); try { // (07/20/2011) identifier for cgi.script-server - by a.popov http://s3blog.org var uri = this.framearray[this.activeframe][0]; if (/\?/.test(uri)) { uri += '&request_from=lytebox'; } else { uri += '?request_from=lytebox'; } this.doc.getelementbyid('lbiframe').src = uri; } catch(e) { } if (this.afterstart != '') { var callback = window[this.afterstart]; if (typeof callback === 'function') { callback(); } } } else { this.showcontenttimerarray[this.showcontenttimercount++] = settimeout("mylytebox.showcontent()", 200); } }; lytebox.prototype.updatedetails = function() { var object = this.doc.getelementbyid('lbcaption'); var stitle = (this.isslideshow ? this.slidearray[this.activeslide][1] : (this.islyteframe ? this.framearray[this.activeframe][1] : this.imagearray[this.activeimage][1])); object.style.display = ''; object.innerhtml = (stitle == null ? '' : stitle); this.updatenav(); this.doc.getelementbyid('lbdetailscontainer').style.display = ''; object = this.doc.getelementbyid('lbnumberdisplay'); if (this.isslideshow && this.slidearray.length > 1) { object.style.display = ''; object.innerhtml = "image " + eval(this.activeslide + 1) + " of " + this.slidearray.length; this.doc.getelementbyid('lbnavdisplay').style.display = (this.navtypehash['display_by_type_' + this.navtype] && this.shownavigation ? '' : 'none'); } else if (this.imagearray.length > 1 && !this.islyteframe) { object.style.display = ''; object.innerhtml = "image " + eval(this.activeimage + 1) + " of " + this.imagearray.length; this.doc.getelementbyid('lbnavdisplay').style.display = (this.navtypehash['display_by_type_' + this.navtype] ? '' : 'none'); } else if (this.framearray.length > 1 && this.islyteframe) { object.style.display = ''; object.innerhtml = "page " + eval(this.activeframe + 1) + " of " + this.framearray.length; this.doc.getelementbyid('lbnavdisplay').style.display = ''; } else { this.doc.getelementbyid('lbnavdisplay').style.display = 'none'; } if (!((this.ie7 || this.ie8 || this.ie9) && this.doc.compatmode == 'backcompat') && !this.ie6) { this.doc.getelementbyid('lboutercontainer').style.paddingbottom = this.doc.getelementbyid('lbdetailscontainer').offsetheight + 'px'; } this.appear('lbdetailscontainer', (this.doanimations ? 0 : 100)); }; lytebox.prototype.updatenav = function() { if (this.isslideshow) { if (this.activeslide != 0) { if (this.navtypehash['display_by_type_' + this.navtype]) { var object = this.doc.getelementbyid('lbprev2'); object.style.display = ''; object.onclick = function() { if (mylytebox.pauseonprevclick) { mylytebox.toggleplaypause("lbpause", "lbplay"); } mylytebox.changecontent(mylytebox.activeslide - 1); return false; } } if (this.navtypehash['hover_by_type_' + this.navtype]) { var object = this.doc.getelementbyid('lbprev'); object.style.display = ''; object.onclick = function() { if (mylytebox.pauseonprevclick) { mylytebox.toggleplaypause("lbpause", "lbplay"); } mylytebox.changecontent(mylytebox.activeslide - 1); return false; } } } else { if (this.navtypehash['display_by_type_' + this.navtype]) { this.doc.getelementbyid('lbprev2_off').style.display = ''; } } if (this.activeslide != (this.slidearray.length - 1)) { if (this.navtypehash['display_by_type_' + this.navtype]) { var object = this.doc.getelementbyid('lbnext2'); object.style.display = ''; object.onclick = function() { if (mylytebox.pauseonnextclick) { mylytebox.toggleplaypause("lbpause", "lbplay"); } mylytebox.changecontent(mylytebox.activeslide + 1); return false; } } if (this.navtypehash['hover_by_type_' + this.navtype]) { var object = this.doc.getelementbyid('lbnext'); object.style.display = ''; object.onclick = function() { if (mylytebox.pauseonnextclick) { mylytebox.toggleplaypause("lbpause", "lbplay"); } mylytebox.changecontent(mylytebox.activeslide + 1); return false; } } } else { if (this.navtypehash['display_by_type_' + this.navtype]) { this.doc.getelementbyid('lbnext2_off').style.display = ''; } } } else if (this.islyteframe) { if(this.activeframe != 0) { var object = this.doc.getelementbyid('lbprev2'); object.style.display = ''; object.onclick = function() { mylytebox.changecontent(mylytebox.activeframe - 1); return false; } } else { this.doc.getelementbyid('lbprev2_off').style.display = ''; } if(this.activeframe != (this.framearray.length - 1)) { var object = this.doc.getelementbyid('lbnext2'); object.style.display = ''; object.onclick = function() { mylytebox.changecontent(mylytebox.activeframe + 1); return false; } } else { this.doc.getelementbyid('lbnext2_off').style.display = ''; } } else { if(this.activeimage != 0) { if (this.navtypehash['display_by_type_' + this.navtype]) { var object = this.doc.getelementbyid('lbprev2'); object.style.display = ''; object.onclick = function() { mylytebox.changecontent(mylytebox.activeimage - 1); return false; } } if (this.navtypehash['hover_by_type_' + this.navtype]) { var object2 = this.doc.getelementbyid('lbprev'); object2.style.display = ''; object2.onclick = function() { mylytebox.changecontent(mylytebox.activeimage - 1); return false; } } } else { if (this.navtypehash['display_by_type_' + this.navtype]) { this.doc.getelementbyid('lbprev2_off').style.display = ''; } } if(this.activeimage != (this.imagearray.length - 1)) { if (this.navtypehash['display_by_type_' + this.navtype]) { var object = this.doc.getelementbyid('lbnext2'); object.style.display = ''; object.onclick = function() { mylytebox.changecontent(mylytebox.activeimage + 1); return false; } } if (this.navtypehash['hover_by_type_' + this.navtype]) { var object2 = this.doc.getelementbyid('lbnext'); object2.style.display = ''; object2.onclick = function() { mylytebox.changecontent(mylytebox.activeimage + 1); return false; } } } else { if (this.navtypehash['display_by_type_' + this.navtype]) { this.doc.getelementbyid('lbnext2_off').style.display = ''; } } } this.enablekeyboardnav(); }; lytebox.prototype.enablekeyboardnav = function() { document.onkeydown = this.keyboardaction; }; lytebox.prototype.disablekeyboardnav = function() { document.onkeydown = ''; }; lytebox.prototype.keyboardaction = function(e) { var keycode = key = escape = null; keycode = (e == null) ? event.keycode : e.which; key = string.fromcharcode(keycode).tolowercase(); escape = (e == null) ? 27 : e.dom_vk_escape; if ((key == 'x') || (key == 'c') || (keycode == escape)) { mylytebox.end(); } else if ((key == 'p') || (keycode == 37)) { if (mylytebox.isslideshow) { if(mylytebox.activeslide != 0) { mylytebox.disablekeyboardnav(); mylytebox.changecontent(mylytebox.activeslide - 1); } } else if (mylytebox.islyteframe) { if(mylytebox.activeframe != 0) { mylytebox.disablekeyboardnav(); mylytebox.changecontent(mylytebox.activeframe - 1); } } else { if(mylytebox.activeimage != 0) { mylytebox.disablekeyboardnav(); mylytebox.changecontent(mylytebox.activeimage - 1); } } } else if ((key == 'n') || (keycode == 39)) { if (mylytebox.isslideshow) { if(mylytebox.activeslide != (mylytebox.slidearray.length - 1)) { mylytebox.disablekeyboardnav(); mylytebox.changecontent(mylytebox.activeslide + 1); } } else if (mylytebox.islyteframe) { if(mylytebox.activeframe != (mylytebox.framearray.length - 1)) { mylytebox.disablekeyboardnav(); mylytebox.changecontent(mylytebox.activeframe + 1); } } else { if(mylytebox.activeimage != (mylytebox.imagearray.length - 1)) { mylytebox.disablekeyboardnav(); mylytebox.changecontent(mylytebox.activeimage + 1); } } } }; lytebox.prototype.preloadneighborimages = function() { if (this.isslideshow) { if ((this.slidearray.length - 1) > this.activeslide) { preloadnextimage = new image(); preloadnextimage.src = this.slidearray[this.activeslide + 1][0]; } if(this.activeslide > 0) { preloadprevimage = new image(); preloadprevimage.src = this.slidearray[this.activeslide - 1][0]; } } else { if ((this.imagearray.length - 1) > this.activeimage) { preloadnextimage = new image(); preloadnextimage.src = this.imagearray[this.activeimage + 1][0]; } if(this.activeimage > 0) { preloadprevimage = new image(); preloadprevimage.src = this.imagearray[this.activeimage - 1][0]; } } }; lytebox.prototype.toggleplaypause = function(shideid, sshowid) { if (this.isslideshow && shideid == "lbpause") { for (var i = 0; i < this.slideshowidcount; i++) { window.cleartimeout(this.slideshowidarray[i]); } } this.doc.getelementbyid(shideid).style.display = 'none'; this.doc.getelementbyid(sshowid).style.display = ''; if (shideid == "lbplay") { this.ispaused = false; if (this.activeslide == (this.slidearray.length - 1)) { if (this.loopslideshow) { this.changecontent(0); } else if (this.autoend) { this.end(); } } else { this.changecontent(this.activeslide + 1); } } else { this.ispaused = true; } }; lytebox.prototype.end = function(scaller) { var closeclick = (scaller == 'slideshow' ? false : true); if (this.isslideshow && this.ispaused && !closeclick) { return; } if (this.beforeend != '') { var callback = window[this.beforeend]; if (typeof callback === 'function') { if (!callback()) { return; } } } this.disablekeyboardnav(); // (07/20/2011) save last func for body.onscroll - fixed by a.popov http://s3blog.org document.body.onscroll = this.bodyonscroll; // (07/20/2011) refresh main page? - by a.popov http://s3blog.org if (this.refreshpage) { this.doc.getelementbyid('lbloading').style.display = ''; this.doc.getelementbyid('lbimage').style.display = 'none'; this.doc.getelementbyid('lbiframe').style.display = 'none'; this.doc.getelementbyid('lbprev').style.display = 'none'; this.doc.getelementbyid('lbnext').style.display = 'none'; this.doc.getelementbyid('lbiframecontainer').style.display = 'none'; this.doc.getelementbyid('lbdetailscontainer').style.display = 'none'; this.doc.getelementbyid('lbnumberdisplay').style.display = 'none'; this.refreshpage = false; var uri_href = top.location.href; var reg=/\#.*$/g; uri_href=uri_href.replace(reg, ""); top.location.href = uri_href; return; } this.doc.getelementbyid('lbmain').style.display = 'none'; this.fade('lboverlay', (this.doanimations ? this.maxopacity : 0)); this.toggleselects('visible'); if (this.hideobjects) { this.toggleobjects('visible'); } this.doc.getelementbyid('lboutercontainer').style.width = '200px'; this.doc.getelementbyid('lboutercontainer').style.height = '200px'; if (this.isslideshow) { for (var i = 0; i < this.slideshowidcount; i++) { window.cleartimeout(this.slideshowidarray[i]); } } if (this.islyteframe) { this.initialize(); this.doc.getelementbyid('lbiframe').src = 'about:blank'; } if (this.afterend != '') { var callback = window[this.afterend]; if (typeof callback === 'function') { callback(); } } }; lytebox.prototype.checkframe = function() { if (window.parent.frames[window.name] && (parent.document.getelementsbytagname('frameset').length <= 0)) { this.isframe = true; this.lytebox = "window.parent." + window.name + ".mylytebox"; this.doc = parent.document; } else { this.isframe = false; this.lytebox = "mylytebox"; this.doc = document; } }; lytebox.prototype.getpixelrate = function(icurrent, idim) { var diff = (idim > icurrent) ? idim - icurrent : icurrent - idim; if (diff >= 0 && diff <= 100) { return 10; } if (diff > 100 && diff <= 200) { return 15; } if (diff > 200 && diff <= 300) { return 20; } if (diff > 300 && diff <= 400) { return 25; } if (diff > 400 && diff <= 500) { return 30; } if (diff > 500 && diff <= 600) { return 35; } if (diff > 600 && diff <= 700) { return 40; } if (diff > 700) { return 45; } }; lytebox.prototype.appear = function(sid, iopacity) { var object = this.doc.getelementbyid(sid).style; object.opacity = (iopacity / 100); object.mozopacity = (iopacity / 100); object.khtmlopacity = (iopacity / 100); object.filter = "alpha(opacity=" + (iopacity + 10) + ")"; if (iopacity == 100 && (sid == 'lbimage' || sid == 'lbiframe')) { try { object.removeattribute("filter"); } catch(e) {} this.updatedetails(); } else if (iopacity >= this.maxopacity && sid == 'lboverlay') { for (var i = 0; i < this.overlaytimercount; i++) { window.cleartimeout(this.overlaytimerarray[i]); } return; } else if (iopacity >= 100 && sid == 'lbdetailscontainer') { try { object.removeattribute("filter"); } catch(e) {} for (var i = 0; i < this.imagetimercount; i++) { window.cleartimeout(this.imagetimerarray[i]); } this.doc.getelementbyid('lboverlay').style.height = this.getpagesize()[1] + "px"; } else { if (sid == 'lboverlay') { this.overlaytimerarray[this.overlaytimercount++] = settimeout("mylytebox.appear('" + sid + "', " + (iopacity+20) + ")", 1); } else { this.imagetimerarray[this.imagetimercount++] = settimeout("mylytebox.appear('" + sid + "', " + (iopacity+10) + ")", 1); } } }; lytebox.prototype.fade = function(sid, iopacity) { var object = this.doc.getelementbyid(sid).style; object.opacity = (iopacity / 100); object.mozopacity = (iopacity / 100); object.khtmlopacity = (iopacity / 100); object.filter = "alpha(opacity=" + iopacity + ")"; if (iopacity <= 0) { try { object.display = 'none'; } catch(err) { } } else if (sid == 'lboverlay') { this.overlaytimerarray[this.overlaytimercount++] = settimeout("mylytebox.fade('" + sid + "', " + (iopacity-20) + ")", 1); } else { this.timeridarray[this.timeridcount++] = settimeout("mylytebox.fade('" + sid + "', " + (iopacity-10) + ")", 1); } }; lytebox.prototype.resizew = function(sid, icurrentw, imaxw, ipixelrate, ispeed) { if (!this.hdone) { this.resizewtimerarray[this.resizewtimercount++] = settimeout("mylytebox.resizew('" + sid + "', " + icurrentw + ", " + imaxw + ", " + ipixelrate + ")", 100); return; } var object = this.doc.getelementbyid(sid); var timer = ispeed ? ispeed : (this.resizeduration/2); var neww = (this.doanimations ? icurrentw : imaxw); object.style.width = (neww) + "px"; if (neww < imaxw) { neww += (neww + ipixelrate >= imaxw) ? (imaxw - neww) : ipixelrate; } else if (neww > imaxw) { neww -= (neww - ipixelrate <= imaxw) ? (neww - imaxw) : ipixelrate; } this.resizewtimerarray[this.resizewtimercount++] = settimeout("mylytebox.resizew('" + sid + "', " + neww + ", " + imaxw + ", " + ipixelrate + ", " + (timer+0.02) + ")", timer+0.02); if (parseint(object.style.width) == imaxw) { this.wdone = true; for (var i = 0; i < this.resizewtimercount; i++) { window.cleartimeout(this.resizewtimerarray[i]); } } }; lytebox.prototype.resizeh = function(sid, icurrenth, imaxh, ipixelrate, ispeed) { var timer = ispeed ? ispeed : (this.resizeduration/2); var object = this.doc.getelementbyid(sid); var newh = (this.doanimations ? icurrenth : imaxh); object.style.height = (newh) + "px"; if (newh < imaxh) { newh += (newh + ipixelrate >= imaxh) ? (imaxh - newh) : ipixelrate; } else if (newh > imaxh) { newh -= (newh - ipixelrate <= imaxh) ? (newh - imaxh) : ipixelrate; } this.resizehtimerarray[this.resizehtimercount++] = settimeout("mylytebox.resizeh('" + sid + "', " + newh + ", " + imaxh + ", " + ipixelrate + ", " + (timer+.02) + ")", timer+.02); if (parseint(object.style.height) == imaxh) { this.hdone = true; for (var i = 0; i < this.resizehtimercount; i++) { window.cleartimeout(this.resizehtimerarray[i]); } } }; lytebox.prototype.getpagescroll = function() { if (self.pageyoffset) { return this.isframe ? parent.pageyoffset : self.pageyoffset; } else if (this.doc.documentelement && this.doc.documentelement.scrolltop){ return this.doc.documentelement.scrolltop; } else if (document.body) { return this.doc.body.scrolltop; } }; lytebox.prototype.getpagesize = function() { var xscroll, yscroll, windowwidth, windowheight; if (window.innerheight && window.scrollmaxy) { xscroll = this.doc.scrollwidth; yscroll = (this.isframe ? parent.innerheight : self.innerheight) + (this.isframe ? parent.scrollmaxy : self.scrollmaxy); } else if (this.doc.body.scrollheight > this.doc.body.offsetheight){ xscroll = this.doc.body.scrollwidth; yscroll = this.doc.body.scrollheight; } else { xscroll = this.doc.getelementsbytagname("html").item(0).offsetwidth; yscroll = this.doc.getelementsbytagname("html").item(0).offsetheight; xscroll = (xscroll < this.doc.body.offsetwidth) ? this.doc.body.offsetwidth : xscroll; yscroll = (yscroll < this.doc.body.offsetheight) ? this.doc.body.offsetheight : yscroll; } if (self.innerheight) { windowwidth = (this.isframe) ? parent.innerwidth : self.innerwidth; windowheight = (this.isframe) ? parent.innerheight : self.innerheight; } else if (document.documentelement && document.documentelement.clientheight) { // explorer 6 strict mode windowwidth = this.doc.documentelement.clientwidth; windowheight = this.doc.documentelement.clientheight; } else if (document.body) { windowwidth = this.doc.getelementsbytagname("html").item(0).clientwidth; windowheight = this.doc.getelementsbytagname("html").item(0).clientheight; windowwidth = (windowwidth == 0) ? this.doc.body.clientwidth : windowwidth; windowheight = (windowheight == 0) ? this.doc.body.clientheight : windowheight; } var pageheight = (yscroll < windowheight) ? windowheight : yscroll; var pagewidth = (xscroll < windowwidth) ? windowwidth : xscroll; return new array(pagewidth, pageheight, windowwidth, windowheight); }; lytebox.prototype.toggleobjects = function(sstate) { var objects = this.doc.getelementsbytagname("object"); for (var i = 0; i < objects.length; i++) { objects[i].style.visibility = (sstate == "hide") ? 'hidden' : 'visible'; } var embeds = this.doc.getelementsbytagname("embed"); for (var i = 0; i < embeds.length; i++) { embeds[i].style.visibility = (sstate == "hide") ? 'hidden' : 'visible'; } if (this.isframe) { for (var i = 0; i < parent.frames.length; i++) { try { objects = parent.frames[i].window.document.getelementsbytagname("object"); for (var j = 0; j < objects.length; j++) { objects[j].style.visibility = (sstate == "hide") ? 'hidden' : 'visible'; } } catch(e) { } try { embeds = parent.frames[i].window.document.getelementsbytagname("embed"); for (var j = 0; j < embeds.length; j++) { embeds[j].style.visibility = (sstate == "hide") ? 'hidden' : 'visible'; } } catch(e) { } } } }; lytebox.prototype.toggleselects = function(sstate) { var selects = this.doc.getelementsbytagname("select"); for (var i = 0; i < selects.length; i++ ) { selects[i].style.visibility = (sstate == "hide") ? 'hidden' : 'visible'; } if (this.isframe) { for (var i = 0; i < parent.frames.length; i++) { try { selects = parent.frames[i].window.document.getelementsbytagname("select"); for (var j = 0; j < selects.length; j++) { selects[j].style.visibility = (sstate == "hide") ? 'hidden' : 'visible'; } } catch(e) { } } } }; lytebox.prototype.pause = function(imillis) { var now = new date(); var exittime = now.gettime() + imillis; while (true) { now = new date(); if (now.gettime() > exittime) { return; } } }; lytebox.prototype.combine = function(aanchors, aareas) { var lytelinks = []; for (var i = 0; i < aanchors.length; i++) { lytelinks.push(aanchors[i]); } for (var i = 0; i < aareas.length; i++) { lytelinks.push(aareas[i]); } return lytelinks; }; lytebox.prototype.removeduplicates = function (aarray) { for (var i = 1; i < aarray.length; i++) { if (aarray[i][0] == aarray[i-1][0]) { aarray.splice(i,1); } } return aarray; }; lytebox.prototype.printwindow = function () { var w = 400; var h = 300; var left = parseint((screen.availwidth/2) - (w/2)); var top = parseint((screen.availheight/2) - (h/2)); var wopts = "width=" + w + ",height=" + h + ",left=" + left + ",top=" + top + "screenx=" + left + ",screeny=" + top + "directories=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0"; var d = new date(); var wname = 'print' + d.gettime(); var wurl = document.getelementbyid(this.printid).src; this.wcontent = window.open(wurl, wname, wopts); this.wcontent.focus(); var t = settimeout("mylytebox.printcontent()",1000); }; lytebox.prototype.printcontent = function() { if (this.wcontent.document.readystate == 'complete') { this.wcontent.print(); this.wcontent.close(); this.wcontent = null; } else { var t = settimeout("mylytebox.printcontent()",1000); } }; lytebox.prototype.setoptions = function(soptions) { this.hideobjects = this.__hideobjects; this.autoresize = this.__autoresize; this.doanimations = this.__doanimations; this.forcecloseclick = this.__forcecloseclick; this.refreshpage = this.__refreshpage; this.showprint = this.__showprint; this.navtype = this.__navtype; this.beforestart = this.__beforestart; this.afterstart = this.__afterstart this.beforeend = this.__beforeend; this.afterend = this.__afterend; this.scrollbars = this.__scrollbars; this.width = this.__width; this.height = this.__height; this.slideinterval = this.__slideinterval; this.shownavigation = this.__shownavigation; this.showclose = this.__showclose; this.showdetails = this.__showdetails; this.showplaypause = this.__showplaypause; this.autoend = this.__autoend; this.pauseonnextclick = this.__pauseonnextclick; this.pauseonprevclick = this.__pauseonprevclick; this.loopslideshow = this.__loopslideshow; var sname = svalue = ''; var asetting = null; var aoptions = soptions.split(' '); for (var i = 0; i < aoptions.length; i++) { asetting = aoptions[i].split(':'); sname = (asetting.length > 1 ? string(asetting[0]).trim().tolowercase() : ''); svalue = (asetting.length > 1 ? string(asetting[1]).trim() : ''); switch(sname) { case 'hideobjects': this.hideobjects = (/true|false/.test(svalue) ? (svalue == 'true') : this.__hideobjects); break; case 'autoresize': this.autoresize = (/true|false/.test(svalue) ? (svalue == 'true') : this.__autoresize); break; case 'doanimations': this.doanimations = (/true|false/.test(svalue) ? (svalue == 'true') : this.__doanimations); break; case 'forcecloseclick': this.forcecloseclick = (/true|false/.test(svalue) ? (svalue == 'true') : this.__forcecloseclick); break; case 'refreshpage': this.refreshpage = (/true|false/.test(svalue) ? (svalue == 'true') : this.__refreshpage); break; case 'showprint': this.showprint = (/true|false/.test(svalue) ? (svalue == 'true') : this.__showprint); break; case 'navtype': this.navtype = (/[1-3]{1}/.test(svalue) ? parseint(svalue) : this.__navtype); break; case 'beforestart': this.beforestart = (svalue != '' ? svalue : this.__beforestart); break; case 'afterstart': this.afterstart = (svalue != '' ? svalue : this.__afterstart); break; case 'beforeend': this.beforeend = (svalue != '' ? svalue : this.__beforeend); break; case 'afterend': this.afterend = (svalue != '' ? svalue : this.__afterend); break; case 'scrollbars': this.scrollbars = (/auto|yes|no/.test(svalue) ? svalue : this.__scrollbars); break; case 'width': this.width = (/\d(%|px|)/.test(svalue) ? svalue : this.__width); break; case 'height': this.height = (/\d(%|px|)/.test(svalue) ? svalue : this.__height); break; case 'slideinterval': this.slideinterval = (/\d/.test(svalue) ? parseint(svalue) : this.__slideinterval); break; case 'shownavigation': this.shownavigation = (/true|false/.test(svalue) ? (svalue == 'true') : this.__shownavigation); break; case 'showclose': this.showclose = (/true|false/.test(svalue) ? (svalue == 'true') : this.__showclose); break; case 'showdetails': this.showdetails = (/true|false/.test(svalue) ? (svalue == 'true') : this.__showdetails); break; case 'showplaypause': this.showplaypause = (/true|false/.test(svalue) ? (svalue == 'true') : this.__showplaypause); break; case 'autoend': this.autoend = (/true|false/.test(svalue) ? (svalue == 'true') : this.__autoend); break; case 'pauseonnextclick': this.pauseonnextclick = (/true|false/.test(svalue) ? (svalue == 'true') : this.__pauseonnextclick); break; case 'pauseonprevclick': this.pauseonprevclick = (/true|false/.test(svalue) ? (svalue == 'true') : this.__pauseonprevclick); break; case 'loopslideshow': this.loopslideshow = (/true|false/.test(svalue) ? (svalue == 'true') : this.__loopslideshow); break; } } }; if (window.addeventlistener) { window.addeventlistener("load", initlytebox,false); } else if (window.attachevent) { window.attachevent("onload", initlytebox); } else { window.onload = function() {initlytebox();} } function initlytebox() { mylytebox = new lytebox(); }