function Gallery (){var self = this;var _clicked = false;this._init = function (){var list = document.getElementsByTagName('a');for ( var i = 0; i < list.length; i++ ){if ( list[i].className == "showImage" ) {this._addEvent(list[i], 'click', this._showImage);}}};this._showImage = function (e){this._center= self._findComponent('imprensaCenter');this._imgNormal = self._findComponent('imageNormal');this._zoomLink= self._findComponent('imageZoom');if(this._imgNormal) this._center.removeChild(this._imgNormal);if(this._zoomLink)this._center.removeChild(this._zoomLink);this._event = e ? e : window.event;if ( this._event.target ) this._targ = this._event.target;else if ( this._event.srcElement ) this._targ = this._event.srcElement;if ( this._event.nodeType == 3 ) this._targ = this._event.parendNode;this._imageSrc = String(this._targ.getAttribute('src'));this._imageSrc = this._imageSrc.replace(/thumb/i,'normal');this._zoomImageSrc = this._imageSrc.replace(/normal/,'zoom');this._attrAlt= this._targ.getAttribute('alt');self._findComponent('principalTitulo').innerHTML = this._attrAlt;this._imgNormal = document.createElement('img');this._zoomLink = document.createElement('div');this._imgNormal.setAttribute('src', this._imageSrc);this._imgNormal.setAttribute('id', 'imageNormal');this._imgNormal.setAttribute('title', this._attrAlt);this._zoomLink.setAttribute('rel', this._zoomImageSrc);this._zoomLink.className = 'imageZoom';this._zoomLink.setAttribute('id','imageZoom');this._zoomLink.setAttribute('title', 'ampliar');this._center.appendChild(this._imgNormal);this._center.appendChild(this._zoomLink);self._addEvent(this._zoomLink, 'click', self._showImageZoom);_clicked = true;return false;};this._showImageZoom = function(e){if(_clicked){this._e = e ? e : window.event;if ( this._e.target ) this._t = this._e.target;else if ( this._e.srcElement ) this._t = this._e.srcElement;if ( this._e.nodeType == 3 ) this._t = this._e.parendNode;} else {this._t = e;}this._newImageSrc = String(this._t.getAttribute('rel'));this._divBg= document.createElement('div');this._divZoom= document.createElement('div');this._newImage = document.createElement('img');this._divBg.setAttribute('id','ZoomBG');this._divBg.setAttribute('title','fechar');this._divZoom.setAttribute('id', 'divZoom');this._divZoom.setAttribute('title','fechar');this._newImage.setAttribute('src', this._newImageSrc);this._newImage.setAttribute('id', 'newImage');this._newImage.setAttribute('title','fechar');self._findComponent('container').appendChild(this._divBg);this._divBg.appendChild(this._divZoom);this._divZoom.appendChild(this._newImage);self._addEvent(this._divBg,'click', self._closeImageZoom);self._addEvent(this._divZoom,'click', self._closeImageZoom);self._addEvent(this._newImage, 'click', self._closeImageZoom);};this._closeImageZoom = function (){self._findComponent('divZoom').removeChild(self._findComponent('newImage'));self._findComponent('ZoomBG').removeChild(self._findComponent('divZoom'));self._findComponent('container').removeChild(self._findComponent('ZoomBG'));};this._findComponent = function (e){return (document.all) ? document.all[e] : document.getElementById(e);};this._addEvent = function (o, t, f) {if (o.addEventListener) o.addEventListener(t, f, true);else if (o.attachEvent) o.attachEvent('on' + t, f);else o['on' + t] = f;};this._removeEvent = function (o, t, f) {if (o.removeEventListener) o.removeEventListener(t, f, false);else if (o.detachEvent) o.detachEvent('on' + t, f);else o['on' + t] = null;};this._init();}var Gallery = new Gallery();