
SM.namespace('navigation');(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.util.Lang;PageNav=function(el,attr){attr=attr||{};if(arguments.length===1&&!Lang.isString(el)&&!el.nodeName){attr=el;el=attr.element;}
if(!el&&!attr.element){el=_createPageNavElement.call(this,attr);}
if(Event.isIE){Dom.setStyle(el,'z-index','999');}
PageNav.superclass.constructor.call(this,el,attr);_initEvents.call(this);_createNavigation.call(this);};YAHOO.extend(PageNav,YAHOO.util.Element);var proto=PageNav.prototype;proto._picker=null;proto.PAGENAV_CLASSNAME='pageNav';proto.NAV_CLASSNAME='nav';proto.FIRSTLINK_CLASSNAME=proto.NAV_CLASSNAME+' first';proto.PREVLINK_CLASSNAME=proto.NAV_CLASSNAME+' prev';proto.NEXTLINK_CLASSNAME=proto.NAV_CLASSNAME+' next';proto.LASTLINK_CLASSNAME=proto.NAV_CLASSNAME+' last';proto.CURRENTPAGE_CLASSNAME='pageOn title';proto.TOTALPAGES_CLASSNAME='totalPages title';proto.toString=function(){var el=this.get('element');var id=el.id||el.tagName;return"PageNav "+id;};proto.initAttributes=function(attr){attr=attr||{};PageNav.superclass.initAttributes.call(this,attr);this.setAttributeConfig('currentPage',{value:attr.currentPage||0,method:function(value){if(this.get('currentPage')==value){return;}
if(this._picker){this._picker.set('currentPage',value);}},validator:Lang.isNumber});this.setAttributeConfig('totalPages',{value:attr.totalPages||0,method:function(value){if(this.get('totalPages')==value){return;}
if(this._picker){this._picker.set('totalPages',value);}},validator:Lang.isNumber});this.setAttributeConfig('photosPerPage',{value:attr.photosPerPage||0,method:function(value){if(this.get('photosPerPage')==value){return;}
if(this._picker){this._picker.set('photosPerPage',value);}},validator:Lang.isNumber});this.setAttributeConfig('pagePicker',{value:this._picker,readOnly:true});};var _initEvents=function(){this.addListener('currentPageChange',function(e){if(e.newValue!=e.prevValue){_updateNav.call(this);}},this,true);this.addListener('totalPagesChange',function(e){if(e.newValue!=e.prevValue){_updateNav.call(this);}},this,true);this.addListener('photosPerPageChange',function(e){if(e.newValue!=e.prevValue){_updateNav.call(this);}},this,true);};var _createPageNavElement=function(attr){var pn=document.createElement("div");Dom.addClass(pn,this.PAGENAV_CLASSNAME);if(attr.id){pn.id=attr.id;}
return(pn);};var _createNavigation=function(){var nav=SM.navigation;var navFrag=document.createDocumentFragment();var currentPage=this.get('currentPage');var photosPerPage=this.get('photosPerPage');var totalPages=this.get('totalPages');var first=document.createElement('a');first.className=this.FIRSTLINK_CLASSNAME;first.href=SM.navigation.getAjaxPageLink(1,photosPerPage);first.appendChild(document.createTextNode('<<'));var prev=document.createElement('a');prev.className=this.PREVLINK_CLASSNAME;prev.href=SM.navigation.getAjaxPageLink(currentPage-1,photosPerPage);prev.appendChild(document.createTextNode('< Prev'));if(currentPage==1){Dom.setStyle([first,prev],'visibility','hidden');}
var next=document.createElement('a');next.className=this.NEXTLINK_CLASSNAME;next.href=SM.navigation.getAjaxPageLink(currentPage+1,photosPerPage);next.appendChild(document.createTextNode('Next >'));var last=document.createElement('a');last.className=this.LASTLINK_CLASSNAME;last.href=SM.navigation.getAjaxPageLink(totalPages,photosPerPage);last.appendChild(document.createTextNode('>>'));if(currentPage==totalPages){Dom.setStyle([next,last],'visibility','hidden');}
if(totalPages<3){var page=document.createElement('span');Dom.addClass(page,this.CURRENTPAGE_CLASSNAME);page.appendChild(document.createTextNode(currentPage));}else{var page=document.createElement('a');Dom.addClass(page,this.CURRENTPAGE_CLASSNAME);page.innerHTML=currentPage+'&nbsp;<img src="/img/spacer.gif" />';this._picker=new SM.navigation.PagePicker({'id':YD.generateId(null,'pp'),'currentPage':currentPage,'totalPages':totalPages,'photosPerPage':photosPerPage,'visible':false});this._picker.appendTo(page);var oThis=this;Event.addListener(page,'mouseover',function(e,picker){if(picker.get('visible')){return;}
var target=YE.getTarget(e);var relatedTarget=YE.getRelatedTarget(e);if(!YD.isAncestor(target,relatedTarget)){_setPickerPosition.call(oThis);picker.open();}},this._picker,false);Event.addListener(page,'mouseout',function(e,picker){if(!picker.get('visible')){return;}
var target=YE.getTarget(e);var relatedTarget=YE.getRelatedTarget(e);if(relatedTarget!=this&&!YD.isAncestor(this,relatedTarget)){picker.close();}},this._picker,false);}
navFrag.appendChild(first);navFrag.appendChild(prev);navFrag.appendChild(document.createTextNode('Page'));navFrag.appendChild(page);navFrag.appendChild(document.createTextNode('of '+totalPages));navFrag.appendChild(next);navFrag.appendChild(last);this.appendChild(navFrag);if(this._picker){_setPickerPosition.call(this);}};var _setPickerPosition=function(){var me=this._picker.get('element');var parent=me.parentNode;var offsetTop=0;var offsetLeft=0;if(YD.hasClass(document.body,'allthumbs_stretch')){offsetTop=YD.getY(parent);offsetLeft=YD.getX(parent);}
else{offsetTop=parent.offsetTop;offsetLeft=parent.offsetLeft;}
this._picker.setStyle('top',offsetTop+parent.offsetHeight+'px');this._picker.setStyle('left',offsetLeft-(me.offsetWidth/2)+(parent.offsetWidth/2)+'px');};var _updateNav=function(){var firstLink=this.getElementsByClassName(this.FIRSTLINK_CLASSNAME,'a')[0];var prevLink=this.getElementsByClassName(this.PREVLINK_CLASSNAME,'a')[0];var nextLink=this.getElementsByClassName(this.NEXTLINK_CLASSNAME,'a')[0];var lastLink=this.getElementsByClassName(this.LASTLINK_CLASSNAME,'a')[0];var currentLink=this.getElementsByClassName(this.CURRENTPAGE_CLASSNAME,'')[0];var currentPage=this.get('currentPage');var photosPerPage=this.get('photosPerPage');var totalPages=this.get('totalPages');firstLink.href=SM.navigation.getAjaxPageLink(1,photosPerPage);prevLink.href=SM.navigation.getAjaxPageLink(currentPage-1,photosPerPage);nextLink.href=SM.navigation.getAjaxPageLink(currentPage+1,photosPerPage);lastLink.href=SM.navigation.getAjaxPageLink(totalPages,photosPerPage);currentLink.replaceChild(document.createTextNode(currentPage+'\u00a0'),currentLink.firstChild);this.get('element').replaceChild(document.createTextNode('of '+totalPages),currentLink.nextSibling);if(currentPage<=1){Dom.setStyle([firstLink,prevLink],'visibility','hidden');}else{Dom.setStyle([firstLink,prevLink],'visibility','visible');}
if(currentPage>=totalPages){Dom.setStyle([nextLink,lastLink],'visibility','hidden');}else{Dom.setStyle([nextLink,lastLink],'visibility','visible');}};SM.navigation.PageNav=PageNav;})();(function(){SM.navigation.PagePicker=function(attr){attr=attr||{};var el=_createPagePickerElement.call(this,attr);SM.navigation.PagePicker.superclass.constructor.call(this,el,attr);this.set('visible',attr.visible);_initEvents.call(this);_initContent.call(this);};YAHOO.extend(SM.navigation.PagePicker,YAHOO.util.Element);var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.util.Lang,proto=SM.navigation.PagePicker.prototype;proto._hasScrollBars=false;proto._initialized=false;proto.PICKER_CLASSNAME='pickerBox';proto.BACKGROUND_CLASSNAME='pickerBg';proto.CONTROLS_CLASSNAME='pickerControls';proto.CONTENT_CLASSNAME='pickerContent';proto.CONTENT_MAXHEIGHT=102;proto.CURRENTPAGE_CLASSNAME='pageOn';proto.PAGE_CLASSNAME='page nav';proto.MAXPAGES=60;proto.toString=function(){var el=this.get('element');var id=el.id||el.tagName;return"PagePicker "+id;};proto.initAttributes=function(attr){SM.navigation.PagePicker.superclass.initAttributes.call(this,attr);this._status='closed';this._scrollPageStart=0;this._scrollPageEnd=0;this.setAttributeConfig('totalPages',{value:attr.totalPages,validator:Lang.isNumber});this.setAttributeConfig('currentPage',{value:attr.currentPage,validator:Lang.isNumber});this.setAttributeConfig('photosPerPage',{value:attr.photosPerPage,validator:Lang.isNumber});this.setAttributeConfig('visible',{value:attr.visible,method:function(value){if(value===true){this.setStyle('visibility','visible');}else{this.setStyle('visibility','hidden');}},validator:Lang.isBoolean});};proto.open=function(){var contentEl=_getContentEl.call(this);var animDuration,contentHeight;this._status='opening';if(this._hasScrollBars){contentHeight=this.CONTENT_MAXHEIGHT;animDuration=.1;}else{contentHeight=contentEl.scrollHeight;animDuration=.05;}
this.set('visible',true,false);var anim=new YA(_getBackgroundEl.call(this).childNodes[1],{height:{to:contentHeight}},animDuration,YAHOO.util.Easing.backOut);anim.onComplete.subscribe(function(e){if(this._status=='opening'){_setContentVisibility.call(this,true);if(this._hasScrollBars){_setScrollbarStatus.call(this);}
this._status='open';}},this,true);anim.animate();};proto.close=function(){this._status='closing';var animDuration=(this._hasScrollBars)?.1:.05;var anim=new YA(_getBackgroundEl.call(this).childNodes[1],{height:{to:-1}},animDuration,YAHOO.util.Easing.backIn);anim.onComplete.subscribe(function(e){if(this._status=='closing'){this.set('visible',false,false);this._status='closed';}},this,true);_setContentVisibility.call(this,false);anim.animate();};var _initEvents=function(){this.addListener('click',function(e){var target=Event.getTarget(e);if(Dom.hasClass(target,'pageOn')){Event.stopEvent(e);}});this.addListener('currentPageChange',function(e){if(e.prevValue!=e.newValue){_updateCurrentPage.call(this);}},this,true);this.addListener('totalPagesChange',function(e){if(e.prevValue!=e.newValue){this._scrollPageStart=this.get('currentPage');this._scrollPageEnd=this.get('currentPage');_writePages.call(this);}},this,true);this.addListener('photosPerPageChange',function(e){if(e.prevValue!=e.newValue){_updatePageLinks.call(this);}},this,true);};var _createPagePickerElement=function(){var pickerBox=document.createElement('div');Dom.addClass(pickerBox,this.PICKER_CLASSNAME);Dom.setStyle(pickerBox,'zIndex',999);var pickerBg=document.createElement('div');Dom.addClass(pickerBg,this.BACKGROUND_CLASSNAME);pickerBox.appendChild(pickerBg);var pickerBgFirst=document.createElement('div');Dom.addClass(pickerBgFirst,'first');pickerBg.appendChild(pickerBgFirst);var pickerBgMain=document.createElement('div');pickerBg.appendChild(pickerBgMain);var pickerBgLast=document.createElement('div');Dom.addClass(pickerBgLast,'last');pickerBg.appendChild(pickerBgLast);var pickerContent=document.createElement('div');Dom.addClass(pickerContent,this.CONTENT_CLASSNAME);pickerBox.appendChild(pickerContent);return pickerBox;};var _initContent=function(){if(!this.get('element').parentNode||!this.get('element').parentNode.tagName){this.appendTo(document.body);}
var contentEl=_getContentEl.call(this);this._scrollPageStart=this.get('currentPage');this._scrollPageEnd=(this._scrollPageStart==1)?0:this._scrollPageStart;_writePages.call(this);};var _writePages=function(direction){var fillForward=function(){var aTag;while(contentEl.offsetHeight<=this.CONTENT_MAXHEIGHT&&this._scrollPageEnd<=totalPages){this._scrollPageEnd++;aTag=document.createElement('a');aTag.href=SM.navigation.getAjaxPageLink(this._scrollPageEnd,photosPerPage);if(this._scrollPageEnd==currentPage){aTag.className='page nav pageOn';}else{aTag.className='page nav';}
aTag.appendChild(document.createTextNode(this._scrollPageEnd));contentEl.appendChild(aTag);}
contentEl.removeChild(contentEl.lastChild);this._scrollPageEnd--;this._scrollPageStart=this._scrollPageEnd-contentEl.childNodes.length+1;};var fillBackward=function(){var aTag;while(contentEl.offsetHeight<=this.CONTENT_MAXHEIGHT&&this._scrollPageStart>=1){this._scrollPageStart--;aTag=document.createElement('a');aTag.href=SM.navigation.getAjaxPageLink(this._scrollPageStart,photosPerPage);if(this._scrollPageStart==currentPage){aTag.className='page nav pageOn';}else{aTag.className='page nav';}
aTag.appendChild(document.createTextNode(this._scrollPageStart));contentEl.insertBefore(aTag,contentEl.firstChild);}
contentEl.removeChild(contentEl.firstChild);this._scrollPageStart++;this._scrollPageEnd=this._scrollPageStart+contentEl.childNodes.length-1;};var contentEl=_getContentEl.call(this);var totalPages=this.get('totalPages');var photosPerPage=this.get('photosPerPage');var currentPage=this.get('currentPage');while(contentEl.hasChildNodes()){contentEl.removeChild(contentEl.childNodes[0]);}
if(direction=='backward'){fillBackward.call(this);fillForward.call(this);}else{fillForward.call(this);fillBackward.call(this);}
if(totalPages>this.MAXPAGES){_createPagePickerScrollbar.call(this);this._hasScrollBars=true;}else{_removePagePickerScrollbar.call(this);this._hasScrollBars=false;}};var _createPagePickerScrollbar=function(){var pickerBgMain=_getBackgroundEl.call(this).childNodes[1];Dom.addClass(pickerBgMain,'controls');var spacer=document.createElement('img');spacer.src='/img/spacer.gif';var pickerControls=document.createElement('div');pickerControls.className=this.CONTROLS_CLASSNAME;pickerControls.style.visibility='hidden';var upControls=document.createElement('div');var pageFirst=document.createElement('a');pageFirst.className='control first';Event.addListener(pageFirst,'click',function(){_scroll.call(this,'first');},this,true);pageFirst.appendChild(spacer.cloneNode(false));var pagePrev=document.createElement('a');pagePrev.className='control prev';Event.addListener(pagePrev,'click',function(){_scroll.call(this,'prev');},this,true);pagePrev.appendChild(spacer.cloneNode(false));upControls.appendChild(pageFirst);upControls.appendChild(pagePrev);var downControls=document.createElement('div');var pageNext=document.createElement('a');pageNext.className='control next';Event.addListener(pageNext,'click',function(){_scroll.call(this,'next');},this,true);pageNext.appendChild(spacer.cloneNode(false));var pageLast=document.createElement('a');pageLast.className='control last';Event.addListener(pageLast,'click',function(){_scroll.call(this,'last');},this,true);pageLast.appendChild(spacer.cloneNode(false));downControls.appendChild(pageNext);downControls.appendChild(pageLast);pickerControls.appendChild(upControls);pickerControls.appendChild(downControls);this.appendChild(pickerControls);};var _removePagePickerScrollbar=function(){var pickerBgMain=_getBackgroundEl.call(this).childNodes[1];Dom.removeClass(pickerBgMain,'controls');var controlsEl=_getControlsEl.call(this);if(controlsEl){controlsEl.parentNode.removeChild(controlsEl);}};var _getBackgroundEl=function(){return this.getElementsByClassName(this.BACKGROUND_CLASSNAME)[0];};var _getContentEl=function(){return this.getElementsByClassName(this.CONTENT_CLASSNAME)[0];};var _getControlsEl=function(){return this.getElementsByClassName(this.CONTROLS_CLASSNAME)[0];};var _contentVisible=function(){var strVisible=_getContentEl.call(this).style.visibility;if(strVisible=='visible'){return true;}else{return false;}};var _setContentVisibility=function(visible){var strVisible=(visible)?'visible':'hidden';Dom.setStyle(_getContentEl.call(this),'visibility',strVisible);if(this._hasScrollBars){Dom.setStyle(_getControlsEl.call(this),'visibility',strVisible);}};var _getVisible=function(){return this.getStyle('visibility')=='visible'?true:false;};var _updateCurrentPage=function(){var contentEl=_getContentEl.call(this);Dom.removeClass(Dom.getElementsByClassName(this.CURRENTPAGE_CLASSNAME,'a',contentEl),this.CURRENTPAGE_CLASSNAME);var pageOn=(this.get('currentPage')==1)?0:this.get('currentPage')-this._scrollPageStart;var pages=Dom.getElementsByClassName(this.PAGE_CLASSNAME,'a',contentEl);Dom.addClass(pages[pageOn],this.CURRENTPAGE_CLASSNAME);};var _updatePageLinks=function(){var contentEl=_getContentEl.call(this);var pages=Dom.getElementsByClassName(this.PAGE_CLASSNAME,'a',contentEl);var page=this._scrollPageStart;for(i=0;i<pages.length;i++){pages[i].href=SM.navigation.getAjaxPageLink(page,this.get('photosPerPage'));page++;}};var _scroll=function(scrollTo){var contentEl=_getContentEl.call(this);var direction='forward';switch(scrollTo){case'prev':this._scrollPageEnd=this._scrollPageStart-1;direction='backward';break;case'next':this._scrollPageStart=this._scrollPageEnd+1;direction='forward';break;case'first':this._scrollPageStart=1;this._scrollPageEnd=0;direction='forward';break;case'last':this._scrollPageStart=this.get('currentPage');this._scrollPageEnd=this.get('totalPages');direction='forward';break;}
_writePages.call(this,direction);if(_contentVisible.call(this)){_setScrollbarStatus.call(this);}};var _setScrollbarStatus=function(){var contentEl=_getContentEl.call(this);var controls=_getControlsEl.call(this);var upControls=controls.childNodes[0];var downControls=controls.childNodes[1];if(this._scrollPageStart==1){Dom.addClass(upControls,'disabled');Dom.removeClass(downControls,'disabled');}else if(this._scrollPageEnd==this.get('totalPages')){Dom.addClass(downControls,'disabled');Dom.removeClass(upControls,'disabled');}else{Dom.removeClass(upControls,'disabled');Dom.removeClass(downControls,'disabled');}};})();SM.navigation.getAjaxPageLink=function(page,photosPerPage){return('#P-'+page+'-'+photosPerPage);};
SM.namespace('photo','photo.data');SM.photo.ORIENTATION_SQUARE=0;SM.photo.ORIENTATION_PORTRAIT=1;SM.photo.ORIENTATION_LANDSCAPE=2;SM.photo.getOrientation=function(el){var w=parseInt(YAHOO.util.Dom.getStyle(el,'width'),10);var h=parseInt(YAHOO.util.Dom.getStyle(el,'height'),10);if(w<h){return SM.photo.ORIENTATION_PORTRAIT;}else if(w>h){return SM.photo.ORIENTATION_LANDSCAPE;}else{return SM.photo.ORIENTATION_SQUARE;}};SM.photo.getAspect=function(el){var w=parseInt(YAHOO.util.Dom.getStyle(el,'width'),10);var h=parseInt(YAHOO.util.Dom.getStyle(el,'height'),10);var f=SM.util.reduceFraction(w,h);return(Math.max(f[0],f[1])/Math.min(f[0],f[1]));};SM.photo.getPhototileMarkup=function(values){values.top=(Math.max(values.width,values.height)-values.height)/2;var markup=['<div class="phototile {cssClass}">','<div class="photoframe">','<div class="photo" style="width:{width}px; height:{height}px; top:{top}px;">','<div class="photoborder">','<div class="l"></div>','<div class="t"></div>','<div class="r"></div>','<div class="b"></div>','<div class="tl"></div>','<div class="tr"></div>','<div class="br"></div>','<div class="bl"></div>','</div>','<img border="0" alt="{title} : {desc}" title="{title} : {desc}" width="{width}" height="{height}" src="{src}" /></a>','</div>','</div>','</div>'];return YAHOO.lang.substitute(markup.join(''),values);};(function(){var ExifBox=function(attr){attr=attr||{};var el=_createExifBoxElement.call(this,attr);superC.constructor.call(this,el,attr);Dom.setXY(el,_calculatePosition.call(this));};YAHOO.extend(ExifBox,YAHOO.util.Element);var proto=ExifBox.prototype,superC=ExifBox.superclass,Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.util.Lang;proto.CLASSNAME='exifBox';proto.BACKGROUND_CLASSNAME='background';proto.CONTENT_CLASSNAME='content';proto.EXIFLINK_CLASSNAME='exifLink';proto.toString=function(){var el=this.get('element');var id=el.id||el.tagName;return"ExifBox "+id;};proto.initAttributes=function(attr){superC.initAttributes.call(this,attr);if(!attr.appendTo){attr.appendTo=document.body;}
if(!attr.visible){attr.visible=false;}
if(!attr.autoPosition){attr.autoPosition=false;}
if(!attr.positionAnchor){attr.positionAnchor=document.body;}
if(!attr.draggable){attr.draggable=false;}
this._exifInfo=new SM.util.SimpleAjaxCache('/rpc/image.mg');this._exifInfo.subscribe('load',_updateExifContent,this,true);this._backgroundElement=this.getElementsByClassName(this.BACKGROUND_CLASSNAME)[0];this._contentParent=this.getElementsByClassName(this.CONTENT_CLASSNAME)[0];_setContentVisibility.call(this,false);this._ddObj=null;this.register('appendTo',{value:attr.appendTo,method:function(el){this.appendTo(Dom.get(el));},writeOnce:true,validator:function(el){return Dom.inDocument(el);}});this.register('imageId_Key',{value:attr.imageId_Key,validator:function(value){return value!==this.get('imageId_Key');}});this.register('autoPosition',{value:attr.autoPosition,method:function(value){if(value===true){Event.addListener(window,'resize',_setPosition,this,true);}else{Event.removeListener(window,'resize',_setPosition);}},validator:Lang.isBoolean});this.register('positionAnchor',{value:attr.positionAnchor,validator:function(el){return Dom.inDocument(el);}});this.register('draggable',{value:attr.draggable,method:function(value){_setDraggable.call(this,value);},validator:Lang.isBoolean});this.register('dragDropObject',{value:this._ddObj,readOnly:true});this.register('tabViewObject',{value:_createTabViewObject.call(this),readOnly:true});this.register('visible',{value:attr.visible,method:function(value){this.setStyle('visibility',value?'visible':'hidden');},validator:Lang.isBoolean});this.initEvents();};proto.initEvents=function(){this.addListener('imageId_KeyChange',function(e){if(e.newValue!==e.prevValue){if(this.get('visible')){_updateExifLink.call(this);_getExifInfo.call(this);}}},this,true);var tvObj=this.get('tabViewObject');tvObj.addListener('beforeActiveTabChange',function(e){if(e.prevValue===e.newValue){return false;}
Dom.setStyle(tvObj._contentParent,'visibility','hidden');},this,true);tvObj.addListener('activeTabChange',_handleActiveTabChange,this,true);tvObj.beforeActiveContentChange=new YAHOO.util.CustomEvent('beforeActiveContentChange',this.get('tabViewObject'),false,YAHOO.util.CustomEvent.FLAT);tvObj.beforeActiveContentChange.subscribe(function(e){Dom.setStyle(tvObj._contentParent,'visibility','hidden');},this,true);tvObj.activeContentChange=new YAHOO.util.CustomEvent('activeContentChange',this.get('tabViewObject'),false,YAHOO.util.CustomEvent.FLAT);tvObj.activeContentChange.subscribe(_handleActiveContentChange,this,true);this.addListener('click',function(e){var target=Event.getTarget(e);var thisEl=this.get('element');while(target!==thisEl&&target.tagName!=='A'){target=target.parentNode;}
if(target===thisEl){return;}
if(Dom.hasClass(target,'closeButton')){Event.stopEvent(e);this.close();}},this,true);};proto.open=function(){_updateExifLink.call(this);_getExifInfo.call(this);};proto.close=function(){var bgContentEl=this._backgroundElement.childNodes[1];var tvObj=this.get('tabViewObject');_setContentVisibility.call(this,false);var anim=new YAHOO.util.Anim(bgContentEl,{height:{to:-1}},.25,YAHOO.util.Easing.backIn);anim.onComplete.subscribe(function(){this.set('visible',false);},this,true);anim.animate();};var _handleActiveContentChange=function(e){_resizeToContent.call(this,this._contentParent.offsetHeight);};var _handleActiveTabChange=function(e){_resizeToContent.call(this,this._contentParent.offsetHeight);e.newValue.set('title','');SM.util.setCookie('exifTab',e.newValue.get('label').toLowerCase(),365);};var _resizeToContent=function(newHeight){var bgContentEl=this._backgroundElement.childNodes[1];var tabViewObj=this.get('tabViewObject');newHeight-=parseInt(Dom.getStyle(this._contentParent,'padding-top'),10);newHeight-=parseInt(Dom.getStyle(this._contentParent,'padding-bottom'),10);var bgContentHeight=bgContentEl.offsetHeight;if(!this.get('visible')){this.set('visible',true);}
if(bgContentHeight!==newHeight){Dom.setStyle(tabViewObj._contentParent,'visibility','hidden');var anim=new YAHOO.util.Anim(bgContentEl,{height:{to:newHeight}},.25,(bgContentHeight>newHeight)?YAHOO.util.Easing.backIn:YAHOO.util.Easing.backOut);anim.onComplete.subscribe(function(){_setContentVisibility.call(this,true);Dom.setStyle(this.get('tabViewObject')._contentParent,'visibility','');},this,true);anim.animate();}else{Dom.setStyle(tabViewObj._contentParent,'visibility','');}
_setPosition.call(this);};var _setContentVisibility=function(visible){var strVisible=(visible)?'visible':'hidden';Dom.setStyle(this._contentParent,'visibility',strVisible);this._contentVisible=visible;};var _setDraggable=function(draggable){if(!this._ddObj&&draggable){var myObj=this;this._ddObj=new YAHOO.util.DD(this.get('element'));this._ddObj.endDrag2=new YAHOO.util.CustomEvent('endDrag2',this._ddObj);this._ddObj.endDrag=function(e){var exifXY=YD.getXY(myObj.get('element'));var anchorXY=YD.getXY(myObj.get('positionAnchor'));SM.util.setCookie(galleryStyle+'ExifPos',[exifXY[0]-anchorXY[0],exifXY[1]-anchorXY[1]],365);};this.setStyle('cursor','move');}else if(this._ddObj&&!draggable){this._ddObj.unreg();this._ddObj=null;this.setStyle('cursor','auto');}};var _updateExifLink=function(){var exifLink=this.getElementsByClassName(this.EXIFLINK_CLASSNAME)[0];var imageId=this.get('imageId_Key').split('_')[0];var imageKey=this.get('imageId_Key').split('_')[1];if(exifLink&&exifLink.tagName.toLowerCase()==='a'){exifLink.href='/photos/newexif.mg?ImageID='+imageId+'&ImageKey='+imageKey;}};var _getExifInfo=function(){var imageId=this.get('imageId_Key').split('_')[0];var imageKey=this.get('imageId_Key').split('_')[1];this._exifInfo.load({'method':'getExif','imageId':imageId,'imageKey':imageKey});};var buildTabContent=function(category,property){var i,str='';for(i in property){str+='<tr id="'+property[i].name+'"><th>'+property[i].friendlyName+'</th><td>'+property[i].friendlyValue+'</td></tr>';}
if(str===''){str='<h4 class="noExif">No '+category.toLowerCase()+' information available</h4>';}else{str='<table class="photoInfo">'+str+'</table>';}
return str;};var _updateExifContent=function(responseText){var tvObj=this.get('tabViewObject'),tabs=tvObj.get('tabs'),activeTab=SM.util.getCookie('exifTab')||'basic',cats,tab,label,oldContent,newContent,i;try{cats=this._exifInfo.data;}catch(e){cats={};}
for(i=0;i<tabs.length;i++){tab=tvObj.getTab(i);label=tab.get('label').toLowerCase();oldContent=tab.get('content');if(typeof cats==='object'){newContent=buildTabContent(label,cats[label]);}else{newContent=buildTabContent(label,{});}
if(tab.get('active')){tvObj.beforeActiveContentChange.fire({'prevValue':oldContent,'newValue':newContent});}
tab.set('content',newContent);if(tab.get('active')){tvObj.activeContentChange.fire({'prevValue':oldContent,'newValue':newContent});}
if(activeTab===label&&!tab.get('active')){tvObj.set('activeIndex',i);}}
if(tvObj.get('activeIndex')===undefined){tvObj.set('activeIndex',0);}};var _createExifBoxElement=function(attr){var exifBox=document.createElement('div');Dom.addClass(exifBox,this.CLASSNAME);if(attr.id){exifBox.id=attr.id;}
var exifBg=document.createElement('div');Dom.addClass(exifBg,this.BACKGROUND_CLASSNAME);exifBox.appendChild(exifBg);var exifBgFirst=document.createElement('div');Dom.addClass(exifBgFirst,'first');exifBg.appendChild(exifBgFirst);var exifBgMain=document.createElement('div');exifBg.appendChild(exifBgMain);var exifBgLast=document.createElement('div');Dom.addClass(exifBgLast,'last');exifBg.appendChild(exifBgLast);var exifContent=document.createElement('div');Dom.addClass(exifContent,this.CONTENT_CLASSNAME);exifBox.appendChild(exifContent);var exifClose=document.createElement('a');Dom.addClass(exifClose,'closeButton');exifClose.href='#';var spacer=document.createElement('img');spacer.src='/img/spacer.gif';exifClose.appendChild(spacer);exifContent.appendChild(exifClose);var exifTitle=document.createElement('h3');exifContent.appendChild(exifTitle);var exifLink=document.createElement('a');Dom.addClass(exifLink,'title exifLink');exifLink.href='#';exifLink.target='_blank';exifLink.appendChild(document.createTextNode('Photo Information'));exifTitle.appendChild(exifLink);exifTitle.appendChild(document.createTextNode('(arrow keys change photo)'));return exifBox;};var _createTabViewObject=function(){var tvObj=new YAHOO.widget.TabView();tvObj.appendTo(this._contentParent);tvObj.addTab(new YAHOO.widget.Tab({'label':'Basic'}));tvObj.addTab(new YAHOO.widget.Tab({'label':'Detailed'}));return tvObj;};var _calculatePosition=function(){var documentDimensions=[Dom.getDocumentWidth(),Dom.getDocumentHeight()];var viewPortDimensions=[Dom.getViewportWidth(),Dom.getViewportHeight()];var docScrollY=document.documentElement.scrollTop||window.pageYOffset;var docScrollX=document.documentElement.scrollLeft||window.pageXOffset;var outerLimits=[(viewPortDimensions[0]>documentDimensions[0])?viewPortDimensions[0]:documentDimensions[0],(viewPortDimensions[1]>documentDimensions[1])?viewPortDimensions[1]:documentDimensions[1]];var viewRegion=new YAHOO.util.Region(docScrollY,docScrollX+viewPortDimensions[0],docScrollY+viewPortDimensions[1],docScrollX);var anchorEl=Dom.get(this.get('positionAnchor'));var anchorXY=Dom.getXY(anchorEl);var anchorRegion=YAHOO.util.Region.getRegion(anchorEl);var exifXY=null;exifXY=SM.util.getCookie(galleryStyle+'ExifPos');exifXY=(!exifXY||exifXY.indexOf(',')===-1)?[0,0]:exifXY.split(',');exifXY=[parseInt(exifXY[0],10),parseInt(exifXY[1],10)];exifXY=[anchorXY[0]+exifXY[0],anchorXY[1]+exifXY[1]];var exifEl=this.get('element');var exifRegion=new YAHOO.util.Region(exifXY[1],exifXY[0]+exifEl.offsetWidth,exifXY[1]+exifEl.offsetHeight,exifXY[0])
if(viewRegion.contains(anchorRegion)){exifXY=[(exifRegion.right<viewRegion.left)?viewRegion.left:exifRegion.left,(exifRegion.bottom<viewRegion.top)?viewRegion.top:exifRegion.top];exifXY=[(exifRegion.left>viewRegion.right)?viewRegion.right-(exifRegion.right-exifRegion.left):exifRegion.left,(exifRegion.top>viewRegion.bottom)?viewRegion.bottom-(exifRegion.bottom-exifRegion.top):exifXY[1]];}
return exifXY;};var _setPosition=function(){var currentXY=Dom.getXY(this.get('element'));var newXY=_calculatePosition.call(this);if(currentXY[0]===newXY[0]&&currentXY[1]===newXY[1]){return;}
var anim=new YAHOO.util.Motion(this.get('element'),{points:{to:_calculatePosition.call(this)}},.25);anim.animate();};SM.photo.ExifBox=ExifBox;})();
SM.namespace('catalog');(function(){SM.catalog.ProductCatalog=function(catalog){this.loaded=false;_initEvents.call(this);if(catalog){_loadCatalog.call(this,catalog);}};var Catalog=SM.catalog.ProductCatalog,Connect=YAHOO.util.Connect,Event=YAHOO.util.Event,Lang=YAHOO.lang,catalogUrl='/rpc/cart.mg?method=getCatalog&imageId=';var _initEvents=function(){this.createEvent('load');this.createEvent('failure');};var _loadCatalog=function(catalog){this.vendors=_unPack(catalog.vendors);this.categories=_unPack(catalog.categories);this.meta=catalog.meta;this.products={};this.skus={options:{},addons:{},colors:{}};for(var categoryId in this.categories){var cat=this.categories[categoryId];cat.subCategories=_unPack(cat.subCategories);for(var subCategoryId in cat.subCategories){var subcat=cat.subCategories[subCategoryId];subcat.products={};}}
for(var vendorId in this.vendors){var vendor=this.vendors[vendorId];vendor.products=_unPack(vendor.products);for(var productId in vendor.products){this.productsAvailable=true;var product=vendor.products[productId];this.products[productId]=product;this.categories[product.categoryId].subCategories[product.subCategoryId].products[productId]=product;if(product.options){product.options=_unPack(product.options);for(var o in product.options){product.options[o].productId=productId;this.skus.options[o]=product.options[o];}}
if(product.addons){product.addons=_unPack(product.addons);for(var o in product.addons){product.addons[o].productId=productId;this.skus.addons[o]=product.addons[o];}}
if(product.colors){product.colors=_unPack(product.colors);for(var o in product.colors){product.colors[o].productId=productId;this.skus.colors[o]=product.colors[o];}}}}
for(var metaId in this.meta){this.meta[metaId]=_unPack(this.meta[metaId]);}
if(catalog.priceList){this.priceList=new SM.catalog.ProPriceList();this.priceList.subscribe('load',function(){this.loaded=true;this.fireEvent('load')},this,true);this.priceList.load(catalog.priceList);}else{this.loaded=true;this.fireEvent('load');}};var _unPack=function(array){if(!Lang.isArray(array)){return;}
var obj={};for(var i=0,len=array.length;i<len;i++){obj[array[i]['id']]=array[i];}
return obj;};Catalog.prototype={CROPRATIO_TOLERANCE:.05,load:function(data){_loadCatalog.call(this,data);},loadFromUrl:function(imageId,imageKey){var sUrl=catalogUrl+'&imageId='+imageId+'&imageKey='+imageKey;var tx=Connect.asyncRequest('POST','/rpc/cart.mg',{success:function(o){try{var raw=YAHOO.lang.JSON.parse(o.responseText);}catch(err){return;}
if(raw.status==='success'){var result=raw.result;_loadCatalog.call(this,raw.result);}else{this.fireEvent('failure',{'status':raw.status,'msg':raw.msg,'args':raw.args});}},failure:function(o){YAHOO.log('call to '+sUrl+'failed: '+o.responseText);this.fireEvent('failure',o.responseText);},scope:this,timeout:0},'method=getCatalog&imageId='+imageId+'&imageKey='+imageKey);},getVendor:function(vendorId){var vendors=this.vendors;if(!vendors){return null;}
if(!vendorId){return vendors;}
return this.vendors[vendorId]||null;},getProduct:function(productId){var products=this.products;if(!products){return null;}
if(!productId){return products;}
return products[productId]||null;},getSku:function(skuId){var skus=this.skus;if(!skus){return null;}
if(!skuId){return skus;}
return skus.options[skuId]||skus.addons[skuId]||skus.colors[skuId]||null;},checkRes:function(productId,skuId,width,height){var sku=this.getSku(skuId);var product=this.getProduct(productId);if(!product||!sku){return false;}
if(product.categoryId=="download"){switch(sku.typeCode){case'lores':return(width*height>=1000000);case'hires':return(width*height>=4000000);default:return true;}}else{return((width>=product.minResWidth&&height>=product.minResHeight)||(height>=product.minResWidth&&width>=product.minResHeight));}},needsCrop:function(productId,width,height){var product=this.getProduct(productId);if(!product){return false;}
var productW=product.width;var productH=product.height;var imageRatio=Math.max(width,height)/Math.min(width,height);var productRatio=Math.min(productW,productH)>0?Math.max(productW,productH)/Math.min(productW,productH):0;return(productRatio>0&&Math.abs(imageRatio-productRatio)>this.CROPRATIO_TOLERANCE);}};Lang.augmentProto(Catalog,YAHOO.util.EventProvider);})();(function(){SM.catalog.PriceList=function(list){this.loaded=false;_initEvents.call(this);if(list){_loadPriceList.call(this,list);}};var PriceList=SM.catalog.PriceList,Connect=YAHOO.util.Connect,Event=YAHOO.util.Event,Lang=YAHOO.lang,rpcUrl='/rpc/pro.mg?method=getPriceList';var _initEvents=function(){this.createEvent('load');this.createEvent('failure');this.createEvent('updatePrintVendor');this.createEvent('updateColorCorrection');};var _loadPriceList=function(list){this.type=list.type;this.typeId=list.typeId;this.printVendor=list.printVendor;this.colorCorrection=list.colorCorrection;this.listOwner=list.listOwner;this.proList=list.proList;this.vendors=_unPack(list.vendors);this.categories=_unPack(list.categories);this.products={};this.skus={options:{},addons:{},colors:{}};for(var categoryId in this.categories){var cat=this.categories[categoryId];cat.subCategories=_unPack(cat.subCategories);for(var subCategoryId in cat.subCategories){var subcat=cat.subCategories[subCategoryId];subcat.products={};}}
for(var vendorId in this.vendors){var vendor=this.vendors[vendorId];vendor.products=_unPack(vendor.products);for(var productId in vendor.products){this.productsAvailable=true;var product=vendor.products[productId];this.products[productId]=product;if(product.options){product.options=_unPack(product.options);this.skus.options=Lang.merge(this.skus.options,product.options);}
if(product.addons){product.addons=_unPack(product.addons);this.skus.addons=Lang.merge(this.skus.addons,product.addons);}
if(product.colors){product.colors=_unPack(product.colors);this.skus.colors=Lang.merge(this.skus.colors,product.colors);}}}
this.loaded=true;this.fireEvent('load');};var _unPack=function(array){var obj={};for(var i=0,len=array.length;i<len;i++){obj[array[i]['id']]=array[i];}
return obj;};PriceList.prototype={load:function(data){_loadPriceList.call(this,data);},loadFromUrl:function(listType,listId){var sUrl=rpcUrl+'&listType='+listType+'&listId='+listId;var tx=Connect.asyncRequest('GET',sUrl,{success:function(o){try{var raw=YAHOO.lang.JSON.parse(o.responseText);}catch(err){return;}
if(raw.status==='success'){var result=raw.result;_loadPriceList.call(this,raw.result);}else{this.fireEvent('failure',{'status':raw.status,'msg':raw.msg,'args':raw.args});}},failure:function(o){YAHOO.log('call to '+sUrl+'failed: '+o.responseText);this.fireEvent('failure',o.responseText);},scope:this,timeout:0});},getVendor:function(vendorId){var vendors=this.vendors;if(!vendors){return null;}
if(!vendorId){return vendors;}
return this.vendors[vendorId]||null;},getProduct:function(productId){var products=this.products;if(!products){return null;}
if(!productId){return products;}
return products[productId]||null;},getSku:function(skuId){var skus=this.skus;if(!skus){return null;}
if(!skuId){return skus;}
return skus.options[skuId]||skus.addons[skuId]||skus.colors[skuId]||null;},updatePrintVendor:function(printVendor){var prevValue=this.printVendor;var newValue=printVendor;this.printVendor=newValue;var result={prevValue:prevValue,newValue:newValue};this.fireEvent('updatePrintVendor',{status:'success',msg:[],args:arguments,result:result,type:'updatePrintVendor'});},updateColorCorrection:function(colorCorrection){var prevValue=this.colorCorrection;var newValue=colorCorrection;this.colorCorrection=Lang.isBoolean(newValue)?newValue:(newValue==1);var result={prevValue:prevValue,newValue:newValue};this.fireEvent('updateColorCorrection',{status:'success',msg:[],args:arguments,result:result,type:'updateColorCorrection'});},getBasePrice:function(skuId){var sku=this.getSku(skuId),colorCorrection=this.colorCorrection;if(!sku){return null;}
if(sku.pricing.smugmugPrice){return sku.pricing.smugmugPrice[(colorCorrection?1:0)];}else{return null;}}};Lang.augmentProto(PriceList,YAHOO.util.EventProvider);SM.catalog.ProPriceList=function(list){SM.catalog.ProPriceList.superclass.constructor.call(this,list);this.createEvent('updatePrice');};Lang.extend(SM.catalog.ProPriceList,SM.catalog.PriceList,{proShare:.85,hasProPricing:function(skuId){var sku=this.getSku(skuId);return Lang.isValue(sku.pricing.proPrice);},getProPrice:function(skuId,type){var sku=this.getSku(skuId);if(!sku||!sku.pricing||!sku.pricing.proPrice){return null;}
var proPricing=sku.pricing.proPrice,price=null;if(type){price=parseFloat(proPricing[type]);price=(isNaN(price)?null:price);}else{var order=['Image','Album','User'];for(var i=0,len=order.length;i<len;i++){price=parseFloat(proPricing[order[i]]);if(!isNaN(price)){break;}}}
return price;},updatePrice:function(skuId,proPrice){var sku=this.getSku(skuId),listType=this.type,prevValue;if(!sku){sku={id:skuId};this.skus.options[skuId]=sku;}
if(!sku.pricing){sku.pricing={};}
if(!sku.pricing.proPrice){sku.pricing.proPrice={};sku.pricing.proPrice[listType]=null;}
proPrice=parseFloat(proPrice);prevValue=sku.pricing.proPrice[listType]||null;sku.pricing.proPrice[listType]=proPrice>=0?proPrice:null;var result={skuId:skuId,prevValue:prevValue,newValue:sku.pricing.proPrice[listType]};this.fireEvent('updatePrice',{status:'success',msg:[],args:arguments,result:result,type:'updatePrice'});}});})();
SM.namespace('cart.data','cart.UI','cart.context');(function(){SM.cart.data.UserCart=function(data){this.loaded=false;this.returnMarkup=false;this.cartId='';_initEvents.call(this);if(data){this.load(data);}};var UserCart=SM.cart.data.UserCart,Connect=YAHOO.util.Connect,Event=YAHOO.util.Event,Lang=YAHOO.lang;var _initEvents=function(){this.createEvent('load');this.createEvent('failure');this.createEvent('addItem');this.createEvent('removeItem');this.createEvent('changeCrop');this.createEvent('beforeChangeProduct');this.createEvent('changeProduct');this.createEvent('changeColor');this.createEvent('changeQuantity');};var _loadCart=function(cart){var i,len;this.images={};for(i=0,len=cart.images.length;i<len;i++){this.images[cart.images[i].id]=cart.images[i];}
this.vendors={};for(i=0,len=cart.vendors.length;i<len;i++){this.vendors[cart.vendors[i].id]=cart.vendors[i];}
this.products={};for(i=0,len=cart.products.length;i<len;i++){this.products[cart.products[i].id]=cart.products[i];}
this.skus={};for(i=0,len=cart.skus.length;i<len;i++){this.skus[cart.skus[i].id]=cart.skus[i];}
this.items={};for(i=0,len=cart.items.length;i<len;i++){this.items[cart.items[i].id]=cart.items[i];}
this.loaded=true;this.fireEvent('load');};var _updateCart=function(args,callback){var sUrl='';args=Lang.merge({markup:this.returnMarkup,cartId:this.cartId},args);for(var a in args){if(Lang.hasOwnProperty(args,a)){if(sUrl!==''){sUrl+='&';}
sUrl+=(a+'='+(Lang.isObject(args[a])?Lang.JSON.stringify(args[a]):args[a]));}}
this.fireEvent('beforeChangeProduct');var tx=Connect.asyncRequest('POST',this.cartUrl,{success:callback,failure:function(o){YAHOO.log('call to '+sUrl+'failed: '+o.responseText);},scope:this,timeout:0},sUrl);};var _updateCartItem=function(newValue,prevValue){if(prevValue.skuId!=newValue.skuId){for(var i=0,len=this.skus[prevValue.skuId].items.length;i<len;i++){if(this.skus[prevValue.skuId].items[i]==newValue.id){this.skus[prevValue.skuId].items.splice(i,1);}}
if(!this.getItemsBySku(prevValue.skuId).length){delete this.skus[prevValue.skuId];}}
if(prevValue.productId!=newValue.productId){for(var i=0,len=this.products[prevValue.productId].items.length;i<len;i++){if(this.products[prevValue.productId].items[i]==newValue.id){this.products[prevValue.productId].items.splice(i,1);}}
if(!this.getItemsByProduct(prevValue.productId).length){delete this.products[prevValue.productId];}}
if(prevValue.vendorId!=newValue.vendorId){for(var i=0,len=this.vendors[prevValue.vendorId].items.length;i<len;i++){if(this.vendors[prevValue.vendorId].items[i]==newValue.id){this.vendors[prevValue.vendorId].items.splice(i,1);}}
if(!this.getItemsByVendor(prevValue.vendorId).length){delete this.vendors[prevValue.vendorId];}}
if(prevValue.imageId!=newValue.imageId){for(var i=0,len=this.images[item.imageId].items.length;i<len;i++){if(this.images[item.imageId].items[i]==item.id){this.images[item.imageId].items.splice(i,1);}}
if(!this.getItemsByPhoto(item.imageId).length){delete this.images[item.imageId];}}
this.items[newValue.id]=newValue;if(!this.images[newValue.imageId]){this.images[newValue.imageId]={id:newValue.imageId,items:[]};}
this.images[newValue.imageId].items.push(newValue.id);if(!this.vendors[newValue.vendorId]){this.vendors[newValue.vendorId]={id:newValue.vendorId,items:[]};}
this.vendors[newValue.vendorId].items.push(newValue.id);if(!this.products[newValue.productId]){this.products[newValue.productId]={id:newValue.productId,items:[]};}
this.products[newValue.productId].items.push(newValue.id);if(!this.skus[newValue.skuId]){this.skus[newValue.skuId]={id:newValue.skuId,items:[]};}
this.skus[newValue.skuId].items.push(newValue.id);};UserCart.prototype={cartUrl:'/rpc/cart.mg',load:function(data){_loadCart.call(this,data);},loadFromUrl:function(cartId){var args={method:'getUserCart'};var callback=function(o){try{var raw=Lang.JSON.parse(o.responseText);}catch(err){return;}
if(raw.status==='success'){_loadCart.call(this,raw.result);}};_updateCart.call(this,args,callback);},getItemsByPhoto:function(imageId){if(!this.images){return[];}
if(!this.images[imageId]){return[];}
return this.getItems(this.images[imageId].items);},getItemsByVendor:function(vendorId){if(!this.vendors){return[];}
if(!this.vendors[vendorId]){return[];}
return this.getItems(this.vendors[vendorId].items);},getItemsByProduct:function(productId){if(!this.products){return[];}
if(!this.products[productId]){return[];}
return this.getItems(this.products[productId].items);},getItemsBySku:function(skuId){if(!this.skus){return[];}
if(!this.skus[skuId]){return[];}
return this.getItems(this.skus[skuId].items);},getVendors:function(){var vendors=[];if(!this.vendors){return vendors;}
for(var v in this.vendors){if(Lang.hasOwnProperty(this.vendors,v)){vendors.push(v);}}
return vendors;},getPhotos:function(){var photos=[];if(!this.images){return photos;}
for(var p in this.images){if(Lang.hasOwnProperty(this.images,p)){photos.push(p);}}
return photos;},getProducts:function(){var products=[];if(!this.products){return products;}
for(var p in this.products){if(Lang.hasOwnProperty(this.products,p)){products.push(p);}}
return products;},getItems:function(){var a,item,items=[];if(arguments.length>0){a=arguments[0];}
if(Lang.isArray(a)){for(var i=0,len=a.length;i<len;i++){item=this.getItem(a[i]);if(item){items.push(item);}}}else if(a){item=this.getItem(a);if(item){items.push(item);}}else{for(item in this.items){if(Lang.hasOwnProperty(this.items,item)){items.push(this.getItem(item));}}}
return items;},getItem:function(cartItemId){return this.items[cartItemId];},getPhoto:function(imageId){return this.images[imageId];},getVendor:function(vendorId){return this.vendors[vendorId];},getProduct:function(productId){return this.products[productId];},changeCrop:function(cartItemId,cropInfo,markup){var item=this.getItem(cartItemId);if(!item||!item.crop){return;}
if(!Lang.isBoolean(markup)){markup=true;}
var defaultCrop={cropType:'Auto',cropW:0,cropH:0,cropX:0,cropY:0};cropInfo=Lang.merge(defaultCrop,cropInfo);if(cropInfo.cropType===item.crop.cropType&&cropInfo.cropW===item.crop.cropW&&cropInfo.cropH===item.crop.cropH&&cropInfo.cropX===item.crop.cropX&&cropInfo.cropY===item.crop.cropY){return;}
var args={method:'updateCartItem',cartItemId:cartItemId,attr:{crop:{cropType:cropInfo.cropType,cropW:cropInfo.cropW,cropH:cropInfo.cropH,cropX:cropInfo.cropX,cropY:cropInfo.cropY}},markup:(markup?1:0)};var callback=function(o){try{var raw=Lang.JSON.parse(o.responseText);}
catch(x){return;}
if(raw.status==='success'){var result={cartItemId:raw.args.cartItemId,prevValue:item.crop,newValue:raw.result.item.crop,markup:raw.result.markup};this.items[cartItemId].crop=result.newValue;this.fireEvent('changeCrop',{status:raw.status,msg:raw.msg,args:raw.args,result:result,type:'changeCrop'});}else{this.fireEvent('failure',{status:raw.status,msg:raw.msg,args:raw.args,result:raw.result,type:'changeCrop'});}};_updateCart.call(this,args,callback);},changeColor:function(cartItemId,color){var item=this.getItem(cartItemId);if(!item||!item.color){return;}
if(color===item.color){return;}
var args={method:'updateCartItem',cartItemId:cartItemId,attr:{color:color}};var callback=function(o){try{var raw=Lang.JSON.parse(o.responseText);}
catch(x){return;}
if(raw.status==='success'){var result={cartItemId:raw.args.cartItemId,prevValue:item.color,newValue:raw.result.item.color};this.items[cartItemId].color=result.newValue;this.fireEvent('changeColor',{status:raw.status,msg:raw.msg,args:raw.args,result:result,type:'changeColor'});}else{this.fireEvent('failure',{status:raw.status,msg:raw.msg,args:raw.args,result:raw.result,type:'changeColor'});}};_updateCart.call(this,args,callback);},addItem:function(imageId,imageKey,vendorId,productId,skuId,quantity,markup){if(!Lang.isBoolean(markup)){markup=true;}
var args={method:'addItem',imageId:imageId,imageKey:imageKey,vendorId:vendorId,productId:productId,skuId:skuId,quantity:quantity,markup:(markup?1:0)};var callback=function(o){try{var raw=Lang.JSON.parse(o.responseText);}
catch(x){return;}
if(raw.status==='success'){var result={cartItemId:raw.result.item.id,item:raw.result.item,markup:raw.result.markup||''};var cartItemId=result.cartItemId,item=result.item;this.items[cartItemId]=item;if(!this.images[item.imageId]){this.images[item.imageId]={id:item.imageId,items:[]};}
this.images[item.imageId].items.push(cartItemId);if(!this.vendors[item.vendorId]){this.vendors[item.vendorId]={id:item.vendorId,items:[]};}
this.vendors[item.vendorId].items.push(cartItemId);if(!this.products[item.productId]){this.products[item.productId]={id:item.productId,items:[]};}
this.products[item.productId].items.push(cartItemId);if(!this.skus[item.skuId]){this.skus[item.skuId]={id:item.skuId,items:[]};}
this.skus[item.skuId].items.push(cartItemId);this.fireEvent('addItem',{status:raw.status,msg:raw.msg,args:raw.args,result:result,type:'addItem'});}else{this.fireEvent('failure',{status:raw.status,msg:raw.msg,args:raw.args,result:raw.result,type:'addItem'});}};_updateCart.call(this,args,callback);},changeQuantity:function(cartItemId,quantity,markup){var item=this.getItem(cartItemId);if(!item){return;}
if(quantity===item.quantity){return;}
if(!Lang.isBoolean(markup)){markup=true;}
var args={method:'updateCartItem',cartItemId:cartItemId,attr:{quantity:quantity},markup:(markup?1:0)};var callback=function(o){try{var raw=Lang.JSON.parse(o.responseText);}
catch(x){return;}
if(raw.status==='success'){var result={cartItemId:raw.result.item.id,newValue:raw.result.item.quantity,prevValue:item.quantity};this.items[cartItemId].quantity=result.newValue;this.fireEvent('changeQuantity',{status:raw.status,msg:raw.msg,args:raw.args,result:result,type:'changeQuantity'});}else{this.fireEvent('failure',{status:raw.status,msg:raw.msg,args:raw.args,result:raw.result,type:'changeQuantity'});}};_updateCart.call(this,args,callback);},removeItem:function(cartItemId){var item=this.getItem(cartItemId);if(!item){return;}
var args={method:'removeItem',cartItemId:cartItemId};var callback=function(o){try{var raw=Lang.JSON.parse(o.responseText);}
catch(x){return;}
if(raw.status==='success'){var result={cartItemId:item.id};for(var i=0,len=this.products[item.productId].items.length;i<len;i++){if(this.products[item.productId].items[i]==item.id){this.products[item.productId].items.splice(i,1);}}
if(!this.getItemsByProduct(item.productId).length){delete this.products[item.productId];}
for(var i=0,len=this.vendors[item.vendorId].items.length;i<len;i++){if(this.vendors[item.vendorId].items[i]==item.id){this.vendors[item.vendorId].items.splice(i,1);}}
if(!this.getItemsByVendor(item.vendorId).length){delete this.vendors[item.vendorId];}
for(var i=0,len=this.images[item.imageId].items.length;i<len;i++){if(this.images[item.imageId].items[i]==item.id){this.images[item.imageId].items.splice(i,1);}}
if(!this.getItemsByPhoto(item.imageId).length){delete this.images[item.imageId];}
delete this.items[item.id];this.fireEvent('removeItem',{status:raw.status,msg:raw.msg,args:raw.args,result:result,type:'removeItem'});}else{this.fireEvent('failure',{status:raw.status,msg:raw.msg,args:raw.args,result:raw.result,type:'removeItem'});}};_updateCart.call(this,args,callback);},updateItem:function(cartItemId,attr,markup){var item=this.getItem(cartItemId);if(!item){return;}
var hasChanges=false;for(var a in attr){if(Lang.hasOwnProperty(attr,a)&&Lang.hasOwnProperty(item,a)){if(Lang.isObject(attr[a])&&Lang.isObject(item[a])){if({}.toSource){hasChanges=(attr[a].toSource()!==item[a].toSource());}else{hasChanges=true;}}else{hasChanges=(attr[a]!==item[a]);}}
if(hasChanges){break;}}
if(!hasChanges){return;}
if(!Lang.isBoolean(markup)){markup=true;}
var args={method:'updateCartItem',cartItemId:cartItemId,attr:attr,markup:(markup?1:0)};var callback=function(o){try{var raw=YAHOO.lang.JSON.parse(o.responseText);}
catch(x){return;}
if(raw.status==='success'){var result={cartItemId:raw.args.cartItemId,prevValue:item,newValue:raw.result.item,markup:raw.result.markup};_updateCartItem.call(this,result.newValue,item);this.fireEvent('changeProduct',{status:raw.status,msg:raw.msg,args:raw.args,result:result,type:'changeProduct'});}else{this.fireEvent('failure',{status:raw.status,msg:raw.msg,args:raw.args,result:raw.result,type:'changeProduct'});}};_updateCart.call(this,args,callback);}};Lang.augmentProto(UserCart,YAHOO.util.EventProvider);})();(function(){var AddCartSingle=function(){var uiFilters={};var cartFilters=SM.util.getCookie('cartfilters');if(cartFilters){cartFilters=cartFilters.split('|');if(cartFilters.length>0){for(var i=0,len=cartFilters.length;i<len;i+=1){uiFilters[cartFilters[i]]=true;}}}
this.currentContext={'cartId':null,'ch':null,'imageId':null,'imageKey':null,'vendorId':'EZprints','productId':null,'cartItemId':null,'pendingUpdates':[]};this.uiContext={'vendorPanel':null,'loadPanel':null,'container':null,'catalogPanel':null,'infoPanel':null,'cartItemsPanel':null,'updating':false,'catalogOptions':{'uiFilters':uiFilters}};this.dataContext={'catalog':new SM.catalog.ProductCatalog(),'cart':SM.cart.userCart||new SM.cart.data.UserCart(),'photoInfo':new SM.util.SimpleAjaxCache('/rpc/image.mg'),'productInfo':new SM.util.SimpleAjaxCache('/rpc/cart.mg')};this.createEvent('show');this.createEvent('hide');this.dataContext.photoInfo.subscribe('load',_loadInfoPanel,this,true);this.dataContext.photoInfo.subscribe('failure',_failInfoPanel,this,true);this.dataContext.productInfo.subscribe('load',_showProductInfo,this,true);this.dataContext.cart.subscribe('load',_loadCatalog,this,true);this.dataContext.cart.subscribe('load',_loadCartItemsPanel,this,true);this.dataContext.cart.subscribe('addItem',_updateProductItem,this,true);this.dataContext.cart.subscribe('removeItem',_updateProductItem,this,true);this.dataContext.cart.subscribe('changeQuantity',_updateProductItem,this,true);this.dataContext.cart.subscribe('failure',_updateProductItem,this,true);this.dataContext.catalog.subscribe('load',_loadCatalog,this,true);this.dataContext.catalog.subscribe('load',_loadCartItemsPanel,this,true);this.dataContext.catalog.subscribe('failure',_failCatalog,this,true);_initUI.call(this);};YAHOO.augment(AddCartSingle,YAHOO.util.EventProvider);var proto=AddCartSingle.prototype,Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Connect=YAHOO.util.Connect,Lang=YAHOO.lang,Anim=YAHOO.util.Anim;proto.CHROME_MARKUP='<div class="top border"></div><div class="bottom border"></div><div class="left border"></div><div class="right border"></div><div class="top_left corner"></div><div class="top_right corner"></div><div class="bottom_right corner"></div><div class="bottom_left corner"></div><div class="bg"></div>';proto.LOADING_MARKUP='<h5>loading</h5><img src="/img/spacer.gif" />';proto.NOPRODUCTS_MARKUP='<h2 class="noProducts">Sorry, this photo has no products available for purchase.</h2>';proto.QUANTITY_MAX=999;proto.toString=function(){return"GalleryCart: "+this.uiContext.container.toString();};proto.show=function(imageId,cartId,ch,imageKey){var cCtx=this.currentContext,dCtx=this.dataContext,uiCtx=this.uiContext;if(imageId!=cCtx.imageId){cCtx.imageId=imageId;cCtx.imageKey=imageKey;cCtx.cartId=cartId||'';cCtx.ch=ch||'';_showLoadingPanel.call(this);uiCtx.catalogPanel.innerHTML='';uiCtx.cartItemsPanel.childNodes[0].innerHTML='';dCtx.catalog.loaded=false;dCtx.cart.cartId=cartId;_loadCartData.call(this);}
var zI=parseInt(Dom.getStyle('lightBoxStage','zIndex'),10);zI=zI<60000?60000:zI;uiCtx.container.cfg.setProperty('zIndex',zI+=2);this.fireEvent('show');uiCtx.container.show();};proto.hide=function(){this.fireEvent('hide');this.uiContext.container.hide();};var _initUI=function(){var uiCtx=this.uiContext;var cCtx=this.currentContext;uiCtx.container=new YAHOO.widget.Panel('cartUI',{'constraintoviewport':true,'underlay':'none','close':false,'visible':false,'draggable':false,'modal':true});uiCtx.nowShowing='photoInfo';uiCtx.selectedItem=null;uiCtx.chrome=document.createElement('div');uiCtx.chrome.className='chrome';uiCtx.chrome.innerHTML=this.CHROME_MARKUP;uiCtx.loadPanel=document.createElement('div');uiCtx.loadPanel.id='loadingPanel';uiCtx.loadPanel.innerHTML=this.LOADING_MARKUP;uiCtx.vendorPanel=document.createElement('div');uiCtx.vendorPanel.id='vendorPanel';uiCtx.cartItemsPanel=document.createElement('div');uiCtx.cartItemsPanel.id='itemsPanel';uiCtx.cartItemsPanel.innerHTML='<div class="itemSummaryBlock"></div><div id="cartContinue" class="cartBtn">&lt; Back to Photos</div><div id="cartCheckout" class="cartBtn">Checkout &gt;</div>';uiCtx.infoPanel=document.createElement('div');uiCtx.infoPanel.id='infoPanel';uiCtx.catalogPanel=document.createElement('div');uiCtx.catalogPanel.id='catalogPanel';uiCtx.container.innerElement.appendChild(uiCtx.chrome);uiCtx.container.innerElement.appendChild(uiCtx.loadPanel);uiCtx.container.appendToBody(uiCtx.cartItemsPanel);uiCtx.container.appendToBody(uiCtx.infoPanel);uiCtx.container.appendToBody(uiCtx.catalogPanel);uiCtx.container.render(document.body);_initUIEvents.call(this);};var _initUIEvents=function(){var uiCtx=this.uiContext;var cCtx=this.currentContext;YAHOO.widget.Overlay.windowResizeEvent.subscribe(uiCtx.container.center,uiCtx.container,true);uiCtx.container.showEvent.subscribe(uiCtx.container.center);uiCtx.container.sizeMask=function(){if(this.mask){this.mask.style.height=Dom.getDocumentHeight()+"px";this.mask.style.width='100%';}};uiCtx.container.beforeShowEvent.subscribe(function(){if(typeof keyDown==='function'){Event.removeListener(document,"keydown",keyDown);}});uiCtx.container.beforeHideEvent.subscribe(function(){if(typeof keyDown==='function'){Event.on(document,"keydown",keyDown);}});var checkOut=function(){if(cCtx.pendingUpdates.length){setTimeout(checkOut,200);}else{window.location.href=SM.hostConfig.cartUrl+'?back2shop='+window.location;}};Event.on('cartContinue','click',this.hide,this,true);Event.on('cartCheckout','click',checkOut);Event.on(uiCtx.catalogPanel,'mouseover',_catalogEventHandler,this,true);Event.on(uiCtx.catalogPanel,'mouseout',_catalogEventHandler,this,true);Event.on(uiCtx.catalogPanel,'click',_catalogEventHandler,this,true);var ku1=new YAHOO.util.KeyListener(uiCtx.catalogPanel,{'shift':true,'keys':9},{'fn':_catalogEventHandler,'scope':this,'correctScope':true},YAHOO.util.KeyListener.KEYUP);ku1.enable();var ku2=new YAHOO.util.KeyListener(uiCtx.catalogPanel,{'keys':[9,48,49,50,51,52,53,54,55,56,57,96,97,98,99,100,101,102,103,104,105]},{'fn':_catalogEventHandler,'scope':this,'correctScope':true},YAHOO.util.KeyListener.KEYUP);ku2.enable();};var _loadCartData=function(){var dCtx=this.dataContext,cCtx=this.currentContext;if(!dCtx.cart.loaded){dCtx.cart.loadFromUrl(cCtx.cartId,cCtx.ch);}
dCtx.photoInfo.load({'method':'getImageInfo','imageId':cCtx.imageId,'imageKey':cCtx.imageKey});dCtx.catalog.loadFromUrl(cCtx.imageId,cCtx.imageKey);};var _showLoadingPanel=function(){var uiCtx=this.uiContext;Dom.setStyle([uiCtx.infoPanel,uiCtx.catalogPanel],'visibility','hidden');Dom.setStyle(uiCtx.loadPanel,'display','block');};var _hideLoadingPanel=function(){var uiCtx=this.uiContext;Dom.setStyle(uiCtx.loadPanel,'display','none');Dom.setStyle([uiCtx.infoPanel,uiCtx.catalogPanel],'visibility','inherit');};var _loadCartItemsPanel=function(){var dCtx=this.dataContext,cCtx=this.currentContext,uiCtx=this.uiContext;if(!dCtx.catalog.loaded||!dCtx.cart.loaded){return;}
var cartItems=dCtx.cart.getItems(),photoItems=dCtx.cart.getItemsByPhoto(cCtx.imageId),photoNumItems=0,photoCost=0,totalNumItems=0,totalCost=0;for(var i=0,len=photoItems.length;i<len;i++){photoNumItems+=photoItems[i].quantity;photoCost+=photoItems[i].quantity*photoItems[i].price;}
for(var i=0,len=cartItems.length;i<len;i++){totalNumItems+=cartItems[i].quantity;totalCost+=cartItems[i].quantity*cartItems[i].price;}
var str=[],rowTemplate='<div class="itemSummary">{0}: {1} item(s) for {2}</div>',fc=SM.util.formatCurrency,fn=SM.util.formatNumber,fs=SM.util.formatString;str.push(fs(rowTemplate,'This Photo',fn(photoNumItems),fc(photoCost)));str.push(fs(rowTemplate,'Your Cart',fn(totalNumItems),fc(totalCost)));Event.purgeElement(uiCtx.cartItemsPanel,false,'click');uiCtx.cartItemsPanel.childNodes[0].innerHTML=str.join('');};var _failInfoPanel=function(o){var uiCtx=this.uiContext;var status=o.status;var msg=o.msg;var args=o.args;var markup=[];for(var i=0,len=msg.length;i<len;i++){markup.push('<h5>'+msg[i]+'</h5>');}
uiCtx.infoPanel.innerHTML=markup.join('');};var _loadInfoPanel=function(){var uiCtx=this.uiContext,dCtx=this.dataContext,cCtx=this.currentContext,uiFilters=uiCtx.catalogOptions.uiFilters,isFiltered=false;var p=dCtx.photoInfo.data;var thumbRatio=150/Math.max(p.OriginalWidth,p.OriginalHeight);var thumbH=Math.round(p.OriginalHeight*thumbRatio);var thumbW=Math.round(p.OriginalWidth*thumbRatio);var pInfo={cssClass:'phototile-thumb',width:thumbW,height:thumbH,src:'/photos/toolthumbs.mg?tool=realThumb&ImageID='+cCtx.imageId+'&ImageKey='+(cCtx.imageKey||''),title:'',desc:''};var desc='<p>As you change quantities, your cart is updated magically.</p><p>Want other photos?  Click \'Back to Photos\' and find more to buy.</p><p>\'Checkout\' to see everything in your cart and make finishing touches.</p>';var panelTemplate='<div id="catalogOptions"><h3>Catalog Options</h3><div class="catalogOptions"><div class="options"><fieldset><legend>Hide Photo Finishes</legend><ul id="finishFilter"><li id="filterLustre" class="{6}"><img class="checkbox" src="/img/spacer.gif" />Lustre</li><li id="filterMatte" class="{7}"><img class="checkbox" src="/img/spacer.gif" />Matte</li><li id="filterGloss" class="{8}"><img class="checkbox" src="/img/spacer.gif" />Glossy</li><li id="filterMetal" class="{14}"><img class="checkbox" src="/img/spacer.gif" />Metallic</li><li id="filterWatercolor" class="{15}"><img class="checkbox" src="/img/spacer.gif" />Gicl&eacute;e Watercolor</li></ul></fieldset><ul><li id="filterCrop" class="{9}"><img class="checkbox" src="/img/spacer.gif" />Hide products that need to be cropped</li></ul><ul><li id="filterPrint" class="{11}"><img class="checkbox" src="/img/spacer.gif" />Hide products that cannot be purchased</li></ul><ul><li id="filterCart" class="{10}"><img class="checkbox" src="/img/spacer.gif" />Only show products in my cart</li></ul></div></div><a id="hideOptions">Show my photo &gt;&gt;</a></div>';panelTemplate+='<div id="photoInfo"><h3>Buy This Photo</h3><div class="photoInfo">'+SM.photo.getPhototileMarkup(pInfo)+'<h5>How to Get the Goods:</h5><p class="desc">'+desc+'</p></div><div id="showOptions"><div id="filterMsg" style="{12}">You have options set that may limit which items are shown.</div><a>&lt;&lt; Simplify this page</a></div></div>';for(var f in uiFilters){if(uiFilters[f]){isFiltered=true;break;}}
uiCtx.infoPanel.innerHTML=SM.util.formatString(panelTemplate,cCtx.imageId,thumbW,thumbH,p.OriginalWidth,p.OriginalHeight,p.FileName,uiFilters.lustre?'checked':'',uiFilters.matte?'checked':'',uiFilters.gloss?'checked':'',uiFilters.crop?'checked':'',uiFilters.cart?'checked':'',uiFilters.print?'checked':'',isFiltered?'':'visibility: hidden;',cCtx.imageKey?cCtx.imageKey:'',uiFilters.metal?'checked':'',uiFilters.watercolor?'checked':'');var doFilter=function(e,filter){var filterClasses={'crop':'needCrop','cart':'product','matte':'matteFinish','lustre':'lustreFinish','gloss':'glossFinish','metal':'metalFinish','watercolor':'watercolorFinish','print':'noPrint'};var re=/.+_.+_.+_(.+)/;var simpleFilter=function(el){if(Dom.hasClass(el,'product')&&Dom.hasClass(el,filterClasses[filter])&&!re.test(el.id)&&!Dom.hasClass(el,'inCart')&&!Dom.hasClass(el.nextSibling,'inCart')){if(Dom.hasClass(el,'filtered')){for(var f in uiFilters){if(f!=filter&&uiFilters[f]&&Dom.hasClass(el,filterClasses[f])){return false;}}}
return true;}else{return false;}};var prods=Dom.getElementsBy(simpleFilter,'div',uiCtx.catalogPanel);var sb=uiCtx.categoryTabSet.get('activeTab').scrollBar;if(uiFilters[filter]){_expandProducts(prods,function(){if(sb){sb.resize();}},function(){Dom.removeClass(prods,'filtered');if(sb){sb.resize(true);}});Dom.removeClass(this,'checked');uiFilters[filter]=false;}else{_collapseProducts(prods,function(){if(sb){sb.resize();}},function(){Dom.addClass(prods,'filtered');if(sb){sb.resize(true);}});Dom.addClass(this,'checked');uiFilters[filter]=true;}
var onFilters=[];for(var f in uiFilters){if(uiFilters[f]){onFilters.push(f);}}
var filterMsg=Dom.get('filterMsg');if(onFilters.length===0){Dom.setStyle(filterMsg,'visibility','hidden');}else{Dom.setStyle(filterMsg,'visibility','inherit');}
SM.util.setCookie('cartfilters',onFilters.join('|'),365);};Event.on('showOptions','click',_showCatalogOptions,this,true);Event.on('hideOptions','click',_showPhotoInfo,this,true);Event.on('filterLustre','click',doFilter,'lustre');Event.on('filterGloss','click',doFilter,'gloss');Event.on('filterMatte','click',doFilter,'matte');Event.on('filterMetal','click',doFilter,'metal');Event.on('filterWatercolor','click',doFilter,'watercolor');Event.on('filterCrop','click',doFilter,'crop');Event.on('filterCart','click',doFilter,'cart');Event.on('filterPrint','click',doFilter,'print');};var _showProductInfo=function(o){var uiCtx=this.uiContext,dCtx=this.dataContext,cCtx=this.currentContext;var status=o.status;var msg=o.msg;var args=o.args;var prodInfo=dCtx.productInfo.data;var photoInfo=dCtx.photoInfo.data;var itemInfo=dCtx.cart.getItem(args.cartItemId);var cropW=0,cropH=0,cropX=0,cropY=0;if(itemInfo){cropW=itemInfo.crop.cropW;cropH=itemInfo.crop.cropH;cropX=itemInfo.crop.cropX;cropY=itemInfo.crop.cropY;}
var markup=prodInfo.markup;var pP=Dom.get('photoInfo');var prod=Dom.getElementsByClassName('productInfo','div',pP);var pI=Dom.getElementsByClassName('photoInfo','div',pP)[0];var p1=prod.length>0?prod[prod.length-1]:pI;var p2=pP.lastChild===p1?pP.appendChild(document.createElement('div')):pP.insertBefore(document.createElement('div'),p1.nextSibling);Dom.addClass(p2,'productInfo');p2.innerHTML=markup+SM.util.formatString('<h5>{0}</h5>',prodInfo.ProductName)+SM.util.formatString('<p class="desc">'+prodInfo.Description+'</p>',prodInfo.ProductName);if(uiCtx.nowShowing==='catalogOptions'){if(Dom.hasClass(p1,'productInfo')){p1.parentNode.removeChild(p1);}else{Dom.setX(p1,Dom.getX(p1)-pP.offsetWidth);}
Dom.setX(p2,Dom.getX(pP));_showPhotoInfo.call(this);}else{if(p1!=pI&&Dom.getX(pI)>Dom.getX(pP)-pP.offsetWidth){var a=new YAHOO.util.Motion(p1,{'points':{'to':[Dom.getX(pP)-pP.offsetWidth,Dom.getY(pI)]}},.5);a.animate();}
var anim=new YAHOO.util.Motion(p1,{'points':{'by':[-pP.offsetWidth,0]}},.5);var anim2=new YAHOO.util.Motion(p2,{'points':{'by':[-pP.offsetWidth,0]}},.5);anim2.onComplete.subscribe(function(){if(p1!=pI){if(p1.parentNode){p1.parentNode.removeChild(p1);}else if(p2.parentNode){p2.parentNode.removeChild(p2);}}});anim.animate();anim2.animate();}
uiCtx.nowShowing='productInfo';};var _showPhotoInfo=function(){var oP=Dom.get('catalogOptions');var pP=Dom.get('photoInfo');var photoInfo=Dom.getElementsByClassName('photoInfo','div',pP)[0];var prods=Dom.getElementsByClassName('productInfo','div',pP);if(this.uiContext.nowShowing==='catalogOptions'){var iP=this.uiContext.infoPanel;var iPXY=Dom.getXY(iP);if(!this.uiContext.selectedItem){Dom.setX(photoInfo,Dom.getX(pP));if(prods.length>0){Dom.batch(prods,function(el){el.parentNode.removeChild(el);});}}
var anim=new YAHOO.util.Motion(pP,{'points':{'to':iPXY}},.5);var anim2=new YAHOO.util.Motion(oP,{'points':{'to':[iPXY[0]-iP.offsetWidth,iPXY[1]]}},.5);anim.animate();anim2.animate();}else{var anim=new YAHOO.util.Motion(photoInfo,{'points':{'to':[Dom.getX(pP),Dom.getY(photoInfo)]}},.5);var anim2=new YAHOO.util.Motion(prods[0],{'points':{'to':[Dom.getX(pP)+pP.offsetWidth,Dom.getY(photoInfo)]}},.5);anim2.onComplete.subscribe(function(){Dom.batch(prods,function(el){if(el.parentNode){el.parentNode.removeChild(el);}});});anim.animate();anim2.animate();}
this.uiContext.nowShowing='photoInfo';};var _showCatalogOptions=function(e){var iP=this.uiContext.infoPanel;var iPXY=Dom.getXY(iP);var oP=Dom.get('catalogOptions');var pP=Dom.get('photoInfo');var anim=new YAHOO.util.Motion(oP,{'points':{'to':iPXY}},.5);var anim2=new YAHOO.util.Motion(pP,{'points':{'to':[iPXY[0]+iP.offsetWidth,iPXY[1]]}},.5);anim.animate();anim2.animate();this.uiContext.nowShowing='catalogOptions';};var _loadCatalog=function(){var cCtx=this.currentContext,dCtx=this.dataContext;if(dCtx.catalog.loaded&&dCtx.cart.loaded){_createCategoryTabSet.call(this);}};var _failCatalog=function(o){var uiCtx=this.uiContext;var status=o.status;var msg=o.msg;var args=o.args;var markup=[];for(var i=0,len=msg.length;i<len;i++){markup.push(msg[i]+'<br />');}
uiCtx.catalogPanel.innerHTML='<h2 class="noProducts">'+markup.join('')+'</h2>';_hideLoadingPanel.call(this);};var _createCategoryTabSet=function(){var cCtx=this.currentContext,uiCtx=this.uiContext,dCtx=this.dataContext,tabSet;if(dCtx.catalog.productsAvailable){tabSet=new YAHOO.widget.TabView({'orientation':'top'});tabSet.addClass('categoryTabs');tabSet.appendTo(uiCtx.catalogPanel);tabSet.addListener('activeTabChange',function(o){if(o.prevValue===o.newValue){return;}
var content=o.newValue.get('content');if(content){return;}
content=_buildTabContent.call(this,dCtx.catalog.categories[o.newValue.categoryId]);o.newValue.set('content',content);},this,true);tabSet.addListener('beforeActiveTabChange',function(o){if(!o.prevValue){return;}
o.prevValue.set('contentVisible',false);},this,true);_createCategoryTabs.call(this,tabSet);tabSet.set('activeIndex',0);uiCtx.categoryTabSet=tabSet;}else{uiCtx.catalogPanel.innerHTML=this.NOPRODUCTS_MARKUP;}
_hideLoadingPanel.call(this);};var _createCategoryTabs=function(tabSet){var cCtx=this.currentContext,dCtx=this.dataContext,uiCtx=this.uiContext,catalog=dCtx.catalog,meta=catalog.meta,categories=[],tab,category,i,len,tabClass;for(i in catalog.categories){categories.push(catalog.categories[i]);}
categories.sort(function(a,b){var s1=meta.category[a.id].SortIndex,s2=meta.category[b.id].SortIndex;return(s1-s2);});len=categories.length;for(i=0;i<len;i++){category=categories[i];tab=new YAHOO.widget.Tab({'label':meta.category[category.id].Name});tab.addClass('tab_'+category.id.toLowerCase());tab.categoryId=category.id;tabSet.addTab(tab);tab.addListener('activeChange',function(o){tabClass='tab_'+this.categoryId.toLowerCase();if(o.newValue){cCtx.categoryId=this.categoryId;this.replaceClass(tabClass,tabClass+'_active');this.set('title','');}else{this.replaceClass(tabClass+'_active',tabClass);}},this);tab.addListener('contentChange',_addScrollBar);}};var _buildTabContent=function(category){var dCtx=this.dataContext,meta=dCtx.catalog.meta,str=[],subCats=[],subCat,i,len;var fs=SM.util.formatString,fn=SM.util.formatNumber,fc=SM.util.formatCurrency;for(i in category.subCategories){subCats.push(category.subCategories[i]);}
subCats.sort(function(a,b){var s1=meta.subcategory[a.id].SortIndex,s2=meta.subcategory[b.id].SortIndex;return(s1-s2);});len=subCats.length;str.push(fs('<div class="subCatLinks"><h5>{0} categories:</h5><ul>',meta.category[category.id].Name));for(i=0;i<len;i++){subCat=subCats[i];str.push(fs('<li id="_{0}_{1}">{2}</li>',category.id,subCat.id,meta.subcategory[subCat.id].Name||''));}
str.push('</ul></div>');str.push('<div class="productsHeader"><div class="costTotal">Cost</div><div class="quantity">Qty.</div><div class="costEach">Cost ea.</div><div class="productName">Product</div></div>');str.push('<div class="productsContainer"><div class="productsList">');for(i=0;i<len;i++){subCat=subCats[i];str.push(fs('<h5 id="{0}_{1}" class="{2}">{3}<div class="desc">{4}</div></h5>',category.id,subCat.id,(i==0?'first':''),meta.subcategory[subCat.id].Name,meta.subcategory[subCat.id].Description));str=str.concat(_productMarkup.call(this,subCat));}
str.push('</div></div>');str=str.join('');return str;};var _productMarkup=function(subCat){var str=[],products=[],product,i,len;for(i in subCat.products){products.push(subCat.products[i]);}
products.sort(function(a,b){var g1=a.group,g2=b.group,s1=a.sortIndex,s2=b.sortIndex;if(g1==g2){return(s1-s2);}else{return(g1-g2);}});len=products.length;for(i=0;i<len;i++){product=products[i];str=str.concat(_skuMarkup.call(this,product));}
return str;};var _skuMarkup=function(product){var dCtx=this.dataContext,cCtx=this.currentContext,uiCtx=this.uiContext,catalog=dCtx.catalog,priceList=catalog.priceList,meta=catalog.meta,str=[],skus=[],sku,i,j,len,jlen;var fs=SM.util.formatString,fn=SM.util.formatNumber,fc=SM.util.formatCurrency;var skuTemplate='<div class="{0}" id="{1}" style="{7}"><div class="costTotal numeric">{2}</div><div class="quantity">{3}</div><div class="costEach numeric">{4}</div><div class="productName">{5}</div>{6}</div>';for(i in product.options){skus.push(product.options[i]);}
skus.sort(function(a,b){var s1=meta[product.optionType][a.typeCode].SortIndex,s2=meta[product.optionType][b.typeCode].SortIndex;return(s1-s2);});len=skus.length;for(i=0;i<len;i++){sku=skus[i];skuName=product.name;skuClass='product';skuStyle='';skuMsg='';isFiltered=false;finish=null;skuId=product.vendorId+'_'+product.id+'_'+sku.id;printable=catalog.checkRes(product.id,sku.id,dCtx.photoInfo.data.OriginalWidth,dCtx.photoInfo.data.OriginalHeight);needsCrop=catalog.needsCrop(product.id,dCtx.photoInfo.data.OriginalWidth,dCtx.photoInfo.data.OriginalHeight);listOwner=priceList.listOwner;proList=priceList.proList;basePrice=priceList.getBasePrice(sku.id);proPrice=priceList.getProPrice(sku.id);if(proPrice===null){proPrice=basePrice;}
price=listOwner?basePrice:proPrice;if(!listOwner&&proPrice<basePrice){continue;}
if(product.optionType!=='none'&&meta[product.optionType][sku.typeCode]){skuName+=' ('+meta[product.optionType][sku.typeCode].Name+')';}
if(listOwner&&proList){skuMsg+=fs('<div class="proPrice message">Your customer&#39;s price: {0}</div>',proPrice<basePrice?'not for sale':fc(proPrice));}
if(listOwner&&product.categoryId==='download'){printable=false;skuClass+=' noPrint';skuMsg+='<div class="noPrint message"><img src="/img/spacer.gif" />You may not purchase downloads of your photos</div>';}else if(!printable){skuClass+=' noPrint';skuMsg+='<div class="noPrint message"><img src="/img/spacer.gif" />The photo is too small to buy this item</div>';if(uiCtx.catalogOptions.uiFilters.print){isFiltered=true;}}else if(needsCrop){skuClass+=' needCrop';skuMsg+='<div class="needCrop message">Needs cropping in checkout</div>';if(uiCtx.catalogOptions.uiFilters.crop){isFiltered=true;}}
if(product.categoryId==='prints'&&product.optionType=='finish'){finish=sku.typeCode;if(finish){skuClass+=' '+finish+'Finish';if(uiCtx.catalogOptions.uiFilters[finish]){isFiltered=true;}}}
if(isFiltered){skuClass+=' filtered';skuStyle='height: 0px; display: none;';}
str.push(fs(skuTemplate,skuClass,skuId,fc(0),(printable?'<div class="sm-spinner"><div class="sm-spinner-less"></div><div class="sm-spinner-more"></div><input type="text" class="sm-spinner-input numeric" size="3" value="0" maxlength="3" /></div>':0),fc(price),skuName,skuMsg,skuStyle));skuItems=dCtx.cart.getItemsBySku(sku.id);jlen=skuItems.length;if(jlen){skuClass+=' inCart';for(j=0;j<jlen;j++){cItem=skuItems[j];if(cItem.imageId!=cCtx.imageId){continue;}
if(cItem.crop.cropType==='Crop'&&cItem.crop.cropW*cItem.crop.cropH!=0){itemCrop='Cropped';}else if(cItem.crop.cropType==='Crop'){itemCrop='Not Cropped';}else{itemCrop='Do Not Crop';}
cItemId=skuId+'_'+cItem.id;skuName=itemCrop;str.push(fs(skuTemplate,skuClass,cItemId,fc(price*cItem.quantity),(printable?'<div class="sm-spinner"><div class="sm-spinner-less"></div><div class="sm-spinner-more"></div><input type="text" class="sm-spinner-input numeric" size="3" value="'+cItem.quantity+'" maxlength="3"/></div>':cItem.quantity),fc(price),skuName,'<div class="message">Previously added to your cart</div>',skuStyle));}}
skuClass=skuClass.replace(' inCart','');}
return str;};var _addScrollBar=function(o){var tabContentEl=this.get('contentEl');var productContainer=tabContentEl.childNodes[2];if(!productContainer){return;}
var sHeight=productContainer.scrollHeight;var oHeight=productContainer.offsetHeight;this.scrollBar=new SM.cart.UI.ScrollBar(productContainer,{'mouseWheel':true});if(sHeight<=oHeight){Dom.setStyle(this.scrollBar.sb,'visibility','hidden');}
this.addListener('contentVisibleChange',function(o){if(o.newValue&&!o.prevValue){this.scrollBar.resize(true);var sliderOffset=this.scrollBar.thumb.getYValue();sliderOffset+=(sliderOffset===0)?0:1;if(sliderOffset!=0){this.scrollBar.fireEvent('change',sliderOffset);}}});};var spinningSpinner=null,activeSpinners={};var _catalogEventHandler=function(){if(arguments.length===2){var e=arguments[0];}else{var e=arguments[1][1];}
var self=this,dCtx=this.dataContext,cCtx=this.currentContext,uiCtx=this.uiContext,type=e.type,target=Event.getTarget(e),targetTag=null,product=null;if(target){targetTag=target.tagName.toLowerCase();product=findParentProduct(target,this);}
switch(type){case'mouseover':case'mouseout':if(product){mouseHoverHandler(type);}
break;case'click':if(product){productClickHandler();spinClickHandler();}else{linkClickHandler();}
break;case'keyup':target=uiCtx.selectedItem.getElementsByTagName('input')[0];keyHandler(e);}
function findParentProduct(child,ancestor){var test=function(node){return Dom.hasClass(node,'product');};var getProductParts=function(product){var parts=product.id.split('_');return{'el':product,'imageId':cCtx.imageId,'vendorId':parts[0],'productId':parts[1],'skuId':parts[2],'cartItemId':parts[3]||null};};do{if(child.nodeType===1&&test(child)){return getProductParts(child);}}while((child=child.parentNode)&&(child!==ancestor));return null;}
function mouseHoverHandler(){switch(type){case'mouseover':Dom.addClass(product.el,'hover');break;case'mouseout':Dom.removeClass(product.el,'hover');break;}}
function linkClickHandler(){if(targetTag!='li'){return;}
var linkId=target.id.substr(1);var linkEl=Dom.get(linkId);if(!Dom.hasClass(target.parentNode.parentNode,'subCatLinks')){return;}
var productContainer=linkEl.parentNode.parentNode;var a=new YAHOO.util.Scroll(productContainer,{'scroll':{'to':[0,linkEl.offsetTop]}},.5,YAHOO.util.Easing.easeOut);a.animate();}
function productClickHandler(){if(Dom.hasClass(product.el,'selected')){if(!Dom.hasClass(target.parentNode,'sm-spinner')){Dom.removeClass(product.el,'selected');uiCtx.selectedItem=null;_showPhotoInfo.call(self);}}else{Dom.removeClass(uiCtx.selectedItem,'selected');Dom.addClass(product.el,'selected');uiCtx.selectedItem=product.el;var qtyEl=product.el.getElementsByTagName('input')[0];if(qtyEl){var el=qtyEl.createTextRange?qtyEl.createTextRange():qtyEl;el.select();Event.stopEvent(e);}
dCtx.productInfo.load({method:'getProductInfo',vendorId:product.vendorId,skuId:product.skuId,cartItemId:(product.cartItemId||''),imageId:cCtx.imageId,imageKey:(cCtx.imageKey||''),markup:1});}}
function beforeChangeHandler(product){var updateId=product.cartItemId||product.skuId;if(!cCtx.pendingUpdates[updateId]){cCtx.pendingUpdates.push(updateId);}}
function changeHandler(product,el){var cost=Dom.getElementsByClassName('costTotal','div',product.el)[0];_lockProductItem(el);cost.innerHTML='&nbsp;';Dom.addClass(cost,'ajaxBusy_small');if(!product.cartItemId){dCtx.cart.addItem(product.imageId,cCtx.imageKey,product.vendorId,product.productId,product.skuId,el.value)}else if(parseInt(el.value,10)===0){dCtx.cart.removeItem(product.cartItemId)}else{dCtx.cart.changeQuantity(product.cartItemId,el.value)}}
function keyHandler(e){if(e.keyCode===9){if(!product){return;}else{var sel=uiCtx.selectedItem,sib=e.shiftKey?sel.previousSibling:sel.nextSibling;while(sib){if(Dom.hasClass(sib,'product')){product=findParentProduct(sib,sib);productClickHandler();return;}
sib=e.shiftKey?sib.previousSibling:sib.nextSibling;}}}else{spinClickHandler();}}
function spinClickHandler(){var minValue=0;var maxValue=(uiCtx.categoryTabSet.get('activeTab').get('label')==='Downloads'?1:self.QUANTITY_MAX);var delay=1000;if(!Dom.hasClass(target.parentNode,'sm-spinner')){return;}
spinningSpinner=uiCtx.selectedItem.id;if(activeSpinners[spinningSpinner]){clearTimeout(activeSpinners[spinningSpinner].spinChangeTimer);delete activeSpinners[spinningSpinner];}
activeSpinners[spinningSpinner]=product;var targetEl=activeSpinners[spinningSpinner].el.getElementsByTagName('input')[0];if(targetEl.disabled){return;}
var newValue=targetEl.value;try{var oldValue=dCtx.cart.getItem(activeSpinners[spinningSpinner].cartItemId).quantity;}catch(err){var oldValue=0;}
if(!/^\d+$/.test(newValue)){newValue=(!/^\d+$/.test(oldValue))?0:oldValue;}
newValue=parseInt(newValue,10);if(Dom.hasClass(target,'sm-spinner-more')&&(maxValue===null||newValue<maxValue)){newValue+=1;}else if(Dom.hasClass(target,'sm-spinner-less')&&(minValue===null||newValue>minValue)){newValue-=1;}
targetEl.value=newValue;if(oldValue===newValue){return;}
var updateProduct=activeSpinners[spinningSpinner];activeSpinners[spinningSpinner].spinChangeTimer=setTimeout(function(){delete activeSpinners[spinningSpinner];spinningSpinner=null;beforeChangeHandler(updateProduct);changeHandler(updateProduct,targetEl);},delay);}};var _updateProductItem=function(o){var cCtx=this.currentContext,uiCtx=this.uiContext,dCtx=this.dataContext,status=o.status,msg=o.msg,args=o.args,type=o.type,result=o.result||null;if(status=='failure'||type==='removeItem'){var row=Dom.get(args.vendorId+'_'+args.productId+'_'+args.skuId+'_'+args.cartItemId);}else{var cartItem=dCtx.cart.getItem(result.cartItemId);var row=Dom.get(cartItem.vendorId+'_'+cartItem.productId+'_'+cartItem.skuId+'_'+cartItem.id);}
if(row&&type==='removeItem'){if(Dom.hasClass(row,'inCart')){var sb=uiCtx.categoryTabSet.get('activeTab').scrollBar;_collapseProducts(row,function(){if(sb){sb.resize();}},function(){row.parentNode.removeChild(row);var p=Dom.get(args.vendorId+'_'+args.productId);if(!p){return;}
var qtyInput=p.getElementsByTagName('input')[0];if(!qtyInput){return;}
qtyInput.select();});}else{row.id=args.vendorId+'_'+args.productId+'_'+args.skuId;}}else if(!row){row=Dom.get(args.vendorId+'_'+args.productId+'_'+args.skuId);row.id=args.vendorId+'_'+args.productId+'_'+args.skuId+'_'+args.cartItemId;}
var errors=Dom.getElementsByClassName('error','ul',row);for(var i=0,len=errors.length;i<len;i+=1){errors[i].parentNode.removeChild(errors[i]);}
var cost=Dom.getElementsByClassName('costTotal','div',row)[0];Dom.removeClass(cost,'ajaxBusy_small');_unlockProductItem(row.getElementsByTagName('input')[0]);var qtyInput=row.getElementsByTagName('input')[0];if(qtyInput){qtyInput.select();}
if(status==='success'){if(type==='removeItem'){cost.innerHTML='$0.00';}else{cost.innerHTML=SM.util.formatCurrency(cartItem.price*cartItem.quantity);}
_loadCartItemsPanel.call(this);}else{var errEl=document.createElement('ul');errEl.className='error message';var message='';for(var i=0,len=msg.length;i<len;i+=1){message+='<li>'+msg[i]+'</li>';}
errEl.innerHTML=message;row.appendChild(errEl);}
var i=0;while(i<cCtx.pendingUpdates.length){if(cCtx.pendingUpdates[i]==args.cartItemId||cCtx.pendingUpdates[i]==args.skuId){cCtx.pendingUpdates.splice(i,1);}else{i++;}}};var _lockProductItem=function(el){el.disabled=true;};var _unlockProductItem=function(el){el.disabled=false;};var _collapseProducts=function(prods,fn1,fn2){if(!YAHOO.lang.isArray(prods)){var tmp=prods;prods=[];prods[0]=tmp;}
if(prods.length===0){return;}
Dom.setStyle(prods,'overflow','hidden');var anim=new YAHOO.util.Anim(prods,{'opacity':{'to':0}},.5);anim.onComplete.subscribe(function(){var anim2;for(var i=0,len=prods.length;i<len;i+=1){prods[i].setAttribute('sm-height',Dom.getStyle(prods[i],'height'));prods[i].setAttribute('sm-border-top-width',Dom.getStyle(prods[i],'border-top-width'));prods[i].setAttribute('sm-border-bottom-width',Dom.getStyle(prods[i],'border-bottom-width'));prods[i].setAttribute('sm-padding-top',Dom.getStyle(prods[i],'padding-top'));prods[i].setAttribute('sm-padding-bottom',Dom.getStyle(prods[i],'padding-bottom'));Dom.setStyle(prods[i],'border-top-width','0px');Dom.setStyle(prods[i],'border-bottom-width','0px');Dom.setStyle(prods[i],'padding-top','0px');Dom.setStyle(prods[i],'padding-bottom','0px');}
anim2=new YAHOO.util.Anim(prods,{'height':{'to':0}},.5);anim2.onComplete.subscribe(function(){Dom.setStyle(prods,'display','none');});if(fn1){anim2.onTween.subscribe(fn1);}
if(fn2){anim2.onComplete.subscribe(fn2);}
anim2.animate();});anim.animate();};var _expandProducts=function(prods,fn1,fn2){if(!YAHOO.lang.isArray(prods)){var tmp=prods;prods=[];prods[0]=tmp;}
if(prods.length===0){return;}
var anim,anim2,pHeight;for(var i=0,len=prods.length;i<len;i+=1){Dom.setStyle(prods[i],'display','block');Dom.setStyle(prods[i],'border-top-width',prods[i].getAttribute('sm-border-top-width'));Dom.setStyle(prods[i],'border-bottom-width',prods[i].getAttribute('sm-border-bottom-width'));Dom.setStyle(prods[i],'padding-top',prods[i].getAttribute('sm-padding-top'));Dom.setStyle(prods[i],'padding-bottom',prods[i].getAttribute('sm-padding-bottom'));pHeight=prods[i].getAttribute('sm-height')||prods[i].scrollHeight;prods[i].removeAttribute('sm-border-top-width');prods[i].removeAttribute('sm-border-bottom-width');prods[i].removeAttribute('sm-padding-top');prods[i].removeAttribute('sm-padding-bottom');anim=new YAHOO.util.Anim(prods[i],{'height':{'to':pHeight}},.5);if(i===prods.length-1){if(fn1){anim.onTween.subscribe(fn1);}
anim.onComplete.subscribe(function(){Dom.batch(prods,function(el){Dom.setStyle(el,'overflow','visible');Dom.setStyle(el,'height','auto');});anim2=new YAHOO.util.Anim(prods,{'opacity':{'to':1}},.5);if(fn2){anim2.onComplete.subscribe(fn2);}
anim2.animate();});}
anim.animate();}};SM.cart.AddCartSingle=AddCartSingle;})();(function(){var ScrollBar=function(targetEl,attr){targetEl=Dom.get(targetEl);if(!targetEl){return;}
attr=attr||{};var oHeight=targetEl.offsetHeight;var scrollId=attr.id||Dom.generateId('','sb');var mouseWheel=attr.mouseWheel||false;var sliderMinHeight=Math.floor(oHeight*(attr.sliderMinHeight||.15));var sliderMaxHeight=Math.floor(oHeight*(attr.sliderMaxHeight||.85));var scrollAmount=attr.scrollAmount||15;var scrollContainer=document.createElement('div');scrollContainer.className='scrollContainer';var sb=document.createElement('div');sb.className='scrollBar';var sliderBg=document.createElement('div');sliderBg.id=scrollId+'_sb';sliderBg.className='scrollBg';var sliderUp=document.createElement('div');sliderUp.className='scrollUp';var sliderDown=document.createElement('div');sliderDown.className='scrollDown';var sliderThumb=document.createElement('div');sliderThumb.id=scrollId+'_st';sliderThumb.className='scrollThumb';sliderThumb.innerHTML='<div class="top"></div><div class="bottom"></div>';sliderBg.appendChild(sliderThumb);sb.appendChild(sliderBg);sb.appendChild(sliderUp);sb.appendChild(sliderDown);targetEl.parentNode.insertBefore(scrollContainer,targetEl);scrollContainer.appendChild(targetEl);scrollContainer.appendChild(sb);var sHeight,sliderHeight,ratio,maxOffset;var setSize=function(){oHeight=targetEl.offsetHeight;sHeight=Math.max(targetEl.scrollHeight,oHeight);sliderHeight=Math.min(Math.max(Math.floor(sHeight/(sHeight-oHeight)*100),sliderMinHeight),sliderMaxHeight);if(sHeight<oHeight||sHeight==oHeight){sliderHeight=sliderMaxHeight;}
else{sliderHeight=Math.max((((1-(sHeight-oHeight)/sHeight))*sliderMaxHeight),sliderMinHeight);}
maxOffset=oHeight-sliderUp.offsetHeight-sliderDown.offsetHeight-sliderHeight;ratio=(sHeight-oHeight)/maxOffset;};setSize();Dom.setStyle(sliderThumb,'height',sliderHeight+'px');var scrollBar=YAHOO.widget.Slider.getVertSlider(sliderBg.id,sliderThumb.id,0,maxOffset);scrollBar.sb=sb;scrollBar.resize=function(checkVisibility,setToZero,animTime){setSize();scrollBar.thumb.setYConstraint(0,maxOffset);Dom.setStyle(sliderThumb,'height',sliderHeight+'px');if(scrollBar.thumb.getYValue()+sliderHeight>maxOffset){scrollBar.setValue(maxOffset,true,true);}else{scrollBar.fireEvent('change',scrollBar.thumb.getYValue());}
if(!checkVisibility){return;}
if(setToZero){scrollBar.setValue(0,true,true);}
var sHeight=targetEl.scrollHeight,oHeight=targetEl.offsetHeight,vis=Dom.getStyle(sb,'visibility');if(sHeight<=oHeight&&vis!='hidden'){if(!animTime){var animTime=.5;}
var anim=new YAHOO.util.Anim(sb,{'opacity':{'to':0}},animTime);anim.onComplete.subscribe(function(){Dom.setStyle(sb,'visibility','hidden');});anim.animate();}else if(sHeight>oHeight&&vis==='hidden'){if(!animTime){var animTime=.5;}
Dom.setStyle(sb,'visibility','inherit');var anim=new YAHOO.util.Anim(sb,{'opacity':{'to':1}},animTime);anim.animate();}};scrollBar.scrollTargetBy=function(xDelta){targetEl.scrollTop+=xDelta;};var fireEvent=true;var scrollClickTimer;var clickedEl;var doScroll=function(){if(clickedEl===sliderDown){scrollBar.scrollTargetBy(scrollAmount);}else if(clickedEl===sliderUp){scrollBar.scrollTargetBy(-(scrollAmount));}else{return;}
var scrollInterval=100;scrollClickTimer=setTimeout(doScroll,scrollInterval);};var mouseDown=function(e){clickedEl=this;doScroll();};var mouseUp=function(e){Event.stopEvent(e);if(scrollClickTimer){clearTimeout(scrollClickTimer);scrollClickTimer=null;}};var scrollTarget=function(e){fireEvent=false;scrollBar.setValue(this.scrollTop/ratio,true,true);fireEvent=true;};Event.on(targetEl,'scroll',scrollTarget);Event.on([sliderDown,sliderUp],'mousedown',mouseDown);Event.on([sliderDown,sliderUp],'mouseup',mouseUp);scrollBar.subscribe('change',function(offsetY){if(fireEvent){targetEl.scrollTop=offsetY*ratio;}});scrollBar.thumb.onMouseUp=function(){Event.on(targetEl,'scroll',scrollTarget);scrollBar.thumbMouseUp();};scrollBar.thumb.onMouseDown=function(){Event.removeListener(targetEl,'scroll',scrollTarget);return scrollBar.focus();};if(mouseWheel){var DOMTarget,DOMEvent;if(Event.isIE){DOMTarget=document;DOMEvent='mousewheel';}else if(Event.isSafari){DOMTarget=window;DOMEvent='mousewheel';}else{DOMTarget=window;DOMEvent='DOMMouseScroll';}
Event.on(DOMTarget,DOMEvent,_handleMouseWheel,{'targetObj':scrollContainer,'scrollBar':scrollBar});}
return scrollBar;};var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang;var _handleMouseWheel=function(e,parms){var event=Event.getEvent(e);var eventTarget=Event.getTarget(e);var targetObj=parms.targetObj;var scrollBar=parms.scrollBar;var multiplier=15;var scrollOffset;if(Event.isIE){scrollOffset=120;}else if(Event.isSafari){scrollOffset=120;}else{scrollOffset=1;}
if(eventTarget===targetObj||Dom.isAncestor(targetObj,eventTarget)){Event.stopEvent(e);var wheelDelta=(event.wheelDelta?-(event.wheelDelta):event.detail)/scrollOffset;var scrollBy=Math.floor(wheelDelta*multiplier);if(scrollBy){scrollBar.scrollTargetBy(scrollBy);}}};SM.cart.UI.ScrollBar=ScrollBar;})();
var lightBoxImageID='';var lightBoxImageKey='';var lightBoxCaption=false;var lightBoxSize='Medium';var checkingLBSize=false;var lbImage=[];var lbLoaded=false;var prevLBPhoto='';var nextLBPhoto='';var canPrintLB='';var canPrintGuid='';var lightBoxFixed=false;var lightBoxShowDetails=false;var lightBoxAllowDetails=false;var lightBoxOriginalScrollTop=0;var lightBoxDetailsCurrentImageID='0';var lightBoxDetailsImageCurrentSize='';var lightBoxDetailsResizeListenerAdded=false;var lightBoxCurrentImageWidth=0;var lightBoxOriginalReqSize='';var lightBoxCommentsEnabled=false;var lightBoxExifEnabled=false;var lightBoxKeywordsEnabled=false;var lightBoxOpenDetailsSection='Comments';var lightBoxExifRequestComplete=false;var lightBoxOn=true;var newWin=null;function getCustomResizeSizes(targetWidth,targetHeight,baseWidth,baseHeight){var sizes={};var ratio=Math.min(baseWidth,baseHeight)/Math.max(baseWidth,baseHeight);if(baseHeight>=baseWidth){sizes.height=Math.min(targetWidth,targetHeight);sizes.width=Math.ceil(sizes.height*ratio);}else{sizes.width=Math.max(targetWidth,targetHeight);sizes.height=Math.ceil(sizes.width*ratio);}
return sizes;}
function getPerfectSize(lbImage){var reqSize='';var screenWidth=YD.getViewportWidth()-40;var screenHeight=YD.getViewportHeight()-40;var widthSize=0;var heightSize=0;var lbImageOWidth=lbImage.OriginalWidth;var lbImageOHeight=lbImage.OriginalHeight;var mediumSize=getCustomResizeSizes(600,450,lbImageOWidth,lbImageOHeight);var largeSize=getCustomResizeSizes(800,600,lbImageOWidth,lbImageOHeight);var xlargeSize=getCustomResizeSizes(1024,768,lbImageOWidth,lbImageOHeight);var x2largeSize=getCustomResizeSizes(1280,960,lbImageOWidth,lbImageOHeight);var x3largeSize=getCustomResizeSizes(1600,1200,lbImageOWidth,lbImageOHeight);if(screenWidth<=mediumSize.width-1){widthSize=1;}else if(screenWidth>=mediumSize.width&&screenWidth<=largeSize.width-1){widthSize=2;}else if(screenWidth>=largeSize.width&&screenWidth<=xlargeSize.width-1){widthSize=3;}else if(screenWidth>=xlargeSize.width&&screenWidth<=x2largeSize.width-1){widthSize=4;}else if(screenWidth>=x2largeSize.width&&screenWidth<=x3largeSize.width-1){widthSize=5;}else if(screenWidth>=x3largeSize.width){widthSize=6;}
if(screenHeight<=mediumSize.height-1){heightSize=1;}else if(screenHeight>=mediumSize.height&&screenHeight<=largeSize.height-1){heightSize=2;}else if(screenHeight>=largeSize.height&&screenHeight<=xlargeSize.height-1){heightSize=3;}else if(screenHeight>=xlargeSize.height&&screenHeight<=x2largeSize.height-1){heightSize=4;}else if(screenHeight>=x2largeSize.height&&screenHeight<=x3largeSize.height-1){heightSize=5;}else if(screenHeight>=x3largeSize.height){heightSize=6;}
var perfectSize=Math.min(heightSize,widthSize);switch(perfectSize){case 1:reqSize='Small';break;case 2:reqSize='Medium';break;case 3:reqSize='Large';break;case 4:reqSize='XLarge';break;case 5:reqSize='X2Large';break;case 6:reqSize='X3Large';break;}
return reqSize;}
function convertSizeNameToNumber(sizeName){switch(sizeName.toLowerCase()){case'small':return 1;case'medium':return 2;case'large':return 3;case'xlarge':return 4;case'x2large':return 5;case'x3large':return 6;case'original':return 7;default:return 2;}}
function resizeStage(){YD.setStyle('lightBoxStage','height',YD.getDocumentHeight()+'px');}
function prepLBOptions(ImageID,reqSize,setSize,ImageKey,options){var defaultOptions={'fixedTop':false,'allowDetails':false};var setOptions=YAHOO.lang.merge(defaultOptions,options);lightBoxImageID=ImageID;lightBoxImageKey=ImageKey;canPrintLB='';closePhotoBar();closeSmugPopular();if(lightBoxOn){var postArray=[];postArray.autoSize=false;if(reqSize===''){reqSize=SM.util.getCookie('lbSize');if(!reqSize){reqSize="Medium";}}
lightBoxOriginalReqSize=reqSize;if(setOptions.allowDetails||lightBoxAllowDetails){lightBoxAllowDetails=true;}
else{lightBoxAllowDetails=false;}
if(SM.util.getCookie('lightBoxComments')==1&&!lightBoxShowDetails&&lightBoxAllowDetails){lightBoxShowDetails=true;}
if(setSize){SM.util.setCookie('lbSize',setSize,365);}
if(reqSize.toLowerCase()=="auto"){postArray.autoSize=true;if(lightBoxShowDetails){reqSize=getLBDetailsImageSize(lbImage[ImageID]);lightBoxDetailsImageCurrentSize=reqSize;if(!lightBoxDetailsResizeListenerAdded){YE.addListener(window,'resize',resizeLBDetails);lightBoxDetailsResizeListenerAdded=true;}}
else{reqSize=getPerfectSize(lbImage[ImageID]);if(!checkingLBSize){checkingLBSize=true;YE.addListener(window,'resize',checkLBSize);}}}else{checkingLBSize=false;YE.removeListener(window,'resize',checkLBSize);if(lightBoxShowDetails){var lbCommentsSize=getLBDetailsImageSize(lbImage[ImageID]);if(convertSizeNameToNumber(reqSize)>convertSizeNameToNumber(lbCommentsSize)){reqSize=lbCommentsSize;}}
if(lightBoxDetailsResizeListenerAdded){YE.removeListener(window,'resize',resizeLBDetails);lightBoxDetailsResizeListenerAdded=false;}}
lightBoxSize=reqSize;if(useLightbox){YD.addClass(document.body,'masked');var lbStage=YD.get('lightBoxStage');YD.setStyle(lbStage,'zIndex',getZindex(document.body)+1);YD.setStyle(lbStage,'display','block');YD.setStyle(lbStage,'height',YD.getDocumentHeight()+'px');YE.on(window,'scroll',resizeStage);YE.on(window,'resize',resizeStage);if(setOptions.fixedTop||lightBoxFixed){lightBoxFixed=true;if(lightBoxOriginalScrollTop==0){lightBoxOriginalScrollTop=YD.getDocumentScrollTop();}
window.scrollTo('',0);}
else{lightBoxFixed=false;window.scrollTo('',0);}
var lbCaption=YD.get('lightBoxCaption');if(lbCaption&&lbCaption.offsetWidth){lightBoxCaption=true;}
YD.setStyle('lightBoxCaption','display','none');lbLoaded=false;YD.get('lightBoxNav').innerHTML="<span class='title'>loading</span>";lbLoading(0);document.onkeydown='';postArray.tool='lightBoxImage';postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;postArray.AlbumKey=AlbumKey;postArray.AlbumID=AlbumID;postArray.size=reqSize;postArray.pageType=pageType;postArray.pageTypeDetails=pageTypeDetails;postArray.pageScope=pageScope;postArray.pageDrawBy=pageDrawBy;if(typeof siteUser!=='undefined'){postArray.siteUser=siteUser;}
postArray.community=community;postArray.screenWidth=YD.getViewportWidth()-40-(lightBoxShowDetails?325:0);postArray.screenHeight=YD.getViewportHeight()-40-(lightBoxShowDetails?325:0);postArray.showDetails=lightBoxShowDetails;if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){postArray.ajaxNav=true;}else{postArray.ajaxNav='';}
ajax_query(prepLBimg,'/rpc/gallery.mg',postArray,true);}else if(popWidth!==''&&popHeight!==''){imagePopUp('/photos/popup.mg?ImageID='+ImageID+'&ImageKey='+ImageKey+'&Size='+reqSize+'&popUp=1','console',popWidth,popHeight);}}}
function prepLB(ImageID,reqSize,setSize,ImageKey){prepLBOptions(ImageID,reqSize,setSize,ImageKey,{})}
function openLBOptions(lbID,reqSize,setSize,options){var ImageKey='';var pieces=lbID.split('_');var ImageID=pieces[0];var defaultOptions={'fixedTop':false,'allowDetails':false};var setOptions=YAHOO.lang.merge(defaultOptions,options);if(pieces.length>1){ImageKey=pieces[1];}
if((reqSize=="Auto"||setOptions.allowDetails)&&!lbImage[ImageID]){var handleSuccess=function(o){if(o.responseText!==undefined){try{var returnedData=YAHOO.lang.JSON.parse(o.responseText);}
catch(x){return;}
for(var i in returnedData){lbImage[i]=returnedData[i];}
if(lbImage[ImageID].CloseLB){location.hash=ImageID+'_'+ImageKey;}else{prepLBOptions(ImageID,reqSize,setSize,ImageKey,setOptions);}}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};var postArray=[];postArray.push('ImageID='+ImageID);postArray.push('ImageKey='+ImageKey);postArray.push('Size=Original');postArray.push('tool=imageSize');var sUrl="/rpc/gallery.mg";var imageRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postArray.join('&'));}else{prepLBOptions(ImageID,reqSize,setSize,ImageKey,setOptions);}}
function openLB(lbID,reqSize,setSize){openLBOptions(lbID,reqSize,setSize,{});}
function checkLBSize(){var perfectSize=getPerfectSize(lbImage[lightBoxImageID]);if(lightBoxSize!=perfectSize){openLB(lightBoxImageID+'_'+lightBoxImageKey,'Auto');}}
function lbLoading(count){if(!lbLoaded){if(count<=3){var loading='';for(var i=1;i<=count;i++){loading+='.';}
if(count==3){count=0;}else{count++;}
YD.get('lightBoxNav').innerHTML="<span class='title'>loading "+loading+"</span>";var string='lbLoading('+count+');';setTimeout(string,500);}else{var lbNav=URLDecode(count);if(canPrintLB!==''){lbNav+='|&nbsp;<a href="javascript:addCartSingle('+canPrintLB+', \''+canPrintKey+'\');"><img src="/img/spacer.gif" alt="buy this photo" title="buy this photo" width="21" height="18" hspace="0" vspace="0" border="0" class="cart_add" /></a>';}
if(lightBoxAllowDetails){if(lightBoxShowDetails){lbNav+='<span id="lightBoxDetailsLink">|&nbsp;<a href="javascript: void(0);" onmouseup="hideLBDetails();" class="title">Hide Details</a>&nbsp;</span>';}
else{lbNav+='<span id="lightBoxDetailsLink">|&nbsp;<a href="javascript: void(0);" onmouseup="showLBDetails();" class="title">Show Details</a>&nbsp;</span>';}}
if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){lbNav+='|&nbsp;<a href="#'+lightBoxImageID+'_'+lightBoxImageKey+'" class="title">Close</a>';}else{lbNav+='|&nbsp;<a href="javascript:void(0);" onmouseup="closeLB(event);" class="title">Close</a>';}
YD.get('lightBoxNav').innerHTML=lbNav;lbLoaded=true;}}}
function swapPreLoad(lightBoxInfo){var newIMG=lightBoxInfo.newIMG;var Nav=lightBoxInfo.Nav;var newWidth=lightBoxInfo.newWidth;var newHeight=lightBoxInfo.newHeight;var caption=lightBoxInfo.caption;if(YD.get('lightBoxImage')){removeFromDOM('lightBoxImage');}
if(YD.get('smugMovieDiv')){smugPlayer.pause();var purgeObj=YD.get('smugMovieDiv');while(purgeObj.hasChildNodes()){purgeObj.removeChild(purgeObj.childNodes[0]);}
removeFromDOM('smugMovieDiv');}
var lightBoxPhoto=YD.get('lightBoxPhoto');document.onkeydown=lbNavigation;var lightBoxImage=document.createElement("img");lightBoxImage.setAttribute("id","lightBoxImage");if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){var preloadLBimageAnchor=document.createElement("a");preloadLBimageAnchor.setAttribute("href","#"+lightBoxImageID+'_'+lightBoxImageKey);lightBoxPhoto.appendChild(preloadLBimageAnchor);preloadLBimageAnchor.appendChild(lightBoxImage);}else{lightBoxPhoto.appendChild(lightBoxImage);YE.addListener(lightBoxImage,'mouseup',closeLB);}
YE.addListener(lightBoxImage,'mouseover',function(e){if(displaySmugPopular){if(!(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch'))||(photoInfo[lightBoxImageID]!==undefined&&photoInfo[lightBoxImageID].displayPopular!=='')){smugPopular(this.id,lightBoxImageID,lightBoxImageKey);}}});lightBoxImage.style.background="url("+newIMG+")";lightBoxImage.style.width=newWidth+"px";lightBoxImage.style.height=newHeight+"px";YE.removeListener(lightBoxImage,'load');YE.addListener(lightBoxImage,'load',function(){lbLoading(Nav);});lightBoxImage.className="protected";lightBoxImage.setAttribute("src","/img/spacer.gif");if(caption!==''&&lightBoxCaption){YD.setStyle('lightBoxCaption','display','block');YD.get('lightBoxCaption').innerHTML=caption;}
if(YD.get('preloadLBimage')){removeFromDOM('preloadLBimage');}
initializeLBDetails(lightBoxInfo);}
function prepLBimg(response){try{var lbInfo=YAHOO.lang.JSON.parse(response);}
catch(x){return;}
var newIMG=lbInfo.newIMG;var imageKey=lbInfo.ImageKey;var Nav=lbInfo.Nav;var newWidth=lbInfo.newWidth;var newHeight=lbInfo.newHeight;var protect=lbInfo.protect;var caption=lbInfo.caption;var showCart=lbInfo.showCart;lightBoxCurrentImageWidth=newWidth;prevLBPhoto=lbInfo.prevPhoto;nextLBPhoto=lbInfo.nextPhoto;if(lightBoxShowDetails&&lightBoxImageID!=lightBoxDetailsCurrentImageID){SM.Comments.Views['lightBoxComments'].clearComments();}
if(showCart){canPrintLB=lbInfo.ImageID;canPrintKey=lbInfo.ImageKey;}
if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){loadedImageRPC(lbInfo.ImageID,lbInfo.Size,imageKey);}
var lightBoxPhoto=YD.get('lightBoxPhoto');if(!lbInfo.isMovie){if(!Yua.webkit&&protect){var preloadLBimage=document.createElement("img");preloadLBimage.setAttribute("id","preloadLBimage");lightBoxPhoto.appendChild(preloadLBimage);preloadLBimage.style.width="10px";preloadLBimage.style.height="10px";preloadLBimage.style.position="absolute";preloadLBimage.style.zIndex="1000000";preloadLBimage.style.visibility="hidden";YE.on(preloadLBimage,'load',function(){swapPreLoad(lbInfo);});preloadLBimage.setAttribute("src",newIMG);}else{if(YD.get('lightBoxImage')){removeFromDOM('lightBoxImage');}
if(YD.get('smugMovieDiv')){smugPlayer.pause();var purgeObj=YD.get('smugMovieDiv');while(purgeObj.hasChildNodes()){purgeObj.removeChild(purgeObj.childNodes[0]);}
removeFromDOM('smugMovieDiv');}
document.onkeydown=lbNavigation;var lightBoxImage=document.createElement("img");lightBoxImage.setAttribute("id","lightBoxImage");YE.addListener(lightBoxImage,'mouseover',function(e){if(displaySmugPopular){if(!(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch'))||(photoInfo[lightBoxImageID]!==undefined&&photoInfo[lightBoxImageID].displayPopular!=='')){smugPopular(this.id,lightBoxImageID,lightBoxImageKey);}}});YE.removeListener(lightBoxImage,'load');YE.addListener(lightBoxImage,'load',function(){lbLoading(Nav);});lightBoxImage.style.width=newWidth+"px";lightBoxImage.style.height=newHeight+"px";if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){var preloadLBimageAnchor=document.createElement("a");preloadLBimageAnchor.setAttribute("href","#"+lightBoxImageID+'_'+lightBoxImageKey);lightBoxPhoto.appendChild(preloadLBimageAnchor);preloadLBimageAnchor.appendChild(lightBoxImage);}else{lightBoxPhoto.appendChild(lightBoxImage);YE.addListener(lightBoxImage,'mouseup',closeLB);}
if(!Yua.webkit){lightBoxImage.setAttribute("src",newIMG);}else{if(protect){lightBoxImage.style.background="url("+newIMG+")";lightBoxImage.className="protected";lightBoxImage.setAttribute("src","/img/spacer.gif");}else{lightBoxImage.setAttribute("src",newIMG);}}
if(caption!==''&&lightBoxCaption){YD.setStyle('lightBoxCaption','display','block');YD.get('lightBoxCaption').innerHTML=caption;}
initializeLBDetails(lbInfo);}
var tempStyle=YD.getStyle('lightBoxPhoto','display');YD.setStyle('lightBoxPhoto','display','inline');YD.setStyle('lightBoxPhoto','display',tempStyle);}
else{var lightBoxPhoto=YD.get('lightBoxPhoto');document.onkeydown=lbNavigation;if(YD.get('lightBoxImage')){removeFromDOM('lightBoxImage');}
if(YD.get('smugMovieDiv')){smugPlayer.pause();var purgeObj=YD.get('smugMovieDiv');while(purgeObj.hasChildNodes()){purgeObj.removeChild(purgeObj.childNodes[0]);}
removeFromDOM('smugMovieDiv');}
var smugMovieDiv=document.createElement("div");smugMovieDiv.id='smugMovieDiv';lightBoxPhoto.appendChild(smugMovieDiv);lightBoxCurrentImageWidth=parseInt(lbInfo.movieWidth);smugPlayer=new SM.flash.Video('smugMovieDiv','',{'videoKey':lbInfo.ImageKey,'videoId':lbInfo.ImageID,'width':lbInfo.movieWidth,'height':lbInfo.movieHeight,'format':lbInfo.format,'src':lbInfo.movieSrc,'albumId':lbInfo.AlbumID,'albumKey':lbInfo.AlbumKey,'share':lbInfo.share,'protected':lbInfo.protect,'owner':lbInfo.owner});YD.removeClass(smugMovieDiv,'qtMovie');lbLoading(Nav);if(caption!=""&&lightBoxCaption==true){YD.setStyle('lightBoxCaption','display','block');YD.get('lightBoxCaption').innerHTML=caption;}
initializeLBDetails(lbInfo);}}
function closeLB(e){if(!e){e=window.event;}
if(e&&e.button==2){return true;}
if(YD.get('lightBoxImage')){removeFromDOM('lightBoxImage');}else if(YD.get('smugMovieDiv')){smugPlayer.pause();var purgeObj=YD.get('smugMovieDiv');while(purgeObj.hasChildNodes()){purgeObj.removeChild(purgeObj.childNodes[0]);}
removeFromDOM('smugMovieDiv');}else{return true;}
removeFromDOM('smugPopular');removeFromDOM('smugPopularContent');closeSmugPopular();checkingLBSize=false;YE.removeListener(window,'resize',checkLBSize);YE.removeListener(document,'mousemove',watchMouseOverPhoto);YD.get('lightBoxCaption').innerHTML='';document.onkeydown='';YD.setStyle('lightBoxStage','display','none');YE.removeListener(window,'scroll',resizeStage);YE.removeListener(window,'resize',resizeStage);YD.removeClass(document.body,'masked');if(!lightBoxFixed){scroll(0,1);scroll(0,-1);}
else{scroll(0,lightBoxOriginalScrollTop);}
if(lightBoxShowDetails){var lightBoxPhotoCaption=YD.get('lightBoxPhotoCaption');YD.setStyle('lightBoxDetails','display','none');if(YD.hasClass(lightBoxPhotoCaption,'show_details')){YD.removeClass(lightBoxPhotoCaption,'show_details')}
YE.removeListener(window,'resize',resizeLBDetails);lightBoxDetailsResizeListenerAdded=false;}
lightBoxDetailsImageCurrentSize='';lightBoxFixed=false;lightBoxOriginalScrollTop=0;photoHovering=false;lightBoxCurrentImageWidth=0;if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){removeFromDOM('photoBar');removeFromDOM('photoBarContent');YE.removeListener(document,'mousemove',watchPhotoBar);}
lightBoxImageID='';lightBoxImageKey='';lightBoxSize='';}
var closeLightBox=closeLB;function lbNavigation(e){if(!e){e=window.event;}
var whichPhoto;if(e.keyCode==37){whichPhoto=prevLBPhoto;}else if(e.keyCode==39){whichPhoto=nextLBPhoto;}else{return true;}
if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){if(whichPhoto){var reqSize=getHash().split('-')[1];var breakDown=whichPhoto.split(',');var thisHash=breakDown[0].split('(')[1].replace(/\'/g,'')+'-'+reqSize+'-'+'LB';location.hash=thisHash;SM.history.add(thisHash);}}else{eval(whichPhoto);}
return false;}
function imagePopUp(strURL,strType,strWidth,strHeight){var windowWidth,windowHeight;if(parseInt(parseInt(strWidth,10)+50,10)>=YD.getViewportWidth()){windowWidth=YD.getViewportWidth();}else{windowWidth=parseInt(parseInt(strWidth,10)+50,10);}
if(parseInt(parseInt(strHeight,10)+50,10)>=YD.getViewportHeight()){windowHeight=YD.getViewportHeight();}else{windowHeight=parseInt(parseInt(strHeight,10)+50,10);}
if(newWin!==null&&!newWin.closed){newWin.close();}
var strOptions='top='+((self.screen.height-windowHeight)/2)+', left='+((self.screen.width-windowWidth)/2)+',';if(strType=='console'){strOptions+='resizable, scrollbars, height='+windowHeight+', width='+windowWidth;}
if(strType=='fixed'){strOptions+='status, height='+windowHeight+', width='+windowWidth;}
if(strType=='elastic'){strOptions+='toolbar, menubar, scrollbars, resizable, location, height='+windowHeight+', width='+windowWidth;}
newWin=window.open(strURL,'newWin',strOptions);if(!newWin||typeof(newWin)==='undefined'){if(window.location.href.split("#")[1].indexOf('-LB')>-1){var hash=window.location.href.split("#")[1];location.replace(window.location.href.split("#")[0]+'#'+hash.split("-")[0]);}}else{newWin.focus();}}
function getLBDetailsImageSize(imageSizeInfo){var containerWidth=YD.getViewportWidth();var containerHeight=YD.getViewportHeight()-40;var imageOWidth=imageSizeInfo.OriginalWidth;var imageOHeight=imageSizeInfo.OriginalHeight;var portraitImage=(imageOHeight>imageOWidth)?true:false;var mediumSize=getCustomResizeSizes(600,450,imageOWidth,imageOHeight);var largeSize=getCustomResizeSizes(800,600,imageOWidth,imageOHeight);var xlargeSize=getCustomResizeSizes(1024,768,imageOWidth,imageOHeight);var x2largeSize=getCustomResizeSizes(1280,960,imageOWidth,imageOHeight);var x3largeSize=getCustomResizeSizes(1600,1200,imageOWidth,imageOHeight);if(portraitImage){if(containerHeight<=mediumSize.height-1){return'Small';}
else if(containerHeight>=mediumSize.height&&containerHeight<=largeSize.height-1){return'Medium';}
else if(containerHeight>=largeSize.height&&containerHeight<=xlargeSize.height-1){return'Large';}
else if(containerHeight>=xlargeSize.height&&containerHeight<=x2largeSize.height-1){return'XLarge';}
else if(containerHeight>=x2largeSize.height&&containerHeight<=x3largeSize.height-1){return'X2Large';}
else if(containerHeight>=x3largeSize.height){return'X3Large';}}
else{var minCommentsWidth=350;if(containerWidth>=minCommentsWidth+x3largeSize.width){return'X3Large';}
else if(containerWidth>=minCommentsWidth+x2largeSize.width){return'X2Large';}
else if(containerWidth>=minCommentsWidth+xlargeSize.width){return'XLarge';}
else if(containerWidth>=minCommentsWidth+largeSize.width){return'Large';}
else if(containerWidth>=minCommentsWidth+mediumSize.width){return'Medium';}
else{return'Small';}}}
function showLBDetails(){lightBoxShowDetails=true;SM.util.setCookie('lightBoxComments',1,1);prepLBOptions(lightBoxImageID,lightBoxOriginalReqSize,null,lightBoxImageKey,{'allowDetails':true});}
function resizeLBDetails(){var newLBDetailsImageSize=getLBDetailsImageSize(lbImage[lightBoxImageID]);if(lightBoxDetailsImageCurrentSize!=newLBDetailsImageSize){prepLBOptions(lightBoxImageID,lightBoxOriginalReqSize,null,lightBoxImageKey,{'allowDetails':true});}
else{initializeLBDetailsElements();}}
function hideLBDetails(){if(lightBoxShowDetails){var lightBoxPhotoCaption=YD.get('lightBoxPhotoCaption');lightBoxShowDetails=false;YD.setStyle('lightBoxDetails','display','none');if(YD.hasClass(lightBoxPhotoCaption,'show_details')){YD.removeClass(lightBoxPhotoCaption,'show_details')}
YD.setStyle(lightBoxPhotoCaption,'width','auto');YD.setStyle('lightBoxCaption','width','500px');YD.setStyle('lightBoxMain','width','auto');SM.util.setCookie('lightBoxComments',0,1);YE.removeListener(window,'resize',resizeLBDetails);lightBoxDetailsResizeListenerAdded=false;prepLBOptions(lightBoxImageID,lightBoxOriginalReqSize,null,lightBoxImageKey,{'allowDetails':true});}}
function initializeLBDetails(lbInfo){if(lightBoxShowDetails){initializeLBDetailsElements();if(lightBoxDetailsCurrentImageID!=lightBoxImageID){lightBoxCommentsEnabled=false;lightBoxExifEnabled=false;lightBoxKeywordsEnabled=false;lbDrawKeywords(lbInfo);lbDrawExif();lbDrawComments(lbInfo);lbShowDefaultDetailsSection();lightBoxDetailsCurrentImageID=lightBoxImageID;}}}
function lbShowDefaultDetailsSection(){if(lightBoxExifRequestComplete){if(lightBoxCommentsEnabled&&lightBoxOpenDetailsSection=='Comments'){lbToggleDetails('Comments','lightBoxCommentsLink',{});return;}
lightBoxOpenDetailsSection=lightBoxOpenDetailsSection=='Comments'?'Exif':lightBoxOpenDetailsSection;if(lightBoxExifEnabled&&lightBoxOpenDetailsSection=='Exif'){lbToggleDetails('Exif','lightBoxExifLink',{});return;}
lightBoxOpenDetailsSection=lightBoxOpenDetailsSection=='Exif'?'Keywords':lightBoxOpenDetailsSection;if(lightBoxKeywordsEnabled&&lightBoxOpenDetailsSection=='Keywords'){lbToggleDetails('Keywords','lightBoxKeywordsLink',{});}}}
function lbEnableDetailsFeature(type){switch(type){case'Comments':lightBoxCommentsEnabled=true;featureElements=Sizzle('#lightBoxDetails .feature_comments');break;case'Exif':lightBoxExifEnabled=true;featureElements=Sizzle('#lightBoxDetails .feature_exif');break;case'Keywords':lightBoxKeywordsEnabled=true;featureElements=Sizzle('#lightBoxDetails .feature_keywords');break;}
YD.setStyle(featureElements,'display','');}
function lbDisableDetailsFeature(type){var featureElements;switch(type){case'Comments':lightBoxCommentsEnabled=false;featureElements=Sizzle('#lightBoxDetails .feature_comments');break;case'Exif':lightBoxExifEnabled=false;featureElements=Sizzle('#lightBoxDetails .feature_exif');break;case'Keywords':lightBoxKeywordsEnabled=false;featureElements=Sizzle('#lightBoxDetails .feature_keywords');break;}
YD.setStyle(featureElements,'display','none');}
function lbDrawComments(lbInfo){if(lbInfo.allowComments){lbEnableDetailsFeature('Comments');SM.Comments.Views['lightBoxComments'].setCommentType('Image',lightBoxImageID,lightBoxImageKey);SM.Comments.Views['lightBoxComments'].getComments(1);}
else{lbDisableDetailsFeature('Comments');}}
function lbDrawKeywords(lbInfo){var keywordsContainer=YD.get('lightBoxKeywords');keywordsContainer.innerHTML='';if(lbInfo.keywords.showKeywords){if(lbInfo.keywords.keywords.length>0){keywordsContainer.innerHTML=lbInfo.keywords.keywords;}
else{keywordsContainer.innerHTML='no keywords';}}
else{keywordsContainer.innerHTML='no keywords';}
lbEnableDetailsFeature('Keywords');}
function lbDrawExif(){var postArray=[];var postData="method=getExif";var url="/rpc/image.mg";lightBoxExifRequestComplete=false;var handleSuccess=function(response){try{var exif=YAHOO.lang.JSON.parse(response.responseText);}
catch(err){return;}
if(exif.result){var i,basicHTML='',detailedHTML='';var basicProperties=exif.result.basic;var detailedProperties=exif.result.detailed;var exifHtml=[];if(basicProperties.fileName){exifHtml.push('<div class="exif_title">');exifHtml.push(basicProperties.fileName.friendlyValue);exifHtml.push('</div>');}
exifHtml.push('<div class="exif_basic">');exifHtml.push('<table width="100%" cellpadding="2" cellspacing="0">');exifHtml.push('<tr>');exifHtml.push('<td valign="top" align="right" width="110">Date Taken:</td>');exifHtml.push('<td valign="top">'+(basicProperties.DateTimeOriginal?basicProperties.DateTimeOriginal.friendlyValue:'n/a')+'</td>');exifHtml.push('</tr>');exifHtml.push('<tr>');exifHtml.push('<td valign="top" align="right" width="110">Camera:</td>');exifHtml.push('<td valign="top">'+(basicProperties.Camera?basicProperties.Camera.friendlyValue:'n/a')+'</td>');exifHtml.push('</tr>');exifHtml.push('<tr>');exifHtml.push('<td valign="top" align="right" width="110">Exposure Time:</td>');exifHtml.push('<td valign="top">'+(basicProperties.ExposureTime?basicProperties.ExposureTime.friendlyValue:'n/a')+'</td>');exifHtml.push('</tr>');exifHtml.push('<tr>');exifHtml.push('<td valign="top" align="right" width="110">Aperture:</td>');exifHtml.push('<td valign="top">'+(basicProperties.Aperture?basicProperties.Aperture.friendlyValue:'n/a')+'</td>');exifHtml.push('</tr>');exifHtml.push('<tr>');exifHtml.push('<td valign="top" align="right" width="110">ISO:</td>');exifHtml.push('<td valign="top">'+(basicProperties.ISO?basicProperties.ISO.friendlyValue:'n/a')+'</td>');exifHtml.push('</tr>');exifHtml.push('<tr>');exifHtml.push('<td valign="top" align="right" width="110">Focal Length:</td>');exifHtml.push('<td valign="top">'+(basicProperties.FocalLength?basicProperties.FocalLength.friendlyValue:'n/a')+'</td>');exifHtml.push('</tr>');exifHtml.push('</table>');exifHtml.push('</div>');exifHtml.push('<div class="exif_detailed">');exifHtml.push('<table width="100%" cellpadding="2" cellspacing="0">');for(i in basicProperties){if(i!='DateTimeOriginal'&&i!='Camera'&&i!='fileName'&&i!='ExposureTime'&&i!='Aperture'&&i!='ISO'&&i!='FocalLength'){exifHtml.push('<tr><td valign="top" align="right" width="115">'+basicProperties[i].friendlyName+':</td><td valign="top">'+basicProperties[i].friendlyValue+'</td></tr>');}}
for(i in detailedProperties){if(i!='DateTimeOriginal'&&i!='Camera'&&i!='fileName'&&i!='ExposureTime'&&i!='Aperture'&&i!='ISO'&&i!='FocalLength'){exifHtml.push('<tr><td valign="top" align="right" width="115">'+detailedProperties[i].friendlyName+':</td><td valign="top">'+detailedProperties[i].friendlyValue+'</td></tr>');}}
exifHtml.push('</table>');exifHtml.push('</div>');if(exifHtml.length>0){lbEnableDetailsFeature('Exif');YD.get('lightBoxExif').innerHTML=exifHtml.join('');}
else{lbDisableDetailsFeature('Exif');YD.get('lightBoxExif').innerHTML='';}}
else{lbDisableDetailsFeature('Exif');YD.get('lightBoxExif').innerHTML='';}
lightBoxExifRequestComplete=true;lbShowDefaultDetailsSection();};var handleFailure=function(response){lightBoxExifRequestComplete=true;lbDisableDetailsFeature('Exif');lbShowDefaultDetailsSection();YD.get('lightBoxExif').innerHTML='Failed to retrieve photo information';};var callback={'success':handleSuccess,'failure':handleFailure,'scope':this};postArray.imageId=lightBoxImageID;postArray.imageKey=lightBoxImageKey;for(var i in postArray){postData+="&"+i+"="+postArray[i];}
var rpc=YAHOO.util.Connect.asyncRequest('POST',url,callback,postData);}
function initializeLBDetailsElements(){var containerWidth=parseInt(YD.getViewportWidth());var imageWidth=parseInt(lightBoxCurrentImageWidth);var imageContainerWidth=0;var commentsWidth=0;var imagePadding=10;var commentsPadding=8;var commentsSpaceAvailable=0;var totalWidth=0;var lightBoxComments=YD.get('lightBoxDetails');var lightBoxPhotoCaption=YD.get('lightBoxPhotoCaption');if(!YD.hasClass(lightBoxPhotoCaption,'show_details')){YD.addClass(lightBoxPhotoCaption,'show_details')}
containerWidth=containerWidth-40;imageContainerWidth=imageWidth+imagePadding;commentsWidth=containerWidth-imageContainerWidth-commentsPadding;if(commentsWidth>600){commentsWidth=600;}
totalWidth=imageContainerWidth+commentsWidth+commentsPadding;YD.setStyle(lightBoxComments,'display','block');YD.setStyle('lightBoxCaption','width',(imageWidth-20)+'px');YD.setStyle(lightBoxPhotoCaption,'width',imageContainerWidth+'px');YD.setStyle(lightBoxComments,'width',commentsWidth+'px');YD.setStyle('lightBoxMain','width',totalWidth+'px');}
function lbToggleDetails(type,target,e){YAHOO.util.Event.preventDefault(e);var links=Sizzle('.lightbox_details_link');var sections=Sizzle('.lightbox_details_section');var section;lightBoxOpenDetailsSection=type;for(var i=0;i<links.length;i++){YD.removeClass(links[i],'title');}
for(var i=0;i<sections.length;i++){YD.setStyle(sections[i],'display','none');}
switch(type){case'Comments':section=Sizzle('#lightBoxDetails .comments_container');break;case'Exif':section=Sizzle('#lightBoxDetails .exif_container');break;case'Keywords':section=Sizzle('#lightBoxDetails .keywords_container');break;}
YD.addClass(target,'title');YD.setStyle(section,'display','block');}
var totalComments=0;var totalRating=0;var commentOn=0;var commentPageOn=1;var commentsPerPage=10;var closeMe='';function submitTitle(AlbumID,AlbumKey){pageWorking('Saving Gallery Title');var postArray=[];postArray.tool='editTitle';postArray.AlbumID=AlbumID;postArray.AlbumKey=AlbumKey;postArray.Title=YD.get('newTitle').value;ajax_query(editTitleRPCResult,'/rpc/gallery.mg',postArray,true);}
function editTitleRPCResult(response){try{var returnedData=YAHOO.lang.JSON.parse(response);}
catch(x){return;}
YD.get('albumTitle').innerHTML=returnedData.Title+" <a href=\"javascript:toggleDIV('editTitle','albumTitle', 'inline');\" class=\"copy\">edit<\/a> ";toggleDIV('albumTitle','editTitle','inline');removePageWorking();}
function renumberGallery(AlbumID,AlbumKey,ImageIDs,startPosition){pageWorking('Saving Positions');var postArray=[];postArray.tool='renumberGallery';postArray.AlbumID=AlbumID;postArray.AlbumKey=AlbumKey;postArray.ImageIDs=ImageIDs.join(",");postArray.startPosition=startPosition;ajax_query(removePageWorking,'/rpc/gallery.mg',postArray,true);}
function submitDescription(AlbumID,AlbumKey){pageWorking('Saving Gallery Desc.');var postArray=[];postArray.tool='editDescription';postArray.AlbumID=AlbumID;postArray.AlbumKey=AlbumKey;postArray.Description=YD.get('newDescription').value;ajax_query(editDescriptionRPCResult,'/rpc/gallery.mg',postArray,true);}
function editDescriptionRPCResult(response){try{var returnedData=YAHOO.lang.JSON.parse(response);}
catch(x){return;}
YD.get('albumDescription').innerHTML=returnedData.Description+" <a href=\"javascript:toggleDIV('editDescription','albumDescription', 'block');\">edit<\/a> ";toggleDIV('albumDescription','editDescription','block');if(galleryStyle==="filmstrip"){move4IE(0);}
removePageWorking();}
function submitCaption(ImageID,ImageKey,Caption){pageWorking('Saving Caption');var postArray=[];postArray.tool='editCaption';postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;postArray.Caption=Caption;ajax_query(editCaptionRPCDone,'/rpc/gallery.mg',postArray,true);}
function editCaptionRPCDone(response){try{var returnedData=YAHOO.lang.JSON.parse(response);}
catch(x){return;}
var displayCaption=returnedData.displayCaption;var editCaption=returnedData.editCaption;var altCaption=returnedData.altCaption;var imageId=returnedData.imageId;var editText=displayCaption===''?'add caption':'edit';if(YD.hasClass(document.body,'smugmug_ajax')){photoInfo[imageId].caption=displayCaption;photoInfo[imageId].editCaption=editCaption;photoInfo[imageId].altCaption=altCaption;updateCaption();}else{var captions=galleryStyle==='journal'?YD.get('caption'+imageId):YD.getElementsByClassName('caption','div','bodyWrapper');var journalId=galleryStyle==='journal'?imageId:'';if(captions){YD.batch(captions,function(caption){caption.innerHTML=displayCaption+" <a href=\"javascript:toggleDIV('editCaption"+journalId+"', 'caption"+journalId+"', 'block');\">"+editText+"<\/a>";var editBox=YD.getNextSibling(caption)
if(editBox&&YD.getStyle(editBox,'display')==='block'){YD.setStyle(caption,'display','block');YD.setStyle(editBox,'display','none');}});}}
removePageWorking();}
function submitKeywords(ImageID,ImageKey,Keywords){pageWorking('Saving Keywords');var postArray=[];postArray.tool='editKeywords';postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;postArray.Keywords=Keywords;ajax_query(editKeywordsRPCDone,'/rpc/gallery.mg',postArray,true);}
function editKeywordsRPCDone(response){try{var returnedData=YAHOO.lang.JSON.parse(response);}
catch(x){return;}
var newKeywords=returnedData.newKeywords;var textAreaKeywords=returnedData.textAreaKeywords;if(newKeywords==='dontShow'){YD.get('photoKeywords').innerHTML="";}else if(newKeywords!==""){YD.get('photoKeywords').innerHTML="<span class=\"title\">keywords:<\/span> "+newKeywords+" &#183; <a href=\"javascript:toggleDIV('editKeywords','photoKeywords','block');\">edit<\/a>";}else{YD.get('photoKeywords').innerHTML="<span class=\"title\">keywords:<\/span> <a href=\"javascript:toggleDIV('editKeywords','photoKeywords', 'block');\">add<\/a>";}
YD.get('newKeywords').value=textAreaKeywords;if(YD.hasClass(document.body,'smugmug_ajax')){if(newKeywords==='dontShow'){newKeywords='';}
photoInfo[ImageID].keywords=newKeywords;photoInfo[ImageID].editKeywords=textAreaKeywords;}
toggleDIV('photoKeywords','editKeywords','block');removePageWorking();}
function changeGalleryComments(){if(showGalleryComments===true){showGalleryComments=false;SM.util.setCookie('showGalleryComments','false',365);YD.get('showGalleryComments').innerHTML='gallery comments hidden';}else{showGalleryComments=true;SM.util.setCookie('showGalleryComments','true',-365);YD.get('showGalleryComments').innerHTML='hide gallery comments';}
showCommentPage(1);}
function approveComment(CommentID,Type,TypeID,TypeKey){pageWorking('Approving Comment');var postArray=[];postArray.tool='approveComment';postArray.CommentID=CommentID;postArray.Type=Type;postArray.TypeID=TypeID;postArray.TypeKey=TypeKey;ajax_query(handleJS,'/rpc/gallery.mg',postArray,true);}
function deleteComment(CommentID,Type,TypeID,TypeKey){pageWorking('Deleting Comment');var postArray=[];postArray.tool='deleteComment';postArray.CommentID=CommentID;postArray.Type=Type;postArray.TypeID=TypeID;postArray.TypeKey=TypeKey;ajax_query(handleJS,'/rpc/gallery.mg',postArray,true);}
function showCommentPage(newPage){newPage=parseInt(newPage,10);if(isNaN(newPage)){commentPageOn=1;}else{commentPageOn=newPage;}
var postArray=[];if(YD.hasClass(document.body,'traditional')||YD.hasClass(document.body,'slideshow')||YD.hasClass(document.body,'allthumbs')||YD.hasClass(document.body,'journal')||YD.hasClass(document.body,'journal_new')||YD.hasClass(document.body,'allthumbs_stretch')){postArray.Type='Album';postArray.TypeID=AlbumID;postArray.TypeKey=AlbumKey;}else{postArray.Type='Image';postArray.TypeID=ImageID;postArray.TypeKey=ImageKey;}
if(YD.inDocument('commentType')){postArray.alsoGetAlbum='true';}else{postArray.alsoGetAlbum='false';}
postArray.tool='getComments';ajax_query(drawCommentsRPCResult,'/rpc/gallery.mg',postArray,true);}
function submitComment(Type,TypeID,TypeKey){var postArray=[];postArray.tool='addComment';var submitThis=true;var commentType=YD.get('commentType');if(commentType){postArray.captchaType='Combined';if(commentType.value==='Image'){postArray.Type='Image';postArray.TypeID=ImageID;postArray.TypeKey=ImageKey;}else if(commentType.value==='Album'){postArray.Type='Album';postArray.TypeID=AlbumID;postArray.TypeKey=AlbumKey;}else{submitThis=false;alert("You must choose to either comment on the gallery or photo.");}}else{postArray.captchaType=Type;postArray.Type=Type;postArray.TypeID=TypeID;postArray.TypeKey=TypeKey;}
if(!YD.inDocument('noCaptchaNeeded')){postArray.Captcha=YD.get('AlbumCaptcha').value;}
postArray.Rating=YD.get('albumCommentRating').value;postArray.Comment=YD.get('albumComment').value;if(YD.inDocument('albumCommentName')){postArray.Name=YD.get('albumCommentName').value;}
if(YD.inDocument('albumCommentEmail')){postArray.Email=YD.get('albumCommentEmail').value;}
if(YD.inDocument('albumCommentLink')){postArray.Link=YD.get('albumCommentLink').value;}
if(YD.inDocument('ServiceID')){postArray.ServiceID=YD.get('ServiceID').value;}
if(YD.inDocument('SocialID')){postArray.SocialID=YD.get('SocialID').value;}
if(SM.util.trimString(postArray.Comment)===''){alert('You can not leave an empty comment.');}else if(submitThis===true){pageWorking('Submitting Comment');ajax_query(handleJS,'/rpc/gallery.mg',postArray,true);}}
function redoCaptcha(Type,error){if(error==='true'){if(YD.inDocument('commentType')){Type='Album';}
YD.get(Type+'CaptchaConfirm').className="title alert";YD.get(Type+'Captcha').value="try again";alert("Whoops, the spam-foiling code didn't match.  Please try again.");}
if(YD.inDocument('commentType')){document.images.AlbumCaptchaSource.src="/photos/captcha.mg?width=100&height=25&Type=Combined&randomBits="+randomString(8);}else{document.images[Type+'CaptchaSource'].src="/photos/captcha.mg?width=100&height=25&Type="+Type+"&randomBits="+randomString(8);}
removePageWorking();}
function commentApprovedResult(Type,TypeID,TypeKey){removePageWorking();if(YD.inDocument('commentApproval')&&YD.getStyle('commentApproval','display')!=="none"){pageWorking('Awaiting Approval');}
if(YD.inDocument('commentType')){Type='Album';}
if(!YD.inDocument('noCaptchaNeeded')){YD.get(Type+'CaptchaConfirm').className="title";YD.get(Type+'Captcha').value='';}
if(YD.hasClass(document.body,'critique')){var postArray=[];postArray.Type='Image';postArray.TypeID=ImageID;postArray.TypeKey=ImageKey;postArray.alsoGetAlbum='';postArray.tool='getCommentSummary';ajax_query(handleJS,'/rpc/gallery.mg',postArray,true);}
if(Type==='Image'&&!YD.inDocument('commentType')){if(YD.inDocument('imageCommentName')){YD.get('imageCommentName').value='';}
if(YD.inDocument('imageCommentLink')){YD.get('imageCommentLink').value='';}
YD.get('imageComment').value='';toggleDIV('imageCommentSummary','addImageComment','inline');}else{if(YD.inDocument('albumCommentName')){}
if(YD.inDocument('albumCommentLink')){}
YD.get('albumComment').value='';toggleDIV('toggleAlbumComment','addAlbumComment','inline');}
showCommentPage('');}
function drawCommentsSummaryRPCResult(totalComments,totalRating,Type){if(YD.inDocument('rating')){var output='';var imageRating=Math.floor(totalRating);if(imageRating>0){output="";for(var i=0;i<imageRating;i++){output+='<img src="/img/spacer.gif" alt="star" title="star" width="25" height="25" hspace="0" vspace="0" border="0" class="bigStarSolid" />';}
for(var i=5;i>imageRating;i--){output+='<img src="/img/spacer.gif" alt="star" title="star" width="25" height="25" hspace="0" vspace="0" border="0" class="bigStarTrans" />';}}
YD.get('rating').innerHTML=output;}}
var showGalleryComments=true;var commentsDrawing=false;function drawCommentsRPCResult(response){removePageWorking();if(!commentsDrawing){try{var returnedData=YAHOO.lang.JSON.parse(response);}
catch(x){return;}
var comments=[];for(var i in returnedData){comments[comments.length]=returnedData[i];}
commentsDrawing=true;var str=[];var ct='<div class="box {0}"><div class="boxTop nav"><div class="boxNote">{1}{2}{3}{4}{5}</div><span class="foreground">{6}. </span>{7}{8} wrote about this<span class="title"> {9} </span>{10}<span class="title">{11}</span><div class="spacer"></div></div><div class="boxBottom">{12}<p class="foreground">{13}</p><div class="spacer"></div></div></div></div>';var output='no photo comments';if(comments!==undefined){var hideGalleryCommentsBox=true;var imageCommentCount=0;var showCommentStart=(commentPageOn-1)*commentsPerPage;var showCommentStop=showCommentStart+commentsPerPage;if(showCommentStop>comments.length){showCommentStop=comments.length;}
var commentCount,loopCounter=0;var CommentID,poster,nofollow,Rating,Comment,commentDate,Status,thisCommentType,thisCommentTypeID,thisCommentTypeKey,userImage,confirmedUser,commentOwner;var flipFlop,approveLink,deleteLink,slashDivider,smallFullStar,smallTranStar,posterLink,userLink,commentType,yearOn,userPhoto;for(var commentCount=0;commentCount<comments.length;commentCount++){CommentID=comments[commentCount].CommentID;poster=comments[commentCount].poster;nofollow=comments[commentCount].nofollow;Rating=comments[commentCount].Rating;Comment=comments[commentCount].Comment;commentDate=comments[commentCount].commentDate;Status=comments[commentCount].Status;thisCommentType=comments[commentCount].thisCommentType;thisCommentTypeID=comments[commentCount].thisCommentTypeID;thisCommentTypeKey=comments[commentCount].thisCommentTypeKey;userImage=comments[commentCount].userImage;confirmedUser=comments[commentCount].confirmedUser;commentOwner=comments[commentCount].commentOwner;if((showGalleryComments===true||(showGalleryComments!==true&&thisCommentType!=='Album'))&&showCommentStart<showCommentStop){if(loopCounter<(commentPageOn-1)*commentsPerPage){loopCounter++;}else{showCommentStart++;if(showCommentStart%2===1){flipFlop='odd';}else{flipFlop='even';}
approveLink='';deleteLink='';if(commentOwner===true){if(Status==='Pending'){approveLink='<a class="alert" href="javascript:approveComment('+CommentID+',\''+thisCommentType+'\',\''+thisCommentTypeID+'\',\''+thisCommentTypeKey+'\');">approve</a><span>&nbsp;&#183;&nbsp</span>';}
deleteLink='<a class="alert" href="javascript:deleteComment('+CommentID+',\''+thisCommentType+'\',\''+thisCommentTypeID+'\',\''+thisCommentTypeKey+'\');">delete</a>';}
slashDivider='';smallFullStar='';smallTranStar='';if(Rating!==0){if(commentOwner===true){slashDivider=' | ';}
for(var i=0;i<Rating;i++){smallFullStar+='<img class="star" src="/img/spacer.gif">';}
for(var i=5;i>Rating;i--){smallTranStar+='<img class="starTrans" src="/img/spacer.gif">';}}
posterLink='';userLink='';if(confirmedUser){posterLink=poster.split('"')[1];userLink='<a href="'+posterLink+'"><img class="openID" src="/img/spacer.gif"></img></a>';}
if(thisCommentType==='Album'){commentType='gallery';}else{commentType='photo';}
yearOn='';if(commentDate.indexOf('year')===-1){yearOn='on ';}
posterLink='';userPhoto='';if(userImage!==''){posterLink=poster.split('"')[1];userPhoto='<a href="'+posterLink+'"><img class="imgBorder userCommentPhoto" src="'+userImage+'" /></a>';}
str.push(SM.util.formatString(ct,flipFlop,approveLink,deleteLink,slashDivider,smallFullStar,smallTranStar,showCommentStart,userLink,poster,commentType,yearOn,commentDate,userPhoto,Comment));}}
if(thisCommentType==='Album'){hideGalleryCommentsBox=false;}else{imageCommentCount++;}}
if(YD.inDocument('hideGalleryComments')){if(hideGalleryCommentsBox!==true){YD.setStyle(YD.get('hideGalleryComments'),'display','inline');if(showGalleryComments===true){YD.get('showGalleryComments').innerHTML='hide gallery comments';}else{YD.get('showGalleryComments').innerHTML=comments.length-imageCommentCount+' gallery comments hidden';}}else{YD.setStyle(YD.get('hideGalleryComments'),'display','none');}}
var commentPageNavCount=0;for(var commentCount=0;commentCount<comments.length;commentCount++){thisCommentType=comments[commentCount].thisCommentType;if(showGalleryComments===true||(showGalleryComments!==true&&thisCommentType!=='Album')){commentPageNavCount++;}}
var totalPages=Math.ceil(commentPageNavCount/commentsPerPage),output='';if(commentPageNavCount>0){output='<span class="title">page:<\/span> ';if(commentPageOn>1){output+='<a href="javascript:showCommentPage('+(commentPageOn-1)+');" class="nav">&lt;<\/a> ';}
for(var i=1;i<=totalPages;i++){if(commentPageOn!==i){output+='<a href="javascript:showCommentPage('+i+');" class="nav">'+i+'<\a> ';}else{output+=i+' ';}}
if(commentPageOn<totalPages){output+='<a href="javascript:showCommentPage('+(commentPageOn+1)+');" class="nav">&gt;<\/a>';}}}
if(YD.get('comment_nav')){YD.get('comment_nav').innerHTML=output;}
if(YD.get('comments')){YD.get('comments').innerHTML=str.join('');}
commentsDrawing=false;}else{setTimeout(function(){drawCommentsRPCResult(response);},500);}}
if(typeof moveTool==='undefined'){var moveTool=false;}
var moveWarning=false;function moveStatus(){if(moveWarning){alert("New positions will not be shown until you change the gallery sort options to Position in your gallery settings.");moveWarning=false;}
if(moveTool===true){moveTool=false;YD.setStyle(YD.getElementsByClassName('photoLink','a'),'cursor','pointer');if(YD.get('mouseFollow')){var el=YD.get('mouseFollow');el.parentNode.removeChild(el);}
scrollAreas('remove');YD.removeClass('arrangePhotosText','title');}else{moveTool=true;YD.setStyle(YD.getElementsByClassName('photoLink','a'),'cursor','move');var body=document.getElementsByTagName("body")[0];var mouseFollow=document.createElement("div");mouseFollow.setAttribute("id","mouseFollow");mouseFollow.className="photo";body.appendChild(mouseFollow);scrollAreas('add');YD.addClass('arrangePhotosText','title');}}
var startBox=-1;var holdThis="";function pickPhoto(t,e){if(moveTool===true){startBox=t.parentNode;while(!YD.hasClass(startBox,'photo')){startBox=startBox.parentNode;}
startBox=parseInt(startBox.id.replace("photoBox_",""),10);holdThis=imageIDs[startBox];YD.get('mouseFollow').innerHTML=YD.get('photoBox_'+startBox).innerHTML;YD.get('photoBox_'+startBox).innerHTML="";YD.setStyle('mouseFollow','display','block');YD.setStyle('scrollTop','display','block');YD.setStyle('scrollBottom','display','block');if(!e){var e=window.event;}
document.onselectstart=function(){return false;};document.onmouseup=placePhoto;movePhoto(e);document.onmousemove=movePhoto;}}
function placePhoto(){if(moveTool===true&&startBox>=0){scrollUnit=0;if(scrolly!==""){clearInterval(scrolly);}
document.onmousemove="";document.onselectstart="";document.onmouseup="";YD.get('photoBox_'+startBox).innerHTML=YD.get('mouseFollow').innerHTML;YD.setStyle('photoBox_'+startBox,'width',prevPhotoBoxWidth+'px');YD.setStyle('photoBox_'+startBox,'height',prevPhotoBoxHeight+'px');YD.get('photoBox_'+startBox).className="photo";YD.setStyle('mouseFollow','display','none');YD.setStyle('scrollTop','display','none');YD.setStyle('scrollBottom','display','none');imageIDs[startBox]=holdThis;startBox=-1;var startPosition=0;if(galleryStyle==='smugmug_small'){startPosition=(pageOn-1)*10;}else if(galleryStyle==='smugmug'){startPosition=(pageOn-1)*16;}else if(galleryStyle==='traditional'){startPosition=(pageOn-1)*17;}
renumberGallery(AlbumID,AlbumKey,imageIDs,startPosition);}}
function movePhoto(e){if(!e){e=window.event;}
var posx=0;var posy=0;if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY;}else if(e.clientX||e.clientY){posx=e.clientX+document.documentElement.scrollLeft;posy=e.clientY+document.documentElement.scrollTop;}
if(posx>0&&posy>0){YD.setStyle('mouseFollow','top',posy+1+'px');YD.setStyle('mouseFollow','left',posx+1+'px');}}
var prevPhotoBoxHeight='';var prevPhotoBoxWidth='';var newPhotoBoxHeight='';var newPhotoBoxWidth='';function cyclePhotos(boxNum){if(moveTool===true&&startBox>=0){if(prevPhotoBoxHeight===""&&newPhotoBoxHeight===""){prevPhotoBoxWidth=parseInt(YD.getStyle('photoBox_0','width'),10);prevPhotoBoxHeight=parseInt(YD.getStyle('photoBox_0','height'),10);newPhotoBoxWidth=prevPhotoBoxWidth-2;newPhotoBoxHeight=prevPhotoBoxHeight-2;}
if(boxNum!==startBox){if(boxNum>startBox){for(var i=startBox;i<boxNum;i++){YD.get('photoBox_'+i).innerHTML=YD.get('photoBox_'+(i+1)).innerHTML;YD.get('photoBox_'+i).className="photo";YD.setStyle('photoBox_'+i,'width',prevPhotoBoxWidth+'px');YD.setStyle('photoBox_'+i,'height',prevPhotoBoxHeight+'px');imageIDs[i]=imageIDs[i+1];}}else if(boxNum<startBox){for(var i=startBox;i>boxNum;i--){YD.get('photoBox_'+i).innerHTML=YD.get('photoBox_'+(i-1)).innerHTML;YD.get('photoBox_'+i).className="photo";YD.setStyle('photoBox_'+i,'width',prevPhotoBoxWidth+'px');YD.setStyle('photoBox_'+i,'height',prevPhotoBoxHeight+'px');imageIDs[i]=imageIDs[i-1];}}
YD.get('photoBox_'+i).innerHTML="";YD.setStyle('photoBox_'+i,'width',newPhotoBoxWidth+'px');YD.setStyle('photoBox_'+i,'height',newPhotoBoxHeight+'px');YD.get('photoBox_'+i).className="photo photoTarget";startBox=i;}}}
var scrollUnit="";var scrolly="";function goScroll(gUnit){scrollUnit=gUnit*3;if(scrollUnit===0){clearInterval(scrolly);}else{scrolly=setInterval("scrollPage()",5);}}
function scrollPage(){scrollBy(0,scrollUnit);}
var photoHovering=false;var photoHoveringAnimation=false;var photoBarTimeout='';var closingPhotoBar=false;function photoHover(photoID,photoImageID,waited){var position=SM.PhotoBar.config.position||'right';var hoverPhoto=YD.get(photoID);if(SM.menus.menuOpen>0){return;}
if(photoInfo[photoImageID].Format!=="ARC"){if(!showPhotoBar||hoverPhoto.offsetWidth*hoverPhoto.offsetHeight<30000||photoInfo[photoImageID]===undefined||photoHovering||photoInfo[photoImageID].Format==="MPG"||(YD.inDocument('themeChoicesContainer')&&parseInt(YD.getStyle('themeChoicesContainer','height'),10)!==0)){return;}}
if(!waited){YE.addListener(document,'mousemove',watchPhotoBar,photoID);photoBarTimeout=setTimeout("photoHover('"+photoID+"', '"+photoImageID+"', true)",photoBarDelay*1000);return;}
if(YD.inDocument('photoBarBg')&&YD.inDocument('photoBarContent')&&!YD.hasClass('photoBarContent','photoId_'+photoImageID)){removeFromDOM('photoBarBg');removeFromDOM('photoBarContent');}
var hoverRegion=YAHOO.util.Region.getRegion(hoverPhoto);var photoBarBg=YD.get('photoBarBg');var photoBarContent=YD.get('photoBarContent');if(!photoBarBg){photoBarBg=document.createElement('div');photoBarBg.setAttribute('id','photoBarBg');photoBarBg.className=position;document.body.appendChild(photoBarBg);YD.setStyle(photoBarBg,'zIndex',getZindex(hoverPhoto)+1);photoBarBg.innerHTML='<div class="first"></div><div class="middle"></div><div class="last"></div>';YE.on(window,'resize',function(){if(photoBarBg&&photoBarBg.offsetWidth<=1){YD.setStyle(photoBarBg,'left',0);if(photoBarContent){YD.setStyle(photoBarContent,'left',0);}}});}
var photoImageKey=photoInfo[photoImageID].ImageKey;if(!photoBarContent){photoBarContent=document.createElement("div");photoBarContent.setAttribute('id','photoBarContent');YD.addClass(photoBarContent,position);YD.addClass(photoBarContent,'photoId_'+photoImageID);document.body.appendChild(photoBarContent);YD.setStyle(photoBarContent,'zIndex',getZindex(photoBarBg)+1);if(displaySmugPopular&&photoInfo[photoImageID].Format!=="ARC"){if(photoInfo[photoImageID].displayPopular){var photoRank=document.createElement('div');YD.addClass(photoRank,'photoRank');photoRank.id='photoRank';if(photoBarContent.childNodes.length===0){YD.addClass(photoRank,'first');}
photoBarContent.appendChild(photoRank);var postArray=[];postArray.tool='smugPopular';postArray.ImageID=photoImageID;postArray.ImageKey=photoImageKey;if(Yua.ie!==6){ajax_query(smugPopularResponse,'/rpc/gallery.mg',postArray,true);}}}
if(photoInfo[photoImageID].Format!=="MP4"&&photoInfo[photoImageID].Format!=="ARC"){if(YD.getStyle(YD.get('lightBoxStage'),'display')!=="block"){var photoSizes=document.createElement("div");YD.addClass(photoSizes,"photoSizes");photoSizes.setAttribute("id","photoSizes");if(photoBarContent.childNodes.length===0){YD.addClass(photoSizes,'first');}
photoBarContent.appendChild(photoSizes);photoSizes.innerHTML='<h4>Photo Sizes</h4>';var photoSizesContent=document.createElement("ul");photoSizes.appendChild(photoSizesContent);if(photoInfo[photoImageID]['SmallSrc']){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-S-LB">Small<\/a></li>';}
if(photoInfo[photoImageID]['MediumSrc']){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-M-LB">Medium<\/a></li>';}
if(photoInfo[photoImageID].albumLarges){if(photoInfo[photoImageID]['LargeSrc']){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-L-LB">Large<\/a></li>';}
if(photoInfo[photoImageID].hasXLarges){if(photoInfo[photoImageID].albumXLarges){if(photoInfo[photoImageID]['XLargeSrc']){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-XL-LB">XLarge<\/a></li>';}}
if(photoInfo[photoImageID].albumX2Larges){if(photoInfo[photoImageID]['X2LargeSrc']){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-X2-LB">X2Large<\/a></li>';}}
if(photoInfo[photoImageID].albumX3Larges){if(photoInfo[photoImageID]['X3LargeSrc']){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-X3-LB">X3Large<\/a></li>';}}}
if(photoInfo[photoImageID].albumOriginals){photoSizesContent.innerHTML+='<li><a href="#'+photoImageID+'_'+photoImageKey+'-O-LB">Original<\/a></li>';}}}}else if(photoInfo[photoImageID].Format!=="ARC"&&(photoInfo[photoImageID].canEdit||(!photoInfo[photoImageID].canEdit&&!photoInfo[photoImageID]['protected']))){var photoSizes=document.createElement("div");YD.addClass(photoSizes,"photoSizes");photoSizes.setAttribute("id","photoSizes");if(photoBarContent.childNodes.length===0){YD.addClass(photoSizes,'first');}
photoBarContent.appendChild(photoSizes);photoSizes.innerHTML='<h4>Save Movie</h4>';photoSizes.innerHTML+='<img id="savePhotoButton" src="/img/spacer.gif" width="28" height="31" border="0" style="cursor: pointer" />';YE.on('savePhotoButton','click',function(){if(YD.getStyle('photoSizesContent','display')!=='block'){YD.setStyle('photoSizesContent','display','block');}else{YD.setStyle('photoSizesContent','display','none');}
YD.setStyle(photoBarBg.childNodes[1],'height',photoBarContent.offsetHeight-photoBarBg.childNodes[0].offsetHeight+'px');YD.setStyle(photoBarBg,'height',YD.getStyle(photoBarBg.childNodes[1],'height'));});var photoSizesContent=document.createElement("ul");photoSizesContent.id='photoSizesContent';YD.setStyle(photoSizesContent,'display','none');YD.setStyle(photoSizesContent,'marginTop','3px');photoSizes.appendChild(photoSizesContent);photoSizesContent.innerHTML+='<li style="margin-bottom: 3px;"><strong style="text-decoration: underline;">Size:</strong></li>';photoSizesContent.innerHTML+='<li><a href="/photos/'+photoImageID+'_'+photoImageKey+'-320D.mp4">Web<\/a></li>';if(photoInfo[photoImageID]['640Movie']){photoSizesContent.innerHTML+='<li><a href="/photos/'+photoImageID+'_'+photoImageKey+'-640D.mp4">iPod/DVD<\/a></li>';}
if(photoInfo[photoImageID]['960Movie']){photoSizesContent.innerHTML+='<li><a href="/photos/'+photoImageID+'_'+photoImageKey+'-960D.mp4">Mid-Def<\/a></li>';}
if(photoInfo[photoImageID]['1280Movie']){photoSizesContent.innerHTML+='<li><a href="/photos/'+photoImageID+'_'+photoImageKey+'-1280D.mp4">HiDef<\/a></li>';}
if(photoInfo[photoImageID].Archive){photoSizesContent.innerHTML+='<li style="margin: 5px 0 3px 0;"><strong style="text-decoration: underline;">Archive:</strong></li>';for(var i in photoInfo[photoImageID].Archive){var obj=photoInfo[photoImageID].Archive[i];photoSizesContent.innerHTML+='<li><a href="'+obj.URL+'" title="'+obj.FileName+'" alt="'+obj.FileName+'">'+obj.FileName.split('.').pop().toUpperCase()+'<\/a></li>';}}}
if(photoInfo[photoImageID].displayEXIF&&photoInfo[photoImageID].Format!=="MP4"&&photoInfo[photoImageID].Format!=="ARC"){var photoExif=document.createElement("div");photoExif.setAttribute("id","photoExif");if(photoBarContent.childNodes.length===0){YD.addClass(photoExif,'first');}
photoBarContent.appendChild(photoExif);photoExif.innerHTML='<h4>Photo Info</h4>';photoExif.innerHTML+='<a href="javascript:exifDetails('+photoImageID+', \''+photoImageKey+'\');"><img id="photoInfoButton" src="/img/spacer.gif" width="27" height="27" border="0" /></a>';}
if((photoInfo[photoImageID].canEdit||(photoInfo[photoImageID].albumOriginals&&!photoInfo[photoImageID]['protected']))&&photoInfo[photoImageID].Format!=="MP4"){var photoSave=document.createElement("div");photoSave.setAttribute("id","photoSave");if(photoBarContent.childNodes.length===0){YD.addClass(photoSave,'first');}
photoBarContent.appendChild(photoSave);if(photoInfo[photoImageID].canEdit){photoSave.innerHTML='<h4>Owner Save</h4>';}
else if(photoInfo[photoImageID].Format==="ARC"){photoSave.innerHTML='<h4>Save File</h4>';}
else{photoSave.innerHTML='<h4>Save Photo</h4>';}
photoSave.innerHTML+='<img id="savePhotoButton" src="/img/spacer.gif" width="28" height="31" border="0" style="cursor:pointer" />';if(photoInfo[photoImageID].Archive&&((photoInfo[photoImageID].Format==="ARC"&&photoInfo[photoImageID].Archive.length>1)||photoInfo[photoImageID].Format!=="ARC")){YE.on('savePhotoButton','click',function(){if(YD.getStyle('photoSaveContent','display')!=='block'){YD.setStyle('photoSaveContent','display','block');}else{YD.setStyle('photoSaveContent','display','none');}
YD.setStyle(photoBarBg.childNodes[1],'height',photoBarContent.offsetHeight-photoBarBg.childNodes[0].offsetHeight+'px');YD.setStyle(photoBarBg,'height',YD.getStyle(photoBarBg.childNodes[1],'height'));});var photoSaveContent=document.createElement("ul");photoSaveContent.id='photoSaveContent';YD.setStyle(photoSaveContent,'display','none');YD.setStyle(photoSaveContent,'marginTop','3px');photoSave.appendChild(photoSaveContent);photoSaveContent.innerHTML+='<li style="margin-bottom: 3px;"><strong style="text-decoration: underline;">File:</strong></li>';if(photoInfo[photoImageID].Format!=="ARC"){photoSaveContent.innerHTML+='<li><a href="/photos/'+photoImageID+'_'+photoImageKey+'-D.jpg">Original<\/a></li>';}
for(var i in photoInfo[photoImageID].Archive){var obj=photoInfo[photoImageID].Archive[i];photoSaveContent.innerHTML+='<li><a href="'+obj.URL+'" title="'+obj.FileName+'" alt="'+obj.FileName+'">'+obj.FileName.split('.').pop().toUpperCase()+'<\/a></li>';}}
else{if(photoInfo[photoImageID].Format==="ARC"){var linkage=photoInfo[photoImageID].Archive[0].URL;}
else{var linkage='/photos/'+photoImageID+'_'+photoImageKey+'-D.jpg';}
YE.on('savePhotoButton','click',function(){location.href=linkage;});}}
if(Yua.ie===6&&hoverPhoto.offsetHeight<photoBarContent.offsetHeight+20){YD.setStyle('photoTools','visibility','hidden');}}
switch(position){case'right':YD.setStyle(photoBarBg.childNodes[1],'height',photoBarContent.offsetHeight-photoBarBg.childNodes[0].offsetHeight+'px');YD.setStyle(photoBarBg,'height',YD.getStyle(photoBarBg.childNodes[1],'height'));YD.setXY(photoBarBg,[hoverRegion.right,hoverRegion.top]);YD.setXY(photoBarContent,[hoverRegion.right-photoBarContent.offsetWidth,hoverRegion.top]);var attr={'left':{'by':-97},'width':{'to':96}};break;case'bottom':if(Yua.ie===6){YD.setStyle(photoBarBg.childNodes[1],'width',photoBarContent.offsetWidth+'px');}else{YD.setStyle(photoBarBg.childNodes[1],'width',photoBarContent.offsetWidth-photoBarBg.childNodes[0].offsetWidth+'px');}
YD.setStyle(photoBarBg,'width',YD.getStyle(photoBarBg.childNodes[1],'width'));YD.setXY(photoBarBg,[hoverRegion.right-(hoverPhoto.offsetWidth/2)-(photoBarBg.offsetWidth/2),hoverRegion.bottom]);if(Yua.ie===6){YD.setXY(photoBarContent,[hoverRegion.right-(hoverPhoto.offsetWidth/2)-(photoBarBg.offsetWidth/2)+photoBarBg.childNodes[0].offsetWidth,hoverRegion.bottom+7]);}else{YD.setXY(photoBarContent,[hoverRegion.right-(hoverPhoto.offsetWidth/2)-(photoBarBg.offsetWidth/2),hoverRegion.bottom]);}
var attr={'height':{'to':100}};if(Yua.ie===6){YD.setStyle('photoTools','visibility','hidden');}}
photoHovering=true;switch(position){case'right':if(parseInt(YD.getStyle(photoBarBg,'width'),10)>0){YD.setStyle(photoBarBg,'width',0);}
break;case'bottom':if(parseInt(YD.getStyle(photoBarBg,'height'),10)>0){YD.setStyle(photoBarBg,'height',0);}
break;}
photoHoveringAnimation=new YAHOO.util.Anim(photoBarBg,attr,.5,YAHOO.util.Easing.backOut);photoHoveringAnimation.onComplete.subscribe(function(e){if(Yua.ie===6){var postArray=[];postArray.tool='smugPopular';postArray.ImageID=photoImageID;postArray.ImageKey=photoImageKey;ajax_query(smugPopularResponse,'/rpc/gallery.mg',postArray,true);}
if(photoHovering){YD.setStyle('photoBarContent','visibility','visible');}});photoHoveringAnimation.animate();}
function watchPhotoBar(e,photoID){if(!e){e=window.event;}
var posX=0;var posY=0;if(e.pageX||e.pageY){posX=e.pageX;posY=e.pageY;}else if(e.clientX||e.clientY){posX=e.clientX+document.documentElement.scrollLeft;posY=e.clientY+document.documentElement.scrollTop;}
var photoId=YD.get(photoID);var photoXY=YD.getXY(photoId);var photoBarBg=YD.get('photoBarBg');var barXY=YD.getXY(photoBarBg);if(YD.inDocument('photoBarBg')){if((posX+3<photoXY[0]||posX-3>parseInt(photoId.offsetWidth+photoXY[0],10)||posY+3<photoXY[1]||posY-3>parseInt(photoId.offsetHeight+photoXY[1],10))&&(posX+3<barXY[0]||posX-3>parseInt(photoBarBg.offsetWidth+barXY[0],10)||posY+3<barXY[1]||posY-3>parseInt(photoBarBg.offsetHeight+barXY[1],10))){closePhotoBar();}}else if(posX+3<photoXY[0]||posX-3>parseInt(photoId.offsetWidth+photoXY[0],10)||posY+3<photoXY[1]||posY-3>parseInt(photoId.offsetHeight+photoXY[1],10)){clearTimeout(photoBarTimeout);YE.removeListener(document,'mousemove',watchPhotoBar);}}
function closePhotoBar(){clearTimeout(photoBarTimeout);YE.removeListener(document,'mousemove',watchPhotoBar);photoHovering=false;var photoBarBg=YD.get('photoBarBg');if(photoBarBg){if(photoHoveringAnimation.isAnimated()){photoHoveringAnimation.stop();}
YD.setStyle(YD.get('photoBarContent'),'visibility','hidden');var position=SM.PhotoBar.config.position||'right';switch(position){case'right':var attr={'width':{'to':0},'left':{'by':photoBarBg.offsetWidth}};break;case'bottom':var attr={'height':{'to':0}};break;}
closingPhotoBar=new YAHOO.util.Anim(photoBarBg,attr,.5,YAHOO.util.Easing.backIn);if(Yua.ie===6){closingPhotoBar.onComplete.subscribe(function(e){if(YD.getStyle('lightBoxStage','display')!=="block"){YD.setStyle('photoTools','visibility','visible');}});}
closingPhotoBar.animate();}}
function exifDetails(imageId,imageKey){var cCtx=SM.currentContext;var imageId_Key=imageId+'_'+imageKey;if(!cCtx.exifBox){cCtx.exifBox=new SM.photo.ExifBox({'imageId_Key':imageId_Key,'autoPosition':true,'positionAnchor':'displayPhoto','draggable':true});cCtx.exifBox.open();}else if(cCtx.exifBox.get('visible')){cCtx.exifBox.close();}else{cCtx.exifBox.set('imageId_Key',imageId_Key);cCtx.exifBox.open();}}
var smugPopularPhoto="";var smugPopularTimeout='';function smugPopular(photoID,ImageID,ImageKey,waited){if(!displaySmugPopular){return;}
if(SM.menus.menuOpen>0){return;}
if(!YD.hasClass(document.body,'smugmug_ajax')||(photoInfo[ImageID]!==undefined&&photoInfo[ImageID].displayPopular)){if(!YD.hasClass(document.body,'smugmug_ajax')||lightBoxOn===true){photoHovering=true;}
if(pageLoaded&&displaySmugPopular){if(waited!==true){YE.addListener(document,'mousemove',watchMouseOverPhoto,photoID);smugPopularTimeout=setTimeout("smugPopular('"+photoID+"', '"+ImageID+"', '"+ImageKey+"', true)",500);}else{smugPopularPhoto=photoID;if(!YD.inDocument('smugPopular')&&photoHovering===true){var body=document.body;var smugPopular=document.createElement("div");var smugPopularContent=document.createElement("div");smugPopular.setAttribute("id","smugPopular");smugPopularContent.setAttribute("id","smugPopularContent");body.appendChild(smugPopular);body.appendChild(smugPopularContent);var popPhoto=YD.get(smugPopularPhoto);var photoWrapper=YD.get('photoWrapper');YD.setStyle(smugPopular,'zIndex',getZindex(popPhoto));YD.setStyle(smugPopularContent,'zIndex',getZindex(smugPopular));if(YD.hasClass(document.body,'singleImage')&&YD.hasClass(document.body,'Original')&&photoWrapper.offsetWidth<popPhoto.offsetWidth){YD.setX(smugPopular,YD.getX(photoWrapper)+photoWrapper.offsetWidth-smugPopular.offsetWidth-5);YD.setX(smugPopularContent,YD.getX(smugPopular));}else{YD.setX(smugPopular,YD.getX(popPhoto)+popPhoto.offsetWidth-smugPopular.offsetWidth-5);YD.setX(smugPopularContent,YD.getX(smugPopular));}
YD.setY(smugPopular,YD.getY(popPhoto)+parseInt(YD.getStyle(smugPopularPhoto,'borderTopWidth'),10));YD.setY(smugPopularContent,YD.getY(smugPopular));var myAnim=new YA('smugPopular',{'height':{'to':70}},.3,YAHOO.util.Easing.backOut);myAnim.onComplete.subscribe(function(e){var postArray=[];postArray.tool='smugPopular';postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;ajax_query(smugPopularResponse,'/rpc/gallery.mg',postArray,true);});myAnim.animate();}}}}}
function smugPopularResponse(response){if(YD.inDocument('smugPopular')){YD.get('smugPopularContent').innerHTML=response;YD.setStyle(YD.get('smugPopularContent'),'visibility','visible');}
if(YD.inDocument('photoRank')&&response.indexOf('prepLBimg')!==0){YD.get('photoRank').innerHTML='<h4>PhotoRank</h4>'+response;}}
var smugPopularTotal=0;function showSmugPopular(total){}
function smugPopularVote(Side,ImageID,ImageKey){var postArray=[];postArray.tool='smugPopularVote';postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;postArray.Side=Side;if(YD.inDocument('smugPopularContainer')){postArray.newPopular=true;}else{postArray.newPopular=false;}
ajax_query(smugPopularResponse,'/rpc/gallery.mg',postArray,true);}
function watchMouseOverPhoto(e,photoID){if(!e){e=window.event;}
var posX=0;var posY=0;if(e.pageX||e.pageY){posX=e.pageX;posY=e.pageY;}else if(e.clientX||e.clientY){posX=e.clientX+document.documentElement.scrollLeft;posY=e.clientY+document.documentElement.scrollTop;}
var photoId=YD.get(photoID);var photoXY=YD.getXY(photoId);if(posX+3<YD.getX(YD.get(photoID))||posX-3>parseInt(photoId.offsetWidth+photoXY[0],10)||posY+3<photoXY[1]||posY-3>parseInt(photoId.offsetHeight+photoXY[1],10)){closeSmugPopular();}}
function closeSmugPopular(){clearTimeout(smugPopularTimeout);YE.removeListener(document,'mousemove',watchMouseOverPhoto);if(YD.inDocument('smugPopular')){YD.setStyle(YD.get('smugPopularContent'),'visibility','hidden');var myAnim=new YA('smugPopular');myAnim.attributes.height={to:0};myAnim.duration=.3;myAnim.method=YAHOO.util.Easing.backIn;myAnim.onComplete.subscribe(function(e){if(YD.inDocument('smugPopular')){removeFromDOM('smugPopular');removeFromDOM('smugPopularContent');}});myAnim.animate();smugPopularPhoto="";smugVote="";}}
function getProPrices(AlbumID,ImageID,Type,AlbumKey,ImageKey){pageWorking('Getting Album Prices');var postArray=[];postArray.tool='getProPrices';postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;postArray.AlbumID=AlbumID;postArray.AlbumKey=AlbumKey;postArray.Type=Type;ajax_query(handleJS,location.protocol+'//'+location.hostname+'/hack/RPC/tools.mg',postArray,true);}
YE.addListener(document,"keyup",function(e){if(YE.getTarget(e).nodeName.toLowerCase()==="input"||YE.getTarget(e).nodeName.toLowerCase()==="textarea"||e.metaKey){return;}
if(e.keyCode===72&&YD.inDocument('hidePhotoTool')){hidePhoto(null,ImageID,ImageKey);}});function hidePhoto(status,ImageID,ImageKey){var postArray=[];postArray.ImageID=ImageID;postArray.ImageKey=ImageKey;if(status===true){postArray.Action="Hide";}else if(status===false){postArray.Action="Unhide";}else{var hidePhotoBox=YD.get('hidePhotoTool');if(hidePhotoBox){if(hidePhotoBox.checked){hidePhotoBox.checked=false;postArray.Action="Unhide";}else{hidePhotoBox.checked=true;postArray.Action="Hide";}}}
if(galleryStyle==="smugmug"){if(postArray.Action==="Hide"){photoInfo[ImageID].Status='Hidden';}else{photoInfo[ImageID].Status='Open';}}
else if(galleryStyle==="allthumbs_stretch"){if(photoInfo[ImageID].Status=='Open'){photoInfo[ImageID].Status='Hidden';postArray.Action="Hide";}
else{photoInfo[ImageID].Status='Open';postArray.Action="Unhide";}}
if(postArray.Action==="Unhide"){pageWorking('Unhiding Photo');YD.removeClass('hidePhotoText','title');}else{pageWorking('Hiding Photo');YD.addClass('hidePhotoText','title');}
postArray.tool='hidePhoto';ajax_query(removePageWorking,'/rpc/gallery.mg',postArray,true);}
function addCartSingle(imageId,imageKey){if(!SM.currentContext.addCartSingle){SM.currentContext.addCartSingle=new SM.cart.AddCartSingle();}
if(/\S+\.smugmug\.[net|com]/.test(location.href)){SM.currentContext.addCartSingle.show(imageId.toString(),'','',imageKey.toString());}else{var s=document.createElement('script');s.src='http://'+SM.hostConfig.mainHost+'/cart/gallerySingle.mg?imageId='+imageId+'&imageKey='+imageKey;document.body.appendChild(s);}}
if(typeof(galleryStyle)!="undefined"&&!YD.hasClass(document.body,'smugmug_ajax')){YE.onDOMReady(showCommentPage);}
if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept.util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return;}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(swf){this.setAttribute('swf',swf);}
if(id){this.setAttribute('id',id);}
if(w){this.setAttribute('width',w);}
if(h){this.setAttribute('height',h);}
if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}
if(c){this.addParam('bgcolor',c);}
var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute('redirectUrl',redirectUrl);}}
deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"expressinstall.swf":path;this.setAttribute('useExpressInstall',true);},setAttribute:function(name,value){this.attributes[name]=value;},getAttribute:function(name){return this.attributes[name];},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariable:function(name){return this.variables[name];},getVariables:function(){return this.variables;},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=key+"="+variables[key];}
return variablePairs;},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){swfNode+=[key]+'="'+params[key]+'" ';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"';}
swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'">';swfNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />';}
swfNode+="</object>";}
return swfNode;},write:function(elementId){if(this.getAttribute('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'));}}
return false;}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(PlayerVersion.major==6){return PlayerVersion;}}
try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}
if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return PlayerVersion;}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true;}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q;}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){};}}}}
if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);}
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}
if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;YAHOO.widget.FlashAdapter=function(swfURL,containerID,attributes)
{this._queue=this._queue||[];this._events=this._events||{};this._configs=this._configs||{};attributes=attributes||{};this._id=attributes.id=attributes.id||YAHOO.util.Dom.generateId(null,"yuigen");attributes.version=attributes.version||"9.0.45";attributes.backgroundColor=attributes.backgroundColor||"#ffffff";this._attributes=attributes;this._swfURL=swfURL;this._embedSWF(this._swfURL,containerID,attributes.id,attributes.version,attributes.backgroundColor,attributes.expressInstall);this.createEvent("contentReady");};YAHOO.extend(YAHOO.widget.FlashAdapter,YAHOO.util.AttributeProvider,{_swfURL:null,_swf:null,_id:null,_attributes:null,toString:function()
{return"FlashAdapter "+this._id;},_embedSWF:function(swfURL,containerID,swfID,version,backgroundColor,expressInstall)
{var swfObj=new deconcept.SWFObject(swfURL,swfID,"100%","100%",version,backgroundColor,expressInstall);swfObj.addParam("allowScriptAccess","always");swfObj.addVariable("allowedDomain",document.location.hostname);swfObj.addVariable("elementID",swfID);swfObj.addVariable("eventHandler","YAHOO.widget.FlashAdapter.eventHandler");var container=YAHOO.util.Dom.get(containerID);var result=swfObj.write(container);if(result)
{this._swf=YAHOO.util.Dom.get(swfID);this._swf.owner=this;}},_eventHandler:function(event)
{var type=event.type;switch(type)
{case"swfReady":{this._loadHandler();return;}
case"log":{return;}}
this.fireEvent(type,event);},_loadHandler:function()
{this._initAttributes(this._attributes);this.setAttributes(this._attributes,true);this._attributes=null;this.fireEvent("contentReady");},_initAttributes:function(attributes)
{this.getAttributeConfig("swfURL",{method:this._getSWFURL});},_getSWFURL:function()
{return this._swfURL;}});YAHOO.widget.FlashAdapter.eventHandler=function(elementID,event)
{var loadedSWF=YAHOO.util.Dom.get(elementID);if(!loadedSWF.owner)
{setTimeout(function(){YAHOO.widget.FlashAdapter.eventHandler(elementID,event);},0);}
else loadedSWF.owner._eventHandler(event);};SM.flash.FlashAdapter=function(swfURL,containerID,attributes){SM.flash.FlashAdapter.superclass.constructor.call(this,swfURL,containerID,attributes);}
YAHOO.lang.extend(SM.flash.FlashAdapter,YAHOO.widget.FlashAdapter,{_embedSWF:function(swfURL,containerID,swfID,version,backgroundColor,expressInstall)
{var swfObj=new deconcept.SWFObject(swfURL,swfID,this._attributes['width'],this._attributes['height'],version,"#ffffff",expressInstall);swfObj.useExpressInstall('/ria/expressinstall.swf');for(var i in this._attributes){swfObj.addParam(i,this._attributes[i]);}
for(var i in this._flashVars){swfObj.addVariable(i,this._flashVars[i]);}
swfObj.addParam("allowScriptAccess","always");swfObj.addVariable("allowedDomain",document.location.hostname);swfObj.addVariable("elementID",swfID);swfObj.addVariable("eventHandler","SM.flash.FlashAdapter.eventHandler");var container=YAHOO.util.Dom.get(containerID);var result=swfObj.write(container);if(result)
{this._swf=YAHOO.util.Dom.get(swfID);this._swf.owner=this;}}});SM.flash.FlashAdapter.eventHandler=function(elementID,event)
{var loadedSWF=YAHOO.util.Dom.get(elementID);if(!loadedSWF.owner)
{setTimeout(function(){SM.flash.FlashAdapter.eventHandler(elementID,event);},0);}
else loadedSWF.owner._eventHandler(event);};
SM.flash.Slideshow=function(containerId,type,flashVars,attributes,images,url)
{this._containerId=containerId;this._type=type||'gallery';this._tempFlashVars=flashVars||{};this._tempAttributes=attributes||{};this._images=images;this._url=url||location.href;this._slideshowLoaded=false;this._ninjaLoaded=false;this._flashVars={};this._attributes={};this._showSWF=true;this._canLoadSWF=false;this._preLoad=3;this._openedOnce=false;this._trueFSSS=false;this._stats=new Array();this.createEvent("loadSlideStart");this.createEvent("loadSlideEnd");this.createEvent("slideshowLoaded");this.createEvent("ninjaLoaded");this.createEvent("thumbsShown");this.createEvent("thumbsHidden");switch(type){case'fullScreen':var swf=location.protocol+'//'+SM.hostConfig['cdnHost']+'/ria/ninjaLoader-'+SM.appVersion['ninjaLoader']+'.swf';var defaultFlashVars={fileURL:location.protocol+'//'+SM.hostConfig['cdnHost']+'/ria/ShizamSlides-'+SM.appVersion['ShizamSlides']+'.swf',galleryURL:escape(this._url),captions:'true',newWindow:'false',transparent:'true',showLogo:'false',showThumbs:'true',fetchAPIData:'false',showButtons:'true',crossFadeSpeed:'351',showSpeed:'true',waitforClick:'true',type:'fullScreen'};var defaultAttributes={version:'9',bgcolor:'#000000',backgroundColor:'#000000',allowFullSCreen:'true',wmode:'transparent',allowScriptAccess:'always',allowNetworking:'all',play:'true',loop:'false',quality:'best',width:'100%',height:'100%'};this.createEvent("ninjaLoaded");this.on('contentReady',function(){this.fireEvent('ninjaLoaded');if(this._ninjaLoaded!=true){this._ninjaLoaded=true;}},this,true);this.createEvent("ninjaClicked");this.on('ninjaClicked',function(){},this,true);this.createEvent("slideshowOpened");this.on('slideshowOpened',function(){this._openedOnce=true;if(this._showSWF){this._swf.preCallback({cmd:'beginLoad'});this.sendImages();}},this,true);this.on('slideshowLoaded',function(){this._slideshowLoaded=true;},this,true);this.createEvent("slideshowClosed");this.on('slideshowClosed',function(){if(YAHOO.env.ua.gecko>0){this._swf.width="99%";this._swf.height="99%";var that=this;setTimeout(function(){that._swf.height="100%";that._swf.width="100%";},50);}
else if(YAHOO.env.ua.ie>0){YD.addClass(document.body,'ieMask');YD.removeClass(document.body,'ieMask');}
for(var i in this._stats){loadedImageRPC(this._stats[i].id,this._stats[i].size,this._stats[i].key);}
this._stats=new Array();},this,true);this.on('versionCheck',function(obj){var parts=obj['version'].split(' ');var OS=parts[0].toLowerCase();var pieces=parts[1].split(',');var major=pieces[0];var minor=pieces[1];var rev=pieces[2];var that=this;if(major>9||(major==9&&rev>=115)){this._trueFSSS=true;this._canLoadSWF=true;this.fireEvent('canLoadSWF');if(!YD.hasClass(document.body,'smugmug_ajax')){if(windowLoaded==true){that.loadSlideSWF();}
else{YE.on(window,'load',function(){this.loadSlideSWF();},this,true);}}}
else{this._showSWF=false;this.popupLink();}},this,true);var flashVersion=deconcept.SWFObjectUtil.getPlayerVersion();if(flashVersion.major<9||(Yua.ie>0&&navigator.userAgent.toLowerCase().indexOf('windows nt 6')>-1)){this._showSWF=false;this.popupLink();}
break;case'homepage':break;default:var swf=location.protocol+'//'+SM.hostConfig['cdnHost']+'/ria/ShizamSlides-'+SM.appVersion['ShizamSlides']+'.swf';var defaultFlashVars={galleryURL:escape(this._url),newWindow:'false',transparent:'true',showLogo:'false',showThumbs:'false',fetchAPIData:'false',showButtons:'false',crossFadeSpeed:'350'};var defaultAttributes={bgcolor:'#000000',backgroundColor:'#000000',wmode:'transparent',allowScriptAccess:'always',allowNetworking:'all',quality:'best',version:'9.0.28',width:'100%',height:'100%'};this.on('slideshowLoaded',function(){this._slideshowLoaded=true;this.sendImages();},this,true);this.createEvent("closeShow");this.on('closeShow',function(){window.close();},this,true);var flashVersion=deconcept.SWFObjectUtil.getPlayerVersion();if(flashVersion.major<7){if(this._tempAttributes['width']){var warningWidth=this._tempAttributes['width'];}
if(this._tempAttributes['height']){var warningHeight=this._tempAttributes['height'];}
YD.get(containerId).innerHTML='<div style="text-align: center; width: '+warningWidth+'px; height: '+warningHeight+'px; vertical-align: middle; margin: 0 auto; padding: 0 20px; "><h3 style="text-align: center; position: relative; top: 40%">Holy HTTP, Batman! You need the latest version of Adobe Flash Player to view the show! <a href="http://www.adobe.com/go/getflashplayer">Get it here</a>!</h3></div>';this._showSWF=false;}
else if(flashVersion.major>=7&&(flashVersion.major<9||(flashVersion.major==9&&flashVersion.rev<28))){if(defaultAttributes['width']<214){defaultAttributes['width']=214;}
if(defaultAttributes['height']<137){defaultAttributes['height']=137;}}
break;}
for(var i in defaultFlashVars){this._flashVars[i]=defaultFlashVars[i];}
for(var i in this._tempFlashVars){this._flashVars[i]=this._tempFlashVars[i];}
this._flashVars['mainHost']=SM.hostConfig['mainHost'];for(var i in defaultAttributes){this._attributes[i]=defaultAttributes[i];}
for(var i in this._tempAttributes){this._attributes[i]=this._tempAttributes[i];}
this.on('loadSlideEnd',function(obj){var statImageID=parseInt(obj['ImageID']);for(var i in this._images['Images']){if(this._images['Images'][i]['id']==statImageID){statImageKey=this._images['Images'][i]['key'];break;}}
var width=parseInt(obj['Width']);var height=parseInt(obj['Height']);if(width<=100&&height<=100){var statSize="Tiny";}
else if(width<=150&&height<=150){var statSize="Thumb";}
else if(width<=400&&height<=300){var statSize="Small";}
else if(width<=600&&height<=450){var statSize="Medium";}
else if(width<=800&&height<=600){var statSize="Large";}
else if(width<=1024&&height<=768){var statSize="XLarge";}
else if(width<=1280&&height<=960){var statSize="X2Large";}
else if(width<=1600&&height<=1200){var statSize="X3Large";}
else{var statSize="Original";}
if(this._trueFSSS){this._stats.push({id:statImageID,size:statSize,key:statImageKey});}
else{loadedImageRPC(statImageID,statSize,statImageKey);}});if(this._showSWF){SM.flash.Slideshow.superclass.constructor.call(this,swf,containerId,this._attributes);}}
YAHOO.extend(SM.flash.Slideshow,SM.flash.FlashAdapter,{play:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'play'});}},pause:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'pause'});}},nextSlide:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'next'});}},prevSlide:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'back'});}},goToPosition:function(position){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'goToIndex',index:position});}},setSpeed:function(speed){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'setSpeed',speed:speed});}},toggleThumbs:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'toggleThumbs'});}},showThumbs:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'showThumbs'});}},hideThumbs:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'hideThumbs'});}},resize:function(size){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'resize',size:size+'URL'});}},clearCache:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'clearCache'});}},height:function(dim){this._swf.height=dim;},width:function(dim){this._swf.width=dim;},swf:function(){return this._swf;},pauseFetch:function(){if(this._canLoadSWF&&this._openedOnce!=true){this._swf.preCallback({cmd:'pauseFetch'});}},resumeFetch:function(){if(this._canLoadSWF&&this._openedOnce!=true){this._swf.preCallback({cmd:'resumeFetch'});}},cleanUp:function(){if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'cleanUp'});}},loadSlideSWF:function(){if(this._canLoadSWF){if(!YAHOO.env.ua.webkit||(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit>=525.18)){this._swf.preCallback({cmd:'beginLoad'});}
this.preLoadImages();}
else{this.on('canLoadSWF',this.loadSlideSWF,this,true);}},popupLink:function(){if(this._showSWF){YD.setStyle(this._swf,'display','none');var el=this._swf;el.width=1;el.height=1;}
YAHOO.util.Dom.setStyle(this._containerId,'cursor','pointer');if(YAHOO.env.ua.ie>0){YAHOO.util.Dom.setStyle(this._containerId,'background','black');YAHOO.util.Dom.setStyle(this._containerId,'opacity',0);}
YAHOO.util.Event.addListener(this._containerId,'mouseup',function(){this.fireEvent('ninjaClicked');var newwin=window.open('/photos/swfpopup.mg?swfPop=true&noClickURL=true&url='+encodeURI(location.href),'ssWindow','scrollbars=0,status=0,resizable=1,width='+screen.width+',height='+screen.height+',top=0,left=0,fullscreen=1');if(window.focus){newwin.focus();}
return false;},this,true);},preLoadImages:function(){if(YAHOO.lang.isString(this._images)){var handleSuccess=function(o){if(o.responseText!==undefined){try{var returnedData=YAHOO.lang.JSON.parse(o.responseText);}
catch(x){return;}
var preLoadThese=returnedData['Images'];this._swf.preCallback({cmd:'fetchThis',data:preLoadThese});}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};var postArray=[];postArray.push('url='+escape(this._url));postArray.push('tool=slideshowPhotos');postArray.push('returnCount='+this._preLoad);var sUrl="/rpc/gallery.mg";var imageRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postArray.join('&'));}
else{var preLoadThese=this._images['Images'].slice(0,this._preLoad);this._swf.preCallback({cmd:'fetchThis',data:preLoadThese});}},sendImages:function(){if(YAHOO.lang.isString(this._images)){var handleSuccess=function(o){if(o.responseText!==undefined){try{this._images=YAHOO.lang.JSON.parse(o.responseText);}
catch(x){return;}
if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'loadData',data:this._images});}
else{this.on('slideshowLoaded',this.sendImages,this,true);}}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};var FSSS_THUMB_WIDTH=68;var postArray=[];postArray.push('url='+encodeURI(this._url));postArray.push('tool=slideshowPhotos');postArray.push('currentPixels='+screen.width+'x'+screen.height);postArray.push('returnCount='+parseInt(screen.width/FSSS_THUMB_WIDTH+2)*3);var sUrl="/rpc/gallery.mg";var imageRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postArray.join('&'));}
else{if(this._slideshowLoaded){this._swf.extHookHandler({cmd:'loadData',data:this._images});}
else{this.on('slideshowLoaded',this.sendImages,this,true);}}}});
SM.flash.Video=function(containerId,flashVars,attributes)
{this._tempFlashVars=flashVars||{};this._tempAttributes=attributes||{};this._containerId=containerId;this._movieLoaded=false;this._ninjaLoaded=false;this._flashVars={};this._attributes={};this._isFlash=true;this._qtID=null;this.createEvent("movieLoaded");this.createEvent("swfUpdate");var userNick='';if(typeof(NickName)!=='undefined'){userNick="&u="+NickName;}
var share='';if(this._tempAttributes.share!=1){share='&se=0';}
var endPoint='';if(SM.hostConfig['mainHost'].match('smugmug.net')){endPoint='&endPoint='+SM.hostConfig['mainHost'];}
var video64=SM.util.base64_encode('i='+this._tempAttributes.videoId+'&k='+this._tempAttributes.videoKey+'&a='+this._tempAttributes.albumId+'_'+this._tempAttributes.albumKey+userNick+share+endPoint);var swf=location.protocol+'//'+SM.hostConfig['cdnHost']+'/ria/ShizVidz-'+SM.appVersion['ShizVidz']+'.swf';var defaultFlashVars={video64:video64,fileURL:swf,width:this._tempAttributes['width'],height:this._tempAttributes['height'],mainHost:SM.hostConfig['mainHost']};var defaultAttributes={bgcolor:'#000000',wmode:'window',backgroundColor:'#000000',allowScriptAccess:'always',allowNetworking:'all',allowFullScreen:'true',quality:'best',version:'7',width:'100%',height:'100%'};var ua=navigator.userAgent.toLowerCase();if(this._tempAttributes['format']!=="MP4"||ua.indexOf("mac")>0||this._tempAttributes['width']==1920){this._isFlash=false;this._qtID=YAHOO.util.Dom.generateId(null,"yuigen");var qtAttr={id:this._qtID,width:this._tempAttributes['width'],height:this._tempAttributes['height']+16,style:'',src:this._tempAttributes['src']};var qtParams={};if(this._tempAttributes['protected']&&!this._tempAttributes['owner']){qtParams.kioskmode=true;}
YD.get(containerId).innerHTML=SM.qtHTML(qtAttr,qtParams);}
else{this.on('movieLoaded',function(){this._movieLoaded=true;},this,true);this.on('contentReady',function(){this._ninjaLoaded=true;},this,true);this.on('swfUpdate',function(){if(this._savedAttributes['width']<214){this._savedAttributes['width']=214;}
if(this._savedAttributes['height']<137){this._savedAttributes['height']=137;}
this._savedAttributes['version']='9.0.115';var swf=location.protocol+'//'+SM.hostConfig['cdnHost']+'/ria/ShizVidz-'+SM.appVersion['ShizVidz']+'.swf';SM.flash.Video.superclass.constructor.call(this,swf,this._containerId,this._savedAttributes);},this,true);for(var i in defaultFlashVars){this._flashVars[i]=defaultFlashVars[i];}
for(var i in this._tempFlashVars){this._flashVars[i]=this._tempFlashVars[i];}
for(var i in defaultAttributes){this._attributes[i]=defaultAttributes[i];}
for(var i in this._tempAttributes){this._attributes[i]=this._tempAttributes[i];}
this._savedAttributes=this._attributes;var showSWF=true;var flashVersion=deconcept.SWFObjectUtil.getPlayerVersion();if(flashVersion.major<=6){YD.get(containerId).innerHTML='<div style="text-align: center; width: 640px; height: 400px; vertical-align: middle; margin: 0 auto; padding: 0 20px"><h3 style="text-align: center; position: relative; top: 40%">Holy HTTP, Batman! You need the latest version of Adobe Flash Player to view the show! <a href="http://www.adobe.com/go/getflashplayer">Get it here</a>!</h3></div>';showSWF=false;}
else{var swf=location.protocol+'//'+SM.hostConfig['cdnHost']+'/ria/ninjaLoader-'+SM.appVersion['ninjaLoader']+'.swf';}
this._attributes['format']='';this._attributes['src']='';if(showSWF){SM.flash.Video.superclass.constructor.call(this,swf,containerId,this._attributes);}}}
YAHOO.extend(SM.flash.Video,SM.flash.FlashAdapter,{play:function(){if(this._isFlash){if(this._movieLoaded){this._swf.extHookHandler({cmd:'play'});}}
else{YD.get(this._qtID).Play();}},pause:function(){if(this._isFlash){if(this._movieLoaded){}}
else{YD.get(this._qtID).Stop();}}});SM.qtHTML=function(attr,params){var qtNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){qtNode='<embed controller="true" enablejavascript="true" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" src="'+attr['src']+'" width="'+attr['width']+'" height="'+attr['height']+'" class="qtMovie" style="'+attr['style']+'" ';qtNode+=' id="'+attr['id']+'" name="'+attr['id']+'" ';for(var key in params){qtNode+=[key]+'="'+params[key]+'" ';}
qtNode+='/>';}
else{qtNode='<object width="'+attr['width']+'" height="'+attr['height']+'" id="'+attr['id']+'" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" style="'+attr['style']+'" class="qtMovie">';qtNode+='<param name="src" value="'+attr['src']+'" />';qtNode+='<param name="enablejavascript" value="true" />';qtNode+='<param name="controller" value="true" />';for(var key in params){qtNode+='<param name="'+key+'" value="'+params[key]+'" />';}
qtNode+="</object>";}
return qtNode;};
SM.namespace('Panels');SM.Panels.AnimotoSingleton=null;SM.Panels.AnimotoPanel=function(panelID,config){if(SM.Panels.AnimotoSingleton){return SM.Panels.AnimotoSingleton;}
else{this.init(panelID,config);}};SM.Panels.AnimotoPanel.prototype={init:function(panelID,config){var _defaultConfig={'underlay':'shadow','visible':false,'draggable':false,'constraintoviewport':true,'width':'675px','zIndex':9000,'close':false};var _panelConfig=YAHOO.lang.merge(_defaultConfig,config);var _panel=new YAHOO.widget.Panel(panelID,_panelConfig);var _cancelButton;var _startButton;var _bodyContentsInitialized=false;var _cancel=function(e,obj){YAHOO.util.Event.preventDefault(e);_removeSampleVideo();_panel.hide();};var _start=function(e,obj){YAHOO.util.Event.preventDefault(e);var form=YD.get('animotoForm');form.submit();};var _writeSampleVideo=function(){var flashObject='<object width="640" height="356" ><param name="movie" value="http://cdn.smugmug.com/ria/ShizVidz-2009090604.swf" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="s=ZT0xJmk9NjY3MjA3NDkxJms9SE5wRFgmYT0zNzk5MjcyX1ZyWGpOJnU9Y21hYw==" /><embed src="http://cdn.smugmug.com/ria/ShizVidz-2009090604.swf" flashVars="s=ZT0xJmk9NjY3MjA3NDkxJms9SE5wRFgmYT0zNzk5MjcyX1ZyWGpOJnU9Y21hYw==" width="640" height="356" type="application/x-shockwave-flash" allowFullScreen="true"></embed></object>';YD.get('animotoSampleVideo').innerHTML=flashObject;};var _removeSampleVideo=function(){YD.get('animotoSampleVideo').innerHTML='';};var _setPanelBody=function(){var postArray=new Array();var postObj={popup:'animotoPanel',albumID:_panelConfig.albumID,albumKey:_panelConfig.albumKey};var handleSuccess=function(response){if(response.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(response.responseText);}
catch(e){return;}
_panel.setBody(result.info);_panel.center();_bodyContentsInitialized=true;YAHOO.util.Event.onAvailable('animotoCanelButton',function(me){_cancelButton=new YAHOO.widget.Button('animotoCanelButton');YAHOO.util.Event.addListener('animotoCanelButton',"click",_cancel,{'that':this});},this);YAHOO.util.Event.onAvailable('animotoStartButton',function(me){_startButton=new YAHOO.widget.Button('animotoStartButton');YAHOO.util.Event.addListener('animotoStartButton',"click",_start,{'that':this});},this);YAHOO.util.Event.onAvailable('animotoSampleVideo',function(me){_writeSampleVideo();},this);}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};for(var i in postObj){postArray.push(i+'='+postObj[i]);}
var rpc=YAHOO.util.Connect.asyncRequest('POST','/rpc/popups.mg',callback,postArray.join('&'));}
this.show=function(){_panel.center();_panel.show();if(_bodyContentsInitialized){_writeSampleVideo();}
else{_setPanelBody();}};_panel.setHeader('<img src="/img/spacer.gif" class="animoto_logo" width="180" height="40" border="0" alt="Animoto" /><br/><hr />');_panel.setBody('<h2 style="text-align: center; margin-top: 40px;"><em>Loading ...</em><input type="text" style="visibility: hidden;" /></h2>');_panel.render(document.body);SM.Panels.AnimotoSingleton=this;}};SM.Panels.PostProductionPanelSingleton=null;SM.Panels.PostProductionPanel=function(panelID,config){if(SM.Panels.PostProductionPanelSingleton){return SM.Panels.PostProductionPanelSingleton;}
else{this.init(panelID,config);}};SM.Panels.PostProductionPanel.prototype={init:function(panelID,config){var _defaultConfig={'underlay':'shadow','visible':false,'draggable':false,'constraintoviewport':true,'width':'800px','height':'405px','zIndex':9000,'modal':true};var _panelConfig=YAHOO.lang.merge(_defaultConfig,config);var _panel=new YAHOO.widget.Panel(panelID,_panelConfig);var _bodyContentsInitialized=false;var _setPanelBody=function(){var postArray=new Array();var postObj={popup:'postProductionPanel'};var handleSuccess=function(response){if(response.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(response.responseText);}
catch(e){return;}
_panel.setBody(result.info);_panel.center();_bodyContentsInitialized=true;}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};for(var i in postObj){postArray.push(i+'='+postObj[i]);}
var rpc=YAHOO.util.Connect.asyncRequest('POST','/rpc/popups.mg',callback,postArray.join('&'));}
this.show=function(){_panel.center();_panel.show();if(!_bodyContentsInitialized){_setPanelBody();}};_panel.setHeader("<h1>ShootDotEdit - It's time to take your life back!</h1><hr/>");_panel.setBody('<h2 style="text-align: center; margin-top: 40px;"><em>Loading ...</em></h2>');_panel.render(document.body);SM.Panels.PostProductionPanelSingleton=this;}};SM.Panels.ScanningPanelSingleton=null;SM.Panels.ScanningPanel=function(panelID,config){if(SM.Panels.ScanningPanelSingleton){return SM.Panels.ScanningPanelSingleton;}
else{this.init(panelID,config);}};SM.Panels.ScanningPanel.prototype={init:function(panelID,config){var _defaultConfig={'underlay':'shadow','visible':false,'draggable':false,'constraintoviewport':true,'width':'780px','height':'523px','zIndex':9000,'close':true,'modal':true};var _panelConfig=YAHOO.lang.merge(_defaultConfig,config);var _panel=new YAHOO.widget.Panel(panelID,_panelConfig);var _bodyContentsInitialized=false;var _setPanelBody=function(){var postArray=new Array();var postObj={popup:'scanningPanel'};var handleSuccess=function(response){if(response.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(response.responseText);}
catch(e){return;}
_panel.setBody(result.info);_panel.center();_bodyContentsInitialized=true;}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};for(var i in postObj){postArray.push(i+'='+postObj[i]);}
var rpc=YAHOO.util.Connect.asyncRequest('POST','/rpc/popups.mg',callback,postArray.join('&'));}
this.show=function(){_panel.center();_panel.show();if(!_bodyContentsInitialized){_setPanelBody();}};_panel.setHeader("<h1>Let ScanDigital rescue your precious memories</h1><hr/>");_panel.setBody('<h2 style="text-align: center; margin-top: 40px;"><em>Loading ...</em></h2>');_panel.render(document.body);SM.Panels.ScanningPanelSingleton=this;}};
SM.namespace('Comments');SM.Comments.Views=new Array();SM.Comments.View=function(config){this.init(config);};SM.Comments.View.prototype={init:function(config){var COMMENTS_LIST_CONTAINER_ID='commentListContainer';var COMMENT_TYPE_TOGGLE_ID='commentTypeToggle';var ADD_COMMENT_TOGGLE_CONTAINER_ID='addCommentToggleContainer';var ADD_COMMENTS_CONTAINER_ID='addCommentContainer';var CANCEL_ADD_COMMENT_BUTTON_ID='cancelAddCommentButton';var ADD_COMMENT_BUTTON_ID='addCommentButton';var COMMENT_RATING_ID='commentRating';var COMMENT_TEXT_ID='commentText';var COMMENT_TYPE_ID='commentType';var NO_CAPTCHA_ID='noCaptchaNeeded';var COMMENT_NAME_ID='commentName';var COMMENT_EMAIL_ID='commentEmail';var COMMENT_URL_ID='commentURL';var COMMENT_CAPTCHA_ID='CommentCaptcha';var SERVICE_ID='ServiceID';var SOCIAL_ID='SocialID';var COMMENT_USER_CONTAINER_ID='commentUserContainer';var FACEBOOK_LOGIN_CONTAINER_ID='facebookLoginContainer';var COMMENT_CAPTCHA_CONTAINER_ID='commentCaptchaContainer';var COMMENTS_TYPE_TOGGLE_CONTAINER_ID='commentsTypeToggleContainer';var COMMENTS_NAV_CONTAINER_ID='commentsNavContainer';var COMMENTS_LIST_CONTAINER_ID='commentListContainer';var COMMENT_APPROVAL_CONTAINER_ID='commentApproval';var FACEBOOK_LOGIN_IMAGE_ID='fb_login_image';var COMMENTS_CAPTCHA_CONFIRM_ID='CommentCaptchaConfirm';var COMMENTS_CAPTCHA_SOURCE_ID='CommentCaptchaSource';var COMMENT_RATING_CONTAINER_ID='commentRatingContainer';var _defaultConfig={widgetID:'',localImagesURL:'',loggedIn:false,loggedInToFacebook:false,commentType:'Album',albumID:'',albumKey:'',imageID:'',imageKey:'',fbConnectAPIKey:'',showImageAndAlbumComments:false,allowCommentTypeSwitch:false,commentsPerPage:10};var _viewConfig=YAHOO.lang.merge(_defaultConfig,config);var _widgetID=_viewConfig.widgetID;var _loggedIn=_viewConfig.loggedIn;var _loggedInToFacebook=_viewConfig.loggedInToFacebook;var _commentType=_viewConfig.commentType;var _albumID=_viewConfig.albumID;var _albumKey=_viewConfig.albumKey;var _imageID=_viewConfig.imageID;var _imageKey=_viewConfig.imageKey;var _fbConnectAPIKey=_viewConfig.facebookConnectAPIKey;var _localImagesURL=_viewConfig.localImagesURL;var _currentPage=1;var _showImageAndAlbumComments=_viewConfig.showImageAndAlbumComments;var _commentsRendering=false;var _commentsPerPage=_viewConfig.commentsPerPage;var _totalNumberOfComments=0;var _facebookConnectionListenerInitialized=false;var _allowCommentTypeSwitch=_viewConfig.allowCommentTypeSwitch;var _getUniqueElementID=function(id){return _widgetID+id;};var _addCommentToggleContainerID=_getUniqueElementID(ADD_COMMENT_TOGGLE_CONTAINER_ID);var _cancelAddCommentButtonID=_getUniqueElementID(CANCEL_ADD_COMMENT_BUTTON_ID);var _addCommentsContainerID=_getUniqueElementID(ADD_COMMENTS_CONTAINER_ID);var _addCommentButtonID=_getUniqueElementID(ADD_COMMENT_BUTTON_ID);var _commentRatingID=_getUniqueElementID(COMMENT_RATING_ID);var _commentTextID=_getUniqueElementID(COMMENT_TEXT_ID);var _commentTypeID=_getUniqueElementID(COMMENT_TYPE_ID);var _noCaptchaID=_getUniqueElementID(NO_CAPTCHA_ID);var _commentNameID=_getUniqueElementID(COMMENT_NAME_ID);var _commentEmailID=_getUniqueElementID(COMMENT_EMAIL_ID);var _commentURLID=_getUniqueElementID(COMMENT_URL_ID);var _commentCaptchaID=_getUniqueElementID(COMMENT_CAPTCHA_ID);var _serviceID=_getUniqueElementID(SERVICE_ID);var _socialID=_getUniqueElementID(SOCIAL_ID);var _commentUserContainerID=_getUniqueElementID(COMMENT_USER_CONTAINER_ID);var _facebookLoginContainerID=_getUniqueElementID(FACEBOOK_LOGIN_CONTAINER_ID);var _commentCaptchaContainerID=_getUniqueElementID(COMMENT_CAPTCHA_CONTAINER_ID);var _commentsTypeToggleContainerID=_getUniqueElementID(COMMENTS_TYPE_TOGGLE_CONTAINER_ID);var _commentTypeToggleID=_getUniqueElementID(COMMENT_TYPE_TOGGLE_ID);var _commentsNavContainerID=_getUniqueElementID(COMMENTS_NAV_CONTAINER_ID);var _commentsListContainerID=_getUniqueElementID(COMMENTS_LIST_CONTAINER_ID);var _captchaTypeID=_getUniqueElementID('Comment');var _commentApprovalContainerID=_getUniqueElementID(COMMENT_APPROVAL_CONTAINER_ID);var _facebookLoginImageID=_getUniqueElementID(FACEBOOK_LOGIN_IMAGE_ID);var _commentsCaptchaConfirmID=_getUniqueElementID(COMMENTS_CAPTCHA_CONFIRM_ID);var _commentsCaptchaSourceID=_getUniqueElementID(COMMENTS_CAPTCHA_SOURCE_ID);var _commentRatingContainerID=_getUniqueElementID(COMMENT_RATING_CONTAINER_ID);var _addCommentToggleContainer=YD.get(_addCommentToggleContainerID);var _cancelAddCommentButton=YD.get(_cancelAddCommentButtonID);var _addCommentsContainer=YD.get(_addCommentsContainerID);var _addCommentButton=YD.get(_addCommentButtonID);var _commentsNavContainer=YD.get(_commentsNavContainerID);var _commentsListContainer=YD.get(_commentsListContainerID);var _resetLoginHTML=function(){YD.get(_commentUserContainerID).innerHTML='<table cellpadding="2" cellspacing="0" border="0"><tr><td><span class="title">Name:&nbsp;</span></td><td><input type="text" name="'+_commentNameID+'" id="'+_commentNameID+'" style="width: 100px" /></td></tr><tr><td><span class="title">Email:&nbsp;</span></td><td><input type="text" name="'+_commentEmailID+'" id="'+_commentEmailID+'" style="width: 100px" /></td></tr><tr><td><span class="title">Link:&nbsp;</span></td><td><input type="text" name="'+_commentURLID+'" id="'+_commentURLID+'" style="width: 100px" /></td></tr></table>';YD.get(_facebookLoginContainerID).innerHTML='<img id="'+_facebookLoginImageID+'" src="'+_localImagesURL+'facebook/Connect_dark_small_short.gif" alt="Connect" border="0" align="left"/>&nbsp;<a href="#" onclick="SM.Comments.Views[\''+_viewConfig.widgetID+'\'].facebookRequireSession(event);">Connect with Facebook</a>';YD.get(_commentCaptchaContainerID).innerHTML='<span class="title" id="'+_commentsCaptchaConfirmID+'">To foil spammers, enter this code: <img src="/img/spacer.gif" alt="copy this text" title="copy this text" width="100" height="20" hspace="0" vspace="0" border="0" id="'+_commentsCaptchaSourceID+'" name="'+_commentsCaptchaSourceID+'" /> in this box:</span> <input type="text" name="'+_commentCaptchaID+'" id="'+_commentCaptchaID+'" style="width: 100px;" value="" /> <a href="javascript: SM.Comments.Views[\''+_viewConfig.widgetID+'\'].resetCaptcha(\'\');">Code unreadable?</a>';};var _facebookLogin=function(){FB.Facebook.apiClient.users_getInfo([FB.Facebook.apiClient.get_session().uid],["name"],function(result,ex){var fbUserName=result[0]['name'];var fbUserID=result[0]['uid'];var fbCleanName=fbUserName.replace(/\s+/g,'-');var fbProfileURL='http://www.facebook.com/people/'+fbCleanName+'/'+fbUserID;var fbUserHTML='<div id="user" class="user" style="float:left;padding:5px;"><div style="float:left;padding:4px;"><fb:profile-pic uid=loggedinuser facebook-logo=true></fb:profile-pic></div><div style="float:left;margin-top:6px;">Welcome, <a href="'+fbProfileURL+'" target="_blank">'+fbUserName+'</a>. You are signed in with your Facebook account. [<a href="#" onclick="SM.Comments.Views[\''+_viewConfig.widgetID+'\'].facebookLogout(event);">Logout</a>]<input type="hidden" name="'+_serviceID+'" id="'+_serviceID+'"  value="1"><input type="hidden" name="'+_socialID+'"  id="'+_socialID+'" value="'+fbUserID+'"><input type="hidden" name="'+_commentNameID+'" id="'+_commentNameID+'" value="'+fbUserName+'" /><input type="hidden" name="'+_commentURLID+'" id="'+_commentURLID+'" value="'+fbProfileURL+'" /></div><br />';YD.get(_commentUserContainerID).innerHTML=fbUserHTML;FB.XFBML.Host.parseDomTree();_loggedIn=true;_loggedInToFacebook=true;YD.get(_facebookLoginContainerID).innerHTML='<!---->';YD.get(_commentCaptchaContainerID).innerHTML='<input type="hidden" name="'+_noCaptchaID+'" id="'+_noCaptchaID+'" value="true" />';});};var _facebookLogout=function(){YD.addClass(document.body,'masked');FB.Connect.logout(function(){_loggedIn=false;_loggedInToFacebook=false;_resetLoginHTML();_resetCaptcha('');});YD.removeClass(document.body,'masked');};var _resetCaptcha=function(error){if(error==='true'){YD.get(_captchaTypeID+'CaptchaConfirm').className="title alert";YD.get(_captchaTypeID+'Captcha').value="try again";alert("Whoops, the spam-foiling code didn't match.  Please try again.");}
document.images[_captchaTypeID+'CaptchaSource'].src="/photos/captcha.mg?width=100&height=25&Type="+_captchaTypeID+"&randomBits="+randomString(8);removePageWorking();};var _toggleAddComments=function(e){var toggle=function(){var display=YD.getStyle(_addCommentsContainer,'display');if(display==''||display=='block'){YD.setStyle(_addCommentToggleContainer,'display','inline');YD.setStyle(_addCommentsContainer,'display','none');}
else{if(!_loggedIn){_resetCaptcha('');}
if(Yua.ie===6){YD.setStyle(_commentRatingContainerID,'display','none');}
YD.setStyle(_addCommentToggleContainer,'display','none');YD.setStyle(_addCommentsContainer,'display','block');}};if(typeof FB==='object'){_initializeFacebookConnectionListener();toggle();}
else{YAHOO.util.Get.script('http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php',{onSuccess:function(){FB.init(_fbConnectAPIKey,"/services/fbconnect/xd_receiver.htm");_initializeFacebookConnectionListener();toggle();}});}};var _initializeFacebookConnectionListener=function(){if(!_facebookConnectionListenerInitialized&&FB){FB.Bootstrap.requireFeatures(["Connect"],function(){FB.Connect.ifUserConnected(function(uid){if(!_loggedInToFacebook&&!_loggedIn){_facebookLogin();}
_facebookConnectionListenerInitialized=true;},function(){if(_loggedInToFacebook){_resetLoginHTML();}
_facebookConnectionListenerInitialized=true;});});}};var _clearAddCommentForm=function(){YD.get(_commentTextID).value='';YD.get(_commentRatingID).selectedIndex=0;if(!YD.inDocument(_noCaptchaID)){YD.get(_commentCaptchaID).value='';}
if(!YD.inDocument(_socialID)&&YD.inDocument(_commentURLID)){YD.get(_commentURLID).value='';}};var _submitComment=function(e){var postArray=[];var postData="tool=addComment";var submitThis=true;var commentType=YD.get(_commentTypeID);var handleSuccess=function(response){switch(response.responseText){case'1':_toggleAddComments(null);_clearAddCommentForm();_getComments(1);break;case'0':break;case'-1':_resetCaptcha('true');break;}
removePageWorking();};var handleFailure=function(o){removePageWorking();};var callback={'success':handleSuccess,'failure':handleFailure,'scope':this};if(commentType){postArray.captchaType=_captchaTypeID;if(commentType.value==='Image'){postArray.Type='Image';postArray.TypeID=_imageID;postArray.TypeKey=_imageKey;}else if(commentType.value==='Album'){postArray.Type='Album';postArray.TypeID=_albumID;postArray.TypeKey=_albumKey;}else{submitThis=false;alert("You must choose to either comment on the gallery or photo.");}}else{var typeID,typeKey;if(_commentType=='Album'){typeID=_albumID;typeKey=_albumKey;}
else{typeID=_imageID;typeKey=_imageKey;}
postArray.captchaType=_captchaTypeID;postArray.Type=_commentType;postArray.TypeID=typeID;postArray.TypeKey=typeKey;}
if(!YD.inDocument(_noCaptchaID)){postArray.Captcha=YD.get(_commentCaptchaID).value;}
postArray.ReturnType='StatusCode';postArray.Rating=YD.get(_commentRatingID).value;postArray.Comment=YD.get(_commentTextID).value;if(YD.inDocument(_commentNameID)){postArray.Name=YD.get(_commentNameID).value;}
if(YD.inDocument(_commentEmailID)){postArray.Email=YD.get(_commentEmailID).value;}
if(YD.inDocument(_commentURLID)){postArray.Link=YD.get(_commentURLID).value;}
if(YD.inDocument(_serviceID)){postArray.ServiceID=YD.get(_serviceID).value;}
if(YD.inDocument(_socialID)){postArray.SocialID=YD.get(_socialID).value;}
if(SM.util.trimString(postArray.Comment)===''){alert('You can not leave an empty comment.');}else if(submitThis===true){pageWorking('Submitting Comment');for(var i in postArray){postData+="&"+i+"="+postArray[i];}
var xhr=YAHOO.util.Connect.asyncRequest('POST','/rpc/gallery.mg',callback,postData);}};var _getComments=function(page){var postArray=[];var postData="tool=getComments";_commentsNavContainer.innerHTML='Loading comments...';if(isNaN(page)){_currentPage=1;}
else{_currentPage=parseInt(page);}
if(_commentType=='Album'){postArray.Type='Album';postArray.TypeID=_albumID;postArray.TypeKey=_albumKey;}
else{postArray.Type='Image';postArray.TypeID=_imageID;postArray.TypeKey=_imageKey;}
postArray.PageNumber=_currentPage;postArray.PageSize=_commentsPerPage;postArray.alsoGetAlbum=_showImageAndAlbumComments?'true':'false';var handleSuccess=function(response){try{var returnedData=YAHOO.lang.JSON.parse(response.responseText);_renderComments(returnedData);}
catch(x){return;}};var handleFailure=function(response){_commentsNavContainer.innerHTML='Error loading comments';};var callback={'success':handleSuccess,'failure':handleFailure,'scope':this};for(var i in postArray){postData+="&"+i+"="+postArray[i];}
var xhr=YAHOO.util.Connect.asyncRequest('POST','/rpc/gallery.mg',callback,postData);};var _renderComments=function(commentData){if(!_commentsRendering){var comments=[];var returnedComments=commentData.comments;for(var i in returnedComments){comments[comments.length]=returnedComments[i];}
_commentsRendering=true;_totalNumberOfComments=parseInt(commentData.total);var commentsHTML=[];var navHTML=[];var totalPages=Math.ceil(_totalNumberOfComments/_commentsPerPage);var ct='<div class="box {0}"><div class="boxTop nav"><span class="foreground">{6}. </span>{7}{8} wrote about this<span class="title"> {9} </span>{10}<span class="title">{11}</span><div class="boxNote">{1}{2}{3}{4}{5}</div><div class="spacer"></div></div><div class="boxBottom">{12}<p class="foreground">{13}</p><div class="spacer"></div></div></div></div>';var albumCommentsExist=false;if(comments!==undefined&&comments.length>0){var commentNumber=(_currentPage-1)*_commentsPerPage;var CommentID,poster,nofollow,Rating,Comment,commentDate,Status,thisCommentType,thisCommentTypeID,thisCommentTypeKey,userImage,confirmedUser,commentOwner;var flipFlop,approveLink,deleteLink,slashDivider,smallFullStar,smallTranStar,posterLink,userLink,commentType,yearOn,userPhoto;for(var commentCount=0;commentCount<comments.length;commentCount++){CommentID=comments[commentCount].CommentID;poster=comments[commentCount].poster;nofollow=comments[commentCount].nofollow;Rating=comments[commentCount].Rating;Comment=comments[commentCount].Comment;commentDate=comments[commentCount].commentDate;Status=comments[commentCount].Status;thisCommentType=comments[commentCount].thisCommentType;thisCommentTypeID=comments[commentCount].thisCommentTypeID;thisCommentTypeKey=comments[commentCount].thisCommentTypeKey;userImage=comments[commentCount].userImage;confirmedUser=comments[commentCount].confirmedUser;commentOwner=comments[commentCount].commentOwner;commentNumber++;if(commentNumber%2===1){flipFlop='odd';}else{flipFlop='even';}
approveLink='';deleteLink='';if(commentOwner===true){if(Status==='Pending'){approveLink='<a class="alert" href="javascript:SM.Comments.Views[\''+_viewConfig.widgetID+'\'].approveComment('+CommentID+',\''+thisCommentType+'\',\''+thisCommentTypeID+'\',\''+thisCommentTypeKey+'\');">approve</a><span>&nbsp;&#183;&nbsp</span>';}
deleteLink='<a class="alert" href="javascript:SM.Comments.Views[\''+_viewConfig.widgetID+'\'].deleteComment('+CommentID+',\''+thisCommentType+'\',\''+thisCommentTypeID+'\',\''+thisCommentTypeKey+'\');">delete</a>';}
slashDivider='';smallFullStar='';smallTranStar='';if(Rating!==0){if(commentOwner===true){slashDivider=' | ';}
for(var i=0;i<Rating;i++){smallFullStar+='<img class="star" src="/img/spacer.gif">';}
for(var i=5;i>Rating;i--){smallTranStar+='<img class="starTrans" src="/img/spacer.gif">';}}
posterLink='';userLink='';if(confirmedUser){posterLink=poster.split('"')[1];userLink='<a href="'+posterLink+'"><img class="openID" src="/img/spacer.gif"></img></a>';}
if(thisCommentType==='Album'){commentType='gallery';}else{commentType='photo';}
yearOn='';if(commentDate.indexOf('year')===-1){yearOn='on ';}
posterLink='';userPhoto='';if(userImage!==''){posterLink=poster.split('"')[1];userPhoto='<a href="'+posterLink+'"><img class="imgBorder userCommentPhoto" src="'+userImage+'" /></a>';}
commentsHTML.push(SM.util.formatString(ct,flipFlop,approveLink,deleteLink,slashDivider,smallFullStar,smallTranStar,commentNumber,userLink,poster,commentType,yearOn,commentDate,userPhoto,Comment));if(thisCommentType==='Album'&&!albumCommentsExist){albumCommentsExist=true;}}
if(YD.inDocument(_commentsTypeToggleContainerID)){if(_allowCommentTypeSwitch){if(_commentType=='Image'){if(_showImageAndAlbumComments&&!albumCommentsExist){YD.setStyle(YD.get(_commentsTypeToggleContainerID),'display','none');}
else{YD.setStyle(_commentsTypeToggleContainerID,'display','inline');if(_showImageAndAlbumComments){YD.get(_commentTypeToggleID).innerHTML='hide gallery comments';}
else{YD.get(_commentTypeToggleID).innerHTML='show gallery comments';}}}
else{YD.setStyle(YD.get(_commentsTypeToggleContainerID),'display','none');}}}
if(_totalNumberOfComments>0){navHTML.push('<span class="title">page:<\/span> ');if(_currentPage>1){navHTML.push('<a href="javascript:SM.Comments.Views[\''+_viewConfig.widgetID+'\'].getComments('+(_currentPage-1)+');" class="nav">&lt;<\/a> ');}
for(var i=1;i<=totalPages;i++){if(_currentPage!==i){navHTML.push('<a href="javascript:SM.Comments.Views[\''+_viewConfig.widgetID+'\'].getComments('+i+');" class="nav">'+i+'<\/a> ');}else{navHTML.push(i+' ');}}
if(_currentPage<totalPages){navHTML.push('<a href="javascript:SM.Comments.Views[\''+_viewConfig.widgetID+'\'].getComments('+(_currentPage+1)+');" class="nav">&gt;<\/a>');}}
else{navHTML.push('no photo comments');}}
else{if(YD.inDocument(_commentsTypeToggleContainerID)){if(_allowCommentTypeSwitch){if(_commentType=='Image'){if(_showImageAndAlbumComments&&!albumCommentsExist){YD.setStyle(YD.get(_commentsTypeToggleContainerID),'display','none');}
else{YD.setStyle(_commentsTypeToggleContainerID,'display','inline');if(_showImageAndAlbumComments){YD.get(_commentTypeToggleID).innerHTML='hide gallery comments';}
else{YD.get(_commentTypeToggleID).innerHTML='show gallery comments';}}}
else{YD.setStyle(YD.get(_commentsTypeToggleContainerID),'display','none');}}}
navHTML.push('no photo comments');}
if(_commentsNavContainer){_commentsNavContainer.innerHTML=navHTML.join('');}
if(_commentsListContainer){_commentsListContainer.innerHTML=commentsHTML.join('');}
_commentsRendering=false;}
else{setTimeout(function(){_renderComments(commentData);},500);}}
var _deleteComment=function(commentID,commentType,commentTypeID,commentTypeKey){pageWorking('Deleting Comment');var postArray=[];var postData="tool=deleteComment";postArray.CommentID=commentID;postArray.Type=commentType;postArray.TypeID=commentTypeID;postArray.TypeKey=commentTypeKey;var handleSuccess=function(response){removePageWorking();_getComments(_currentPage);};var handleFailure=function(response){};var callback={'success':handleSuccess,'failure':handleFailure,'scope':this};for(var i in postArray){postData+="&"+i+"="+postArray[i];}
var xhr=YAHOO.util.Connect.asyncRequest('POST','/rpc/gallery.mg',callback,postData);};var _approveComment=function(commentID,commentType,commentTypeID,commentTypeKey){pageWorking('Approving Comment');var postArray=[];var postData="tool=approveComment";postArray.CommentID=commentID;postArray.Type=commentType;postArray.TypeID=commentTypeID;postArray.TypeKey=commentTypeKey;var handleSuccess=function(response){removePageWorking();_getComments(_currentPage);};var handleFailure=function(response){};var callback={'success':handleSuccess,'failure':handleFailure,'scope':this};for(var i in postArray){postData+="&"+i+"="+postArray[i];}
var xhr=YAHOO.util.Connect.asyncRequest('POST','/rpc/gallery.mg',callback,postData);};var _addCommentToggleButton=new YAHOO.widget.Button({id:_getUniqueElementID('addCommentToggleButton'),label:'Add Comment',container:_addCommentToggleContainerID,className:'sm-button sm-button-small addcommentButton glyphButton',onclick:{fn:_toggleAddComments}});_addCommentButton.onclick=_submitComment;_cancelAddCommentButton.onclick=_toggleAddComments;this.resetCaptcha=function(error){_resetCaptcha(error);};this.clearComments=function(){_commentsNavContainer.innerHTML='';_commentsListContainer.innerHTML='';};this.setCommentType=function(commentType,typeID,typeKey){_commentType=commentType;if(_commentType='Image'){_imageID=typeID;_imageKey=typeKey;if(photoInfo&&photoInfo[_imageID]){if(photoInfo[_imageID].commentApprovalReqd){YD.setStyle(_commentApprovalContainerID,'display','inline');}
else{YD.setStyle(_commentApprovalContainerID,'display','none');}}
else{YD.setStyle(_commentApprovalContainerID,'display','none');}}
else{_albumID=typeID;_albumKey=typeKey;}};this.getComments=function(page){_getComments(page);};this.toggleCommentsType=function(){_showImageAndAlbumComments=_showImageAndAlbumComments?false:true;_getComments(1);};this.deleteComment=function(commentID,commentType,commentTypeID,commentTypeKey){_deleteComment(commentID,commentType,commentTypeID,commentTypeKey);};this.approveComment=function(commentID,commentType,commentTypeID,commentTypeKey){_approveComment(commentID,commentType,commentTypeID,commentTypeKey);};this.facebookRequireSession=function(e){if(FB){FB.Connect.requireSession(function(){_facebookLogin();});}
YAHOO.util.Event.preventDefault(e);return false;};this.facebookLogout=function(e){if(FB){_facebookLogout();}
YAHOO.util.Event.preventDefault(e);return false;};SM.Comments.Views[_viewConfig.widgetID]=this;if(!_allowCommentTypeSwitch){YD.setStyle(_commentsTypeToggleContainerID,'display','none');}}};