function init()
{Position.prepare();if(typeof window.videos!="undefined")loadVideo();if(typeof Customizer!="undefined"){myCustomization=new Customizer("show",page_access_key,page_custom_bg_url,username);}else myCustomization="invitee mode";fnChangeContentHeight();loadComponents();fnChangeContentHeight();}
var plc=new Array();function loadComponents(){for(var c in plc){if(typeof plc[c]["url"]!="undefined"&&typeof plc[c]["id"]!="undefined"){loadIndividualComponent(c);}}}
function loadIndividualComponent(c){if(typeof plc[c]["url"]!="undefined"&&typeof plc[c]["id"]!="undefined"){cId=plc[c]["id"].substring(plc[c]["id"].indexOf("[")+1,plc[c]["id"].length-1);if(!isNaN(cId)&&$(plc[c]["id"]))
new Ajax.Updater(plc[c]["id"],plc[c]["url"]+cId,{asynchronous:true,evalScripts:true,method:'get'});}}
var Slideshow=Class.create();var MAXWIDTH=470;Slideshow.prototype={initialize:function(strObj,strType,strParentDiv,intCurrent){this.arrSlide=new Array();this.obj=strObj;this.type=strType;this.parentDiv=$(strParentDiv);this.mainDiv=$(strType);this.currentSlide=intCurrent;this.objPopup=null;aslideshow=this;this.eventNext=this.next.bindAsEventListener(this);this.eventPrevious=this.previous.bindAsEventListener(this);this.eventClosePopup=this.closePopup.bindAsEventListener(this);},setObservers:function(strType){switch(strType){case"wall":this.observeWall();this.currentSlide=0;break;case"thumbs":this.observeThumbs();break;}},showshow:function(){if($(this.obj+"mainimage"))
$(this.obj+"mainimage").style.cursor="pointer";if($('photostream_loading')){Effect.BlindUp('photostream_loading',{queue:{scope:"photostream",limit:5},duration:1,afterUpdate:fnChangeContentHeight,afterFinish:fnChangeContentHeight});}
if($('photostreams'))
Effect.Appear('photostreams',{queue:{scope:"photostream",limit:5},duration:2,afterUpdate:changepscontainer,afterFinish:changepscontainer});},observeWall:function(){this.mainDiv=$(this.obj+"wall")
var arrImages=this.mainDiv.getElementsByTagName("IMG")
for(var i=0;i<arrImages.length;i++){this.add(arrImages[i].getAttribute("imagesrc"),arrImages[i].src,arrImages[i].getAttribute("photo_id"),arrImages[i].alt,arrImages[i].title,arrImages[i].getAttribute("actualwidth"),arrImages[i].getAttribute("actualheight"),arrImages[i].getAttribute("comments"));Event.observe(arrImages[i],"click",this.arrSlide[i].popup);}
this.showshow();},updateImgByPhotoId:function(photoId){var arrImages=this.mainDiv.getElementsByTagName("IMG")
var intSlide=0
for(var i=0;i<arrImages.length;i++){if(arrImages[i].getAttribute("photo_id")==photoId){this.arrSlide[intSlide].comments=arrImages[i].getAttribute("comments")
if(!arrImages[i].id||arrImages[i].id!=this.obj+"mainimage"){Event.observe(arrImages[i],"click",this.type=="wall"?this.arrSlide[intSlide].popup:this.arrSlide[intSlide].pick);intSlide++;}}
else{if(!arrImages[i].id||arrImages[i].id!=this.obj+"mainimage"){intSlide++;}}}
if(this.arrSlide[this.currentSlide].comments=="")
$(this.obj+"photocomments").style.display="none";else
$(this.obj+"photocomments").style.display="block";},observeThumbs:function(){this.mainDiv=$(this.obj+"thumbs")
var arrImages=this.mainDiv.getElementsByTagName("IMG")
var intSlide=0
for(var i=0;i<arrImages.length;i++)
{if(arrImages[i].id!=this.obj+"mainimage"){this.add(arrImages[i].getAttribute("imagesrc"),arrImages[i].src,arrImages[i].getAttribute("photo_id"),arrImages[i].alt,arrImages[i].title,arrImages[i].getAttribute("actualwidth"),arrImages[i].getAttribute("actualheight"),arrImages[i].getAttribute("comments"));}
if(!arrImages[i].id||arrImages[i].id!=this.obj+"mainimage"){Event.observe(arrImages[i],"click",this.arrSlide[intSlide].pick);intSlide++;}}
Event.observe($(this.obj+"mainimage"),"click",this.eventNext);this.currentElement=$(this.obj+"mainimage");this.showshow();},next:function(e){this.currentSlide++;if(this.currentSlide==this.arrSlide.length)
this.currentSlide=0;this.changeImage();this.swapPrevNext();Event.stop(e);},previous:function(e){this.currentSlide--;if(this.currentSlide==-1)
this.currentSlide=this.arrSlide.length-1;this.changeImage();this.swapPrevNext();Event.stop(e);},swapPrevNext:function(){if(document.getElementById(this.obj+"previousImage")!=null&&document.getElementById(this.obj+"nextImage")!=null){var nextSlide=this.currentSlide+1
if(this.currentSlide==this.arrSlide.length-1)
nextSlide=0
if($(this.obj+"nextImage")){$(this.obj+"nextImage").src=this.arrSlide[nextSlide].small
$(this.obj+"nextImage").alt=this.arrSlide[nextSlide].title}
var prevSlide=this.currentSlide-1
if(this.currentSlide==0)
prevSlide=this.arrSlide.length-1
if($(this.obj+"previousImage")){$(this.obj+"previousImage").src=this.arrSlide[prevSlide].small
$(this.obj+"previousImage").alt=this.arrSlide[prevSlide].title}}
this.changeCaptions();fnChangeContentHeight();},pick:function(intCount){this.currentSlide=intCount;this.changeImage();this.changeCaptions();fnChangeContentHeight();},changeCaptions:function(){if(document.getElementById(this.obj+"photonumber"))
$(this.obj+"photonumber").innerHTML=(this.currentSlide+1)+" of "+this.arrSlide.length;if(document.getElementById(this.obj+"photocaption"))
$(this.obj+"photocaption").innerHTML=this.arrSlide[this.currentSlide].caption;if(document.getElementById(this.obj+"photoId"))
$(this.obj+"photoId").value=this.arrSlide[this.currentSlide].photoId;if(document.getElementById(this.obj+"photocomments"))
if(this.arrSlide[this.currentSlide].comments==""){$(this.obj+"photocomments").style.display="none";}else{$(this.obj+"photocomments").style.display="block";$(this.obj+"photocomments").innerHTML=this.arrSlide[this.currentSlide].comments;}},popup:function(intCount,objImg){hideAllSlidePopups();this.currentSlide=intCount;Position.prepare();text="";this.showPopupImage(Position.page(objImg));$(this.obj+"mainimage").style.cursor="pointer";},closePopup:function(e){this.objPopup.style.display="none";$(this.obj+"mainimage").src="/images/icons/photo-loading.gif";$(this.obj+"mainimage").style.cursor="";$(this.obj+"photocaption").innerHTML="";overflowShow();Event.stop(e);},showPopupImage:function(arrPos){if(this.objPopup==null){this.objPopup=document.getElementById(this.obj+"photoPopup");Event.observe($(this.obj+"prev"),"click",this.eventPrevious)
Event.observe($(this.obj+"next"),"click",this.eventNext)
Event.observe($(this.obj+"mainimage"),"click",this.eventNext);Event.observe($(this.obj+"close"),"click",this.eventClosePopup);}
overflowHide();var objslide=this.arrSlide[this.currentSlide]
var imgEl=$(this.obj+"mainimage");imgEl.up().style.height=objslide.height+'px';imgEl.src=objslide.large;imgEl.alt=objslide.caption;imgEl.width=objslide.width;imgEl.height=objslide.height;this.changePopup(imgEl);},changePopup:function(imgEl){var st=0;var sl=0;var h=100;var w=100;if(gWin&&typeof gWin.calculate!="undefined"){gWin.calculate();var st=gWin.st;var sl=gWin.sl;var h=gWin.h;var w=gWin.w;}
Position.prepare();var iwidth=this.arrSlide[this.currentSlide].width;var iheight=this.arrSlide[this.currentSlide].height;this.changeCaptions();var marginTop=st-5;if(typeof myCustomization!="undefined"&&myCustomization!="invitee mode"){if(typeof $("hidden_custom").offsetHeight!="undefined")
marginTop-=$("hidden_custom").offsetHeight;}
this.objPopup.style.marginTop=marginTop+"px";this.objPopup.style.height="auto";var marginLeft=(-(470/2)+sl-20);if(470>w)marginLeft=marginLeft+((470-w)/2);marginLeft+=8;this.objPopup.style.left="50%";this.objPopup.style.marginLeft=marginLeft+"px";this.objPopup.style.zIndex=10000;this.currentElement=imgEl;this.objPopup.style.display="block";},changePopUpHeight:function(){},changeImage:function(){var element=this.createImageElement(this.arrSlide[this.currentSlide]);this.currentElement.style.visibility='hidden';this.currentElement.up().style.height=element.height+'px';this.currentElement.up().replaceChild(element,this.currentElement);this.currentElement=element;Event.observe($(this.obj+"mainimage"),"click",this.eventNext);if(this.objPopup!=null&&this.objPopup.style.display=="block")
this.changePopup($(this.obj+"mainimage"));else{fnChangeContentHeight();}},createImageElement:function(objslide){var imgEl=document.createElement("IMG");imgEl.src=objslide.large;imgEl.alt=objslide.caption;imgEl.id=this.obj+"mainimage";imgEl.style.cursor="pointer";this.orient(imgEl,objslide);return imgEl;},orient:function(objelement,objslide){objelement.height=objslide.height;objelement.style.paddingTop="0px";objelement.style.paddingBottom="0px";fnChangeContentHeight();},count:function(){return this.arrSlide.length;},getHTML:function(){},add:function(strSrcLarge,strSrcSmall,photoId,strTitle,strCaption,strWidth,strHeight,strComments){intImage=this.arrSlide.length;this.arrSlide[intImage]=new Slide()
this.arrSlide[intImage].initialize(this,intImage,strSrcLarge,strSrcSmall,photoId,strTitle,strCaption,strWidth,strHeight,strComments);}}
function Slide(){var aslide=this;function initialize(strObj,intImage,strSrcLarge,strSrcSmall,photoId,strTitle,strCaption,strWidth,strHeight,strComments){this.slideshow=strObj;this.slideIndex=intImage;this.large=strSrcLarge;this.small=strSrcSmall;this.photoId=photoId;this.title=strTitle;this.caption=strCaption;this.width=strWidth;this.height=strHeight;this.portrait=true;this.comments=strComments;if(strWidth>strHeight)
this.portrait=false;}
function previous(e){aslide.slideshow.previous(aslide.slideIndex,aslide.slideshow);e&&Event.stop(e);}
function next(e){aslide.slideshow.next(aslide.slideIndex,aslide.slideshow);e&&Event.stop(e);}
function pick(e){aslide.slideshow.pick(aslide.slideIndex,aslide.slideshow);e&&Event.stop(e);}
function popup(e){var imgObj=Event.element(e);aslide.slideshow.popup(aslide.slideIndex,imgObj);e&&Event.stop(e);}
this.pick=pick;this.popup=popup;this.initialize=initialize;}
Slide.prototype.pick=Slide.pick;Slide.prototype.popup=Slide.popup;Slide.prototype.initialize=Slide.initialize;function changepscontainer(){if($('ps_container')){Element.setStyle('ps_container',{height:"auto"});fnChangeContentHeight();}else{var queue=Effect.Queues.get('photostream');queue.each(function(e){e.cancel()});}}