
var gpgembd=null;var gfnEmbdPhotoGalleryNum=null;function EmbdPG(){var self=this;this.imgLoader=new ImagePreloader(function(bLoaded,image){self.imageLoaderCallBack(bLoaded,image)});this.opacityFadeEffect=null;this.photoPath=null;this.photos=null;this.photoDescriptions=null;this.loadingNum=0;this.fContentMode=false;this.contentModeCallback=null;this.currentPhotoNum=-1;this.overlay=null;this.centerLeftPos=0;this.staticLeftPos=0;this.centerWidth=480;this.centeredDivMode=false;this.filemode=true;this.nextTitle=null;this.uriPhotoNextTitle=null;this.oldBodyBg=null;this.overlayDisabled=false;this.overlayAnimation=true;this.preferredWidth=0;this.preferredHeight=0;this.loadedPhoto=null;this.loadingScreenAnimationDone=false;this.busy=false;this.imageLoadingIndicator="/images/pgembd/loading.gif";this.imagePrevPhoto="/images/pgembd/prev.gif";this.imageNextPhoto="/images/pgembd/next.gif";this.imageClose="/images/pgembd/close.gif";this.delayedPSTimer=null;this.fCloseButtonAtTop=false;this.fPNGHoverButtons=false;this.fPNGCloseButton=false;this.fPNGCloseButtonFade=true;this.xPNGCloseButtonOffset=0;this.yPNGCloseButtonOffset=0;this.fCloseOnOuterClick=true;this.fCloseOnEscape=true;this.borderWidth=10;this.fHighRes=false;this.fCenterPrevNextButtons=false;this.fPhotoSelectorEnabled=true;this.prevNextButtonsHeight=0;this.secResizeHorizontal=0.25;this.secResizeVertical=0.25;this.fnPreCloseCallback=null;this.fnPostCloseCallback=null;this.fnContentAddedCallback=null;this.fnNextKeyPressed=null;this.fnPrevKeyPressed=null;this.fCyclingEnabled=false;this.fActive=false;this.fFixedPositionMode=false;this.xMousePos=0;this.yMousePos=0;this.controlPanelClassName="pgembd_cp";this.contentLoadingClassName="content_pgembd_loading";this.contentLoadedClassName="content_pgembd_loaded";this.customBottomControlPanelHTML=null;this.cxCustomBottomCP=0;this.cyCustomBottomCP=0;this.customWidgetHTML=null;this.customWidgetID=null;this.customWidgetOffsetLeft=null;this.customWidgetOffsetTop=null;this.cxContent=0;this.cyContent=0;this.fSizeAnimation=true;this.fLoadContentBeforeOverlayAnimation=false;this.dragDiv=null;this.xDragMin=0;this.xDragOff=0;this.yDragOff=0;this.dragWinSize=null;this.dragScrollTop=0;}
EmbdPG.prototype.setCustomBottomControlPanel=function(html,cxCustomBottomCP,cyCustomBottomCP){this.customBottomControlPanelHTML=html;this.cxCustomBottomCP=cxCustomBottomCP;this.cyCustomBottomCP=cyCustomBottomCP;}
EmbdPG.prototype.setCustomWidget=function(id,html,offsetLeft,offsetTop){this.customWidgetHTML=html;this.customWidgetID=id;this.customWidgetOffsetLeft=offsetLeft;this.customWidgetOffsetTop=offsetTop;}
EmbdPG.prototype.setCloseButtonAtTop=function(state){this.fCloseButtonAtTop=state;}
EmbdPG.prototype.setPNGHoverButtons=function(state){this.fPNGHoverButtons=state;}
EmbdPG.prototype.setPNGCloseButton=function(state,xOffset,yOffset){this.fPNGCloseButton=state;this.xPNGCloseButtonOffset=xOffset;this.yPNGCloseButtonOffset=yOffset;}
EmbdPG.prototype.setPNGCloseButtonFade=function(state){this.fPNGCloseButtonFade=state;}
EmbdPG.prototype.setBorderWidth=function(width){this.borderWidth=width;}
EmbdPG.prototype.setPrevNextButtonsCentered=function(state){this.fCenterPrevNextButtons=state;}
EmbdPG.prototype.setPrevNextButtonsHeight=function(height){this.prevNextButtonsHeight=height;}
EmbdPG.prototype.setPhotoSelectorEnabled=function(state){this.fPhotoSelectorEnabled=state;}
EmbdPG.prototype.setCyclingEnabled=function(state){this.fCyclingEnabled=state;}
EmbdPG.prototype.setPostCloseCallback=function(fn){this.fnPostCloseCallback=fn;}
EmbdPG.prototype.setPreCloseCallback=function(fn){this.fnPreCloseCallback=fn;}
EmbdPG.prototype.setContentAddedCallback=function(fn){this.fnContentAddedCallback=fn;}
EmbdPG.prototype.setNextKeyPressedCallback=function(fn){this.fnNextKeyPressed=fn;}
EmbdPG.prototype.setPrevKeyPressedCallback=function(fn){this.fnPrevKeyPressed=fn;}
EmbdPG.prototype.setCloseOnOuterClick=function(fEnabled){this.fCloseOnOuterClick=fEnabled;}
EmbdPG.prototype.setCloseOnEscape=function(fEnabled){this.fCloseOnEscape=fEnabled;}
EmbdPG.prototype.setLoadContentBeforeOverlayAnimation=function(fEnabled){this.fLoadContentBeforeOverlayAnimation=fEnabled;}
EmbdPG.prototype.getOverlayTargetElement=function(){return document.body;}
EmbdPG.prototype.setMouseCoordinates=function(xMousePos,yMousePos){this.xMousePos=xMousePos;this.yMousePos=yMousePos;}
EmbdPG.prototype.isActive=function(){return this.fActive;}
EmbdPG.prototype.setPreferredSize=function(cxWidth,cyHeight){this.preferredWidth=cxWidth;this.preferredHeight=cyHeight;}
EmbdPG.prototype.setControlPanelClassName=function(className){this.controlPanelClassName=className;var cp=document.getElementById("pgembd_cp");if(cp){cp.className=this.controlPanelClassName;}}
EmbdPG.prototype.setContentLoadingClassName=function(className){this.contentLoadingClassName=className;}
EmbdPG.prototype.setContentLoadedClassName=function(className){this.contentLoadedClassName=className;}
EmbdPG.prototype.setFixedPositionMode=function(state){this.fFixedPositionMode=state&&!browser.ie6;}
EmbdPG.prototype.createOverlay=function(cxPhoto,cyPhoto,iStartPhoto){if(this.overlayAnimation){return this.createOverlayAnimated(cxPhoto,cyPhoto,iStartPhoto);}}
EmbdPG.prototype.createOverlayAnimated=function(cxPhoto,cyPhoto,iStartPhoto){this.queuedImage=null;this.fadeUpCP=true;this.fActive=true;this.loadingScreenAnimationDone=false;this.blurAnyInput();this.onClose(0);if(this.fSizeAnimation){this.preferredWidth=cxPhoto+0;this.preferredHeight=cyPhoto+30;}else{this.preferredWidth=cxPhoto;this.preferredHeight=cyPhoto;}
var centeredDiv=this.getOverlayTargetElement();if(!centeredDiv)
centeredDiv=document.getElementById("wrap");if(!centeredDiv)
return;var st=getPageScrollTop();var wsz=getWindowSize();var y=Math.floor((wsz[1]-this.preferredHeight)/2);if(y<0)
y=0;if(this.yPNGCloseButtonOffset<0){y-=this.yPNGCloseButtonOffset;}
var self=this;if(!this.overlayDisabled){if(!this.overlay){this.overlay=document.createElement("div");this.overlay.id="overlay_pgembd";this.overlay.className="overlay_pgembd";this.overlay.onclick=function(){self.onClose(1);return false;};var h=getPageHeight();if(h<st[1]+wsz[1]){h=st[1]+wsz[1];}
if(h<y+st[1]+this.preferredHeight){h=y+st[1]+this.preferredHeight+this.borderWidth;}
this.overlay.style.height=h+"px";this.overlay.style.width=getWindowSize()[0]+"px";}else{if(this.overlay.filters)
this.overlay.filters.alpha.opacity=0;this.overlay.style.opacity=0;var h=getPageHeight();if(h<st[1]+wsz[1]){h=st[1]+wsz[1];}
if(h<y+st[1]+this.preferredHeight){h=y+st[1]+this.preferredHeight+this.borderWidth;}
this.overlay.style.height=h+"px";this.overlay.style.width=getWindowSize()[0]+"px";}
document.body.className="overlay";centeredDiv.appendChild(this.overlay);}
this.loadingNum=iStartPhoto;var self=this;this.fnKeyPress=function(ev){return self.keyPress(ev)};this.fnMouseMove=function(ev){return self.mouseMove(ev)};this.fnWindowResize=function(ev){return self.windowResize(ev)};dw_Event.add(document.body,"keyup",this.fnKeyPress,false);dw_Event.add(document.body,"mousemove",this.fnMouseMove,false);if(navigator.userAgent.indexOf("Firefox")!=-1)
dw_Event.add(window,"keydown",this.fnKeyPress,false);dw_Event.add(window,"keyup",this.fnKeyPress,false);dw_Event.add(window,"resize",this.fnWindowResize,false);var overlayEffect=new OpacityFadeEffect(0.4);if(this.fLoadContentBeforeOverlayAnimation){this.overlayAnimationCallback();overlayEffect.startFadeEffect(this.overlay,null,false,function(){self.fadeInLoadingContent()},0.7);}else{overlayEffect.startFadeEffect(this.overlay,null,false,function(){self.overlayAnimationCallback()},0.7);}
return true;}
EmbdPG.prototype.overlayAnimationCallback=function(){var loadingBorderWidth=0;if(!this.fSizeAnimation){loadingBorderWidth=this.borderWidth;}
var content=document.createElement("div");content.id="content_pgembd";content.className=this.contentLoadingClassName;if(this.photos&&this.photos.length==1){var self=this;content.onclick=function(){self.onClose(2);return false;};}
var left=0;var st=getPageScrollTop();if(this.fFixedPositionMode){st[0]=0;st[1]=0;}
var wsz=getWindowSize();left=Math.floor((wsz[0]-(this.preferredWidth+loadingBorderWidth*2))/2)+this.centerLeftPos;if(left<0)
left=0;content.style.marginLeft=left+"px";var y=Math.floor((wsz[1]-(this.preferredHeight+loadingBorderWidth*2))/2);if(y<0)
y=0;if(this.yPNGCloseButtonOffset<0){y-=this.yPNGCloseButtonOffset;}
content.style.top=(y+st[1])+"px";if(!this.fSizeAnimation){content.style.width=(this.cxContent+(this.borderWidth*2))+"px";content.style.height=(this.cyContent+(this.borderWidth*2))+"px";}
document.body.appendChild(content);if(this.fnContentAddedCallback){this.fnContentAddedCallback(content);}
if(!this.fLoadContentBeforeOverlayAnimation)
this.fadeInLoadingContent();}
EmbdPG.prototype.fadeInLoadingContent=function(){var content=document.getElementById("content_pgembd");if(this.opacityFadeEffect==null){this.opacityFadeEffect=new OpacityFadeEffect();}
var self=this;this.opacityFadeEffect.startFadeEffect(content,null,false,function(){self.waitForPhoto()});}
EmbdPG.prototype.waitForPhoto=function(){this.loadingScreenAnimationDone=true;if(this.loadedPhoto){this.animatePhotoContent(this.loadedPhoto.width,this.loadedPhoto.height);}else if(this.fContentMode){if(this.fSizeAnimation){this.animatePhotoContent(this.cxContent,this.cyContent);}else{var content=document.getElementById("content_pgembd");content.className=this.contentLoadedClassName;this.busy=false;this.contentModeCallback();}}}
EmbdPG.prototype.animatePhotoContent=function(cxContent,cyContent){var content=document.getElementById("content_pgembd");content.className=this.contentLoadedClassName;var st=getPageScrollTop();if(this.yPNGCloseButtonOffset<0){st[1]-=this.yPNGCloseButtonOffset;}
var wsz=getWindowSize();var content=document.getElementById("content_pgembd");var cy=content.clientHeight||content.offsetHeight;var self=this;var effect=new SetHeightDoubleElementEffect(content,cy,cyContent+(this.borderWidth*2),null,0,0,function(){self.overlayAnimationHeightCallback(cxContent,cyContent)},false,this.secResizeVertical,false,wsz[1],st[1]);effect.startEffect();}
EmbdPG.prototype.overlayAnimationHeightCallback=function(cxContent,cyContent){var wsz=getWindowSize();var content=document.getElementById("content_pgembd");var cx=content.clientWidth||content.offsetWidth;var self=this;var effect=new SetWidthElementEffect(content,cx,cxContent+(this.borderWidth*2),function(){self.overlayAnimationWidthCallback()},this.secResizeHorizontal,wsz[0],this.centerLeftPos);effect.startEffect();}
EmbdPG.prototype.overlayAnimationWidthCallback=function(){if(this.fContentMode){this.busy=false;this.contentModeCallback();return;}
var elPhoto=document.getElementById("pgembd_photo");var _cxContent=this.loadedPhoto?this.loadedPhoto.width:this.cxContent;var _cyContent=this.loadedPhoto?this.loadedPhoto.height:this.cyContent;var cxHoverButton=Math.floor(_cxContent/2)-(this.borderWidth*2);var cyHoverButton=_cyContent;var yPrevNextButtonsTop=this.fCenterPrevNextButtons?Math.floor(_cyContent/2)-Math.floor(this.prevNextButtonsHeight/2):0;if(elPhoto){elPhoto.width=this.loadedPhoto.width;elPhoto.height=this.loadedPhoto.height;elPhoto.src=this.loadedPhoto.src;if(this.photos.length>1){var elPrev=document.getElementById("pgembd_hoverbutton_area_prev");elPrev.style.width=cxHoverButton+"px";elPrev.style.height=cyHoverButton+"px";var elNext=document.getElementById("pgembd_hoverbutton_area_next");elNext.style.width=cxHoverButton+"px";elNext.style.height=cyHoverButton+"px";if(this.fCenterPrevNextButtons){var elPrevButton=document.getElementById("pgembd_hoverbutton_prev");var elNextButton=document.getElementById("pgembd_hoverbutton_next");elNextButton.style.top=elPrevButton.style.top=yPrevNextButtonsTop+"px";}}
setElementsByIdsDisplayInline("pgembd_photo");setElementsByIdsDisplayBlock("pgembd_photo_over","pgembd_hoverbutton_area_prev","pgembd_hoverbutton_area_next");}else{var content=document.getElementById("content_pgembd");var str="<div style='background: white; position: relative; padding: 0px;'>";if(this.photos.length>1){if(!this.fPNGHoverButtons){str+="<img id='pgembd_hoverbutton_prev' src='"+this.imagePrevPhoto+"' />";str+="<img id='pgembd_hoverbutton_next' src='"+this.imageNextPhoto+"' />";}
str+="<div id='pgembd_hoverbutton_area_prev' class='pgembd_hoverbutton' style=\"width: "+cxHoverButton+"px; height: "+cyHoverButton+"px\">&nbsp;</div>";str+="<div id='pgembd_hoverbutton_area_next' class='pgembd_hoverbutton' style=\"width: "+cxHoverButton+"px; height: "+cyHoverButton+"px\">&nbsp;</div>";if(this.fPNGHoverButtons){str+="<div id='pgembd_hoverbutton_prev'></div>";str+="<div id='pgembd_hoverbutton_next'></div>";}}
str+="<div id='pgembd_photo_over' style='position: absolute; z-index: 2000; visibility: visible; background: white; top: "+this.borderWidth+"px; left: "+this.borderWidth+"px; filter:alpha(opacity=100); -moz-opacity:1.0; opacity:1.0; width: "+this.loadedPhoto.width+"px; height: "+this.loadedPhoto.height+"px'></div>";str+="<img id='pgembd_photo' style='border: "+this.borderWidth+"px solid white; vertical-align: center;' src='"+this.loadedPhoto.src+"' width='"+this.loadedPhoto.width+"' height='"+this.loadedPhoto.height+"' alt='' />";str+="</div>";if(this.photos.length>1){var self=this;if(this.fPhotoSelectorEnabled){str+="<div id='pgembd_photoselector' class='pgembd_photoselector'><ul>";for(var i=0;i<this.photos.length;i++){str+="<li><a id='photosel_"+i+"' onclick='gfnEmbdPhotoGalleryNum("+i+"); return false;' href='javascript:void(0);'><span>"+(i+1)+"</span></a></li>";}
str+="</ul></div>";gfnEmbdPhotoGalleryNum=function(num){self.photoGalleryNum(num);return false;};}
content.innerHTML=str;if(this.fCenterPrevNextButtons){var elPrevButton=document.getElementById("pgembd_hoverbutton_prev");var elNextButton=document.getElementById("pgembd_hoverbutton_next");elNextButton.style.top=elPrevButton.style.top=yPrevNextButtonsTop+"px";}
var el=document.getElementById("pgembd_hoverbutton_area_prev");el.onclick=function(){self.photoGalleryPrev(el);return false};el.onmouseover=function(){self.nextPrevMouseOver(el);};el.onmouseout=function(){self.nextPrevMouseOut(el);};var el2=document.getElementById("pgembd_hoverbutton_area_next");el2.onclick=function(){self.photoGalleryNext(el2);return false;};el2.onmouseover=function(){self.nextPrevMouseOver(el2);};el2.onmouseout=function(){self.nextPrevMouseOut(el2);};if(this.fPhotoSelectorEnabled){var el3=document.getElementById("pgembd_photoselector");el3.onmouseover=function(){self.selectPhotoMouseOver(el3)};el3.onmouseout=function(){self.selectPhotoMouseOut(el3)};}}else
content.innerHTML=str;}
this.fadeInPhoto(this.loadedPhoto);}
EmbdPG.prototype.selectPhotoMouseOver=function(el){if(this.delayedPSTimer){clearTimeout(this.delayedPSTimer);this.delayedPSTimer=null;}
JSFX.fadeUpElem("pgembd_photoselector",10,50);}
EmbdPG.prototype.selectPhotoMouseOut=function(el){if(this.delayedPSTimer==null){var self=this;this.delayedPSTimer=setTimeout(function(){self.selectPhotoFadeout()},100);}}
EmbdPG.prototype.selectPhotoFadeout=function(){JSFX.fadeDownElem("pgembd_photoselector",10);this.delayedPSTimer=null;}
EmbdPG.prototype.nextPrevMouseOver=function(el){if(!this.fPNGHoverButtons)
JSFX.fadeUpElem(el.id=="pgembd_hoverbutton_area_prev"?'pgembd_hoverbutton_prev':'pgembd_hoverbutton_next',10,80);else
setElementsByIdsDisplayBlock(el.id=="pgembd_hoverbutton_area_prev"?'pgembd_hoverbutton_prev':'pgembd_hoverbutton_next');this.selectPhotoMouseOver();}
EmbdPG.prototype.nextPrevMouseOut=function(el){if(!this.fPNGHoverButtons)
JSFX.fadeDownElem(el.id=="pgembd_hoverbutton_area_prev"?'pgembd_hoverbutton_prev':'pgembd_hoverbutton_next',10);else
setElementsByIdsDisplayNone(el.id=="pgembd_hoverbutton_area_prev"?'pgembd_hoverbutton_prev':'pgembd_hoverbutton_next');this.selectPhotoMouseOut();}
EmbdPG.prototype.keyPress=function(e){e=dw_Event.DOMit(e);var srcElement=e?(e.target?e.target:e.srcElement):event.srcElement;var keyCode=getKeyCode(e);if(srcElement&&srcElement.nodeName!='TEXTAREA'&&srcElement.nodeName!='INPUT'){if(keyCode==37){e.preventDefault();if(this.fnPrevKeyPressed)
this.fnPrevKeyPressed();else
this.photoGalleryPrev();return false;}else if(keyCode==32||keyCode==39){e.preventDefault();if(this.fnNextKeyPressed)
this.fnNextKeyPressed();else
this.photoGalleryNext();return false;}else if(keyCode==27){e.preventDefault();this.onClose(3);return false;}}
return true;}
EmbdPG.prototype.mouseMove=function(event){var e=event||window.event;this.xMousePos=e.pageX||e.clientX||0;this.yMousePos=e.pageY||e.clientY||0;return true;}
EmbdPG.prototype.windowResize=function(e){var st=getPageScrollTop();var wsz=getWindowSize();var h=getPageHeight();if(h<st[1]+wsz[1]){h=st[1]+wsz[1];}
if(this.overlay){this.overlay.style.height=h+"px";this.overlay.style.width=getWindowSize()[0]+"px";var content=document.getElementById("content_pgembd");if(content){var cx=content.clientWidth||content.offsetWidth;var cy=content.clientHeight||content.offsetHeight;var left=Math.floor((wsz[0]-(cx))/2)+this.centerLeftPos;if(left<0)
left=0;content.style.marginLeft=left+"px";var y=Math.floor((wsz[1]-cy)/2);if(y<0)
y=0;if(this.yPNGCloseButtonOffset<0){y-=this.yPNGCloseButtonOffset;}
var top=y+(this.fFixedPositionMode?0:st[1]);content.style.top=top+"px";var cp=document.getElementById("pgembd_cp");if(cp){var cxContent=this.loadedPhoto?this.loadedPhoto.width:(this.cxContent?this.cxContent:this.preferredWidth);var cyContent=this.loadedPhoto?this.loadedPhoto.height:(this.cyContent?this.cyContent:this.preferredHeight);if(this.fCloseButtonAtTop){cp.style.top=(top+this.yPNGCloseButtonOffset)+"px";}else
cp.style.top=(top+cyContent+(this.borderWidth*2)-33)+"px";cp.style.marginLeft=(left+cxContent+(this.borderWidth*2)+this.xPNGCloseButtonOffset)+"px";}
var cpBottom=document.getElementById("pgembd_bottom_cp");if(cpBottom){cpBottom.style.marginLeft=content.style.marginLeft;cpBottom.style.top=(top+this.loadedPhoto.height+(this.borderWidth*2))+"px";}
if(this.customWidgetID){var customWidget=document.getElementById(this.customWidgetID);if(customWidget){customWidget.style.top=(y+this.borderWidth+this.customWidgetOffsetTop)+"px";customWidget.style.marginLeft=(parseInt(content.style.marginLeft)+this.customWidgetOffsetLeft)+"px";}}}}
return true;}
EmbdPG.prototype.loadEmbeddedPhotoGallery=function(cxPhoto,cyPhoto,iStartPhoto,path,photos){if(this.busy)return;this.busy=true;this.loadedPhoto=null;this.filemode=true;this.photoPath=path;this.photos=new Array();for(var i=4;i<arguments.length;i++){this.photos.push(arguments[i]);}
var flashDivs=document.getElementsByTagName("div");for(var i=0;i<flashDivs.length;i++){if(flashDivs[i].className=="flash"){flashDivs[i].style.visibility="hidden";}}
this.contentModeCallback=null;this.fContentMode=false;this.cxContent=0;this.cyContent=0;this.fSizeAnimation=true;this.createOverlay(300,300,iStartPhoto);this.imgLoader.preload(path+this.photos[iStartPhoto]);}
EmbdPG.prototype.initEmbeddedPhotoGalleryFromDB=function(pgid,pid,fHighRes){if(this.busy)return;this.busy=true;this.fHighRes=fHighRes;var self=this;return new AJAXRequest("POST","/photo2.jspax","gethighreslist&pgid="+ajaxEscape(pgid),"",function(myAJAX){return self.processGetPhotoListXML(myAJAX,pgid,pid);});}
EmbdPG.prototype.processGetPhotoListXML=function(myAJAX,pgid,pid){if(myAJAX.readyState==4){if(myAJAX.status==200){var xml=myAJAX.responseXML;if(xml.documentElement){var status=xml.documentElement.getAttributeNode("status").nodeValue;if(status=="OK"){var pidlist=xml.documentElement.getElementsByTagName("list")[0].firstChild.nodeValue;var returnParms=pidlist.split(',');var startPhotoNum=0;if(returnParms.length>1){for(var i=0;i<returnParms.length;i++){if(pid==returnParms[i]){startPhotoNum=i;}}}
this.busy=false;eval("this.loadEmbeddedPhotoGalleryDB(0, 0, "+startPhotoNum+", "+pgid+", "+pidlist+")");}}}}}
EmbdPG.prototype.loadEmbeddedPhotoGalleryDB=function(cxPhoto,cyPhoto,iStartPhoto,pgid,photos){if(this.busy)return;this.busy=true;this.loadedPhoto=null;this.filemode=false;this.pgid=pgid;this.photos=new Array();for(var i=4;i<arguments.length;i++){this.photos.push(arguments[i]);}
var flashDivs=document.getElementsByTagName("div");for(var i=0;i<flashDivs.length;i++){if(flashDivs[i].className=="flash"){flashDivs[i].style.visibility="hidden";}}
this.createOverlay(300,300,iStartPhoto);this.getPhotoWithPid(this.pgid,this.photos[iStartPhoto]);}
EmbdPG.prototype.onClose=function(idSource){if(this.busy)return;if((idSource==1&&!this.fCloseOnOuterClick)||(idSource==3&&!this.fCloseOnEscape))
return;var self=this;if(this.fnPreCloseCallback&&!this.fnPreCloseCallback(self))
return;this.closeEmbeddedPhotoGallery();}
EmbdPG.prototype.closeEmbeddedPhotoGallery=function(){if(this.busy)return;var overlay=document.getElementById("overlay_pgembd");var content=document.getElementById("content_pgembd");var el=this.getOverlayTargetElement();var elCP=document.getElementById("pgembd_cp");var elBottomCP=document.getElementById("pgembd_bottom_cp");var customWidget=this.customWidgetID?document.getElementById(this.customWidgetID):null;if(el&&content){if(!this.overlayDisabled&&overlay){document.body.className="";el.removeChild(overlay);}else if(this.overlayDisabled)
document.body.className="";content.parentNode.removeChild(content);if(elCP)
elCP.parentNode.removeChild(elCP);if(elBottomCP)
elBottomCP.parentNode.removeChild(elBottomCP);if(customWidget)
customWidget.parentNode.removeChild(customWidget);var flashDivs=document.getElementsByTagName("div");for(var i=0;i<flashDivs.length;i++){if(flashDivs[i].className=="flash"){flashDivs[i].style.visibility="visible";}}
dw_Event.remove(document.body,"keyup",this.fnKeyPress,false);dw_Event.remove(document.body,"mousemove",this.fnMouseMove,false);if(navigator.userAgent.indexOf("Firefox")!=-1)
dw_Event.remove(window,"keydown",this.fnKeyPress,false);dw_Event.remove(window,"keyup",this.fnKeyPress,false);dw_Event.remove(window,"resize",this.fnWindowResize,false);this.fActive=false;if(this.fnPostCloseCallback)
this.fnPostCloseCallback();}}
EmbdPG.prototype.imageLoaderCallBack=function(bLoaded,image){setElementsByIdsDisplayNone("pgembd_hoverbutton_prev","pgembd_hoverbutton_next");if(this.loadedPhoto){var fDiffSize=image.width!=this.loadedPhoto.width||image.height!=this.loadedPhoto.height;this.loadedPhoto=image;var elPhotoOver=document.getElementById("pgembd_photo_over");setElementsByIdsVisible("pgembd_photo_over");var self=this;this.opacityFadeEffect.startFadeEffect(elPhotoOver,null,false,function(){if(fDiffSize){setElementsByIdsDisplayNone("pgembd_photo","pgembd_cp");setElementsByIdsDisplayNone("pgembd_photo_over");self.animatePhotoContent(image.width,image.height);}else{var elPhoto=document.getElementById("pgembd_photo");elPhoto.src=image.src;self.fadeInPhoto(image);}});}else{this.loadedPhoto=image;if(this.loadingScreenAnimationDone){this.animatePhotoContent(image.width,image.height);}}}
EmbdPG.prototype.fadeInBackground=function(image){var content=document.getElementById("content_pgembd");if(this.opacityFadeEffect==null){this.opacityFadeEffect=new OpacityFadeEffect();}
var self=this;this.opacityFadeEffect.startFadeEffect(content,null,false,function(){self.fadeInPhoto(image)});}
EmbdPG.prototype.fadeInPhoto=function(image){var el=document.getElementById("photosel_"+this.currentPhotoNum);if(el)
el.className="";this.currentPhotoNum=this.loadingNum;el=document.getElementById("photosel_"+this.currentPhotoNum);if(el)
el.className="active";var elPhoto=document.getElementById('pgembd_photo');if(elPhoto){var content=document.getElementById("content_pgembd");var elPhotoOver=document.getElementById("pgembd_photo_over");if(elPhotoOver.filters)
elPhotoOver.filters.alpha.opacity=100;elPhotoOver.style.opacity=1.0;elPhotoOver.style.width=image.width+"px";elPhotoOver.style.height=image.height+"px";elPhotoOver.style.visibility="visible";var self=this;this.opacityFadeEffect.startFadeEffect(elPhotoOver,null,true,function(){self.photoOverFadedOut()});if(this.nextTitle){if(image.src.indexOf(this.uriPhotoNextTitle)>=0){var el=document.getElementById("pgembd_photo_title");if(el){el.innerHTML=this.nextTitle;return;}}}
var el=document.getElementById("pgembd_photo_title");if(el)
el.innerHTML="";}}
EmbdPG.prototype.photoOverFadedOut=function(){setElementsByIdsHidden("pgembd_photo_over");var fFirst=false;var content=document.getElementById("content_pgembd");var cp=document.getElementById("pgembd_cp");if(cp&&cp.style.display!="none"){this.busy=false;return;}
if(!cp){fFirst=true;cp=document.createElement("div");cp.id="pgembd_cp";cp.className=this.controlPanelClassName;if(this.fPNGCloseButton){cp.innerHTML="<div><a id='pgembd_close' href='javascript: void(0);'></a></div>";}else
cp.innerHTML="<div style='padding: 8px 0px 0px 8px'><a id='pgembd_close' href='javascript: void(0);'><img src='"+this.imageClose+"' /></a></div>";}
var cpBottom=document.getElementById("pgembd_bottom_cp");if(!cpBottom&&this.customBottomControlPanelHTML){cpBottom=document.createElement("div");cpBottom.id="pgembd_bottom_cp";cpBottom.className="pgembd_bottom_cp";cpBottom.innerHTML=this.customBottomControlPanelHTML;}
var customWidget=this.customWidgetID?document.getElementById(this.customWidgetID):null;if(!customWidget&&this.customWidgetID){customWidget=document.createElement("div");customWidget.id=this.customWidgetID;customWidget.className=this.customWidgetID;customWidget.innerHTML=this.customWidgetHTML;}
var x=parseInt(content.style.marginLeft);var y=parseInt(content.style.top);var cxContent=this.loadedPhoto?this.loadedPhoto.width:(this.cxContent?this.cxContent:this.preferredWidth);var cyContent=this.loadedPhoto?this.loadedPhoto.height:(this.cyContent?this.cyContent:this.preferredHeight);x+=cxContent+(this.borderWidth*2);if(this.fCloseButtonAtTop)
cp.style.top=(y+this.yPNGCloseButtonOffset)+"px";else
cp.style.top=(y+cyContent+(this.borderWidth*2)-33)+"px";cp.style.marginLeft=(x+this.xPNGCloseButtonOffset)+"px";cp.style.width="0px";if(cpBottom){cpBottom.style.top=(y+cyContent+(this.borderWidth*2))+"px";cpBottom.style.marginLeft=content.style.marginLeft;cpBottom.style.width=(cxContent+(this.borderWidth*2))+"px";cpBottom.style.height="0px";}
if(customWidget){customWidget.style.top=(y+this.borderWidth+this.customWidgetOffsetTop)+"px";customWidget.style.marginLeft=(parseInt(content.style.marginLeft)+this.customWidgetOffsetLeft)+"px";}
if(fFirst){document.body.appendChild(cp);var el=document.getElementById("pgembd_close");var self=this;el.onclick=function(){self.onClose(0);return false;};if(cpBottom){document.body.appendChild(cpBottom);}
if(customWidget){document.body.appendChild(customWidget);}}else{cp.style.display="block";if(cpBottom)
cpBottom.style.display="block";if(customWidget)
customWidget.style.display="block";}
var self=this;if(this.fPNGCloseButton){if(this.fPNGCloseButtonFade){var effect=new OpacityFadeEffect(0.4);effect.startFadeEffect(document.getElementById("pgembd_close"),null,false,function(){self.controlPanelWidthCallback()});}else
self.controlPanelWidthCallback();}else{var effect=new SetWidthElementEffect(cp,0,34,function(){self.controlPanelWidthCallback()},0.3);effect.startEffect();}
if(cpBottom){var cpBottomEffect=new SetHeightDoubleElementEffect(cpBottom,0,this.cyCustomBottomCP,null,0,0,null,false,0.15,false);cpBottomEffect.startEffect();}
if(this.photos&&this.photos.length>1){var cxHoverButton=Math.floor(this.loadedPhoto.width/2)-(this.borderWidth*2);var cyHoverButton=this.loadedPhoto.height;var elNext=document.getElementById("pgembd_hoverbutton_area_next");var offsetButton=getElementAbsoluteOffset(elNext);if(offsetButton[0]<this.xMousePos&&offsetButton[0]+cxHoverButton>this.xMousePos&&offsetButton[1]<this.yMousePos&&offsetButton[1]+cyHoverButton>this.yMousePos){setElementsByIdsDisplayBlock("pgembd_hoverbutton_next");}
var elPrev=document.getElementById("pgembd_hoverbutton_area_prev");offsetButton=getElementAbsoluteOffset(elPrev);if(offsetButton[0]<this.xMousePos&&offsetButton[0]+cxHoverButton>this.xMousePos&&offsetButton[1]<this.yMousePos&&offsetButton[1]+cyHoverButton>this.yMousePos){setElementsByIdsDisplayBlock("pgembd_hoverbutton_prev");}}}
EmbdPG.prototype.controlPanelWidthCallback=function(){this.windowResize();this.busy=false;}
EmbdPG.prototype.getPhotoWithPid=function(pgid,pid){var self=this;return new AJAXRequest("POST","/photo2.jspax","pgid="+pgid+"&pid="+pid+(this.fHighRes?"&hres":""),"",function(myAJAX){return self.processGetPhotoXML(myAJAX);});}
EmbdPG.prototype.processGetPhotoXML=function(myAJAX){if(myAJAX.readyState==4){if(myAJAX.status==200){var xml=myAJAX.responseXML;if(xml.documentElement){var status=xml.documentElement.getAttributeNode("status").nodeValue;if(status=="OK"){var photoURI=xml.documentElement.getElementsByTagName("uri")[0].firstChild.nodeValue;var titles=xml.documentElement.getElementsByTagName("title");if(titles.length){this.nextTitle=titles[0].firstChild.nodeValue;this.uriPhotoNextTitle=photoURI;}else{this.nextTitle=null;}
if(photoURI){this.imgLoader.preload(photoURI);}}else if(status=="login"){openLoginForm(loggedInNowCallback,"mg",false,1);}}}}}
EmbdPG.prototype.photoGalleryPrev=function(){if(this.photos&&(this.currentPhotoNum>0||this.fCyclingEnabled)&&!this.busy){this.busy=true;this.loadingNum=this.currentPhotoNum-1;if(this.loadingNum<0)
this.loadingNum=this.photos.length-1;if(this.filemode){if(this.photoDescriptions){this.nextTitle=this.photoDescriptions[this.loadingNum];this.uriPhotoNextTitle=this.photoPath+this.photos[this.loadingNum];}
this.imgLoader.preload(this.photoPath+this.photos[this.loadingNum]);}else
this.getPhotoWithPid(this.pgid,this.photos[this.loadingNum]);}}
EmbdPG.prototype.photoGalleryNext=function(){if(this.photos&&(this.currentPhotoNum+1<this.photos.length||this.fCyclingEnabled)&&!this.busy){this.busy=true;this.loadingNum=this.currentPhotoNum+1;if(this.currentPhotoNum+1==this.photos.length)
this.loadingNum=0;if(this.filemode){if(this.photoDescriptions){this.nextTitle=this.photoDescriptions[this.loadingNum];this.uriPhotoNextTitle=this.photoPath+this.photos[this.loadingNum];}
this.imgLoader.preload(this.photoPath+this.photos[this.loadingNum]);}else
this.getPhotoWithPid(this.pgid,this.photos[this.loadingNum]);}}
EmbdPG.prototype.photoGalleryNum=function(num){if(num>=0&&num<this.photos.length&&!this.busy){this.busy=true;this.loadingNum=num;if(this.filemode){if(this.photoDescriptions){this.nextTitle=this.photoDescriptions[this.loadingNum];this.uriPhotoNextTitle=this.photoPath+this.photos[this.loadingNum];}
this.imgLoader.preload(this.photoPath+this.photos[this.loadingNum]);}else
this.getPhotoWithPid(this.pgid,this.photos[this.loadingNum]);}}
EmbdPG.prototype.blurAnyInput=function(){var inputs=document.getElementsByTagName('input');if(inputs&&inputs[0]&&inputs[0].blur){inputs[0].blur();}}
EmbdPG.prototype.loadEmbeddedContent=function(cxContent,cyContent,callback,fAnimate){if(this.busy)return;this.busy=true;var flashDivs=document.getElementsByTagName("div");for(var i=0;i<flashDivs.length;i++){if(flashDivs[i].className=="flash"){flashDivs[i].style.visibility="hidden";}}
this.photos=null;this.fContentMode=true;this.loadedPhoto=null;this.contentModeCallback=callback;this.cxContent=cxContent;this.cyContent=cyContent;if(fAnimate){this.createOverlay(300,300,-1);}else{this.fSizeAnimation=false;this.createOverlay(cxContent,cyContent,-1);}}
EmbdPG.prototype.dragHandlerCatch=function(e,fIframeChildCall){e=dw_Event.DOMit(e);e.preventDefault();this.dragDiv=document.getElementById("content_pgembd");this.xDragMin=0;this.dragWinSize=getWindowSize();this.dragScrollTop=getPageScrollTop();if(this.fFixedPositionMode){this.dragScrollTop[0]=0;this.dragScrollTop[1]=0;}
var xMouse=e.pageX||e.clientX||0;var yMouse=e.pageY||e.clientY||0;if(fIframeChildCall){var theElement=this.dragDiv;while(theElement!=null){xMouse+=theElement.offsetLeft;yMouse+=theElement.offsetTop;theElement=theElement.offsetParent;}
if(browser.ie6up){yMouse-=this.dragScrollTop[1];}}
this.xDragOff=xMouse-parseInt(this.dragDiv.offsetLeft);this.yDragOff=yMouse-parseInt(this.dragDiv.offsetTop);return false;}
EmbdPG.prototype.dragHandlerMove=function(e,fIframeChildCall){e=dw_Event.DOMit(e);if(this.dragDiv){e.preventDefault();if(e.button>1){this.dragDiv=null;return true;}
var xMouse=e.pageX||e.clientX||0;var yMouse=e.pageY||e.clientY||0;if(fIframeChildCall){var theElement=this.dragDiv;while(theElement!=null){xMouse+=theElement.offsetLeft;yMouse+=theElement.offsetTop;theElement=theElement.offsetParent;}
if(browser.ie6up&&!this.fFixedPositionMode){yMouse-=this.dragScrollTop[1];}}
var x=xMouse-this.xDragOff;var y=yMouse-this.yDragOff;if(x<this.xDragMin)
x=this.xDragMin;if(y<0)
y=0;if(!this.fFixedPositionMode&&y<this.dragScrollTop[1])
y=this.dragScrollTop[1];var cxContent=this.dragDiv.clientWidth||this.dragDiv.offsetWidth;var cyContent=this.dragDiv.clientHeight||this.dragDiv.offsetHeight;if(this.dragWinSize){if(x+cxContent-this.dragScrollTop[0]+(browser.ns6up?20:0)>this.dragWinSize[0])
x=this.dragWinSize[0]-cxContent+this.dragScrollTop[0]-(browser.ns6up?20:0);if(y+cyContent-this.dragScrollTop[1]>this.dragWinSize[1]){y=this.dragWinSize[1]-cyContent+this.dragScrollTop[1];}}
this.dragDiv.style.marginLeft=x+"px";this.dragDiv.style.top=y+"px";return false;}
return true;}
EmbdPG.prototype.dragHandlerRelease=function(e){if(this.dragDiv){e=dw_Event.DOMit(e);e.preventDefault();this.dragDiv=null;return false;}
return true;}
