
SM.namespace('util','widget');SM.util.getCookie=function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');var c;for(var i=0,len=ca.length;i<len;i++){c=ca[i];while(c.charAt(0)===' '){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)===0){return c.substring(nameEQ.length,c.length);}}};SM.util.setCookie=function(name,value,days){var expires,date;var yearFromNow=new Date();yearFromNow.setTime(yearFromNow.getTime()+(365*24*60*60*1000));if(days==365){expires="; expires="+yearFromNow;}else if(days!==''){date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));expires="; expires="+date.toGMTString();}else{expires="";}
var cookieString=name+'='+value+expires+'; path=/; domain='+SM.hostConfig.sessionDomain;document.cookie=cookieString;};SM.util.getCloneDimensions=function(el,forceWidth,forceHeight){el=YAHOO.util.Dom.get(el);if(!el){return;}
var clone=el.cloneNode(true);clone.style.visibility='hidden';clone.style.width=forceWidth||'auto';clone.style.height=forceHeight||'auto';clone.style.position='absolute';clone.style.display='block';var cloneParent=el.parentNode;cloneParent.appendChild(clone);var dimensions=YAHOO.util.Region.getRegion(clone);dimensions.width=clone.offsetWidth;dimensions.height=clone.offsetHeight;cloneParent.removeChild(clone);return dimensions;};SM.util.copy2clipboard=function(copyThis){if(copyThis.createTextRange){var range=copyThis.createTextRange();if(range){range.execCommand('Copy');}}else{var flashcopier=YAHOO.util.Dom.get('flashcopier');if(!flashcopier){flashcopier=document.createElement('div');flashcopier.id='flashcopier';document.body.appendChild(flashcopier);}
flashcopier.innerHTML='<embed src="/include/clipboard.swf" FlashVars="clipboard='+encodeURIComponent(copyThis)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';}};SM.util.normalizeURL=function(url){url=url||window.location.href;url=url.replace(/https?:\/\/[^\/]+/,'');url=url.replace(/\?.*/,'');var base,baseTest=url.match(/.*\/(((gallery|keyword(\/all|\/today)?|date\/([^\/]+))(\/[^\/|#]+)?)|(popular(\/all|\/today)?))/);if(baseTest){base=baseTest[0];url=url.replace(base,'');}else{baseTest=url.match(/(.+)(\/(\d+)_([a-zA-Z0-9]+))/);if(baseTest){base='/gallery'+baseTest[2];url=url.replace(baseTest[0],'');}
else{return url;}}
var page,pageTest=url.match(/(?:#P\-|\/)(\d+)(?:\-\d+)?(?:\/|$)/);page=pageTest?'/'+pageTest[1]:'/1';var image,imageTest=url.match(/(?:#|\/\d+\/)(\w+)(?:\-[A-Z0-9]+\-LB)?(?:\/(?:Small|Medium|[xX]?\d?Large|Original))?$/);image=imageTest?'/'+imageTest[1]:'';return base+page+image;};SM.util.lTrimString=function(str){return str.replace(/^\s+/g,'');};SM.util.rTrimString=function(str){return str.replace(/\s+$/g,'');};SM.util.trimString=function(str){str=SM.util.lTrimString(str);str=SM.util.rTrimString(str);return str;};SM.util.formatString=function(str){var re;for(var i=1,len=arguments.length;i<len;i++){re=new RegExp('\\{'+(i-1)+'\\}','g');str=str.replace(re,arguments[i].toString().replace('$','$$'));}
return str;};SM.util.formatCurrency=function(amount){if(!isNaN(amount)){amount='$'+SM.util.formatNumber(amount,2);}
return amount;};SM.util.formatDate=function(oData){var oDate=oData;var dDate;if(oDate instanceof Date){dDate=(oDate.getMonth()+1)+"/"+oDate.getDate()+"/"+oDate.getFullYear();}else{dDate=oData;}
return dDate;};SM.util.formatNumber=function(num,precision){if(isNaN(num)){return num;}
if(!isNaN(precision)){num=Math.round(num*Math.pow(10,precision))/Math.pow(10,precision);num=num.toString(10);var dotIndex=num.indexOf(".");var numLen=num.length;if(dotIndex<0){num+=('.'+SM.util.repeatString('0',2));}else{num+=SM.util.repeatString('0',precision-(numLen-dotIndex-1));}}
return num.toString();};SM.util.repeatString=function(str,n){var s='';while(--n>=0){s+=str;}
return s;};SM.util.reduceFraction=function(num,den){var found=false;var tempNum=0,tempDen=0;var ctr=Math.min(Math.abs(num),Math.abs(den));while(ctr>0&&!found){tempNum=num/ctr;tempDen=den/ctr;if(tempNum==Math.round(tempNum)&&tempDen==Math.round(tempDen)){found=true;}else{ctr--;}}
if(tempNum<0&&tempDen<0){ctr*=-1;tempNum*=-1;tempDen*=-1;}
return[tempNum,tempDen];};(function(){var _initEvents=function(){this.createEvent('load');this.createEvent('failure');};var _removeCacheEntry=function(oRequest){var aCache=this._dataSource._aCache;var nCacheLength=((aCache)?aCache.length:0);if((this._dataSource.maxCacheEntries>0)&&aCache&&(nCacheLength>0)){for(var i=nCacheLength-1;i>=0;i--){var oCacheElem=aCache[i];if(this._dataSource.isCacheHit(oRequest,oCacheElem.request)){aCache.splice(i,1);break;}}}};var SimpleCache=function(dataUrl){this._dataSource=new YAHOO.util.XHRDataSource(dataUrl);this._dataSource.responseType=YAHOO.util.XHRDataSource.TYPE_JSON;this._dataSource.maxCacheEntries=100;this._dataSource.connTimeout=0;this._dataSource.connMethodPost=false;this._dataSource.parseJSONData=function(oRequest,oFullResponse){return oFullResponse;};_initEvents.call(this);};YAHOO.lang.augmentProto(SimpleCache,YAHOO.util.EventProvider);SimpleCache.prototype.load=function(sig){this.data=null;var signature='';for(var s in sig){if(this._dataSource.connMethodPost){signature+='&'+s+"="+sig[s];}else{signature+=(signature===''?'?':'&')+s+'='+sig[s];}}
var responseHandler={success:function(oReq,oResp){if(!oResp.status){this.data=oResp;this.fireEvent('load',oResp);}else{if(oResp.status==='success'){this.data=oResp.result;this.fireEvent('load',{'status':oResp.status,'msg':oResp.msg,'args':oResp.args});}else{_removeCacheEntry.call(this);this.fireEvent('failure',{'status':oResp.status,'msg':oResp.msg,'args':oResp.args});}}},failure:function(oReq){},scope:this};this._dataSource.sendRequest(signature,responseHandler);};SimpleCache.prototype.loadPost=function(sig){this._dataSource.connMethodPost=true;this.load(sig);};SM.util.SimpleAjaxCache=SimpleCache;}());(function(){var Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,Lang=YAHOO.lang;var DEFAULT_CONFIG={'minValue':0,'maxValue':999,'delay':1000,'useKeys':true,'active':false,'activateOnHover':true,'activateOnFocus':true};var Spinner=function(el,attr){attr=attr||{};if(arguments.length==1&&!Lang.isString(el)&&!el.nodeName){attr=el;el=attr.element;}
if(!el&&!attr.element){el=this._createSpinnerElement(attr);}
Spinner.superclass.constructor.call(this,el,attr);};Spinner._instances={};Spinner.getSpinnerById=function(id){return Spinner._instances[id]||false;};YAHOO.extend(Spinner,YAHOO.util.Element,{CSS_SPINNER:'sm-spinner',CSS_SPINNER_LESS:'sm-spinner-less',CSS_SPINNER_MORE:'sm-spinner-more',CSS_SPINNER_INPUT:'sm-spinner-input',MARKUP_SPINNER_LESS:'-',MARKUP_SPINNER_MORE:'+',_changeTimer:null,_hasFocus:false,toString:function(){var el=this.get('element');var id=el.id||el.tagName;return'Spinner '+id;},destroy:function(){var el=this.get('element'),lessEl=this.get('lessEl'),moreEl=this.get('moreEl'),inputEl=this.get('inputEl');Event.purgeElement(el);Event.purgeElement(lessEl);Event.purgeElement(moreEl);Event.purgeElement(inputEl);this.removeChild(lessEl);this.removeChild(moreEl);this.removeChild(inputEl);delete Spinner._instances[this.get('id')];for(var i in this){if(Lang.hasOwnProperty(this,i)){this[i]=null;delete this[i];}}},init:function(el,attr){Spinner.superclass.init.call(this,el,attr);var setActive=function(ev){var rel=Event.getRelatedTarget(ev);if(Dom.isAncestor(this.get('element'),rel)){return;}
this.set('active',true);};var setInactive=function(ev){var target=Event.getTarget(ev);var rel=Event.getRelatedTarget(ev);if(ev.type==='blur'&&Dom.isAncestor(this.get('element'),target)){return;}
if(Dom.isAncestor(this.get('element'),rel)){return;}
if(this._hasFocus){return;}
this.set('active',false);};var inputEl=this.get('inputEl');Event.on(inputEl,'focus',function(){this._hasFocus=true;},this,true);Event.on(inputEl,'blur',function(){this._hasFocus=false;},this,true);if(this.get('activateOnHover')){this.on('mouseover',setActive);this.on('mouseout',setInactive);}
if(this.get('activateOnFocus')){Event.on(inputEl,'focus',setActive,this,true);Event.on(inputEl,'blur',setInactive,this,true);}
this.createEvent('spinnerChange');var id=el.id;if(!Lang.isString(id)){id=Dom.generateId(id);}
Spinner._instances[id]=this;},initAttributes:function(attr){Spinner.superclass.initAttributes.call(this,attr);var el=this.get('element');attr=Lang.merge(DEFAULT_CONFIG,attr);this.setAttributeConfig('delay',{value:attr.delay,validator:Lang.isNumber});this.setAttributeConfig('minValue',{value:attr.minValue,validator:Lang.isNumber});this.setAttributeConfig('maxValue',{value:attr.maxValue,validator:Lang.isNumber});this.setAttributeConfig('useKeys',{value:attr.useKeys,validator:Lang.isBoolean});this.setAttributeConfig('activateOnHover',{value:attr.activateOnHover,validator:Lang.isBoolean});this.setAttributeConfig('activateOnFocus',{value:attr.activateOnFocus,validator:Lang.isBoolean});this.setAttributeConfig('lessEl',{value:attr.lessEl||this._getLessElement(),method:function(value){var current=this.get('lessEl');if(current){if(current===value){return false;}
this.replaceChild(value,current);}else if(el.firstChild){this.insertBefore(value,el.firstChild);}else{this.appendChild(value);}}});this.setAttributeConfig('moreEl',{value:attr.moreEl||this._getMoreElement(),method:function(value){var current=this.get('moreEl');if(current){if(current===value){return false;}
this.replaceChild(value,current);}else{var inputEl=this.get('inputEl');if(inputEl){this.insertBefore(value,inputEl);}else{this.appendChild(value);}}}});this.setAttributeConfig('inputEl',{value:attr.inputEl||this._getInputElement(),method:function(value){var current=this.get('inputEl');if(current){if(current===value){return false;}
this.replaceChild(value,current);}else{this.appendChild(value);}}});this.setAttributeConfig('value',{value:attr.value||parseInt(this.get('inputEl').value,10),method:function(value){this.get('inputEl').value=value;this._setValue(value);},validator:function(value){var val=this.get('value'),max=this.get('maxValue'),min=this.get('minValue'),valid=true;if(!Lang.isNumber(value)){valid=false;}
if(value>max){valid=false;}
if(value<this.get('minValue')){valid=false;}
if(!valid){this.get('inputEl').value=val;}
return valid;}},true);this.setAttributeConfig('active',{value:attr.value||false,method:function(value){var current=this.get('active');if(current===value){return false;}
if(!value){this._deactivate();}else{this._activate();}},validator:Lang.isBoolean});this.setAttributeConfig('hasFocus',{value:this._hasFocus,readOnly:true});},_createSpinnerElement:function(attr){var el=document.createElement('span');Dom.addClass(el,this.CSS_SPINNER);var lessEl=attr.lessEl||null;var moreEl=attr.moreEl||null;var inputEl=attr.inputEl||null;if(!lessEl){lessEl=this._createLessElement();}else if(lessEl.innerHTML===''){lessEl.innerHTML=this.MARKUP_SPINNER_LESS;}
Dom.addClass(lessEl,this.CSS_SPINNER_LESS);el.appendChild(lessEl);if(!moreEl){moreEl=this._createMoreElement();}else if(moreEl.innerHTML===''){moreEl.innerHTML=this.MARKUP_SPINNER_MORE;}
Dom.addClass(lessEl,this.CSS_SPINNER_MORE);el.appendChild(moreEl);if(!inputEl){inputEl=this._createInputElement();}
Dom.addClass(lessEl,this.CSS_SPINNER_INPUT);el.appendChild(inputEl);return el;},_createLessElement:function(){var el=document.createElement('span');el.innerHTML=this.MARKUP_SPINNER_LESS;return el;},_getLessElement:function(){return this.getElementsByClassName(this.CSS_SPINNER_LESS,'span')[0];},_createMoreElement:function(){var el=document.createElement('span');el.innerHTML=this.MARKUP_SPINNER_MORE;return el;},_getMoreElement:function(){return this.getElementsByClassName(this.CSS_SPINNER_MORE,'span')[0];},_createInputElement:function(){var el=document.createElement('input');el.type='text';return el;},_getInputElement:function(){return this.getElementsByClassName(this.CSS_SPINNER_INPUT,'input')[0];},_activate:function(){var moreEl=this.get('moreEl'),lessEl=this.get('lessEl'),inputEl=this.get('inputEl');Event.on([moreEl,lessEl],'mousedown',Event.stopEvent,Event,true);Event.on([moreEl,lessEl],'selectstart',Event.stopEvent,Event,true);Event.on(moreEl,'mouseup',this._incrementValue,this,true);Event.on(lessEl,'mouseup',this._decrementValue,this,true);Event.on(inputEl,'click',this._selectText);Event.on(document,'keyup',this._handleKeyUp,this,true);if(this.get('useKeys')){Event.on(document,'keydown',this._handleKeyDown,this,true);}},_deactivate:function(){var moreEl=this.get('moreEl'),lessEl=this.get('lessEl'),inputEl=this.get('inputEl');Event.removeListener([lessEl,moreEl],'mousedown');Event.removeListener([lessEl,moreEl],'mouseup');Event.removeListener(inputEl,'click');if(this.get('useKeys')){Event.removeListener(document,'keydown',this._handleKeyDown);}
Event.removeListener(document,'keyup',this._handleKeyUp);var prevValue=this._configs.value._initialConfig.value;var inputValue=parseInt(this.get('inputEl').value,10);if(isNaN(inputValue)){this.set('value',prevValue);}},_incrementValue:function(ev){var val=this.get('value');if(val<this.get('maxValue')){this.set('value',val+1);}},_decrementValue:function(ev){var val=this.get('value');if(val>this.get('minValue')){this.set('value',val-1);}},_selectText:function(ev){var e=this.createTextRange?this.createTextRange():this;e.select();},_handleKeyDown:function(ev){if(!this._hasFocus){return;}
var kc=Event.getCharCode(ev);var stopEvent=false;switch(kc){case 38:this._incrementValue();break;case 40:this._decrementValue();break;default:}
if(stopEvent){Event.preventDefault(ev);}},_handleKeyUp:function(ev){if(!this._hasFocus){return;}
this.set('value',parseInt(this.get('inputEl').value,10));},_setValue:function(value){if(this._changeTimer){this._changeTimer.cancel();}
var prevValue=this._configs.value._initialConfig.value;this._changeTimer=Lang.later(this.get('delay'),this,function(data){if(data.newValue!==data.prevValue){this.setAttributeConfig('value',{'value':data.newValue},true);this.fireEvent('spinnerChange',data);}},[{'newValue':value,'prevValue':prevValue}],false);}});SM.widget.Spinner=Spinner;}());SM.util.base64_encode=function(str){var chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';var encoded=[];var c=0;while(c<str.length){var b0=str.charCodeAt(c++);var b1=str.charCodeAt(c++);var b2=str.charCodeAt(c++);var buf=(b0<<16)+((b1||0)<<8)+(b2||0);var i0=(buf&(63<<18))>>18;var i1=(buf&(63<<12))>>12;var i2=isNaN(b1)?64:(buf&(63<<6))>>6;var i3=isNaN(b2)?64:(buf&63);encoded[encoded.length]=chars.charAt(i0);encoded[encoded.length]=chars.charAt(i1);encoded[encoded.length]=chars.charAt(i2);encoded[encoded.length]=chars.charAt(i3);}
return encoded.join('');};SM.util.base64_decode=function(str){var chars='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';var invalid={strlen:(str.length%4!==0),chars:new RegExp('[^'+chars+']').test(str),equals:(/=/.test(str)&&(/=[^=]/.test(str)||/={3}/.test(str)))};if(invalid.strlen||invalid.chars||invalid.equals){throw new Error('Invalid base64 data');}
var decoded=[];var c=0;while(c<str.length){var i0=chars.indexOf(str.charAt(c++));var i1=chars.indexOf(str.charAt(c++));var i2=chars.indexOf(str.charAt(c++));var i3=chars.indexOf(str.charAt(c++));var buf=(i0<<18)+(i1<<12)+((i2&63)<<6)+(i3&63);var b0=(buf&(255<<16))>>16;var b1=(i2==64)?-1:(buf&(255<<8))>>8;var b2=(i3==64)?-1:(buf&255);decoded[decoded.length]=String.fromCharCode(b0);if(b1>=0){decoded[decoded.length]=String.fromCharCode(b1);}
if(b2>=0){decoded[decoded.length]=String.fromCharCode(b2);}}
return decoded.join('');};SM.util.proxySize=function(t,d,duration,fn,obj,override){var target=YAHOO.util.Dom.getRegion(t);var dest=YAHOO.util.Dom.getRegion(d);var proxy=document.createElement('div');proxy.className='sm-proxysize';proxy.style.width=parseInt(target.right-target.left,10)+'px';proxy.style.height=parseInt(target.bottom-target.top,10)+'px';proxy.style.left=parseInt(target.left,10)+'px';proxy.style.top=parseInt(target.top,10)+'px';document.body.appendChild(proxy);var anim=new YAHOO.util.Motion(proxy,{width:{to:(dest.right-dest.left)},height:{to:(dest.bottom-dest.top)},points:{to:[dest.left,dest.top]}},duration);anim.onComplete.subscribe(function(){proxy.parentNode.removeChild(proxy);});if(fn){anim.onComplete.subscribe(fn,obj,override);}
anim.animate();};SM.util.parseMySQLDate=function(d){if(!YAHOO.lang.isString(d)||d=='0000-00-00 00:00:00'){d='';}
d=d.replace(/\-/g,'/');return new Date(d);};(function(){var Dom=YAHOO.util.Dom,Lang=YAHOO.lang;SM.widget.SelectMenuButton=function(p_oElement,p_oAttributes){this.CSS_CLASS_NAME+=' yui-select-menu-button';var defaults={type:'menu',menualignment:['tl','tl']};if(arguments.length==1&&!Lang.isString(p_oElement)&&!p_oElement.nodeName){SM.widget.SelectMenuButton.superclass.constructor.call(this,Lang.merge(p_oElement,defaults));}else{SM.widget.SelectMenuButton.superclass.constructor.call(this,p_oElement,Lang.merge(p_oAttributes,defaults));}};Lang.extend(SM.widget.SelectMenuButton,YAHOO.widget.Button,{init:function(p_oElement,p_oAttributes){SM.widget.SelectMenuButton.superclass.init.call(this,p_oElement,p_oAttributes);document.body.appendChild(this.getMenu().element);},setLabel:function(p_sLabel){this._setLabel(p_sLabel);},_setLabel:function(p_sLabel){SM.widget.SelectMenuButton.superclass._setLabel.call(this,'<em>'+p_sLabel+'</em>');},_checkMenuItem:function(menu,item){var items=menu.getItems(),i,len,checked,disabled,subMenu;for(i=0,len=items.length;i<len;i++){subMenu=items[i].cfg.getProperty('submenu');disabled=items[i].cfg.getProperty('disabled');if(subMenu){this._checkMenuItem(subMenu,item);}else if(!disabled){checked=(items[i]==item);items[i].cfg.setProperty('checked',checked);}}},checkMenuItem:function(item){var menu=this.getMenu();this._checkMenuItem(menu,item);},_setMenuWidth:function(){var el=this.get('element'),r=Dom.getRegion(el),w=r.right-r.left,menu=this.getMenu();if(YAHOO.env.ua.ie==6){menu.cfg.setProperty('width',w+'px');}else if(YAHOO.env.ua.ie==7){Sizzle('.yuimenu .bd').css('zoom',1);Sizzle('.topscrollbar, .bottomscrollbar',menu.element).css('width',Sizzle('.bd',menu.element).attr('clientWidth'));menu.cfg.setProperty('width','');}else{Dom.setStyle(menu.element,'min-width',w+'px');}},_onMenuRender:function(p_sType){SM.widget.SelectMenuButton.superclass._onMenuRender.call(this,p_sType);var storage=document.createDocumentFragment();this.getMenu().subscribe('show',function(type,args){this._setMenuWidth();this.getMenu().bringToTop();},null,this);this.getMenu().subscribe('click',function(type,args){var oMenuItem=args[1];if(!oMenuItem||oMenuItem.cfg.getProperty('disabled')){return;}
this.checkMenuItem(oMenuItem);this.set('label',oMenuItem.cfg.getProperty('text'));},null,this);}});}());SM.util.cloneObject=function(o){var Lang=YAHOO.lang,newObj;if(Lang.isArray(o)){newObj=[];}else if(Lang.isObject(o)){newObj={};}else{return o;}
for(var p in o){if(!Lang.hasOwnProperty(o,p)){continue;}
if(Lang.isObject(o[p])||Lang.isArray(o[p])){newObj[p]=SM.util.cloneObject(o[p]);}else{newObj[p]=o[p];}}
return newObj;};SM.util.$$$=function(element_or_selector,returnMultiples){if(Sizzle.isArray(element_or_selector)&&!element_or_selector.sizzle){element_or_selector=Sizzle(element_or_selector);}
if(element_or_selector.nodeName||element_or_selector.sizzle){if(element_or_selector.sizzle){return returnMultiples?element_or_selector:element_or_selector[0];}else{return returnMultiples?[element_or_selector]:element_or_selector;}}else if(typeof element_or_selector=="string"){var element;element=Sizzle(element_or_selector);if(element){element=returnMultiples?element:element[0];return element;}
else{element=document.getElementById(element_or_selector);if(element){return element;}}}
return null;};SM.util.css=function(element,prop_or_props,asFinite){if(!SM.util.css.dpi){var sizer=Sizzle.DOM('<div>').css({width:'1in',height:'1in',position:'absolute',top:0,left:0,visibility:'hidden'}).appendTo(document.body);SM.util.css.dpi=sizer.attr('offsetWidth');SM.util.css._horizontal=sizer.attr('offsetWidth');SM.util.css._vertical=sizer.attr('offsetHeight');document.body.removeChild(sizer[0]);sizer=null;}
element=SM.util.$$$(element,true);if(element.length||element.sizzle||element.jquery){if(element.length>1){var results=[];for(var i=0;i<element.length;i++){results.push(SM.util.css(element[i],prop_or_props,asFinite));}
return results;}else{element=element[0];}}
var d=document,p=(asFinite&&asFinite==1.1)?parseFloat:parseInt;var result=d.defaultView&&d.defaultView.getComputedStyle&&d.defaultView.getComputedStyle(element,'')||element.currentStyle||null;if(!prop_or_props)
return result;else{var type=typeof prop_or_props;if(type=='string'&&/margin|border|padding|layout|location|size/.test(prop_or_props)){type='array';prop_or_props=[prop_or_props];}
var positions=[['margin','margin@'],['border','border@Width'],['padding','padding@']];var sides=['Top','Right','Bottom','Left'];switch(type){case'object':case'array':var css=result,result={},value=null;result.element=element;for(var i=0;i<prop_or_props.length;i++){if(prop_or_props[i]=='margin'){for(var j=0;j<sides.length;j++)
prop_or_props.push('margin@'.replace(/@/,sides[j]));result['margin']=true;continue;}else if(prop_or_props[i]=='border'){for(var j=0;j<sides.length;j++)
prop_or_props.push('border@Width'.replace(/@/,sides[j]));result['border']=true;continue;}else if(prop_or_props[i]=='padding'){for(var j=0;j<sides.length;j++)
prop_or_props.push('padding@'.replace(/@/,sides[j]));result['padding']=true;continue;}else if(prop_or_props[i]=='size'){result['client']={t:element.clientTop,r:element.clientLeft+element.clientWidth,b:element.clientTop+element.clientHeight,l:element.clientLeft,w:element.clientWidth,h:element.clientHeight};result['offset']={t:element.offsetTop,r:element.offsetLeft+element.offsetWidth,b:element.offsetTop+element.offsetHeight,l:element.offsetLeft,w:element.offsetWidth,h:element.offsetHeight};result['scroll']={t:element.scrollTop,r:element.scrollLeft+element.scrollWidth,b:element.scrollTop+element.scrollHeight,l:element.scrollLeft,w:element.scrollWidth,h:element.scrollHeight};continue;}else if(prop_or_props[i]=='layout'){prop_or_props[i]='height';prop_or_props.push('width');for(var j=0;j<positions.length;j++)
result[positions[j][0]]=true;for(var j=0;j<sides.length;j++)
prop_or_props.push('margin@'.replace(/@/,sides[j]));for(var j=0;j<sides.length;j++)
prop_or_props.push('border@Width'.replace(/@/,sides[j]));for(var j=0;j<sides.length;j++)
prop_or_props.push('padding@'.replace(/@/,sides[j]));}else if(prop_or_props[i]=='location'){var location=SM.util.pageLocation(element);YAHOO.lang.augmentObject(result,location);continue;}
value=css[prop_or_props[i]];result[prop_or_props[i]]=asFinite?p(value)||(/[0-9]+/.test(value)?0:value):value;}
for(var k=0;k<positions.length;k++){var position=positions[k][0],template=positions[k][1];if(result[position]){result[position]={};for(var j=0;j<sides.length;j++){result[position][sides[j].charAt(0).toLowerCase()]=p(result[template.replace(/@/,sides[j])])||0;}
result[position]['lr']=(p(result[position]['l'])||0)
+(p(result[position]['r'])||0);result[position]['tb']=(p(result[position]['t'])||0)
+(p(result[position]['b'])||0);}}
return result;break;case'string':default:var value=result[prop_or_props]
return asFinite?p(value)||(/[0-9]+/.test(value)?0:value):value;break;}}};SM.util.firstElem=function(parent){element=SM.util.$$$(parent,true);if(element.length||element.sizzle||element.jquery){if(element.length>1){var results=[];for(var i=0;i<element.length;i++){results.push(SM.util.firstElem(element[i]));}
return results;}else{element=element[0];}}
var node=parent.firstElementChild||parent.firstChild;while(node&&node.nodeType!=1||node.offsetParent==null)
node=node.nextElementSibling||node.nextSibling;return node;};SM.util.lastElem=function(parent){element=SM.util.$$$(parent,true);if(element.length||element.sizzle||element.jquery){if(element.length>1){var results=[];for(var i=0;i<element.length;i++){results.push(SM.util.lastElem(element[i]));}
return results;}else{element=element[0];}}
var node=parent.lastElementChild||parent.lastChild;while(node&&node.nodeType!=1&&(node.style&&css(node)['position']=='absolute')||/script/i.test(node.nodeName)||node.offsetParent==null)
node=node.previousElementSibling||node.previousSibling;return node;};SM.util.pageLocation=function(element,container){element=SM.util.$$$(element,true);container=YAHOO.lang.isString(container)?SM.util.$$$(container):container;if(element.length||element.sizzle||element.jquery){if(element.length>1){var results=[];for(var i=0;i<element.length;i++){results.push(SM.util.pageLocation(element[i],container));}
return results;}else{element=element[0];}}
var condition=(function(container){if(container){return function(element){return element!==container;};}
else{return function(element){return!!(/absolute|relative/i.exec(Sizzle(element).css('position')));}}})(container);var x=0,y=0,_x=0,_y=0,_px=0,_py=0,stop=false,node=element;if(element.offsetParent){do{x+=node.offsetLeft||0;y+=node.offsetTop||0;if(!stop&&condition(node)){_x=x;_y=y;stop=true;}}
while(node=node.offsetParent);_px=x;_py=y;}
return{x:_x,y:_y,page:{x:_px,y:_py}};};SM.util.addGradient=function(selector,colorStop1,colorStop2,colorStopN){function draw(colorStop1,colorStop2){var context=this.getContext('2d');var size={w:this.width,h:this.height};var gradient=context.createLinearGradient(0,0,0,size.h);for(var i=0;i<arguments.length;i++){var stop=i==0?0:i==arguments.length-1?1:i/(arguments.length-1);gradient.addColorStop(stop,arguments[i]);}
context.fillStyle=gradient;context.fillRect(0.0,0.0,size.w,size.h);}
var canvas=null;var target=Sizzle(selector)[0];var pos=SM.util.pageLocation(target);var borders=SM.util.css(target,['border']);var skipAdd=false;pos.x+=borders.border.l;pos.y+=borders.border.t;if(target.previousSibling&&target.previousSibling.nodeType&&target.previousSibling.nodeName.toLowerCase()=="canvas"){skipAdd=true;canvas=target.previousSibling;}else{canvas=document.createElement('canvas');}
if(!skipAdd){target.parentNode.insertBefore(canvas,target);}
target.style.position="relative";target.style.backgroundColor="transparent";canvas.style.position="absolute";canvas.style.left=pos.x+"px";canvas.style.top=pos.y+"px";canvas.width=target.clientWidth;canvas.height=target.clientHeight;canvas.style.visibility="";canvas.style.display="";var colorStops=Array.prototype.splice.call(arguments,1,arguments.length);draw.apply(canvas,colorStops);};SM.util.modalMask=function(value,centerElement){if(!SM.util.modalMask._mask){var oMask=document.createElement('div');oMask.className='mask';oMask.innerHTML='&#160;';oMask.id='sm_mask';oMask.style.display='block';oMask.style.overflow='hidden';oMask.style.zIndex=10;SM.util.modalMask._mask=oMask;SM.util.modalMask._storage=document.createDocumentFragment();}
var sizeMask=function(){var mask=SM.util.modalMask._mask,width=YAHOO.util.Dom.getViewportWidth(),height=YAHOO.util.Dom.getViewportHeight;if(mask.offsetHeight>height)
mask.style.height=height+'px';if(mask.offsetWidth>width)
mask.style.width=width+'px';mask.style.height=YAHOO.util.Dom.getDocumentHeight()+'px';mask.style.width=YAHOO.util.Dom.getDocumentWidth()+'px';};if(value){Sizzle(document.body).addClass('masked').css('overflow','hidden');document.body.insertBefore(SM.util.modalMask._mask,document.body.firstChild);sizeMask();Sizzle(document.body).css('height',SM.util.modalMask._mask.style.height);if(centerElement){var size=SM.util.css('html','size');var elem=SM.util.$$$(centerElement);var szEl=Sizzle(elem);szEl.css({visibility:'hidden',display:'',top:0,left:0});var y=(size.scroll.t+size.client.h/2)-(elem.offsetHeight/2);var x=(size.scroll.l+size.client.w/2)-(elem.offsetWidth/2);szEl.css({left:x,top:y,visibility:''});}}else{if(SM.util.modalMask._storage.childNodes.length>0){return;}
Sizzle(SM.util.modalMask._mask).appendTo(SM.util.modalMask._storage);Sizzle(document.body).removeClass('masked').css('overflow','').css('height','');if(centerElement){var elem=SM.util.$$$(centerElement,true);elem.css({left:'',top:'',visibility:'',display:'none'});}}};SM.util.ask=function(question,details,options){var defaultOptions={width:"30em",effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.25},fixedcenter:true,modal:true,visible:false,draggable:false,close:false,adjustUI:null,questionTemplate:null,detailsTemplate:null,bodyTemplate:null,applyStyle:true,sticky:false,stickyText:'Remember my choice on this computer',stickyName:null,stickyYesOnly:false,stickyNoOnly:false};var opts=options||{},i;YAHOO.lang.augmentObject(opts,defaultOptions);if(opts.sticky&&!opts.stickyName){opts.sticky=false;}
var dlg=new YAHOO.widget.SimpleDialog("ask-dialog",opts);var configureDialog=function(options){var dlg=options.dlg;var opts=options.opts;var question=options.question;var details=options.details;var header=options.header||['<h1 class="ask-question">',(question||''),'</h1>'].join('');var body=options.body||['<div class="ask-details">',(details||''),'</div>'].join('');dlg.setHeader(header);dlg.setBody(body);var remove=function(){dlg.hide();dlg.hideEvent.fire(dlg,SM.util.ask.last);try{dlg.element.parentNode.removeChild(dlg.element);dlg.underlay.parentNode.removeChild(dlg.underlay);}
catch(e){}
dlg.destroy();};var handleYes=function(){if(opts.sticky&&!opts.stickyNoOnly){var checked=!!Sizzle('input[type=checkbox]:checked:visible',dlg.sticky).length;var cookie=SM.util.getCookie(opts.stickyName);if(!cookie||(cookie&&cookie!='yes')){SM.util.setCookie(opts.stickyName,'yes',checked?365:-1);}}
if(opts.yes){try{opts.yes.call(this);}
catch(e){throw e;}}
else{SM.util.ask.last=true;remove();}};var handleNo=function(){if(opts.sticky&&!opts.stickyYesOnly){var checked=!!Sizzle('input[type=checkbox]:checked:visible',dlg.sticky).length;var cookie=SM.util.getCookie(opts.stickyName);if(!cookie||(cookie&&cookie!='no')){SM.util.setCookie(opts.stickyName,'no',checked?365:-1);}}
if(opts.no){try{opts.no.call(this);}
catch(e){throw e;}}
else{SM.util.ask.last=false;remove();}};var askButtons=[];if(!opts.notice){askButtons.push({text:opts.noText||"Cancel",id:'askDlg-no',handler:handleNo,isDefault:true});}
askButtons.push({text:opts.yesText||"Yes",id:'askDlg-yes',handler:handleYes});dlg.cfg.queueProperty("buttons",askButtons);if(!!opts.hideEvent){dlg.hideEvent.subscribe(opts.hideEvent);}
dlg.render(document.body);Sizzle(dlg.innerElement).addClass('sm-dialog');if(opts.sticky){dlg.sticky=Sizzle.DOM(['<div class="ask-sticky">','<div class="inline-wedge"></div>','<div class="inline-block">','<input type="checkbox">','<span class="sticky-text">&nbsp;&nbsp;',opts.stickyText,'</span>','</div>','</div>'].join(''));dlg.sticky.insertBefore(dlg.buttonSpan);}
if(opts.applyStyle){var cancelText=opts.noText||"Cancel";var sHead=Sizzle(dlg.header);var sBody=Sizzle(dlg.body);var sFoot=Sizzle(dlg.footer);var sBtns=Sizzle(dlg.buttonSpan);var sQues=Sizzle('.ask-question',sHead);var sDtls=Sizzle('.ask-details',sDtls);Sizzle(dlg.element).css({'-moz-border-radius':'.6em','-webkit-border-radius':'.6em'});Sizzle(dlg.underlay).css({'-moz-border-radius':'.6em','-webkit-border-radius':'.6em'});sBody.css({'-moz-border-radius':'0.6em 0.6em 0 0','-webkit-border-radius':'0.6em 0.6em 0 0',overflow:'hidden'});sFoot.css({textAlign:'right',padding:'1em'});sHead.css({padding:'0.8em 1em 0'});sQues.css({textAlign:'center',fontSize:'1.3em',fontWeight:'bold',margin:'0'});sDtls.css({textAlign:'left',padding:'1em 1.5em','text-shadow':'0.1em 0.1em 0.2em rgba(0, 0, 0, 0.5)'});if(!opts.notice){Sizzle('button[innerHTML*='+cancelText+']',sBtns).each(function(){Sizzle(this.parentNode.parentNode).addClass('sm-button-prev');});}
if(opts.sticky){sFoot.css('position','relative');Sizzle('.inline-wedge',sFoot).css({display:YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<8?'inline':'inline-block',zoom:1,height:'100%',width:1,position:'relative',verticalAlign:'middle'});Sizzle('.inline-block',sFoot).css({display:YAHOO.env.ua.ie>5&&YAHOO.env.ua.ie<8?'inline':'inline-block',zoom:1,verticalAlign:'middle'});dlg.sticky.css({fontSize:'0.8em',position:'absolute',top:0,left:'1em',height:'100%'});sBtns.css({verticalAlign:'middle',display:'inline-block','~display':'inline',zoom:'1'});}
Sizzle('span.yui-button',dlg.buttonSpan).css({'font-family':'arial,helvetica,clean,sans-serif','font-size':'12px','font-weight':'normal','font-style':'normal','color':'#FFFFFF','text-align':'center','direction':'ltr','background-color':'#2F2F2F','background-image':'url("'+SM.hostConfig.httpPrefix+SM.hostConfig.cdnHost+'/img/buttons/buttongroup_sprite.png")','background-repeat':'repeat-x','background-position':'0 -120px','margin':'0 3px','padding':'0','border-width':'1px','border-top-color':'#FFFFFF','border-right-color':'#CCCCCC','border-bottom-color':'#A0A0A0','border-left-color':'#CCCCCC','border-style':'solid','-moz-box-shadow':'0 0.1em 0.5em 0 rgba(0, 0, 0, 0.5)','-moz-border-radius':'.25em','-webkit-box-shadow':'0 0.1em 0.5em 0 rgba(0, 0, 0, 0.5)','-webkit-border-radius':'.25em'});Sizzle('.yui-button .first-child',dlg.buttonSpan).css({'font-family':'arial,helvetica,clean,sans-serif','font-size':'12px','font-weight':'normal','font-style':'normal','color':'#FFFFFF','text-align':'center','direction':'ltr','background-color':'transparent','background-image':'none','margin':'0','padding':'0','border':'none'});Sizzle('.yui-button .first-child button',dlg.buttonSpan).css({'font-family':'arial,helvetica,clean,sans-serif','font-size':'12px','font-weight':'normal','font-style':'normal','color':'#FFFFFF','text-align':'center','direction':'ltr','background-color':'transparent','background-image':'none','margin':'0','padding':'0 .8em','min-height':'2em','border':'none','cursor':'pointer','display':'block','text-shadow':'0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 rgba(255, 255, 255, 0.25)'});}
if(opts.adjustUI){opts.adjustUI.call(dlg);}
var value=SM.util.getCookie(opts.stickyName);if(opts.sticky&&value){if(value=='yes'){try{handleYes.call(dlg);}catch(e){throw e;}
return;}else if(value=='no'){try{handleNo.call(dlg);}catch(e){throw e;}
return;}}
dlg.show();}
if(opts.questionTemplate||opts.detailsTemplate||opts.bodyTemplate){var requestManager=SM.util.RequestManager.getInstance();requestManager.on('askTemplates.onComplete',function(group){var r_question=group.has('question')?group.text('question'):question;var r_details=group.has('details')?group.text('details'):details;var r_body=group.has('body')?group.text('body'):null;configureDialog({dlg:dlg,question:r_question,details:r_details,body:r_body,opts:opts});group.clear();});if(opts.questionTemplate){requestManager.get(opts.questionTemplate,{},'askTemplates:question');}
if(opts.detailsTemplate){requestManager.get(opts.detailsTemplate,{},'askTemplates:details');}
if(opts.bodyTemplate){requestManager.get(opts.bodyTemplate,{},'askTemplates:body');}}
else{configureDialog({dlg:dlg,question:question,details:details,opts:opts});}
return dlg;};SM.util.notice=function(statement,details,options){var opts=YAHOO.lang.merge({notice:true,yesText:'Okay'},options||{});SM.util.ask(statement,details,opts);}
SM.util.loading={node:null,id:null,modal:true,centered:true,inited:false,zIndex:2000,init:function(){if(this.inited){return;}
var id=YAHOO.util.Dom.generateId();var node=Sizzle.DOM(['<div id="',id,'" class="yui-panel sm-panel">','<div class="bd">','<div class="innerbd">','<div class="inline-wedge"></div>','<div class="inline-block">','<h2>Loading, please wait...</h2>','<img class="spinner" src="',SM.hostConfig.imgPrefix,'cart/ajax_busy.gif">','</div>','</div>','</div>','</div>'].join(''));node.css({'z-index':this.zIndex,'position':'absolute','-moz-border-radius':'0.6em','-webkit-border-radius':'0.6em','visibility':'hidden','text-align':'center','background':'url('+SM.hostConfig.imgPrefix+'cart/cartbg-grad-top.gif) repeat-x scroll 0 0 #333333','border':'none','outline':'none','overflow':'hidden'});Sizzle('div.bd',node).css({'padding':'0.5em','border-bottom':'1px solid #292929','border-top':'1px solid #666666','border-left':'1px solid #393939','border-right':'1px solid #393939','-moz-border-radius':'0.6em','-webkit-border-radius':'0.6em','overflow':'hidden'});var ie67=YAHOO.env.ua.ie&&YAHOO.env.ua.ie<8;var ff36=/Firefox\/([0-9\.]+)/i.exec(navigator.userAgent);ff36=ff36&&parseFloat(ff36[1])>=3.6||false;var background=['url(',SM.hostConfig.imgPrefix,'cart/cartbbg-grad.gif) repeat-x'].join('');if(ff36){background='-moz-linear-gradient(#2a2a2a,#1f1f1f)';}
else if(YAHOO.env.ua.webkit>=412){background='-webkit-gradient(linear, center top, center bottom, from(#2a2a2a), to(#1f1f1f))';}
Sizzle('div.innerbd',node).css({'position':'relative','width':'25em','height':'7em','background':background,'text-align':'center','-moz-border-radius':'0.3em','-webkit-border-radius':'0.3em','-moz-box-shadow':'0 0.1em 0.75em 0 rgba(0, 0, 0, 0.4) inset'});if(YAHOO.env.ua.webkit>=532){Sizzle('div.innerbd',node).css({'-webkit-box-shadow':'0 0.1em 0.75em 0 rgba(0, 0, 0, 0.4) inset'});}
Sizzle('div.inline-wedge',node).css({'position':'relative','vertical-align':'middle','height':'100%','width':'1px','overflow':'hidden','display':ie67?'inline':'inline-block','zoom':'1'});Sizzle('div.inline-block',node).css({'vertical-align':'middle','display':ie67?'inline':'inline-block','zoom':'1'});Sizzle('h2',node).css({'color':'#ffffc0','border':'0','text-shadow':'0 .1em .1em rgba(0, 0, 0, .5)','font-size':'130%','padding-bottom':'0.5em','margin':'0','font-weight':'normal'});this.node=node;this.id=id;this.inited=true;},center:function(){this.init();var size=SM.util.css('html','size');var szEl=this.node;var visible=szEl.css('display')=='block';szEl.css({visibility:'hidden',display:'',top:0,left:0,display:'block'});var y=(size.scroll.t+size.client.h/2)-(szEl.attr('offsetHeight')/2);var x=(size.scroll.l+size.client.w/2)-(szEl.attr('offsetWidth')/2);szEl.css({left:x,top:y,visibility:'',display:visible?'block':'none'});return this;},message:function(newMessage,showWhenDone){this.init();var self=this;setTimeout(function(){Sizzle('h2',self.node).attr('innerHTML',newMessage);if(showWhenDone){self.show();}},0);return!newMessage?Sizzle('h2',self.node).attr('innerHTML'):this;},show:function(modal){this.init();if(this.node.attr('parentNode')!==document.body){this.node.appendTo(document.body);}
if(this.centered!==false){this.center();}
if(this.modal!==false){this.modal=modal
SM.util.modalMask(true);}
this.node.css({visibility:'visible',display:'block'});return this;},hide:function(){this.init();SM.util.modalMask(false);this.node.css({visibility:'hidden',display:'none'});return this;},toggleSpinner:function(){this.init();var spinner=Sizzle('img',this.node);if(spinner.css('display')!='none'){spinner.css('display','none');}else{spinner.css('display','');}}};SM.util.box=function(selector){var elements=SM.util.$$$(selector,true);var results=[];for(var i=0;i<elements.length;i++){var element=elements[i];var info=SM.util.css(element,['layout','size'],1.1);var offset=Sizzle(element).offset();var box={offsetParent:element.offsetParent,element:element,top:element.offsetTop,left:element.offsetLeft,right:element.offsetLeft+element.offsetWidth,bottom:element.offsetTop+element.offsetHeight,width:element.offsetWidth,height:element.offsetHeight,region:function(){return new YAHOO.util.Region(this.top,this.right,this.bottom,this.left);},intersect:function(el){var needle=SM.util.box(el);return this.region().intersect(needle);},union:function(el){var needle=SM.util.box(el);return this.region().union(needle);},contains:function(el){var needle=SM.util.box(el);return this.region().contains(needle);},showMe:function(){SM.util.showMe(this.pageLeft,this.pageTop,this.w,this.h);return this;}};box.pageLeft=box.pageX=offset.left;box.pageTop=box.pageY=offset.top;box.pageRight=box.pageX+box.width;box.pageBottom=box.pageY+box.height;box.scroll=info.scroll;box.client=info.client;box.margin=info.margin;box.padding=info.padding;box.border=info.border;box.x=box.l=box.left;box.y=box.t=box.top;box.w=box.width;box.h=box.height;box.r=box.right;box.b=box.bottom;box.scroll.left=box.scroll.l;box.scroll.top=box.scroll.t;box.scroll.width=box.scroll.w;box.scroll.height=box.scroll.h;box.scroll.right=box.scroll.r;box.scroll.bottom=box.scroll.b;box.client.left=box.client.l;box.client.top=box.client.t;box.client.width=box.client.w;box.client.height=box.client.h;box.client.right=box.client.r;box.client.bottom=box.client.b;box.margin.left=box.margin.l;box.margin.top=box.margin.t;box.margin.right=box.margin.r;box.margin.bottom=box.margin.b;box.margin.leftright=box.margin.lr;box.margin.topbottom=box.margin.tb;box.padding.left=box.padding.l;box.padding.top=box.padding.t;box.padding.right=box.padding.r;box.padding.bottom=box.padding.b;box.padding.leftright=box.padding.lr;box.padding.topbottom=box.padding.tb;box.border.left=box.border.l;box.border.top=box.border.t;box.border.right=box.border.r;box.border.bottom=box.border.b;box.border.leftright=box.border.lr;box.border.topbottom=box.border.tb;results.push(box);}
return results.length===0?null:(results.length>1?results:results[0]);};SM.util.in_array=function(string,array){for(var i=0;i<array.length;i++){if(array[i]==string){return true;}}
return false;};SM.util.remove_array=function(string,array){for(var i=0;i<array.length;i++){if(array[i]==string){array.splice(i,1);}}
return array;};SM.util.setProperty=function(root,prop,value){var props=prop.split('.');var obj=root;for(var i=0;i<props.length;i++){obj[props[i]]=obj[props[i]]||{};obj=obj[props[i]];}
obj=value;}
var framesWarning=true;var rightMoves=5;var leftMoves=-5;var filmstripMove=1;var slideDuration=3;var showImagePreview=true;var useLightbox=true;var displaySmugPopular=true;var zoomGalleryPhoto=false;var showPhotoBar=true;var fadeOutTime=0;var fadeInTime=0;var photoBarDelay=0;var SmugMugSize="Small";SM.SmugMug={'config':{'size':'auto'}};SM.PhotoBar={'config':{'position':'right'}};var YD=YAHOO.util.Dom;var YE=YAHOO.util.Event;var YA=YAHOO.util.Anim;var Yua=YAHOO.env.ua;YE.onDOMReady(function(){pageLoaded=true;getTZ();clearCheckboxes();changeInputs();SM.util.setCookie('previewThemeID','',-365);SM.util.setCookie('previewThemeCat','',-365);});var pageLoaded=false;var windowLoaded=false;YE.on(window,'load',function(){windowLoaded=true;});function getTZ(){var rightNow=new Date();var date1=new Date(rightNow.getFullYear(),0,1,0,0,0,0);var date2=new Date(rightNow.getFullYear(),6,1,0,0,0,0);var temp=date1.toGMTString();var date3=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));temp=date2.toGMTString();var date4=new Date(temp.substring(0,temp.lastIndexOf(" ")-1));var hoursDiffStdTime=(date1-date3)/(1000*60*60);var hoursDiffDaylightTime=(date2-date4)/(1000*60*60);var timeZone=hoursDiffStdTime+((hoursDiffDaylightTime===hoursDiffStdTime)?',false':',true');if(SM.util.getCookie('tZone')!==timeZone){SM.util.setCookie('tZone',timeZone,365);}}
function removeFromDOM(el){if(typeof el==="string"){el=YD.get(el);}
if(!el){return;}
YE.purgeElement(el,true);while(el.hasChildNodes()){el.removeChild(el.childNodes[0]);}
el.parentNode.removeChild(el);}
function addEvent(el,sType,fn){YE.addListener(el,sType,fn);}
function setCookie(name,value,expires,path,domain,secure){var navigation=name+"="+encodeURIComponent(value)+
((expires)?"; expires="+expires.toGMTString():"")+
((path)?"; path="+path:"")+
((domain)?"; domain="+domain:"")+
((secure)?"; secure":"");document.cookie=navigation;}
var createCookie=SM.util.setCookie;var readCookie=SM.util.getCookie;function disableButton(){document.loginForm.submitButton.disabled=true;return true;}
function windowOpener(url,name,args){if(typeof(window.popupWin)!=="object"){window.popupWin=window.open(url,name,args);}else{if(!window.popupWin.closed){window.popupWin.close();window.popupWin=window.open(url,name,args);}else{window.popupWin=window.open(url,name,args);}}}
function closeWindow(){if(!opener.closed){opener.focus();self.close();}
self.close();}
var remote;function uploadStatus(){remote=window.open("","uploadstatus","width=450,height=400,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes");remote.location.href="/photos/uploadstatus.mg";if(remote.opener===null){remote.opener=window;}
remote.opener.name="opener";}
function uploadStatusKill(){remote=window.open("","uploadstatus","width=350,height=400,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes");remote.close();}
function handleJS(response){eval(response);}
function ajax_query(callback,url,postArray,asText){var postData=[],xhr;for(var p in postArray){postData.push(encodeURIComponent(p)+'='+encodeURIComponent(postArray[p]));}
var success=function(o){if(typeof callback==='function'){callback(asText?o.responseText:o.responseXML);}};var failure=function(){};var xhrCallback={'success':success,'failure':failure};if(postData.length===0){xhr=YAHOO.util.Connect.asyncRequest('GET',url,xhrCallback);}else{xhr=YAHOO.util.Connect.asyncRequest('POST',url,xhrCallback,postData.join('&'));}}
function checkInput(checkFor,checkHere,useThis){if(typeof(Sizzle)!='undefined'){var matches=Sizzle('*[id='+checkHere+']');for(var i=0;i<matches.length;i++){if(matches[i]&&matches[i].value==checkFor){matches[i].value=useThis;}}}else{checkHere=YD.get(checkHere);if(checkHere&&checkHere.value===checkFor){checkHere.value=useThis;}}}
function goHere(url){if(url!==''){location.href=url;}}
function toggleDIV(on,off,style){var i,styles,ons,offs;if(style!==''&&on!==''){styles=style.split(",");ons=on.split(",");for(i=0;i<ons.length;i++){YD.setStyle(ons[i],'display',styles[i]);}}
if(off!==''){offs=off.split(",");for(i=0;i<offs.length;i++){YD.setStyle(offs[i],'display','none');}}
if(YD.hasClass(document.body,'smugmug_ajax')){if(on=='editCaption_bottom'||on=='editKeywords'){stopProcessingImagesPing();}
if(on=='caption_bottom'||on=='photoKeywords'){startProcessingImagesPing();}}}
function URLEncode(plaintext){var sendText='';for(var i=0;i<plaintext.length;i++){if(plaintext.charCodeAt(i)>255){sendText+="&#"+Number(plaintext.charCodeAt(i)).toString()+";";}else{if(plaintext.charCodeAt(i)==="10"){sendText+=plaintext.charAt(i);}else if(plaintext.charCodeAt(i)==="8220"){sendText+="\"";}else if(plaintext.charCodeAt(i)==="8221"){sendText+="\"";}else if(plaintext.charCodeAt(i)==="8217"){sendText+="'";}else if(plaintext.charCodeAt(i)==="8220"){sendText+="\"";}else{sendText+=plaintext.charAt(i);}}}
return encodeURIComponent(sendText.replace(new RegExp(/\+/g),"&#43;"));}
function URLDecode(encoded){var HEXCHARS="0123456789ABCDEFabcdef";var plaintext="";var i=0,ch;while(i<encoded.length){ch=encoded.charAt(i);if(ch==="+"){plaintext+=" ";i++;}else if(ch==="%"){if(i<(encoded.length-2)&&HEXCHARS.indexOf(encoded.charAt(i+1))!==-1&&HEXCHARS.indexOf(encoded.charAt(i+2))!==-1){plaintext+=unescape(encoded.substr(i,3));i+=3;}else{alert('Bad escape combination near ...'+encoded.substr(i));plaintext+="%[ERROR]";i++;}}else{plaintext+=ch;i++;}}
return plaintext;}
function setOpt(theSel,optValue){var opt=theSel.options;for(var i=0,len=opt.length;i<len;i++){if(opt[i].value===optValue){theSel.selectedIndex=i;return true;}}
return false;}
function clearCheckboxes(){var i,inputTags=document.getElementsByTagName("input");for(i=0;i<inputTags.length;i++){if(inputTags[i].type==="checkbox"&&inputTags[i].className==="refreshClear"){inputTags[i].checked=false;}
if(inputTags[i].type==="checkbox"&&inputTags[i].className==="refreshCheck"){inputTags[i].checked=true;}
if(inputTags[i].type==="radio"&&YD.hasClass(inputTags[i],"refreshCheck")){inputTags[i].checked=true;}}}
var disabledPreview=false;function previewImage(e,imgSrc){if(showImagePreview&&pageLoaded&&!disabledPreview){var el=YD.get('floatingPreview');if(el){el.parentNode.removeChild(el);}
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 body=document.getElementsByTagName("body")[0];var floatingPreview=document.createElement("img");floatingPreview.setAttribute("id","floatingPreview");if(!Yua.webkit){floatingPreview.style.visibility="hidden";YE.addListener(floatingPreview,'load',function(e){var previewPop=setTimeout(function(){YD.setStyle(floatingPreview,'visibility','visible');previewOnload(posx,posy);},1000);});}else{floatingPreview.onload=function(){previewOnload(posx,posy);};}
floatingPreview.style.top=(posy+2)+"px";floatingPreview.style.left=(posx+2)+"px";body.appendChild(floatingPreview);floatingPreview.setAttribute("src",imgSrc);}}
function previewOnload(posx,posy){var toTop,toLeft;if(document.documentElement.scrollTop){toTop=document.documentElement.scrollTop;toLeft=document.documentElement.scrollLeft;}else{toTop=document.body.scrollTop;toLeft=document.body.scrollLeft;}
var el=YD.get('floatingPreview');if(el){if(el.offsetHeight+posy+2>toTop+screenHeight()){YD.setStyle(el,'top',posy-el.offsetHeight-2+'px');}
if(el.offsetWidth+posx+2>toLeft+screenWidth()){YD.setStyle(el,'left',posx-el.offsetWidth-2+'px');}}}
function removePreview(){var el=YD.get('floatingPreview');if(el){el.parentNode.removeChild(el);}}
var findposX=YD.getX;var findposY=YD.getY;var getCSSProp=YD.getStyle;function SmartHelpie(targetSelector){targetSelector=targetSelector||SmartHelpie.buildSelector(this);var targetNodes=Sizzle(targetSelector);targetNodes.each(function(){var targetNode=this;var _helpiesKey=SmartHelpie.buildSelector(this);YAHOO.util.Event.on(this,'mouseover',function(event){var textSelector=/helpietext-([a-zA-Z0-9_-]+)/.exec(targetNode.className);if(textSelector&&textSelector[1]){textSelector='#'+textSelector[1];}else{textSelector=Sizzle(targetNode).attr('datasrc');if(!textSelector){var checkHTML=targetNode.outerHTML?/datasrc[ ]?=[ ]?['"]?([^ >]+)["']?/i.exec(targetNode.outerHTML):null;if(checkHTML){textSelector=checkHTML[1];}else{text="Cannot locate helpie text!";}}}
var nodeText='';var nodeTitle='';var title,text,width;var textNode=Sizzle(textSelector);if(textNode.length){title=textNode.attr('title');text=textNode.attr('innerHTML');width=/^$|^auto$/.test(textNode[0].style.width)?null:parseInt(textNode[0].style.width);}
nodeText=text||'Cannot locate helpie text!';nodeTitle=title||'';nodeWidth=width||null;createHelpie(event,nodeTitle,nodeText,nodeWidth);});YAHOO.util.Event.on(this,'mouseout',function(event){removeHelpie();});});}
SmartHelpie.buildSelector=function(element){if(element.id&&element.id!=''){return'#'+element.id;}
else{var selector=element.tagName.toLowerCase();if(element.className&&element.className!='')
selector=['.',element.className.split(' ').join('.'),selector].join('');var node=element.parentNode;while(node&&node.tagName.toLowerCase()!='body'){if(node.id&&node.id!=''){selector=['#',node.id,' ',selector].join('');break;}else if(node.className&&node.className!=''){selector=[node.tagName.toLowerCase(),'.',node.className.split(' ').join('.'),' ',selector].join('');}else{selector=[node.tagName.toLowerCase(),' ',selector].join('');}
node=node.parentNode;}
return selector;}
return'Should not be here; BREAK THE CODE! DEBUG!!';}
if(YAHOO&&YAHOO.util&&YAHOO.util.Event){YAHOO.util.Event.onDOMReady(function(){SmartHelpie('.smarthelpie');});}
function createHelpie(e,title,bodyText,width){e=e||window.event;var target=e.currentTarget||e.srcElement;var posx=YD.getX(target);var posx2=posx+target.offsetWidth;var posy=YD.getY(target)+target.offsetHeight+10;var posy2=posy+target.offsetHeight;var body=document.body;if(Yua.ie===6){var helpieFrame=document.createElement("iframe");helpieFrame.id='helpieFrame';helpieFrame.src='javascript:false';helpieFrame.style.top=(posy)+"px";helpieFrame.style.left=(posx)+"px";body.appendChild(helpieFrame);}
var helpie=document.createElement("div");helpie.setAttribute("id","helper");if(width&&width!=''){helpie.style.width=width+"px";}
helpie.style.top=(posy)+"px";helpie.style.left=(posx)+"px";if(title!=""){title='<h3 class="notopmargin title">'+URLDecode(title)+'</h3>';}
helpie.innerHTML=title+URLDecode(bodyText);body.appendChild(helpie);if(Yua.ie===6&&helpieFrame){helpieFrame.style.height=helpie.offsetHeight;helpieFrame.style.width=helpie.offsetWidth;}
if(document.documentElement.scrollTop){var toTop=document.documentElement.scrollTop;var toLeft=document.documentElement.scrollLeft;}else{var toTop=document.body.scrollTop;var toLeft=document.body.scrollLeft;}
if(helpie.offsetHeight+posy+2>toTop+screenHeight()){helpie.style.top=(YD.getY(target)-2-helpie.offsetHeight)+'px';if(Yua.ie===6&&helpieFrame){helpieFrame.style.top=(YD.getY(target)-2-helpie.offsetHeight)+'px';}}
if(helpie.offsetWidth+posx+2>toLeft+screenWidth()){helpie.style.left=(posx2-helpie.offsetWidth)+'px';if(Yua.ie===6&&helpieFrame){helpieFrame.style.left=(posx2-helpie.offsetWidth)+'px';}}}
function removeHelpie(){var helpie=YD.get('helper');var helpieFrame=YD.get('helpieFrame');if(helpie){helpie.parentNode.removeChild(helpie);}
if(helpieFrame){helpieFrame.parentNode.removeChild(helpieFrame);}}
var screenWidth=YD.getViewportWidth;var screenHeight=YD.getViewportHeight;function randomString(string_length){var chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";var randomstring='';for(var i=0;i<string_length;i++){var rnum=Math.floor(Math.random()*chars.length);randomstring+=chars.substring(rnum,rnum+1);}
return randomstring;}
function scrollAreas(status){if(status==="add"){var body=document.body;var scrollTop=document.createElement("div");scrollTop.id='scrollTop';scrollTop.onmouseover=function(){goScroll(-1);};scrollTop.onmouseout=function(){goScroll(0);};body.appendChild(scrollTop);var scrollBottom=document.createElement("div");scrollBottom.id='scrollBottom';scrollBottom.onmouseover=function(){goScroll(1);};scrollBottom.onmouseout=function(){goScroll(0);};body.appendChild(scrollBottom);}else{var scrollTop=YD.get('scrollTop');if(scrollTop){scrollTop.parentNode.removeChild(scrollTop);}
var scrollBottom=YD.get('scrollBottom');if(scrollBottom){scrollBottom.parentNode.removeChild(scrollBottom);}}}
var highlightInputs=false;function changeInputs(){var inputTags;if(highlightInputs){inputTags=YD.getElementsBy(function(el){if(el.type==='text'||el.type==='password'){return true;}else{return false;}},'input',null,function(el){el.onfocus=function(){highlightInput(this.id);};el.onblur=function(){unhighlightInput(this.id);};});}}
function highlightInput(choice){setTimeout('changeBGColor("'+choice+'","#f7fbf0")',50);setTimeout('changeBGColor("'+choice+'","#eff8e0")',100);setTimeout('changeBGColor("'+choice+'","#e7f4d0")',150);setTimeout('changeBGColor("'+choice+'","#dff0c0")',200);setTimeout('changeBGColor("'+choice+'","#d7edb1")',250);setTimeout('changeBGColor("'+choice+'","#cfe9a1")',300);setTimeout('changeBGColor("'+choice+'","#c7e591")',350);setTimeout('changeBGColor("'+choice+'","#bfe181")',400);setTimeout('changeBGColor("'+choice+'","#b7de72")',450);setTimeout('changeBGColor("'+choice+'","#afda62")',500);}
function unhighlightInput(choice){setTimeout('changeBGColor("'+choice+'","#ffffff")',500);setTimeout('changeBGColor("'+choice+'","#f7fbf0")',450);setTimeout('changeBGColor("'+choice+'","#eff8e0")',400);setTimeout('changeBGColor("'+choice+'","#e7f4d0")',350);setTimeout('changeBGColor("'+choice+'","#dff0c0")',300);setTimeout('changeBGColor("'+choice+'","#d7edb1")',250);setTimeout('changeBGColor("'+choice+'","#cfe9a1")',200);setTimeout('changeBGColor("'+choice+'","#c7e591")',150);setTimeout('changeBGColor("'+choice+'","#bfe181")',100);setTimeout('changeBGColor("'+choice+'","#b7de72")',50);}
function changeBGColor(choice,color){YD.setStyle(choice,'backgroundColor',color);}
function toggleShow(choice,link,openClass,closeClass){if(!YD.get(choice).offsetWidth){if(link){YD.replaceClass(link,openClass,closeClass);}
YD.setStyle(choice,'display','block');if(document.documentElement.scrollTop){var toTop=document.documentElement.scrollTop;}else{var toTop=document.body.scrollTop;}
choice=YD.get(choice);if(choice.offsetHeight+findposY(choice)>toTop+screenHeight()){var scrollY=choice.offsetHeight+findposY(choice)-screenHeight();window.scrollTo(0,scrollY);}}else{if(link){YD.replaceClass(link,closeClass,openClass);}
YD.setStyle(choice,'display','none');}}
function getZindex(obj){var zIndex=0,zCheck,allObjs;if(obj.offsetParent){while(1){zCheck=parseInt(YD.getStyle(obj,'zIndex'),10);if(!isNaN(zCheck)&&zCheck>zIndex){zIndex=zCheck;}
if(!obj.offsetParent){break;}
obj=obj.offsetParent;}}else{allObjs=document.getElementsByTagName("*");for(var i=0,len=allObjs.length;i<len;i++){zCheck=parseInt(YD.getStyle(allObjs[i],'zIndex'),10);if(!isNaN(zCheck)&&zCheck>zIndex){zIndex=zCheck;}}}
return parseInt(zIndex,10)+1;}
var getCloneDimensions=SM.util.getCloneDimensions;var pageWorkingOn=false;function pageWorking(message,icon){if(!YD.inDocument('pageWorking')){var body=document.body;var pageWorking=document.createElement("div");var pageWorkingContent=document.createElement("div");pageWorking.id='pageWorking';pageWorkingContent.id='pageWorkingContent';body.appendChild(pageWorking);pageWorking.appendChild(pageWorkingContent);YD.setStyle(pageWorking,'zIndex',getZindex(body));pageWorkingContent.innerHTML=message;var workingAnim=new YA('pageWorking');workingAnim.attributes.height={to:43};workingAnim.duration=.5;workingAnim.method=YAHOO.util.Easing.backOut;workingAnim.onComplete.subscribe(function(e){YD.setStyle('pageWorkingContent','visibility','visible');setTimeout("eval('pageWorkingOn = true')",1000);});workingAnim.animate();}else{YD.get('pageWorkingContent').innerHTML=message;}}
function removePageWorking(){if(YD.get('pageWorking')){if(pageWorkingOn){YD.setStyle('pageWorkingContent','visibility','hidden');var workingAnim=new YA('pageWorking');workingAnim.attributes.height={to:0};workingAnim.duration=.75;workingAnim.method=YAHOO.util.Easing.backIn;workingAnim.onComplete.subscribe(function(e){var el=YD.get('pageWorking');el.parentNode.removeChild(el);});workingAnim.animate();pageWorkingOn=false;}else{setTimeout("removePageWorking()",500);}}}
function toggleHeight(id){var obj=YD.get(id);if(parseInt(YD.getStyle(obj,'height'))===0){YD.setStyle(obj,'display','block');var objHeight=getCloneDimensions(id).height;var myAnim=new YA(id);myAnim.attributes.height={to:objHeight};myAnim.duration=.25;myAnim.animate();if(document.documentElement&&document.documentElement.scrollTop){var toTop=document.documentElement.scrollTop;}else if(document.body){var toTop=document.body.scrollTop;}
if(YD.getY(obj)+objHeight>toTop+YD.getViewportHeight()){if(!Yua.webkit){var element=document.documentElement;}else{var element=document.body;}
var scrollAnim=new YAHOO.util.Scroll(element,{scroll:{by:[0,(YD.getY(obj)+objHeight)-(toTop+YD.getViewportHeight())]}},.25);scrollAnim.animate();}}else{var myAnim=new YA(id);myAnim.attributes.height={to:0};myAnim.duration=.25;myAnim.onComplete.subscribe(function(e){YD.setStyle(obj,'display','none');});myAnim.animate();}}
function changeRedirectForAjax(anchor){if(getHash()){anchor.href=anchor.href+"&hash="+getHash();}}
function getHash(){if(!window.location.href.split("#")[1]){return false;}
return window.location.href.split("#")[1];}
var convertAjaxURL=SM.util.normalizeURL;var TrimString=SM.util.trimString;var onPhotoShow=new YAHOO.util.CustomEvent('photoShown',window,false,YAHOO.util.CustomEvent.FLAT);function loadedImageRPC(givenID,givenSize,givenKey){var Size;if(!givenKey){givenKey=photoInfo[givenID]?photoInfo[givenID].ImageKey:'';}
switch(givenSize){case"Small":Size="S";break;case"Medium":Size="M";break;case"Large":Size="L";break;case"XLarge":Size="XL";break;case"X2Large":Size="X2";break;case"X3Large":Size="X3";break;case"Original":Size="O";break;default:Size=givenSize;}
if(Size){var postArray=[];postArray.tool='checkSecurity';postArray.ImageID=givenID;postArray.ImageKey=givenKey;postArray.S=Size;postArray.LB=lightboxSize;ajax_query('','/rpc/gallery.mg',postArray,true);onPhotoShow.fire({ImageID:givenID,Size:Size});}}
(function(){var trackerLoadCount;onPhotoShow.subscribe(function(o){if(!trackerLoadCount){trackerLoadCount=1;return;}
var s=document.getElementsByTagName('script');var re=/statcounter\.com\/.+counter(_xhtml)?\.js$/;for(var i=0;i<s.length;i++){if(re.test(s[i].src)){sc_invisible=1;var newEl=document.createElement('script');newEl.src=s[i].src;s[i].parentNode.replaceChild(newEl,s[i]);break;}}
var reportURL=SM.util.normalizeURL();if(typeof SiteMeter==='object'){var sImage="http://"+SiteMeter.ServerName+"/meter.asp?site="+SiteMeter.CodeName;sImage+="&refer="+SiteMeter.getReferral().replace(/(gallery\/\w+)\S*#/,'$1/1/');if(SiteMeter.IP!==''){sImage+="&ip="+SiteMeter.IP;}
sImage+="&w="+window.screen.width;sImage+="&h="+window.screen.height;sImage+="&clr="+window.screen.colorDepth;sImage+="&lang="+escape(navigator.language?navigator.language:navigator.userLanguage);if(SiteMeter.SecurityCode!==''){sImage+="&sc="+escape(SiteMeter.SecurityCode);}
sImage+="&pg="+escape(document.location.toString().replace(/(gallery\/\w+)\S*#/,'$1/1/'));sImage+="&js=1&rnd="+Math.random();if(SiteMeter.trackingImage){SiteMeter.trackingImage.src=sImage;}}
trackerLoadCount++;});})();function ajaxThrobber(state){var throbber=YD.get('throbber');if(!throbber){return;}
if(state==='on'){YD.setStyle(throbber,'zIndex',getZindex(document.body));YD.setStyle(throbber,'visibility','visible');}
if(state==='off'){YD.setStyle(throbber,'visibility','hidden');}}
function findSize(passed){var map={'s':'Small','m':'Medium','l':'Large','xl':'XLarge','x2':'X2Large','x3':'X3Large','o':'Original','a':'Auto','small':'S','medium':'M','large':'L','xlarge':'XL','x2large':'X2','x3large':'X3','original':'O','auto':'A'};var size=map[passed.toLowerCase()];if(!size){size=passed.length>2?'M':'Medium';}
return size;}
function addslashes(str){str=str.replace(/\'/g,'\\\'');str=str.replace(/\"/g,'\\"');str=str.replace(/\\/g,'\\\\');str=str.replace(/\0/g,'\\0');return str;}
function stripslashes(str){str=str.replace(/\\'/g,'\'');str=str.replace(/\\"/g,'"');str=str.replace(/\\\\/g,'\\');str=str.replace(/\\0/g,'\0');return str;}
(function(){SM.tracking._queue=[];SM.tracking.init=function(){this._queue.push(this.bootstrap_ga());this._queue.push(this.bootstrap_qc());return SM.tracking.track;};SM.tracking.track=function(){for(var i=0,len=this._queue.length;i<len;i++){this._queue[i]();}};SM.tracking.bootstrap_qc=function(){var track=function(){window._qacct=SM.tracking.quantcast.smugmug;window._qpixelsent='';window.quantserve();}
return function(){if(typeof quantserve==='function'){track();}else{YAHOO.util.Get.script(SM.hostConfig.httpPrefix+SM.hostConfig.cdnHost+'/include/js/quantcast-'+SM.md5s['/include/js/quantcast.js']+'.js',{onSuccess:track});}};};SM.tracking.bootstrap_ga=function(){window._gaq=window._gaq||[];var getTrackers=function(){var sessionDomain=SM.hostConfig.sessionDomain,customDomain=(sessionDomain.indexOf('.smugmug.')===-1),trackers=[],tracker,id;if(window._uacct){SM.tracking.ga.user=window._uacct;}else if(window.pageTracker){SM.tracking.ga.user=window.pageTracker._getAccount();}
for(var type in SM.tracking.ga){id=SM.tracking.ga[type];if(id){try{tracker=_gat._createTracker(id,type);}catch(t_ex){tracker=_gat._getTracker(id);}
if(customDomain){tracker._setAllowHash(false);}else if(type=='smugmug'){tracker._setDomainName(sessionDomain);}
trackers.push(tracker);}}
getTrackers=function(){return trackers;};return getTrackers();};var track=function(){var trackURL=SM.util.normalizeURL(),trackers=getTrackers(),tracker;for(var i=0,len=trackers.length;i<len;i++){tracker=trackers[i];tracker._trackPageview(trackURL);}};if(typeof _gat!=='object'){YAHOO.util.Get.script(SM.hostConfig.httpPrefix+SM.hostConfig.cdnHost+'/include/js/ga-'+SM.md5s['/include/js/ga.js']+'.js');}else{}
return function(){window._gaq.push(track);};};YE.onDOMReady(function(){if(YD.hasClass(document.body,'smugmug_ajax')){onPhotoShow.subscribe(SM.tracking.init(),SM.tracking,true);}else{YE.on(window,'load',SM.tracking.init(),SM.tracking,true);}});})();var copy2CB=SM.util.copy2clipboard;function insertAfter(newElement,targetElement){var parent=targetElement.parentNode;if(parent.lastchild===targetElement){parent.appendChild(newElement);}else{parent.insertBefore(newElement,targetElement.nextSibling);}}
SM.namespace('flash');SM.flash.insertSlideshow=function(w,h,params){var iDevice=(YAHOO.env.ua.webkit>1&&(navigator.userAgent.indexOf('iPad')>-1||navigator.userAgent.indexOf('iPhone')>-1||navigator.userAgent.indexOf('iPhone')>-1));var args="noTagBacks=true&amp;";if(iDevice){}else{for(var i in params){args+=i+"="+params[i]+"&amp;";}
document.writeln('<object width="100%" height="100%" align="middle">'+'<param name="movie" value="/ria/ShizamSlides-'+SM.appVersion['ShizamSlides']+'.swf?'+args+'" />'+'<param name="wmode" value="transparent" />'+'<embed src="/ria/ShizamSlides-'+SM.appVersion['ShizamSlides']+'.swf?'+args+'" wmode="transparent" width="'+w+'" height="\
                    '+h+'" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/><\/object>');}
return 1;};SM.flash.insertSlideshowIntoElement=function(elementID,w,h,params){var args="noTagBacks=true&amp;";var objectHTML='';var iDevice=(YAHOO.env.ua.webkit>1&&(navigator.userAgent.indexOf('iPad')>-1||navigator.userAgent.indexOf('iPhone')>-1||navigator.userAgent.indexOf('iPhone')>-1));if(iDevice){var slideshowConfig={containerId:elementID,width:w=='100%'?0:parseInt(0),height:parseInt(h)};var galleryConfig={};if(params['AlbumID']&&params['AlbumKey']){galleryConfig.albumId=params['AlbumID'];galleryConfig.albumKey=params['AlbumKey'];}else if(params['feedURL']&&params['feedURL'].length>0){var urlPieces=params['feedURL'].split('?');if(urlPieces.length!=2){urlPieces=params['feedURL'].split('%3F');}
if(urlPieces.length==2){var queryPieces=urlPieces[1].split('%2526');var queryValues={};for(var i=0;i<queryPieces.length;i++){var queryPiece=queryPieces[i].split('=');if(queryPiece.length!=2){queryPiece=queryPieces[i].split('%3D');}
if(queryPiece.length==2){queryValues[queryPiece[0].toLowerCase()]=queryPiece[1].toLowerCase();}}
if(queryValues.type){switch(queryValues.type){case'userkeyword':galleryConfig.galleryType='Keyword';if(queryValues.nickname){galleryConfig.userNickName=queryValues.nickname;}
if(queryValues.data){galleryConfig.galleryTypeData=queryValues.data;}
break;case'nicknamerecentphotos':galleryConfig.galleryType='Recent';if(queryValues.nickname){galleryConfig.userNickName=queryValues.nickname;}else if(queryValues.data){galleryConfig.userNickName=queryValues.data;}
break;case'nicknamepopular':galleryConfig.galleryType='Popular';galleryConfig.scope='all';if(queryValues.nickname){galleryConfig.userNickName=queryValues.nickname;}else if(queryValues.data){galleryConfig.userNickName=queryValues.data;}
break;}}}}
var slideshow=new SM.Slideshow.Html5Slideshow(slideshowConfig,galleryConfig);slideshow.play();}else{for(var i in params){args+=i+"="+params[i]+"&amp;";}
objectHTML='<div style="width: '+w+'; height: '+h+';"><object width="'+w+'" height="'+h+'" align="middle"><param name="movie" value="/ria/ShizamSlides-'+SM.appVersion['ShizamSlides']+'.swf?'+args+'" /><param name="wmode" value="transparent" /><embed src="/ria/ShizamSlides-'+SM.appVersion['ShizamSlides']+'.swf?'+args+'" wmode="transparent" width="'+w+'" height="'+h+'" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/><\/object></div>';YD.get(elementID).innerHTML=objectHTML;}
return 1;};SM.flash.insertFlashIntoElement=function(elementID,w,h,src,params){var args="noTagBacks=true&amp;";for(var i in params){args+=i+"="+params[i]+"&amp;";}
YD.get(elementID).innerHTML='<div style="width: '+w+'; height: '+h+';"><object width="100%" height="100%" align="middle"><param name="movie" value="'+src+'?'+args+'" /><param name="wmode" value="transparent" /><param name="allowFullScreen" value="true" /><embed src="'+src+'?'+args+'" wmode="transparent" allowFullScreen="true" width="'+w+'" height="'+h+'" type="application/x-shockwave-flash" allowScriptAccess="always" allowNetworking="all"/><\/object></div>';return 1;};SM.FB=function(){return{init:function(fncSuc,fncFail){YAHOO.util.Get.script('http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php',{timeout:10,onSuccess:function(){FB.init(SM.APIKey['fbConnect'],"/services/fbconnect/xd_receiver.htm");if(typeof fncSuc=='function')fncSuc();},onFailure:function(){if(typeof fncFail=='function')fncFail();},onTimeout:function(){if(typeof fncFail=='function')fncFail();}});},login:function(fncSuc){FB.Connect.requireSession(function(){if(typeof fncSuc=='function')fncSuc();});},logout:function(fncSuc){FB.Connect.logout(function(){if(typeof fncSuc=='function')fncSuc();});}};}();var createSWF=SM.flash.insertSlideshow;try{YAHOO.widget.Button.prototype._onMenuClick=function(p_sType,p_aArgs){var oItem=p_aArgs[1],oSrcElement;if(oItem){if(YD.hasClass(oItem.element,'yuimenuitem-hassubmenu')){YE.preventDefault(p_aArgs);YE.stopPropagation(p_aArgs);YE.stopEvent(p_aArgs);}
this.set("selectedMenuItem",oItem);oSrcElement=this.get("srcelement");if(oSrcElement&&oSrcElement.type=="submit"){this.submitForm();}}};}catch(e){}
function previewToggle(state){var handleSuccess=function(o){if(o.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(o.responseText);}
catch(e){alert("Invalid result data");}
if(result.status=="success"){location.reload(true);}
else{alert("Preview mode failed, please refresh and try again.");}}}
var handleFailure=function(o){}
var callback={success:handleSuccess,failure:handleFailure,scope:this};var postObj={'method':'preview','toggle':state}
var tmpArray=new Array();for(var i in postObj){tmpArray.push(i+'='+postObj[i]);}
var toolRequest=YAHOO.util.Connect.asyncRequest('POST','/rpc/tools.mg',callback,tmpArray.join('&'));}
(function(){function RequestManager(singletonKey){if(singletonKey!=RequestManager.singletonKey){alert('Please call RequestManager.getInstance() instead.');return;}else{this.init();}}
RequestManager.prototype={__events:null,__subscribers:null,cache:null,init:function(){this.cache=[];},JSON:window.JSON||window.YAHOO&&YAHOO.lang&&YAHOO.lang.JSON||{parse:function(){alert('JSON tools missing!!!');},stringify:function(){alert('JSON tools missing!!!');}},XHR:function(options){if(window.jQuery&&jQuery.ajax){return jQuery.ajax(options);}else if(window.YAHOO&&YAHOO.util&&YAHOO.util.Connect){var data=options.data&&this.createQueryString(options.data)||undefined;var url=options.type.toUpperCase()=="GET"?options.url+"?"+data:options.url;return YAHOO.util.Connect.asyncRequest(options.type,url,{success:options.success,failure:options.failure},data);}else{if(options.data&&typeof options=='object'){var seed=new Date().getTime();options['rand'+seed]=seed;}
var data=options.data&&this.createQueryString(options.data)||undefined;var url=options.type.toUpperCase()=="GET"?options.url+"?"+data:options.url;var xhr=this.createXHR();xhr.open(options.type,url,options.username,options.password);xhr.onreadystatechange=function(){if((xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223){options.success(xhr,xhr.statusText);}else{options.failure(xhr,xhr.statusText);}}
xhr.send(data);return xhr;}},createGroup:function(groupName,scope){var manager=this;var group=this.cache[groupName];var JSON=this.JSON;if(!group){group=this.cache[groupName]={manager:manager,completed:0,succeeded:0,failed:0,attempted:0,requests:[],results:[],has:function(index,dv){return manager.has(groupName,index,dv);},text:function(index,dv){return manager.text(groupName,index,dv);},xml:function(index,dv){return manager.xml(groupName,index,dv);},json:function(index,dv){return manager.json(groupName,index,dv);},clear:function(){return manager.clear(groupName);}};group.onSuccess=this.createEvent(groupName+'.onSuccess',{scope:scope,throwErrors:RequestManager.debug});group.onFailure=this.createEvent(groupName+'.onFailure',{scope:scope,throwErrors:RequestManager.debug});group.onComplete=this.createEvent(groupName+'.onComplete',{scope:scope,throwErrors:RequestManager.debug});}
return group;},has:function(groupName,index){var group=this.group(groupName),result=false;if(group&&!!group.results[index]){result=true;}
return result;},group:function(groupName){return this.cache[groupName];},text:function(groupName,index,defaultValue){var result=null;if(this.has(groupName,index)){result=this.cache[groupName].results[index].responseText;}else{if(defaultValue){result=defaultValue;}}
return result;},xml:function(groupName,index,defaultValue){var result=null;if(this.has(groupName,index)){result=this.cache[groupName].results[index].responseXML;}else{if(defaultValue){result=defaultValue;}}
return result;},json:function(groupName,index,defaultValue){var result=null;if(this.has(groupName,index)){try{result=this.JSON.parse(this.cache[groupName].results[index].responseText);}
catch(e){if(defaultValue){result=defaultValue;}}}else{if(defaultValue){result=defaultValue;}}
return result;},clear:function(groupName){if(!this.cache[groupName]){return;}
for(var i in this.cache[groupName]){this.cache[groupName][i]=null;}
delete this.cache[groupName];},createQueryString:function(obj_or_array,encodeFn,forceEncode){var results=[];if(typeof obj_or_array=="object"){for(var i in obj_or_array){var key=i;var value=obj_or_array[i];if(encodeFn){value=encodeFn(value);}
results.push(key+"="+value);}}else if(typeof obj_or_array=="array"){for(var i=0;i<obj_or_array.length;i++){var string=obj_or_array[i];if(encodeFn&&forceEncode){var pair=string.split('=');string=pair[0]+'='+encodeFn(pair[1]);}
results.push(string);}}else{if(encodeFn&&forceEncode){results.push(obj_or_array.toString().split('&'),encodeFn,forceEncode);}else{results.push(obj_or_array.toString());}}
return results.join('&');},addXHR:function(options){var group=options.group&&this.createGroup(options.group)||null,callbacks;var manager=this;var callbacks={success:function(xhr,textStatus,fromjQuery){if(window.jQuery&&!fromjQuery)return;if(group){group.succeeded++;group.completed++;group.results.push(xhr);if(options.uniqueId){group.results[options.uniqueId]=xhr;}
group.manager.fireEvent(options.group+'.onSuccess',group);if(group.completed==group.attempted){group.manager.fireEvent(options.group+'.onComplete',group);}}
if(options.callback){try{if('success'in options.callback&&'function'==typeof options.callback.success){options.callback.success.call(manager,xhr,textStatus,fromjQuery);}else{options.callback.apply(manager,arguments);}}
catch(e){}}},complete:function(xhr,textStatus){if(options.callback&&'complete'in options.callback&&'function'==typeof options.callback.complete){options.callback.complete.apply(this,arguments);}else{if((xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223){this.success(xhr,textStatus,true);}}},failure:function(xhr,textStatus,errorThrown){if(group){group.failed++;group.completed++;group.manager.fireEvent(options.group+'.onFailure',group);if(group.completed==group.attempted){group.manager.fireEvent(options.group+'.onComplete',group);}}
if(options.callback){try{if('failure'in options.callback&&'function'==typeof options.callback.failure){options.callback.failure.call(manager,xhr,textStatus,fromjQuery);}else{options.callback.apply(manager,arguments);}}
catch(e){}}}};if(group){var index=group.requests.length;group.attempted++;}
var request=this.XHR({url:options.url,data:options.params,type:options.type,dataType:'text',success:callbacks.success,failure:callbacks.failure,complete:callbacks.complete});if(group){group.requests.push(request);if(options.uniqueId){group.requests[options.uniqueId]=request;}}},createXHR:function(){return RequestManager.createXHR();},get:function(url,params,groupKey_or_callBack,username,password){return RequestManager.get.apply(RequestManager,arguments);},post:function(url,params,groupKey_or_callBack,username,password){return RequestManager.post.apply(RequestManager,arguments);},head:function(url,params,groupKey_or_callBack,username,password){return RequestManager.head.apply(RequestManager,arguments);},request:function(method,url,params,groupKey_or_callBack,username,password){return RequestManager.request.apply(RequestManager,arguments);},subscribe:function(eventType,method,args,overrideContext){this.__events=this.__events||{};var event=this.__events[eventType];if(event){event.subscribe(method,args,overrideContext);}else{var subs=this.__subscribers=this.__subscribers||{};if(!subs[eventType]){subs[eventType]=[];}
subs[eventType].push({fn:method,obj:args,overrideContext:overrideContext});}},on:function(eventType,method,args,overrideContext){return this.subscribe(eventType,method,args,overrideContext);},subscribeOnce:function(eventType,method,args,overrideContext){var manager=this;function oneOff(){var event=manager.__events[eventType];var scope=overrideContext||event.scope||window;method.apply(scope,arguments);event.unsubscribe(oneOff,args);}
this.subscribe(eventType,oneOff,args,overrideContext);},once:function(eventType,method,args,overrideContext){return this.subscribeOnce(eventType,method,args,overrideContext);},unsubscribe:function(eventType,method,args){var events=this.__events=this.__events||{};if(eventType){var event=events[eventType];if(event){return event.unsubscribe(method,args);}}else{var ret=true;for(var i in events){if(eventType==i){ret=ret&&events[i].unsubscribe(method,args);}}
return ret;}
return false;},unsubscribeAll:function(eventType){return this.unsubscribe(eventType);},createEvent:function(eventType,options){var events=this.__events=this.__events||{};var opts=options||{};if(!events[eventType]){var scope=opts.scope||this;var throwErrors=opts.throwErrors||false;var event={scope:scope||window,throwErrors:throwErrors,type:eventType,subscribers:[],subscribe:function(fn,obj,overrideContext){this.subscribers.push({fn:fn,obj:obj||null,overrideContext:overrideContext});},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();}
var found=false;for(var i=0;i<this.subscribers.length;++i){var s=this.subscribers[i];if(s.fn===fn&&s.obj==obj||s.fn===fn){this._delete(i);found=true;}}
return found;},fire:function(){this.lastError=null;var errors=[],len=this.subscribers.length,args=Array.prototype.slice.call(arguments,0),ret=true,i,rebuild=false;var subs=this.subscribers.slice();for(i=0;i<len;++i){var subscriber=subs[i];if(subscriber){var scope=subscriber.overrideContext||this.scope;var param=null;if(args.length>0){param=args[0];}
try{ret=subscriber.fn.call(scope,param,subscriber.obj);}catch(e){this.lastError=e;if(this.throwErrors){throw e;}}
if(false===ret){break;}}}
return(ret!==false);},unsubscribeAll:function(){for(var i=this.subscribers.length-1;i>-1;i--){this._delete(i);}
this.subscribers=[];return l;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;}
this.subscribers.splice(index,1);}};this.__events[eventType]=event;this.__subscribers=this.__subscribers||{};var subscribers=this.__subscribers[eventType];if(subscribers){for(var i=0;i<subscribers.length;++i){event.subscribe(subscribers[i].fn,subscribers[i].obj,subscribers[i].overrideContext);}
subscribers.splice(0,subscribers.length);}}
return events[eventType];},fireEvent:function(eventType,arg1,arg2,etc){this.__events=this.__events||{};var event=this.__events[eventType];if(!event){return null;}
var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);}
return event.fire.apply(event,args);},hasEvent:function(type){return(this.__events&&this.__events[type]);}};RequestManager._events=[];RequestManager.createXHR=function(){var xhr;if(typeof XMLHttpRequest=="undefined"){try{xhr=new ActiveXObject("Msxml2.XMLHTTP.6.0");}catch(e){}
try{xhr=new ActiveXObject("Msxml2.XMLHTTP.3.0");}catch(e){}
try{xhr=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){}
try{xhr=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}
if(!xhr){throw new Error("This browser does not support XMLHttpRequest.");}}else{xhr=new XMLHttpRequest();}
return xhr;}
RequestManager.singletonKey="Yes you *could* fake this if you need to";RequestManager.getInstance=function(){if(!RequestManager._instance){RequestManager._instance=new RequestManager(RequestManager.singletonKey);}
return RequestManager._instance;}
RequestManager.get=function(url,params,groupKey_or_callBack,username,password){return RequestManager.request('GET',url,params,groupKey_or_callBack,username,password);}
RequestManager.post=function(url,params,groupKey_or_callBack,username,password){return RequestManager.request('POST',url,params,groupKey_or_callBack,username,password);}
RequestManager.head=function(url,params,groupKey_or_callBack,username,password){return RequestManager.request('HEAD',url,params,groupKey_or_callBack,username,password);}
RequestManager.request=function(type,url,params,groupKey_or_callBack,username,password){var rm=RequestManager.getInstance();if(!groupKey_or_callBack){var fullUrl=!params?url:[url,'?',rm.createQueryString(params)].join('');var xhr=rm.createXHR();xhr.open(type.toUpperCase(),fullUrl,false,username,password);xhr.send(null);if(xhr.status==200){return xhr.responseText;}}else{var complexKey=groupKey_or_callBack.split&&groupKey_or_callBack.split(':')||null;var groupKey=complexKey&&complexKey[0]||null;var uniqueId=complexKey&&complexKey[1]||null;var callBack=groupKey==null?groupKey_or_callBack:null;var options={type:type,url:url,params:params,group:groupKey,uniqueId:uniqueId,callback:callBack,username:username,password:password};return rm.addXHR(options);}}
RequestManager.debug=false;if(window.SM&&SM.util){SM.util.RequestManager=RequestManager;}else{window.RequestManager=RequestManager;}})();
SM.namespace('buttons');SM.namespace('menus');SM.menus.menuOpen=0;SM.menus.removeSubMenuHrefs=function(menu){var subMenuHrefs=YD.getElementsByClassName('yuimenuitemlabel-hassubmenu','a',menu.element);for(var j in subMenuHrefs){if(YAHOO.lang.hasOwnProperty(subMenuHrefs,j)){subMenuHrefs[j].href='javascript:void(0)';}}}
SM.menus.addOnClick=function(menuParts,onClickFn,scope){for(var i in menuParts){if(YAHOO.lang.hasOwnProperty(menuParts,i)){if(!menuParts[i].onclick&&menuParts[i].value){menuParts[i].onclick={'fn':onClickFn,'scope':scope};}
if(menuParts[i].submenu){SM.menus.addOnClick(menuParts[i].submenu.itemdata,onClickFn,scope);}}}}
SM.menus.disableItems=function(menuParts,matchTerm,disable){for(var i in menuParts){if(YAHOO.lang.hasOwnProperty(menuParts,i)){if(menuParts[i].value){if(menuParts[i].value==matchTerm||matchTerm=="*"){menuParts[i].cfg.setProperty("disabled",disable);}}
if(menuParts[i]._oSubmenu){SM.menus.disableItems(menuParts[i]._oSubmenu.itemData,matchTerm,disable);}}}}
SM.buttons.addPhotos=function(container,id,config){this.init(container,id,config);};SM.buttons.addPhotos.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'type':'gallery','lockedOut':false,'nickName':'','CategoryInfo':'','videoPlan':false};this.config=YAHOO.lang.merge(defaultConfig,config);if(!this.config.lockedOut){this.branchLoaded=new Array();var menu=new Array();if(this.config.type=='gallery'){menu.push([{'text':'To this Gallery','value':AlbumID,'onclick':{'fn':this.addPhotosTo,'obj':{'that':this,'albumId':AlbumID}}}]);}
menu.push([{'text':'New Gallery','url':'/gallery/create.mg?NickName='+this.config.nickName+this.config.CategoryInfo}]);menu.push([{'text':'Loading ...','url':'#','disabled':true}]);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Upload','container':this.container,'className':'sm-button sm-button-small addphotosButton glyphButton','type':'menu','lazyloadmenu':true,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();var groupCount=0;if(this.config.type=='gallery'){menu.setItemGroupTitle('Upload',groupCount++);}
menu.setItemGroupTitle('Create',groupCount++);menu.setItemGroupTitle('Or Select Existing Gallery',groupCount++);menu.subscribe('show',this.menuBranchOpen,{'that':this});menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;});menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;});},this,true);}
else{this.button=new YAHOO.widget.Button({'id':this.id,'label':'Upload','container':this.container,'className':'sm-button sm-button-small addphotosButton glyphButton','onclick':{'fn':this.lockedWarning}});YD.setStyle(this.id,'opacity',.5);}
this.uploadPanel=null;},lockedWarning:function(){alert('Your account appears to have expired. Simply update your credit card in your control panel to continue adding photos.');},menuBranchOpen:function(e,whoKnows,obj){var that=obj.that;if(this.parent===undefined){if(!that.branchLoaded['rootCat']){var groupMenu=this.getItemGroups().length-1;var Type='root';var TypeInfo='';var handleSuccess=function(o){if(o.responseText!==undefined){that.branchLoaded['rootCat']=true;var myMenu=eval('('+o.responseText+')');this.addItems(myMenu,groupMenu);this.removeItem(0,groupMenu);this._onBeforeShow();this.align();this.cfg.setProperty("scrollincrement",10);SM.menus.removeSubMenuHrefs(this);}}
var handleFailure=function(o){this.removeItem(0,1);this.addItem('No galleries found',groupMenu);}}}
else if(!that.branchLoaded[this.id]){if(this.id.indexOf('SubCat_')>-1){var Type='subCategory';}
else{var Type='category';}
var TypeInfo=this.id.split('_')[1];var handleSuccess=function(o){if(o.responseText!==undefined){that.branchLoaded[this.id]=true;var myMenu=eval('('+o.responseText+')');var menuBD=YD.getFirstChild(YD.get(this.id));if(myMenu.subCats){this.addItems(myMenu.subCats,0);var subCatItems=YD.getFirstChild(menuBD);if(!myMenu.galleries){this.removeItem(0,0);}}
if(myMenu.galleries){this.addItems(myMenu.galleries,0);this.removeItem(0,0);if(subCatItems){var ul=document.createElement('ul');menuBD.appendChild(ul);var menuItems=YD.getElementsByClassName('yuimenuitem','li',menuBD);var indexCount=0;for(var i in menuItems){if(!YD.hasClass(menuItems[i],'yuimenuitem-hassubmenu')&&!YD.hasClass(menuItems[i],'yuimenuitem-disabled')){ul.appendChild(menuItems[i]);menuItems[i].setAttribute('groupindex',1);menuItems[i].setAttribute('index',indexCount++);}}
var galleryItems=ul;}
else{var galleryItems=YD.getFirstChild(menuBD);}}
var firstClass='first-of-type';if(myMenu.subCats){var h6=document.createElement('h6');h6.innerHTML='SubCategories';YD.addClass(h6,firstClass);firstClass='';menuBD.insertBefore(h6,subCatItems);YD.addClass(subCatItems,'hastitle');}
if(myMenu.galleries){var h6=document.createElement('h6');h6.innerHTML='Galleries';YD.addClass(h6,firstClass);firstClass='';menuBD.insertBefore(h6,galleryItems);YD.addClass(galleryItems,'hastitle');}
this._onBeforeShow();this.align();SM.menus.removeSubMenuHrefs(this);}}
var handleFailure=function(o){this.removeItem(0,0);this.addItem('No galleries found',0);}}
if(Type){var callback={success:handleSuccess,failure:handleFailure,scope:this};var postData='Menu=categories&NickName='+that.config.nickName+'&Type='+Type+'&TypeInfo='+TypeInfo;var sUrl='/rpc/menus.mg';var menuRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}},addPhotosTo:function(p_sType,p_aArgs,obj){if(obj.albumId&&obj.that&&(!SM.util.getCookie('brandNewUploader')||SM.util.getCookie('brandNewUploader')=='simple')&&(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')||YD.hasClass(document.body,'journal_new'))){if(!obj.that.uploadPanel){obj.that.uploadPanel=new SM.Panels.UploadPanel('',{albumId:obj.albumId,videoPlan:obj.that.config.videoPlan});}
obj.that.uploadPanel.subscribe('close',function(e){if(YD.hasClass(document.body,'smugmug_ajax')){getPhotos();}else if(YD.hasClass(document.body,'allthumbs_stretch')){}else if(YD.hasClass(document.body,'journal_new')){}});obj.that.uploadPanel.show();}else{location.href='http://'+SM.hostConfig.mainHost+'/photos/new_add.mg?AlbumID='+(obj.albumId?obj.albumId:obj.value);}}};SM.buttons.share=function(container,id,config){this.init(container,id,config);};SM.buttons.share.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'disabled':false};this.config=YAHOO.lang.merge(defaultConfig,config);var menu=new Array();var socialArray=new Array();var CurrURL=location.href;var CurrURL=CurrURL.split("#");var CurrURL=encodeURIComponent(CurrURL[0]);socialArray.push({'text':'Digg this','value':'','url':'http://digg.com/submit?phase=2&url='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'Stumbleupon','value':'','url':'http://www.stumbleupon.com/submit?url='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'delicious','value':'','url':'http://del.icio.us/post?url='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'MySpace','value':'','url':'http://www.myspace.com/Modules/PostTo/Pages/?l=3&u='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'buzz up','value':'','url':'http://buzz.yahoo.com/buzz?targetUrl='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'Google','value':'','url':'http://www.google.com/bookmarks/mark?op=edit&bkmk='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'Technorati','value':'','url':'http://technorati.com/cosmos/search.html?url='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'},{'text':'Reddit','value':'','url':'http://reddit.com/submit?url='+(CurrURL)+'&title='+encodeURIComponent(document.title),'target':'_blank'});if(galleryStyle=='allthumbs_stretch'||galleryStyle=='journal_new'||galleryStyle=='journal'){menu.push([{'text':'Send an Email','value':'email','onclick':{'fn':this.pickPhoto,'scope':this}},{'text':'Get a Link','value':'forum','onclick':{'fn':this.pickPhoto,'scope':this}},{'text':'Be Social','value':'besocial','onclick':{'fn':this.pickPhoto,'scope':this}},{'text':'Social Bookmarking','submenu':{'id':'socialBookmarkingSubMenu','itemdata':socialArray}}]);}
else{menu.push([{'text':'Send an Email','value':'','onclick':{'fn':this.goShare}},{'text':'Get a Link','value':'forum','onclick':{'fn':this.getALink}},{'text':'Be Social','value':'','onclick':{'fn':this.beSocial}},{'text':'Social Bookmarking','submenu':{'id':'socialBookmarkingSubMenu','itemdata':socialArray}}]);}
if(this.config.owner){menu.push([{'text':'Show Off','value':'','onclick':{'fn':this.showOff}}]);}
this.button=new YAHOO.widget.Button({'id':this.id,'label':'Share','container':this.container,'className':'sm-button sm-button-small shareButton glyphButton menuButton share_button','type':'menu','lazyloadmenu':true,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();menu.setItemGroupTitle('Owner Only:',1);menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;SM.menus.removeSubMenuHrefs(this);});menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;});},this,true);},goShare:function(p_sType,p_aArgs,p_oItem){if(!pageOn){var pageOn=1;}
location.href='/gallery/share.mg?AlbumID='+AlbumID+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&how='+p_oItem.value+'&Page='+pageOn;},getALink:function(p_sType,p_aArgs,p_oItem){if(!pageOn){var pageOn=1;}
location.href='/gallery/getalink.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&how='+p_oItem.value+'&Page='+pageOn;},showOff:function(p_sType,p_aArgs,p_oItem){if(!pageOn){var pageOn=1;}
location.href='/gallery/showoff.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&Page='+pageOn;},beSocial:function(p_sType,p_aArgs,p_oItem){if(!pageOn){var pageOn=1;}
myPanel=new YAHOO.widget.Panel("myPanel",{width:"850px",height:"650px",x:parseInt((YD.getViewportWidth()/2)-425),y:10,constraintoviewport:false,underlay:"shadow",close:true,modal:true,draggable:false});myPanel.setHeader("Be Social ");myPanel.setBody('<iframe width="100%"  scrolling="no" height="100%" id="BeSocialFrame" name="RSIFrame" style="border: 0px;overflow: hidden"  frameborder="no"  frameborder="0"  src="http://'+SM.hostConfig.mainHost+'/gallery/besocial.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&Page='+pageOn+'"></iframe>');myPanel.render(document.body);myPanel.show();},disable:function(){if(this.button){this.config.disabled=true;YD.setStyle(this.button._button.parentNode.parentNode,'opacity',.5);}},enable:function(){if(this.button){this.config.disabled=false;YD.setStyle(this.button._button.parentNode.parentNode,'opacity',1);}},pickPhoto:function(p_sType,p_aArgs,p_oItem){this.pickedTool=p_oItem.value;switch(p_oItem.value){case'email':var boxCopy='Click on the photo you would like to email.';break;case'forum':var boxCopy='Click on the photo you would like to get a link for.';break;case'besocial':var boxCopy='Click on the photo you would like to be social with.';break;default:var boxCopy="Click on the photo you would like to "+p_oItem.cfg.getProperty('text').toLowerCase()+".";}
function dismissDialogue(){var myAnim=new YAHOO.util.Anim('pickPhotoDialogue_c',{top:{to:-200}},1,YAHOO.util.Easing.easeBoth);myAnim.animate();YE.removeListener(galleryStyle=='journal'?'journal':'photos','click',this.clickedObj);this.clickListeners=false;if(galleryStyle=='journal'&&SM.Gallery.toolSelectionEvent!='undefined'&&SM.Gallery.toolSelectionEvent){SM.Gallery.toolSelectionEvent.fire(new SM.Gallery.ToolSelectionEventData(false,''));}}
if(!YD.inDocument('pickPhotoDialogue')){this.pickPhotoDialogue=new YAHOO.widget.SimpleDialog("pickPhotoDialogue",{width:"300px",fixedcenter:false,visible:false,draggable:true,close:false,text:boxCopy,buttons:[{text:"Cancel",handler:dismissDialogue,isDefault:true,scope:this}],constraintoviewport:true});this.pickPhotoDialogue.setHeader("Choose a photo:");this.pickPhotoDialogue.render(document.body);YD.addClass(YD.getElementsByClassName('yui-button','span','pickPhotoDialogue'),'sm-button-small-smonly');this.pickPhotoDialogue.show();YD.setStyle('pickPhotoDialogue_c','zIndex','1000');YD.setStyle('pickPhotoDialogue_c','top','-200px');YD.setStyle('pickPhotoDialogue_c','left','25px');}
else{this.pickPhotoDialogue.setBody(boxCopy);}
if(!this.pickPhotoDialogue.clickListeners){YE.on(galleryStyle=='journal'?'journal':'photos','click',this.clickedObj,{'that':this});this.pickPhotoDialogue.clickListeners=true;}
var myAnim=new YAHOO.util.Anim('pickPhotoDialogue_c',{top:{to:25}},1,YAHOO.util.Easing.easeBoth);myAnim.animate();},clickedObj:function(e,obj){var tar=YE.getTarget(e);if(YD.hasClass(tar,'imgBorder')){var img=tar;}
if(YD.hasClass(tar,'moviePlayButton')){var img=YD.getPreviousSibling(tar);}
if(YD.hasClass(tar,'archiveButton')){var img=YD.getFirstChild(YD.getPreviousSibling(tar));}
if(img!==undefined){YE.stopEvent(e);obj.that.clickedSinglePhoto(e,{'that':obj.that,'img':img});}},closePickPhotoDialog:function(){var myAnim=new YAHOO.util.Anim('pickPhotoDialogue_c',{top:{to:-200}},1,YAHOO.util.Easing.easeBoth);myAnim.animate();YE.removeListener(galleryStyle=='journal'?'journal':'photos','click',this.clickedObj);this.pickPhotoDialogue.clickListeners=false;},clickedSinglePhoto:function(e,obj){if(obj.img){var img=obj.img;}
else{var img=this;}
var isMovie=false;var isArchive=false;if(YD.hasClass(YD.getNextSibling(img),'moviePlayButton')){isMovie=true;}
if(YD.hasClass(img,'vault_Thumb')||YD.hasClass(img,'vault_Tiny')||YD.hasClass(img,'vault_Small')){isArchive=true;}
if(img.src.indexOf('spacer.gif')>-1){var imgSrc=YD.getStyle(img,'backgroundImage');}
else{var imgSrc=img.src;}
var imgSrcPieces=imgSrc.split('/').pop().split('-')[0].split('_');var ImageID=imgSrcPieces[0];var ImageKey=imgSrcPieces[1];if(!pageOn){var pageOn=1;}
YE.stopEvent(e);switch(obj.that.pickedTool){case'email':location.href='/gallery/share.mg?AlbumID='+AlbumID+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&how='+obj.that.pickedTool+'&Page='+pageOn;break;case'forum':location.href='/gallery/getalink.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&how=forum&Page='+pageOn;break;case'besocial':var beSocialPanel=new YAHOO.widget.Panel("myPanel",{width:"850px",height:"650px",x:parseInt((YD.getViewportWidth()/2)-425),y:10,constraintoviewport:false,underlay:"shadow",close:true,modal:true,draggable:false});beSocialPanel.setHeader("Be Social ");beSocialPanel.setBody('<iframe width="100%"  scrolling="no" height="100%" id="BeSocialFrame" name="RSIFrame" style="border: 0px;overflow: hidden"  frameborder="no"  frameborder="0"  src="http://'+SM.hostConfig.mainHost+'/gallery/besocial.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&ImageID='+ImageID+'&ImageKey='+ImageKey+'&Page='+pageOn+'"></iframe>');beSocialPanel.render(document.body);beSocialPanel.show();obj.that.closePickPhotoDialog();break;}}};SM.buttons.mapThis=function(container,id,config){this.init(container,id,config);};SM.buttons.mapThis.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Map This','container':this.container,'className':'sm-button sm-button-small mapsButton glyphButton map_this','onclick':{'fn':this.goMap,'obj':{'that':this}}});},goMap:function(e,obj){window.open(obj.that.config.mapLink);}};SM.buttons.slideshow=function(container,id,config){this.init(container,id,config);};SM.buttons.slideshow.prototype={config:null,init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.ssDiv=YD.get(this.config.slideshowDiv);var iDevice=(YAHOO.env.ua.webkit>1&&(navigator.userAgent.indexOf('iPad')>-1||navigator.userAgent.indexOf('iPhone')>-1||navigator.userAgent.indexOf('iPhone')>-1));var that=this;this.button=new YAHOO.widget.Button({'id':this.id,'label':this.config.label?this.config.label:'Slideshow','container':this.container,'className':'sm-button sm-button-small slideshowButton glyphButton play_slideshow'});var openFullScreen=function(e){if(that.config.galleryInfo){var slideshowConfig={centerHorizontally:true,centerVertically:true,fullScreen:true};var slideshow=new SM.Slideshow.Html5Slideshow(slideshowConfig,that.config.galleryInfo);slideshow.open();slideshow.play();}};if(iDevice){this.button.on('click',openFullScreen);}else{YE.onAvailable(this.id,function(){YD.setStyle(this.ssDiv,'position','absolute');YD.setStyle(this.ssDiv,'top','0');YD.setStyle(this.ssDiv,'left','0');YD.setStyle(this.ssDiv,'pointer','cursor');YD.setStyle(this.ssDiv,'width',YD.get(this.id).offsetWidth+'px');YD.setStyle(this.ssDiv,'height',YD.get(this.id).offsetHeight+'px');YD.get(this.id).appendChild(this.ssDiv);if(Yua.gecko>0&&Yua.gecko<=1.8){setInterval(function(that){YD.setXY(that.ssDiv,YD.getXY(that.id));},1000,this);}
if(YD.hasClass(document.body,'slideshow')){this.flash=new SM.flash.Slideshow(this.ssDiv,'fullScreen',this.config.flashVars,'',slideData,'');}
else{this.flash=new SM.flash.Slideshow(this.ssDiv,'fullScreen',this.config.flashVars,'','',location.href);}
if(YD.hasClass(document.body,'filmstrip')){var tempFSdirection;YE.on(this.flash.swf(),'mouseover',function(){tempFSdirection=direction;direction=0;});YE.on(this.flash.swf(),'mouseout',function(){direction=tempFSdirection;});}},this,true);}},getFlash:function(){if(this.flash){return this.flash;}
else{return false;}}};SM.buttons.buyThisPhoto=function(container,id,config){this.init(container,id,config);};SM.buttons.buyThisPhoto.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Buy This Photo','container':this.container,'className':'sm-button sm-button-small','type':'push','onclick':{'fn':this.buyThisPhotoClick,'obj':{'that':this}}});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';},buyThisPhotoClick:function(e,obj){addCartSingle(obj.that.config.imageID,obj.that.config.imageKey);}};SM.buttons.viewingStyles=function(container,id,config){this.init(container,id,config);};SM.buttons.viewingStyles.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'pageType':'','pageID':'','nickName':''};var menu=new Array();var selectedStyleID=0;var checked=false;this.config=YAHOO.lang.merge(defaultConfig,config);if(this.config.selectedStyleID&&this.config.selectedStyleID>0){selectedStyleID=this.config.selectedStyleID;}
for(var i=0;i<this.config.styles.length;i++){checked=(selectedStyleID==this.config.styles[i].id)?true:false;menu.push({text:this.config.styles[i].name,'value':this.config.styles[i].id,'checked':checked,'onclick':{'fn':this.setViewingStyle,'scope':this}});}
this.button=new YAHOO.widget.Button({'id':this.id,'label':'Style','container':this.container,'className':'sm-button sm-button-small styleButton glyphButton','type':'menu','lazyloadmenu':false,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';},setViewingStyle:function(p_sType,p_aArgs,p_oItem){var styleValue=p_oItem.value;var fakeComboItem={value:styleValue};var fakeComboBox={selectedIndex:0,options:[fakeComboItem]};styleBarChange("Template",fakeComboBox);}};SM.buttons.themes=function(container,id,config){this.init(container,id,config);};SM.buttons.themes.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'previewingTheme':false,'pageType':'','pageID':'','nickName':''};this.config=YAHOO.lang.merge(defaultConfig,config);this.branchLoaded=new Array();var menu=new Array();if(this.config.previewingTheme){menu.push([{text:'Save Theme Choice','value':this.config.Theme.ThemeID,'onclick':{'fn':this.saveThemeChoice,'scope':this}},{text:'Go Back to Previous Theme','value':0,'onclick':{'fn':this.revertThemeChoice}}]);}
else{if(this.config.Theme.Name=='Default'){menu.push([{'text':'Default Theme','disabled':true}]);}
else{menu.push([{'text':'Revert to Default','value':1,'onclick':{'fn':this.pickedTheme,'scope':this}}]);}}
menu.push([{'text':'Loading ...','url':'#','disabled':true}]);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Themes','container':this.container,'className':'sm-button sm-button-small themesButton glyphButton','type':'menu','lazyloadmenu':true,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();var groupCount=0;if(this.config.previewingTheme){menu.setItemGroupTitle('Previewing: '+this.config.Theme.Name,groupCount++);}
else{menu.setItemGroupTitle('Current Theme: '+this.config.Theme.Name,groupCount++);}
menu.setItemGroupTitle('Pick a Theme',groupCount++);menu.subscribe('show',this.menuBranchOpen,{'that':this});menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;});menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;});if(this.config.previewingTheme){menu.cfg.applyConfig({context:[this.id,'tl','bl'],clicktohide:false});menu.show();menu.cfg.setProperty('maxheight',0);menu.align('tl','bl');}},this,true);},menuBranchOpen:function(e,whoKnows,obj){var that=obj.that;if(this.parent===undefined){if(!that.branchLoaded[this.id]){var groupMenu=this.getItemGroups().length-1;var handleSuccess=function(o){if(o.responseText!==undefined){that.branchLoaded[this.id]=true;var myMenu=eval('('+o.responseText+')');this.addItems(myMenu,groupMenu);this.removeItem(0,groupMenu);this._onBeforeShow();this.align();SM.menus.removeSubMenuHrefs(this);}}
var handleFailure=function(o){this.removeItem(0,groupMenu);this.addItem('No themes found',groupMenu);}
var callback={success:handleSuccess,failure:handleFailure,scope:this};var postData='Menu=themes&NickName='+that.config.nickName+'&ThemeID='+that.config.Theme.ThemeID;var sUrl='/rpc/menus.mg';var menuRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}}},pickedTheme:function(p_sType,p_aArgs,p_oItem){if(this.config.pageType=='AllPages'){this.saveThemeChoice(p_sType,p_aArgs,p_oItem);}
else{SM.util.setCookie('previewThemeID',p_oItem.value,1);location.reload();}},revertThemeChoice:function(p_sType,p_aArgs,p_oItem){SM.util.setCookie('previewThemeID',0,-365);location.reload();},saveThemeChoice:function(p_sType,p_aArgs,p_oItem){var menu=this.button.getMenu();if(this.config.pageType=='AllPages'){var themeID=p_oItem.value;var subMenus=menu.getSubmenus();for(var i in subMenus){var menuItems=subMenus[i].getItems();for(var i in menuItems){menuItems[i].cfg.setProperty('checked',false);}}
p_oItem.cfg.setProperty("checked",true);}
else{var themeID=this.config.Theme.ThemeID;}
pageWorking('Saving Theme Choice');var handleSuccess=function(o){if(o.responseText!==undefined){removePageWorking();var returnInfo=eval('('+o.responseText+')');if(returnInfo.info.Name=='default'){returnInfo.info.Name='Default';}
menu.setItemGroupTitle('Current Theme: '+returnInfo.info.Name,0);if(returnInfo.info.Name=='Default'){menu.addItems([{'text':'Default Theme','disabled':true}],0);}
else{menu.addItems([{'text':'Revert to Default','id':'revertDefault','value':1,'url':'#','onclick':{'fn':this.pickedTheme,'scope':this}}],0);}
menu.removeItem(0,0);if(this.config.pageType!='AllPages'){menu.removeItem(0,0);}
if(this.config.pageType=='AllPages'){YD.get('allPageThemeName').innerHTML=returnInfo.info.Name;}}}
var handleFailure=function(o){removePageWorking();}
var callback={success:handleSuccess,failure:handleFailure,scope:this};var postData='tool=saveTheme&nickName='+this.config.nickName+'&pageType='+this.config.pageType+'&pageID='+this.config.pageID+'&themeID='+themeID;var sUrl='/rpc/settings.mg';var menuRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}};SM.buttons.galleryTools=function(container,id,config){this.init(container,id,config);};SM.buttons.galleryTools.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'owner':false,'proTools':false,'cobranding':false,'Format':'JPG','hasVault':false,'albumFeatured':0,'communityTool':false,'pageType':'nonAlbum','nickName':''};this.config=YAHOO.lang.merge(defaultConfig,config);this.menuRendered=false;var menu=new Array();if(this.config.pageType!='nonGallery'){if(galleryStyle=='all_thumbs'||galleryStyle=='traditional'||galleryStyle=='journal'||galleryStyle=='allthumbs_stretch'||galleryStyle=='journal_new'){this.config.Format='JPG';var singleToolFn=this.pickPhoto;}
else{var singleToolFn=this.goToTool;}
var miniArray=new Array();miniArray.push({'text':'Crop','value':'newcrop','onclick':{'fn':singleToolFn,'scope':this}},{'text':'Make a Copy','value':'makecopy','onclick':{'fn':singleToolFn,'scope':this}});if(galleryStyle=='allthumbs_stretch'){miniArray.push({'text':'Hide/Unhide','value':'hide','onclick':{'fn':singleToolFn,'scope':this}});}
miniArray.push({'text':'Delete','value':'delete','onclick':{'fn':singleToolFn,'scope':this}});var moreArray=new Array();if(this.config.pageType=='Album'){moreArray.push({'text':'Replace','value':'replace','onclick':{'fn':singleToolFn,'scope':this}});}
if(galleryStyle=='all_thumbs'||galleryStyle=='traditional'||galleryStyle=='journal'||galleryStyle=='allthumbs_stretch'||galleryStyle=='journal_new'){moreArray.push({'text':'Edit with picnik.com','value':'picnik','onclick':{'fn':singleToolFn,'scope':this}});}
else{moreArray.push({'text':'Edit with picnik.com','value':'picnik','onclick':{'fn':SM.tools.picnik.open}});}
moreArray.push({'text':'Apply Color Effect','value':'color','onclick':{'fn':singleToolFn,'scope':this}});if(this.config.proTools){moreArray.push({'text':'Make into Watermark','value':'makewatermark','onclick':{'fn':singleToolFn,'scope':this}});moreArray.push({'text':'Make into Printmark','value':'makeprintmark','onclick':{'fn':singleToolFn,'scope':this}});}
moreArray.push({'text':'Edit Geography','value':'coordinates','onclick':{'fn':singleToolFn,'scope':this}},{'text':'Crop Thumbnail','value':'newthumb','onclick':{'fn':singleToolFn,'scope':this}});if(this.config.hasVault&&this.config.pageType=='Album'){moreArray.push({'text':'Attach Related Files','value':'addArchive','onclick':{'fn':singleToolFn,'scope':this}});}
if(this.config.pageType=='Album'){moreArray.push({'text':'Feature','value':'highlight','onclick':{'fn':singleToolFn,'scope':this}});}
moreArray.push({'text':'This is Me! (Bio Photo)','value':'thisisme','onclick':{'fn':singleToolFn,'scope':this}});miniArray.push({'text':'More','submenu':{'id':'thisPhotoMoreSubMenu','itemdata':moreArray}});menu.push(miniArray);var miniArray=new Array();miniArray.push({'text':'Caption \/ Keyword','value':'bulkcaption','onclick':{'fn':this.goToTool}});if(this.config.pageType=='Album'){miniArray.push({'text':'Move to Gallery','value':'splitbulk','onclick':{'fn':this.goToTool}},{'text':'Move to Multiple Galleries','value':'bulkmovegallery','onclick':{'fn':this.goToTool}});}
miniArray.push({'text':'Rotate','value':'rotatebulk','onclick':{'fn':this.goToTool}},{'text':'Delete','value':'newbulkdelete','onclick':{'fn':this.goToTool}});if(this.config.pageType=='Album'){var arrangeArray=new Array();arrangeArray.push({'text':'Arrange Photos','value':'newnewbulkmove','onclick':{'fn':this.goToTool}},{'text':'Drag to Arrange','value':'dragndrop','onclick':{'fn':this.goToTool}},{'text':'Arrange by Number','value':'bulkmove','onclick':{'fn':this.goToTool}},{'text':'Sort','value':'sort','onclick':{'fn':this.goToTool}});miniArray.push({'text':'Arrange','submenu':{'id':'manyPhotosArrangeSubMenu','itemdata':arrangeArray}});}
var moreArray=new Array();moreArray.push({'text':'Collect Photos','value':'collectPhotos','url':'\/photos\/picker.mg?tool=collect&url='+encodeURIComponent(location.href)});if(this.config.proTools){moreArray.push({'text':'Watermarking','value':'bulkwatermark','onclick':{'fn':this.goToTool}});}
moreArray.push({'text':'Apply Color Effect','value':'colorbulk','onclick':{'fn':this.goToTool}},{'text':'Adjust Thumbnails','value':'squareThumbs','onclick':{'fn':this.goToTool}},{'text':'Make SmugMungous Sizes','value':'makeXLarges','onclick':{'fn':this.goToTool}});miniArray.push({'text':'More','submenu':{'id':'manyPhotosMoreSubMenu','itemdata':moreArray}});menu.push(miniArray);if(this.config.pageType=='Album'){var miniArray=[];miniArray.push({'text':'Gallery Settings','url':'\/gallery\/settings.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey},{'text':'View Stats','url':'\/homepage\/newstats.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey});if(this.config.albumFeatured!=0){miniArray.push({'text':'Don\'t Feature Gallery','value':'unFeatureGallery','onclick':{'fn':this.goUnFeature,'scope':this}});}else{miniArray.push({'text':'Feature Gallery','value':'featureGallery','onclick':{'fn':this.goFeature,'scope':this}});}
if(this.config.proTools){miniArray.push({'text':'Set Prices','value':'proprices&Type=Album&AlbumID='+AlbumID+'&AlbumKey='+AlbumKey,'onclick':{'fn':this.goToTool}});}
var moreArray=new Array();if(this.config.communityTool){moreArray.push({'text':'Community Highlight','value':'featurecommunity','onclick':{'fn':this.goToTool}});}
moreArray.push({'text':'SmugVault','value':'SmugVault','url':'\/homepage\/smugvault.mg?browseOpen=1&AlbumID='+AlbumID+'&AlbumKey='+AlbumKey},{'text':'Remove Feature Photo','value':'unhighlight','onclick':{'fn':this.goToTool}},{'text':'Delete','value':'DeleteGallery','url':'\/gallery\/delete.mg?AlbumID='+AlbumID+'&AlbumKey='+AlbumKey});miniArray.push({'text':'More','submenu':{'id':'thisGalleryMoreSubMenu','itemdata':moreArray}});menu.push(miniArray);}}
var miniArray=new Array();miniArray.push({'text':'Go to Control Panel','url':'\/homepage\/controlpanel.mg?NickName='+this.config.nickName});if(this.config.cobranding){miniArray.push({'text':'Easy Customizer','value':'siteCustomization','url':'\/homepage\/sitecustomization.mg?NickName='+this.config.nickName});}
if(this.config.proTools){miniArray.push({'text':'View Sales History','value':'viewProSales','url':'\/sales\/history.mg?NickName='+this.config.nickName});}
menu.push(miniArray);if(this.config.pageType=='nonGallery'&&!this.config.proTools&&!this.config.cobranding){this.button=new YAHOO.widget.Button({'id':this.id,'label':'Control Panel','container':this.container,'className':'sm-button sm-button-small glyphButton toolsButton','onclick':{'fn':this.goToCP,'obj':{'that':this}}});}
else{this.button=new YAHOO.widget.Button({'id':this.id,'label':'Tools','container':this.container,'className':'sm-button sm-button-small glyphButton toolsButton','type':'menu','lazyloadmenu':true,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;this.menuRendered=true;SM.menus.removeSubMenuHrefs(this);},this,true);menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;});var titleCount=0;if(this.config.pageType!='nonGallery'){if(galleryStyle=='smugmug'){menu.setItemGroupTitle("This Photo",titleCount++);}
else{menu.setItemGroupTitle("One Photo",titleCount++);}
menu.setItemGroupTitle("Many Photos",titleCount++);if(this.config.pageType=='Album'){menu.setItemGroupTitle("This Gallery",titleCount++);}}
menu.setItemGroupTitle("My Account",titleCount);menu.subscribe('show',this.updateToolsMenu,{'that':this});},this,true);}},goToCP:function(e,obj){location.href='/homepage\/controlpanel.mg?NickName='+obj.that.config.nickName;},goUnFeature:function(){location.href='/homepage\/feature.mg?slot=Featured'+this.config.albumFeatured+'&nickName='+this.config.nickName+'&tool=nofeature&AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&backToGallery=true&hash='+(encodeURIComponent(location.hash));},goFeature:function(){location.href='/homepage\/feature.mg?nickName='+this.config.nickName+'&tool=feature&AlbumID='+AlbumID+'&AlbumKey='+AlbumKey+'&backToGallery=true&hash='+(encodeURIComponent(location.hash));},pickPhoto:function(p_sType,p_aArgs,p_oItem){this.pickedTool=p_oItem.value;switch(p_oItem.value){case'newcrop':var boxCopy='Click on the photo you would like to crop.';break;case'makecopy':var boxCopy='Click on the photo you would like to make a copy of.';break;case'hide':var boxCopy='Click on the photo you would like to hide/unhide.';break;case'delete':var boxCopy='Click on the photo for which you would like to delete.';break;case'color':var boxCopy='Click on the photo for which you would like to apply a color effect.';break;case'makeprintmark':var boxCopy='Click on the photo you would like to make into a printmark.';break;case'makewatermark':var boxCopy='Click on the photo you would like to make into a watermark.';break;case'coordinates':var boxCopy='Click on the photo for which you would like to edit geography.';break;case'newthumb':var boxCopy='Click on the photo for which you would like to crop the thumbnail.';break;case'highlight':var boxCopy='Click on the photo you would like to feature.';break;case'addArchive':var boxCopy='Click on the photo to which you would like to attach related files to.';break;case'thisisme':var boxCopy='Click on the photo that you would like to be your bio photo.';break;case'picnik':var boxCopy='Click on the photo that you would like to edit.';break;default:var boxCopy="Click on the photo you would like to "+p_oItem.cfg.getProperty('text').toLowerCase()+".";}
function dismissDialogue(){var myAnim=new YAHOO.util.Anim('pickPhotoDialogue_c',{top:{to:-200}},1,YAHOO.util.Easing.easeBoth);myAnim.animate();YE.removeListener(galleryStyle=='journal'?'journal':'photos','click',this.clickedObj);this.clickListeners=false;if(galleryStyle=='journal'&&SM.Gallery.toolSelectionEvent!='undefined'&&SM.Gallery.toolSelectionEvent){SM.Gallery.toolSelectionEvent.fire(new SM.Gallery.ToolSelectionEventData(false,''));}}
if(!YD.inDocument('pickPhotoDialogue')){this.pickPhotoDialogue=new YAHOO.widget.SimpleDialog("pickPhotoDialogue",{width:"300px",fixedcenter:false,visible:false,draggable:true,close:false,text:boxCopy,buttons:[{text:"Cancel",handler:dismissDialogue,isDefault:true,scope:this}],constraintoviewport:true});this.pickPhotoDialogue.setHeader("Choose a photo:");this.pickPhotoDialogue.render(document.body);YD.addClass(YD.getElementsByClassName('yui-button','span','pickPhotoDialogue'),'sm-button-small-smonly');this.pickPhotoDialogue.show();YD.setStyle('pickPhotoDialogue_c','zIndex','1000');YD.setStyle('pickPhotoDialogue_c','top','-200px');YD.setStyle('pickPhotoDialogue_c','left','25px');}
else{this.pickPhotoDialogue.setBody(boxCopy);}
if(!this.pickPhotoDialogue.clickListeners){YE.on(galleryStyle=='journal'?'journal':'photos','click',this.clickedObj,{'that':this});this.pickPhotoDialogue.clickListeners=true;if(galleryStyle=='journal'&&SM.Gallery.toolSelectionEvent!='undefined'&&SM.Gallery.toolSelectionEvent){SM.Gallery.toolSelectionEvent.fire(new SM.Gallery.ToolSelectionEventData(true,''));}}
var myAnim=new YAHOO.util.Anim('pickPhotoDialogue_c',{top:{to:25}},1,YAHOO.util.Easing.easeBoth);myAnim.animate();},closePickPhotoDialog:function(){var myAnim=new YAHOO.util.Anim('pickPhotoDialogue_c',{top:{to:-200}},1,YAHOO.util.Easing.easeBoth);myAnim.animate();YE.removeListener(galleryStyle=='journal'?'journal':'photos','click',this.clickedObj);this.pickPhotoDialogue.clickListeners=false;},clickedObj:function(e,obj){var tar=YE.getTarget(e);if(YD.hasClass(tar,'imgBorder')){var img=tar;}
if(YD.hasClass(tar,'moviePlayButton')){var img=YD.getPreviousSibling(tar);}
if(YD.hasClass(tar,'archiveButton')){var img=YD.getFirstChild(YD.getPreviousSibling(tar));}
if(img!==undefined){YE.stopEvent(e);obj.that.clickedSinglePhoto(e,{'that':obj.that,'img':img});}},clickedSinglePhoto:function(e,obj){if(obj.img){var img=obj.img;}
else{var img=this;}
var isMovie=false;var isArchive=false;if(YD.hasClass(YD.getNextSibling(img),'moviePlayButton')){isMovie=true;}
if(YD.hasClass(img,'vault_Thumb')||YD.hasClass(img,'vault_Tiny')||YD.hasClass(img,'vault_Small')){isArchive=true;}
if((isMovie||isArchive)&&(obj.that.pickedTool=='makeprintmark'||obj.that.pickedTool=='makewatermark'||obj.that.pickedTool=='newcrop'||obj.that.pickedTool=='color'||obj.that.pickedTool=='newthumb'||obj.that.pickedTool=='picnik')){if(isMovie){alert('Sorry, you can\'t use that tool on a movie.');}
else{alert('Sorry, you can\'t use that tool on an archive.');}
YE.stopEvent(e);return false;}
if(isMovie&&obj.that.pickedTool=='makecopy'){alert('Sorry, you can\'t use that tool on a movie.');YE.stopEvent(e);return false;}
if(isArchive&&(obj.that.pickedTool=='coordinates'||obj.that.pickedTool=='highlight'||obj.that.pickedTool=='thisisme')){alert('Sorry, you can\'t use that tool on an archive.');YE.stopEvent(e);return false;}
if(img.src.indexOf('spacer.gif')>-1){var imgSrc=YD.getStyle(img,'backgroundImage');}
else{var imgSrc=img.src;}
var imgSrcPieces=imgSrc.split('/').pop().split('-')[0].split('_');var ImageID=imgSrcPieces[0];var ImageKey=imgSrcPieces[1];if(obj.that.pickedTool=='picnik'){SM.tools.picnik.openSpecificImage(ImageID);YE.stopEvent(e);obj.that.closePickPhotoDialog();return false;}
if(obj.that.pickedTool=='hide'){hidePhoto(null,ImageID,ImageKey);YE.stopEvent(e);obj.that.closePickPhotoDialog();return false;}
YE.stopEvent(e);if(obj.that.pickedTool=='makeprintmark'){location.href='/printmarks/simple/make.mg?ImageID='+ImageID+'&ImageKey='+ImageKey+'&url='+encodeURIComponent(location.href);}else{location.href='/photos/tools.mg?ImageID='+ImageID+'&ImageKey='+ImageKey+'&tool='+obj.that.pickedTool+'&url='+encodeURIComponent(location.href);}},getFormat:function(){var fileFormat=this.config.Format;if(YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch')){fileFormat=photoInfo[ImageID].Format;}
else if(YD.hasClass(document.body,'filmstrip')){fileFormat=imageFormat[imageIndex[ImageID]];}
else if(YD.hasClass(document.body,'slideshow')){fileFormat=ImageFormat;}
return fileFormat;},quickUpdate:function(){if(this.menuRendered){var menu=this.button.getMenu();if(YD.getStyle(menu.id,'visibility')=='visible'){var fileFormat=this.getFormat();var menuItems=menu.getItems();for(var i in menuItems){this.itemCheck(menuItems[i],fileFormat);}
var subMenus=menu.getSubmenus();for(var i in subMenus){var menuItems=subMenus[i].getItems();for(var i in menuItems){this.itemCheck(menuItems[i],fileFormat);}}}}},updateToolsMenu:function(e,whoKnows,obj){var that=obj.that;var fileFormat=that.getFormat();var menuItems=this.getItems();for(var i in menuItems){that.itemCheck(menuItems[i],fileFormat);}},itemCheck:function(menuItem,fileFormat){menuItem.cfg.setProperty("disabled",false);var itemValue=menuItem.value;if((YD.hasClass(document.body,'smugmug_ajax')||YD.hasClass(document.body,'allthumbs_stretch'))&&!photoInfo[ImageID].canEdit){if(itemValue=='newcrop'||itemValue=='makecopy'||itemValue=='replace'||itemValue=='picnik'||itemValue=='color'||itemValue=='thisisme'||itemValue=='coordinates'||itemValue=='newthumb'||itemValue=="makewatermark"||itemValue=='makeprintmark'||itemValue=="addArchive"){menuItem.cfg.setProperty("disabled",true);};}
if(YD.hasClass(document.body,'smugmug_ajax')){if(itemValue=='delete'){menuItem.cfg.setProperty("text","Delete");if(photoInfo[ImageID].Origin=="Collected"){menuItem.cfg.setProperty("text","Remove");}
else if(photoInfo[ImageID].Origin=="Smart"){menuItem.cfg.setProperty("text","Can't Remove Smart Gallery Photo");menuItem.cfg.setProperty("disabled",true);}}}
if(YD.hasClass(document.body,'smugmug_ajax')&&photoInfo[ImageID].Origin!="Album"){if(itemValue=='makecopy'||itemValue=='picnik'||itemValue=='makeprintmark'||itemValue=='makewatermark'){menuItem.cfg.setProperty("disabled",true);}}
if((fileFormat==="MPG"||fileFormat==="MP4"||fileFormat==="ARC")&&(itemValue=='makeprintmark'||itemValue=='makewatermark'||itemValue=='newcrop'||itemValue=='color'||itemValue=='newthumb'||itemValue=='picnik')){menuItem.cfg.setProperty("disabled",true);}
if((fileFormat==="MPG"||fileFormat==="MP4")&&(itemValue=='makecopy')){menuItem.cfg.setProperty("disabled",true);}
if((fileFormat==="MPG"||fileFormat==="MP4")&&itemValue=='replace'){menuItem.cfg.setProperty("text","Replace Video Preview Image");}
else if(itemValue=='replace'){menuItem.cfg.setProperty("text","Replace");}
if(fileFormat==="ARC"&&(itemValue=='coordinates'||itemValue=='highlight'||itemValue=='thisisme')){menuItem.cfg.setProperty("disabled",true);}
if(!this.config.owner){if(itemValue=='delete'||itemValue=='newbulkdelete'||itemValue=='SmugVault'||itemValue=='DeleteGallery'||itemValue=='viewProSales'){menuItem.cfg.setProperty("disabled",true);}}},goToTool:function(p_sType,p_aArgs,p_oItem){if(p_oItem.value=='makeprintmark'){location.href='/printmarks/simple/make.mg?ImageID='+ImageID+'&ImageKey='+ImageKey+'&url='+encodeURIComponent(location.href);}else{location.href='/photos/tools.mg?ImageID='+ImageID+'&ImageKey='+ImageKey+'&tool='+p_oItem.value+'&url='+encodeURIComponent(location.href);}}};SM.buttons.keyTools=function(container,id,config){this.init(container,id,config);};SM.buttons.keyTools.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var menu=new Array();menu.push({'text':'Edit Captions &amp; Keywords','value':'bulkcaption','onclick':{'fn':this.goToTool}});this.button=new YAHOO.widget.Button({'id':this.id,'label':'Tools','container':this.container,'className':'sm-button sm-button-small glyphButton toolsButton','type':'menu','lazyloadmenu':true,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;this.menuRendered=true;},this,true);menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;});},this,true);},goToTool:function(p_sType,p_aArgs,p_oItem){location.href='/photos/tools.mg?ImageID='+ImageID+'&ImageKey='+ImageKey+'&tool='+p_oItem.value+'&url='+encodeURIComponent(location.href);},quickUpdate:function(){}};SM.buttons.buy=function(container,id,config){this.init(container,id,config);};SM.buttons.buy.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'showOwnerBuy':false,'nglazeURL':'','disableSingleImagePrint':false,'batchAddExtra':'','pageType':'gallery','nglazeType':'Gallery','freeTrial':false,'nickName':''};this.config=YAHOO.lang.merge(defaultConfig,config);this.productPanelInfo=new Array();var menu=new Array();if(this.config.pageType=='gallery'){var topMenu=[{'text':'This Photo','value':'buySingle','disabled':this.config.disableSingleImagePrint,'onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Photos in this Gallery','value':'buyGallery','onclick':{'fn':this.buyMenuClick,'scope':this}}];if(this.config.allowGuestCards){topMenu.push({'text':'Create a Card','value':'buyCard','onclick':{'fn':this.buyMenuClick,'scope':this}});}
menu.push(topMenu);if(this.config.hasPackages){menu[menu.length-1].push({text:'Photo Package',value:'buyPackage',onclick:{fn:this.buyPackage,scope:this}});}
if(this.config.bulkBuyDownloads){menu[menu.length-1].push({text:'All Digital Downloads',value:'bulkBuyDownloads',onclick:{fn:this.bulkBuyDownloads,scope:this}});}
if(this.config.showOwnerBuy){var miniArray=new Array();miniArray.push({'text':'Create a Book','value':'buyBook','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Create a Card','value':'buyCard','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Create a Calendar','value':'buyCalendar','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Create a Collage','value':'buyPoster','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Create an Animoto Video','value':'animotoVideo','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Mounting and Framing','value':'buyFraming','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'The Gift of SmugMug','value':'giftOfSmug','onclick':{'fn':this.buyMenuClick,'scope':this}});if(this.config.nglazeURL!=''){miniArray.push({'disabled':true,'text':this.config.nglazeType+' Backup','value':'buyBackup','onclick':{'fn':this.buyMenuClick,'scope':this}});}
if(this.config.freeTrial){miniArray.push({'text':'Pay for Your Account','value':'endTrial','onclick':{'fn':this.buyMenuClick,'scope':this}});}
menu.push(miniArray);var otherServices=new Array();otherServices.push({'text':'Business Cards','value':'bizCards','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Post Production','value':'postProduction','onclick':{'fn':this.buyMenuClick,'scope':this}},{'text':'Scanning','value':'scanning','onclick':{'fn':this.buyMenuClick,'scope':this}});menu.push(otherServices);}}
else{menu.push({'text':'The Gift of SmugMug','value':'giftOfSmug','onclick':{'fn':this.buyMenuClick,'scope':this}},{'disabled':true,'text':this.config.nglazeType+' Backup','value':'buyBackup','onclick':{'fn':this.buyMenuClick,'scope':this}});if(this.config.freeTrial){menu.push({'text':'Pay for Your Account','value':'endTrial','onclick':{'fn':this.buyMenuClick,'scope':this}});}}
var lazyloadmenu=false;if(this.config.pageType!='gallery'){lazyloadmenu=true;}
this.button=new YAHOO.widget.Button({'id':this.id,'label':'Buy','container':this.container,'className':'sm-button sm-button-small menuButton buyButton','type':'menu','lazyloadmenu':lazyloadmenu,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();if(this.config.pageType=='gallery'&&this.config.showOwnerBuy){var menuBD=menu.body;if(this.config.pageType=='gallery'){var ul=YD.getNextSibling(YD.getFirstChild(menuBD));}
else{var ul=YD.getFirstChild(menuBD);}
var otherServicesUL=YD.getLastChild(menuBD);var h6=document.createElement('h6');h6.innerHTML='Owner Buy';menuBD.insertBefore(h6,ul);YD.addClass(ul,'hastitle');if(this.config.pageType!='gallery'){YD.addClass(h6,'first-of-type');}
var h6=document.createElement('h6');h6.innerHTML='Other Services';menuBD.insertBefore(h6,otherServicesUL);YD.addClass(otherServicesUL,'hastitle');if(this.config.pageType!='gallery'){YD.addClass(h6,'first-of-type');}}
else{menu.setItemGroupTitle('Owner Buy',0);}
menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;if(!photoInfo[ImageID].canEdit){var children=YD.getChildren(this.button.getMenu().body);if(children.length>=5){var hideThese=children.slice(1,5);}
YD.setStyle(hideThese,'display','none');}
SM.menus.removeSubMenuHrefs(this);},this,true);menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;var children=YD.getChildren(this.button.getMenu().body);if(children.length>=5){var hideThese=children.slice(1,5);}
YD.setStyle(hideThese,'display','block');},this,true);},this,true);},buyPackage:function(p_sType,p_aArgs,p_oItem){var albumId=/\/(\d+)_\w+#?/.exec(document.location);if(albumId){albumId=albumId[1];}
SM.packages.PackageChooser({userId:this.config.userId,album:albumId});},buyMenuClick:function(p_sType,p_aArgs,p_oItem){switch(p_oItem.value){case'buySingle':addCartSingle(ImageID,ImageKey);break;case'buyGallery':location.href='http://'+SM.hostConfig.mainHost+'/cart/batchadd.mg?url='+encodeURIComponent(location.href)+this.config.batchAddExtra;break;case'buyBook':var popUp=true;var postObj={popup:'productBooks',nickName:this.config.nickName}
var productTitle='<h1>Two choices for bookstore-quality books with your SmugMug photos.</h1><p>Order products through SmugMug\'s partners and get seamless access to all your SmugMug photos.</p>';var panelHeight=500;break;case'buyFraming':var popUp=true;var postObj={popup:'productFraming',nickName:this.config.nickName,ImageID:ImageID,ImageKey:ImageKey,AlbumID:AlbumID,AlbumKey:AlbumKey}
var productTitle='<h1>Flaunt your photos.</h1><p>Order products through SmugMug\'s partners and get seamless access to all your SmugMug photos.</p>';var panelHeight=500;break;case'buyCalendar':var popUp=true;var postObj={popup:'productCalendars',nickName:this.config.nickName}
var productTitle='<h1>Create a beautiful photo calendar with MyCanvas.</h1>';var panelHeight=330;break;case'buyPoster':var popUp=true;var postObj={popup:'productPosters',nickName:this.config.nickName}
var productTitle='<h1>Create magic on a poster with MyCanvas.</h1>';var panelHeight=500;break;case'buyCard':location.href='/photos/tools.mg?ImageID='+ImageID+'&Type=Album&tool=newcard&ImageKey='+ImageKey;break;case'buyBackup':location.href=this.config.nglazeURL;break;case'endTrial':location.href='/endtrial.mg';break;case'giftOfSmug':location.href='/photo-sharing/gift-subscriptions';break;case'animotoVideo':var animotoPanel=new SM.Panels.AnimotoPanel('animotoPanel',{albumID:AlbumID,albumKey:AlbumKey});animotoPanel.show();return;case'postProduction':var postProductionPanel=new SM.Panels.PostProductionPanel('postProductionPanel',{});postProductionPanel.show();return;case'bizCards':var bizCardsPanel=new SM.Panels.BizCardsPanel('bizCardsPanel',{});bizCardsPanel.show();return;case'scanning':var scanningPanel=new SM.Panels.ScanningPanel('scanningPanel',{});scanningPanel.show();return;default:}
if(popUp){if(!YD.inDocument('productsPanel')){this.productPanel=new YAHOO.widget.Panel("productsPanel",{'underlay':'shadow','visible':false,'draggable':false,'constraintoviewport':true,'fixedcenter':true,'modal':true,'width':'800px','zIndex':9000});this.productPanel.hideEvent.subscribe(function(o){this.panelBD.innerHTML='<h2 style="text-align: center; margin-top: 120px;"><em>Loading ...</em></h2>';},this,true);this.productPanel.setHeader(productTitle+'<hr />');this.productPanel.setBody('<div id="productPanelBD"><h2 style="text-align: center; margin-top: 120px;"><em>Loading ...</em></h2></div>');this.productPanel.render(document.body);this.panelBD=YD.get('productPanelBD');}
else{this.productPanel.setHeader(productTitle+'<hr />');this.panelBD.innerHTML='<h2 style="text-align: center; margin-top: 120px;"><em>Loading ...</em></h2>';}
YD.setStyle(this.panelBD,'height',panelHeight+'px');this.productPanel.show();if(!this.productPanelInfo[postObj.popup]){var handleSuccess=function(o){if(o.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(o.responseText);}
catch(e){alert("Invalid result data");}
this.productPanelInfo[postObj.popup]=result.info;this.panelBD.innerHTML=this.productPanelInfo[postObj.popup];if(!this.scrollBar){YD.setStyle(this.panelBD,'overflow','hidden');this.scrollBar=new SM.cart.UI.ScrollBar(this.panelBD,{'mouseWheel':true});}
else{this.scrollBar.resize(true,true,.01);}}}
var handleFailure=function(o){}
var callback={success:handleSuccess,failure:handleFailure,scope:this};var tmpArray=new Array();for(var i in postObj){tmpArray.push(i+'='+postObj[i]);}
var menuRequest=YAHOO.util.Connect.asyncRequest('POST','/rpc/popups.mg',callback,tmpArray.join('&'));}
else{this.panelBD.innerHTML=this.productPanelInfo[postObj.popup];this.scrollBar.resize(true,true,.01);}}},bulkBuyDownloads:function(){if(SM.pageDetails&&SM.pageDetails.Album){var bulkAddDownloadPanel=new SM.Panels.BulkAddDownload('bulkBuyDownloadPanel',{albumID:AlbumID,albumKey:AlbumKey,href:location.href});bulkAddDownloadPanel.show();}},disableSingleBuy:function(){this.button.getMenu().getItem(0).cfg.setProperty('disabled',true);},enableSingleBuy:function(){this.button.getMenu().getItem(0).cfg.setProperty('disabled',false);}};SM.buttons.viewCart=function(container,id,config){this.init(container,id,config);};SM.buttons.viewCart.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.button=new YAHOO.widget.Button({'id':this.id,'label':'View Cart','container':this.container,'className':'sm-button sm-button-small cartButton glyphButton','onclick':{'fn':this.goToCart,'obj':{'config':config}}});},goToCart:function(e,obj){if(YAHOO.env.ua.ie){location.href=SM.hostConfig.cartUrl+'?back2shop='+obj.config.back2Shop;}else{location.href=SM.hostConfig.cartUrl;}}};SM.buttons.visitorView=function(container,id,config){this.init(container,id,config);};SM.buttons.visitorView.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Visitor View','container':this.container,'className':'sm-button sm-button-small','onclick':{'fn':this.previewPage,'obj':{'that':this}}});},previewPage:function(e,obj){previewToggle(1);}};SM.buttons.homeLayout=function(container,id,config){this.init(container,id,config);};SM.buttons.homeLayout.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={'nickName':'','VideoAccount':false,'ProAccount':false};this.config=YAHOO.lang.merge(defaultConfig,config);var viewBy=this.config.ViewBy;if(viewBy=='Categories'){viewBy='Gallery Categories';}
var menu=new Array();var menuItems=new Array();menuItems.push({'text':'Your Bio','value':'Bio','checked':this.config.Bio,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Slideshow','value':'SlideshowBox','checked':this.config.SlideshowBox,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Single Photo'+(this.config.VideoAccount?' or Video':''),'value':'PhotoVideoBox','checked':this.config.PhotoVideoBox,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Photo Communities','value':'Communities','checked':this.config.Communities,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Photo Timeline','value':'Dates','checked':this.config.Dates,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Featured Galleries','value':'Featured','checked':this.config.Featured,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Friends &amp; Family','value':'FriendsAndFamily','checked':this.config.FriendsAndFamily,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':viewBy,'value':'Galleries','checked':this.config.Galleries,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Top Keywords','value':'Keywords','checked':this.config.Keywords,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Most Popular Photos','value':'PhotoRank','checked':this.config.PhotoRank,'onclick':{'fn':this.menuClick,'scope':this}});menuItems.push({'text':'Recent Photos','value':'RecentPhotosBox','checked':this.config.RecentPhotosBox,'onclick':{'fn':this.menuClick,'scope':this}});if(this.config.ProAccount){menuItems.push({'text':'Featured Events','value':'EventsBox','checked':this.config.EventsBox,'onclick':{'fn':this.menuClick,'scope':this}});}
menuItems.push({'text':'Around the World','value':'SmugMaps','checked':this.config.SmugMaps,'onclick':{'fn':this.menuClick,'scope':this}});menu.push(menuItems);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Homepage Layout','container':this.container,'className':'sm-button sm-button-small menuButton homepageLayoutButton','type':'menu','lazyloadmenu':false,'menu':menu});this.button.MENUBUTTON_DEFAULT_TITLE='';this.button.MENUBUTTON_MENU_VISIBLE_TITLE='';YE.onAvailable(this.id,function(){var menu=this.button.getMenu();menu.subscribe('show',function(p_sType,p_aArgs){SM.menus.menuOpen++;});menu.subscribe('hide',function(p_sType,p_aArgs){SM.menus.menuOpen--;});},this,true);},menuClick:function(p_sType,p_aArgs,p_oItem){if(p_oItem.cfg.getProperty('checked')){p_oItem.cfg.setProperty('checked',false);SM.tools.homepageBoxes.toggleBox(p_oItem.value,0);}
else{p_oItem.cfg.setProperty('checked',true);SM.tools.homepageBoxes.show(p_oItem.value);}},setChecked:function(menuItemValue,checkedBool){var menu=this.button.getMenu();var menuItems=menu.getItems();for(var i in menuItems){if(menuItems[i].value==menuItemValue){menuItems[i].cfg.setProperty('checked',checkedBool);}}}};SM.buttons.contactUs=function(container,id,config){this.init(container,id,config);};SM.buttons.contactUs.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.button=YD.get(this.id);YAHOO.util.Event.addListener(this.id,"click",this.onClickContactUs,{'that':this});},onClickContactUs:function(e,obj){var contactUsPanelHeight=580;var ownerNickName=obj.that.config.ownerNickName?obj.that.config.ownerNickName:"";var postObj={popup:obj.that.config.popupName?obj.that.config.popupName:'contactUs',currentPage:escape(obj.that.config.currentPage),currentPageOverride:obj.that.config.currentPageOverride,referringPage:escape(obj.that.config.referringPage),pro:obj.that.config.pro,ownerNickName:ownerNickName,albumID:obj.that.config.albumID?obj.that.config.albumID:''}
if(!YD.inDocument('contactUsPanel'+obj.that.config.uniqueID)){this.contactUsPanel=new YAHOO.widget.Panel("contactUsPanel"+obj.that.config.uniqueID,{'underlay':'shadow','visible':false,'draggable':true,'constraintoviewport':true,'fixedcenter':'contained','modal':obj.that.config.modal,'width':obj.that.config.width,'zIndex':9000});this.contactUsPanel.hideEvent.subscribe(function(o){this.contactUsPanelBD.innerHTML='<h2 style="text-align: center; margin-top: 120px;"><em>Loading ...</em></h2>';},this,true);this.contactUsPanel.setHeader('<h1>'+obj.that.config.panelTitle+'</h1>');this.contactUsPanel.setBody('<div id="contactUsPanelBD"><h2 style="text-align: center; margin-top: 120px;"><em>Loading ...</em></h2></div>');this.contactUsPanel.render(document.body);this.contactUsPanelBD=YD.get('contactUsPanelBD');this.contactUsFormBD=YD.get('contactUsForm');}
else{this.contactUsPanel.setHeader('<h1>'+obj.that.config.panelTitle+'</h1>');this.contactUsPanelBD.innerHTML='<h2 style="text-align: center; margin-top: 120px;"><em>Loading ...</em></h2>';}
YD.setStyle(this.contactUsPanelBD,'height',contactUsPanelHeight+'px');this.contactUsPanel.center();this.contactUsPanel.show();var tempPanel=function(o){return o;}
if(!this.contactUsHTML){var handleSuccess=function(o){if(o.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(o.responseText);}
catch(e){alert("Invalid result data");}
this.contactUsHTML=result.info;this.contactUsPanelBD.innerHTML=this.contactUsHTML;var cancelButton=new YAHOO.widget.Button({'id':'cancelMailButton','label':'Cancel','type':'link','container':'sendMailButtonWrapper','className':'','onclick':{'fn':this.closeContactUs,'obj':{'contactUsPanel':tempPanel(this.contactUsPanel)}}});SM.buttons.sendMailButton=new SM.buttons.sendMail('sendMailButtonWrapper','sendMailButton',{'contactUsPanel':tempPanel(this.contactUsPanel)});cancelButton._button.style.cursor="pointer";SM.buttons.sendMailButton.button._button.style.cursor="pointer";if(!this.scrollBar){YD.setStyle(this.contactUsPanelBD,'overflow','hidden');}}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};var tmpArray=new Array();for(var i in postObj){tmpArray.push(i+'='+postObj[i]);}
var menuRequest=YAHOO.util.Connect.asyncRequest('POST','/rpc/popups.mg',callback,tmpArray.join('&'));}
else{this.contactUsPanelBD.innerHTML=this.contactUsHTML;var cancelButton=new YAHOO.widget.Button({'id':'cancelMailButton','label':'Cancel','type':'link','container':'sendMailButtonWrapper','className':'','onclick':{'fn':this.closeContactUs,'obj':{'contactUsPanel':tempPanel(this.contactUsPanel)}}});SM.buttons.sendMailButton=new SM.buttons.sendMail('sendMailButtonWrapper','sendMailButton',{'contactUsPanel':tempPanel(this.contactUsPanel)});}
this.closeContactUs=function(e,obj){obj.contactUsPanel.hide();}}};SM.buttons.sendMail=function(container,id,config){this.init(container,id,config);};SM.buttons.sendMail.prototype={init:function(container,id,config){this.container=YD.get(container);this.id=id||YD.generateId();var defaultConfig={};this.config=YAHOO.lang.merge(defaultConfig,config);this.button=new YAHOO.widget.Button({'id':this.id,'label':'Send','type':'link','container':this.container,'className':'','onclick':{'fn':this.onClickSendMail,'obj':{'that':this}}});},onClickSendMail:function(e,obj){this.validate=function(emailFrom,emailSubject,emailBody){var isValid=true;var validClassName='contactUsFormName';var invalidClassName='contactUsFormAlert';if(emailFrom.length<5){YD.get('emailLabel').className=invalidClassName;isValid=false;}
else{var emailRegEx=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;if(!emailFrom.match(emailRegEx)){YD.get('emailLabel').className=invalidClassName;isValid=false;}
else{YD.get('emailLabel').className=validClassName;}}
if(emailSubject.length<1){YD.get('subjectLabel').className=invalidClassName;isValid=false;}
else{YD.get('subjectLabel').className=validClassName;}
if(emailBody.length<1){YD.get('problemLabel').className=invalidClassName;isValid=false;}
else{YD.get('problemLabel').className=validClassName;}
return isValid;}
this.closeContactUs=function(e){YAHOO.util.Event.preventDefault(e);obj.that.config.contactUsPanel.hide();}
if(YD.inDocument('contactUsForm')){this.emailFrom=YD.get('Email').value;this.emailSubject=YD.get('Subject').value;this.emailBody=YD.get('Problem').value;this.emailHiddenValues=YD.get('HiddenValues').value;this.ownerNickName=YD.get('ownerNickName')?YD.get('ownerNickName').value:"";if(this.validate(this.emailFrom,this.emailSubject,this.emailBody)){obj.that.button.set('disabled',true);this.contactUsFormBD=YD.get('contactUsForm');var postObj={popup:'contactUsConfirmation',emailFrom:encodeURIComponent(this.emailFrom),emailSubject:encodeURIComponent(this.emailSubject),emailBody:encodeURIComponent(this.emailBody),emailHiddenValues:encodeURIComponent(this.emailHiddenValues),ownerNickName:encodeURIComponent(this.ownerNickName)};var handleSuccess=function(o){if(o.responseText!==undefined){try{var result=YAHOO.lang.JSON.parse(o.responseText);}
catch(e){alert("Invalid result data");}
this.contactUsConfirmationHTML=result.info;this.contactUsFormBD.innerHTML=this.contactUsConfirmationHTML;this.closeButton=new YAHOO.widget.Button("closeContactUs");this.closeButton.on("click",this.closeContactUs);}};var handleFailure=function(o){};var callback={success:handleSuccess,failure:handleFailure,scope:this};var tmpArray=new Array();for(var i in postObj){tmpArray.push(i+'='+postObj[i]);}
var menuRequest=YAHOO.util.Connect.asyncRequest('POST','/rpc/popups.mg',callback,tmpArray.join('&'));}}}}
SM.buttons.GenericGalleryMenu=function(id,config){this.init(id,config);};SM.buttons.GenericGalleryMenu.prototype={init:function(id,config){var _buttonID=id;var _galleriesPopulated=false;var _galleryMenuOpen=0;var _defaulConfig={buttonText:'',nickName:'',showGalleries:true,categoryPickable:false};var _config=YAHOO.lang.merge(_defaulConfig,config);var _type=_config.type;var _showGalleries=_config.showGalleries;var _categoryPickable=_config.categoryPickable;var _nickName=_config.nickName;var _galleryMenu=new YAHOO.widget.Button(_buttonID,{label:_config.buttonText&&_config.buttonText.length>0?_config.buttonText:'Galleries',type:'menu'});var _mnu=new YAHOO.widget.Menu(YD.generateId(),{lazyload:true});_mnu.addItems([{text:'Loading ...',url:'#',disabled:true}]);_mnu.render(document.body);_galleryMenu.set('menu',_mnu);_galleryMenu.MENUBUTTON_DEFAULT_TITLE='';_galleryMenu.MENUBUTTON_MENU_VISIBLE_TITLE='';_galleryMenu.branchLoaded=[];_galleryMenu.addPhotosTo=_config.gallerySelectedCallback;YE.onAvailable(_buttonID,function(){var menu=_galleryMenu.getMenu();menu.subscribe('show',_galleryMenuBranchOpen,{'that':_galleryMenu});menu.subscribe('show',function(p_sType,p_aArgs){_galleryMenuOpen++;});menu.subscribe('hide',function(p_sType,p_aArgs){_galleryMenuOpen--;});},_galleryMenu,true);var _galleryMenuBranchOpen=function(e,whoKnows,obj){var that=obj.that;if(this.parent===undefined){if(!that.branchLoaded['rootCat']){var Type='root';var TypeInfo='';var handleSuccess=function(o){if(o.responseText!==undefined){that.branchLoaded['rootCat']=true;var myMenu=eval('('+o.responseText+')');this.addItems(myMenu);this.removeItem(0);this._onBeforeShow();this.align();this.cfg.setProperty("scrollincrement",10);SM.menus.removeSubMenuHrefs(this);}};var handleFailure=function(o){this.removeItem(0);this.addItem('No galleries found');};}}
else if(!that.branchLoaded[this.id]){if(this.id.indexOf('SubCat_')>-1){var Type='subCategory';}
else{var Type='category';}
var TypeInfo=this.id.split('_')[1];var handleSuccess=function(o){if(o.responseText!==undefined){that.branchLoaded[this.id]=true;var myMenu=eval('('+o.responseText+')');var menuBD=YD.getFirstChild(YD.get(this.id));if(myMenu.subCats){this.addItems(myMenu.subCats,0);var subCatItems=YD.getFirstChild(menuBD);if(!myMenu.galleries){this.removeItem(0,0);}}
if(myMenu.galleries){this.addItems(myMenu.galleries,0);this.removeItem(0,0);if(subCatItems){var ul=document.createElement('ul');menuBD.appendChild(ul);var menuItems=YD.getElementsByClassName('yuimenuitem','li',menuBD);var indexCount=0;for(var i in menuItems){if(!YD.hasClass(menuItems[i],'yuimenuitem-hassubmenu')&&!YD.hasClass(menuItems[i],'yuimenuitem-disabled')){ul.appendChild(menuItems[i]);menuItems[i].setAttribute('groupindex',1);menuItems[i].setAttribute('index',indexCount++);}}
var galleryItems=ul;}
else{var galleryItems=YD.getFirstChild(menuBD);}}
var firstClass='first-of-type';if(myMenu.subCats){var h6=document.createElement('h6');h6.innerHTML='SubCategories';YD.addClass(h6,firstClass);firstClass='';menuBD.insertBefore(h6,subCatItems);YD.addClass(subCatItems,'hastitle');}
if(myMenu.galleries){var h6=document.createElement('h6');h6.innerHTML='Galleries';YD.addClass(h6,firstClass);firstClass='';menuBD.insertBefore(h6,galleryItems);YD.addClass(galleryItems,'hastitle');}
this._onBeforeShow();this.align();SM.menus.removeSubMenuHrefs(this);}}
var handleFailure=function(o){this.removeItem(0,0);this.addItem('No galleries found',0);}}
if(Type){var callback={success:handleSuccess,failure:handleFailure,scope:this};var postData='Menu=categories&Type='+Type+'&TypeInfo='+TypeInfo+'&OutputType='+_type+'&ShowGalleries='+_showGalleries+'&CategoryPickable='+_categoryPickable+(_nickName.length>0?'&NickName='+_nickName:'');var sUrl='/rpc/menus.mg';var menuRequest=YAHOO.util.Connect.asyncRequest('POST',sUrl,callback,postData);}};this.setLabel=function(label){_galleryMenu.set('label',label);};this.setDisabled=function(disabled){_galleryMenu.set('disabled',disabled);};this.get=function(property){return _galleryMenu.get(property);};}};SM.namespace("tools");SM.tools.picnik={init:function(){SM.tools.picnik.object=new YAHOO.widget.Panel("picnikOverlay",{'underlay':'none','close':false,'visible':false,'draggable':false,'constraintoviewport':true,'fixedcenter':true,'modal':((navigator.userAgent.toLowerCase().indexOf("mac")&&Yua.gecko!=0&&Yua.gecko<1.9)?false:true),'zIndex':9000});},open:function(){if(SM.tools.picnik.object==undefined){SM.tools.picnik.init();}
SM.tools.picnik.object.setBody('<iframe id="picnik-iframe" frameborder="0" scrolling="no" width="'+parseInt(YD.getViewportWidth()-50)+'" height="'+parseInt(YD.getViewportHeight()-50)+'" src="/services/picnik/proxy.mg?ImageID='+ImageID+'"></iframe>');SM.tools.picnik.object.render(document.body);SM.tools.picnik.object.show();YE.on(window,'resize',SM.tools.picnik.resize);},openSpecificImage:function(imageID){if(SM.tools.picnik.object==undefined){SM.tools.picnik.init();}
SM.tools.picnik.object.setBody('<iframe id="picnik-iframe" frameborder="0" scrolling="no" width="'+parseInt(YD.getViewportWidth()-50)+'" height="'+parseInt(YD.getViewportHeight()-50)+'" src="/services/picnik/proxy.mg?ImageID='+imageID+'"></iframe>');SM.tools.picnik.object.render(document.body);SM.tools.picnik.object.show();YE.on(window,'resize',SM.tools.picnik.resize);},close:function(id,key){try{if(id!=undefined&&key!=undefined){if(YD.hasClass(document.body,'smugmug_ajax')){if(id!=ImageID){ImageID=id;}
if(key!=ImageKey){ImageKey=key;}
setTimeout(function(){SM.history.add(ImageID+'_'+ImageKey);SM.tools.picnik.object.hide();},200);}
else{if(id!=ImageID){SM.tools.picnik.object.hide();}
else{window.location.reload();}}}
else{SM.tools.picnik.object.hide();}}
catch(e){alert(e)}},resize:function(){var obj=YD.get('picnik-iframe');obj.width=parseInt(YD.getViewportWidth()-50);obj.height=parseInt(YD.getViewportHeight()-50);SM.tools.picnik.object.center();}};function print_r(theObj){if(theObj.constructor==Array||theObj.constructor==Object){document.write("<ul>")
for(var p in theObj){if(theObj[p].constructor==Array||theObj[p].constructor==Object){document.write("<li>["+p+"] => "+typeof(theObj)+"</li>");document.write("<ul>")
print_r(theObj[p]);document.write("</ul>")}else{document.write("<li>["+p+"] => "+theObj[p]+"</li>");}}
document.write("</ul>")}}
(function(){SM.namespace('Data');var Dom=YAHOO.util.Dom;var Event=YAHOO.util.Event;var Lang=YAHOO.lang;var RPC_GALLERY_PATH='/rpc/gallery.mg';var RPC_IMAGE_PATH='/rpc/image.mg';var _galleryDataManagerInstance=null;var _imageDataManagerInstance=null;SM.Data.GalleryDataManager=function(){if(_galleryDataManagerInstance){return _galleryDataManagerInstance;}else{this._init();}};SM.Data.GalleryDataManager.prototype={_rpcGalleryManager:null,galleryData:{},_init:function(){this._rpcGalleryManager=new SM.util.SimpleAjaxCache(RPC_GALLERY_PATH);this.createEvent('load');this.createEvent('failure');_galleryDataManagerInstance=this;},getGalleryData:function(request,callback){var _defaultRequest={tool:'galleryData',galleryType:'',galleryTypeData:'',viewingStyle:'',imageId:0,albumId:0,albumKey:'',userNickName:'',scope:'',orderBy:'',communityId:0,numberOfImagesPerPage:10,pageNumber:0,mainImageSize:'Small',thumbSize:'Tiny'};var _request=YAHOO.lang.merge(_defaultRequest,request);var subscribe=function(loaded,failure,that){that._rpcGalleryManager.subscribe('load',loaded,that);that._rpcGalleryManager.subscribe('failure',failure,that);};var unsubscribe=function(that){that._rpcGalleryManager.unsubscribe('load');that._rpcGalleryManager.unsubscribe('failure');};var loaded=function(data,that){unsubscribe(that);that.galleryData=that._rpcGalleryManager.data;that.fireEvent('load');if(callback&&callback.success){callback.success(that._rpcGalleryManager.data);}};var failure=function(data,that){unsubscribe(that);that.fireEvent('failure');if(callback&&callback.failure){callback.failure();}};subscribe(loaded,failure,this);this._rpcGalleryManager.loadPost(_request);}};Lang.augmentProto(SM.Data.GalleryDataManager,YAHOO.util.EventProvider);SM.Data.ImageDataManager=function(){if(_imageDataManagerInstance){return _imageDataManagerInstance;}else{var _rpcImageManager=new SM.util.SimpleAjaxCache(RPC_GALLERY_PATH);var _rpcExifManager=new SM.util.SimpleAjaxCache(RPC_IMAGE_PATH);this.getImageData=function(imageId,imageKey,callback){var _request={tool:'imageData',imageId:0,imageKey:''};var subscribe=function(loaded,failure){_rpcImageManager.subscribe('load',loaded,this);_rpcImageManager.subscribe('failure',failure,this);};var unsubscribe=function(){_rpcImageManager.unsubscribe('load');_rpcImageManager.unsubscribe('failure');};var loaded=function(){unsubscribe();callback.success(_rpcImageManager.data);};var failure=function(){unsubscribe();callback.failure();};_request.imageId=imageId;_request.imageKey=imageKey;subscribe(loaded,failure);_rpcImageManager.loadPost(_request);};this.getExifData=function(imageId,imageKey,callback){var _request={method:'getExif',imageId:0,imageKey:''};var subscribe=function(loaded,failure){_rpcExifManager.subscribe('load',loaded,this);_rpcExifManager.subscribe('failure',failure,this);};var unsubscribe=function(){_rpcExifManager.unsubscribe('load');_rpcExifManager.unsubscribe('failure');};var loaded=function(){unsubscribe();callback.success(_rpcExifManager.data);};var failure=function(){unsubscribe();callback.failure();};_request.imageId=imageId;_request.imageKey=imageKey;subscribe(loaded,failure);_rpcExifManager.loadPost(_request);};_imageDataManagerInstance=this;}};}());
(function(){var Dom=YAHOO.util.Dom;var Event=YAHOO.util.Event;var Lang=YAHOO.lang;var Widget=YAHOO.widget;SM.namespace('Slideshow');SM.Slideshow.instances=[];SM.Slideshow.fullScreenOpen=new YAHOO.util.CustomEvent('SlideshowFullScreenOpen',window,false,YAHOO.util.CustomEvent.FLAT);SM.Slideshow.fullScreenClose=new YAHOO.util.CustomEvent('SlideshowFullScreenClose',window,false,YAHOO.util.CustomEvent.FLAT);SM.Slideshow.Html5Slideshow=function(config,galleryConfig){this._init(config,galleryConfig);};SM.Slideshow.Html5Slideshow.prototype={_defaultConfig:{containerId:'',slide1Id:'',slide2Id:'',image1Id:'',image2Id:'',width:700,height:500,centerHorizontally:true,centerVertically:true,fullScreen:false},_defaultGalleryConfig:{tool:'galleryData',galleryType:'Album',galleryTypeData:'',viewingStyle:'',imageId:0,albumId:0,albumKey:'',userNickName:'',scope:'',orderBy:'',communityId:0,numberOfImagesPerPage:10,pageNumber:0,mainImageSize:'Small',thumbSize:'Tiny'},_init:function(config,galleryConfig){this._config=Lang.merge(this._defaultConfig,config);this._galleryConfig=Lang.merge(this._defaultGalleryConfig,galleryConfig);this._container=Dom.get(this._config.containerId);this._containerWidth=0;this._containerHeight=0;this._slide1=null;this._slide2=null;this._image1=null;this._image2=null;this._largestSize='Small';this._ready=false;this._playing=false;this._playingQueued=false;this._currentSlideIndex=-1;this._images={};this._totalImages=0;this._totalImagesLoaded=0;this._currentLoadedPage=1;this._totalPages=1;this._imagesPerPage=10;this._imagesOnPage=0;this._preLoadedImages={};this._currentSlide=0;this._slideLoop=null;this._secondsOnSlide=0;this._slideDelaySeconds=3;this._loadGalleryDataInProgress=false;this._pagesRequested={};this._customImageSize='';this._overlay=null;this._overlayId='';this._fullScreenOpen=false;this._controlBar=null;this._closeLink=null;this._initDomElements();this._initEventListeners();SM.Slideshow.instances.push(this);},_initDomElements:function(){if(this._config.fullScreen){var viewPortWidth=Dom.getViewportWidth();var viewPortHeight=Dom.getViewportHeight();if(viewPortHeight>viewPortWidth){viewPortHeight=viewPortWidth;}
this._overlayId=Dom.generateId();this._overlay=new Widget.Panel(this._overlayId,{close:false,draggable:false,visible:false,modal:true});this._config.containerId=Dom.generateId();this._container=document.createElement('div');this._container.id=this._config.containerId;this._container.className='slideshow-container'+(this._config.fullScreen?' loading':'');Dom.setStyle(this._container,'width',viewPortWidth+'px');Dom.setStyle(this._container,'height',viewPortHeight+'px');this._containerWidth=viewPortWidth;this._containerHeight=viewPortHeight;}else{if(!Dom.hasClass(this._container,'slideshow-container')){Dom.addClass(this._container,'slideshow-container');if(this._config.fullScreen){Dom.addClass(this._container,'loading');}}
if(this._config.width>0){Dom.setStyle(this._container,'width',this._config.width+'px');}
Dom.setStyle(this._container,'height',this._config.height+'px');this._containerWidth=this._container.offsetWidth;this._containerHeight=this._container.offsetHeight;}
this._customImageSize=this._containerWidth+'x'+this._containerHeight;if(this._config.slide1Id.length>0&&this._config.slide2Id.length>0){this._slide1=Dom.get(this._config.slide1Id);this._slide2=Dom.get(this._config.slide2Id);if(!Dom.hasClass(this._slide1,'slide')){Dom.addClass(this._slide1,'slide');}
if(!Dom.hasClass(this._slide2,'slide')){Dom.addClass(this._slide2,'slide');}}else{var slides=document.createDocumentFragment();var slide1=document.createElement('div');var slide2=document.createElement('div');var image1=document.createElement('img');var image2=document.createElement('img');this._config.slide1Id=Dom.generateId();slide1.id=this._config.slide1Id;slide1.className='slide';this._config.slide2Id=Dom.generateId();slide2.id=this._config.slide2Id;slide2.className='slide';this._config.image1Id=Dom.generateId();image1.id=this._config.image1Id;this._config.image2Id=Dom.generateId();image2.id=this._config.image2Id;slide1.appendChild(image1);slide2.appendChild(image2);slides.appendChild(slide1);slides.appendChild(slide2);this._container.appendChild(slides);}
var protector=document.createElement('div');protector.className='protector';this._container.appendChild(protector);if(this._config.fullScreen){this._closeLink=document.createElement('a');this._closeLink.id=Dom.generateId();this._closeLink.className='close-link container-close';this._closeLink.href='#';this._closeLink.innerHTML='Close';this._controlBar=document.createElement('div');this._controlBar.id=Dom.generateId();this._controlBar.className='control-bar';this._controlBar.appendChild(this._closeLink);this._container.appendChild(this._controlBar);this._overlay.setBody(this._container);this._overlay.render(document.body);Dom.removeClass(this._overlayId,'yui-panel');}
this._slide1=Dom.get(this._config.slide1Id);this._slide2=Dom.get(this._config.slide2Id);this._image1=Dom.get(this._config.image1Id);this._image2=Dom.get(this._config.image2Id);Dom.setStyle(this._slide1,'width',this._containerWidth+'px');Dom.setStyle(this._slide1,'height',this._containerHeight+'px');Dom.setStyle(this._slide2,'width',this._containerWidth+'px');Dom.setStyle(this._slide2,'height',this._containerHeight+'px');},_initEventListeners:function(){var that=this;var handleAnimationEnd=function(e){if(Dom.hasClass(this,'dissolve-out')){Dom.removeClass(this,'in');Dom.removeClass(this,'dissolve-out');}
if(Dom.hasClass(this,'dissolve-in')){Dom.addClass(this,'in');Dom.removeClass(this,'dissolve-in');that._startSlideLoop();}};var handleContainerClick=function(e){if(that._config.fullScreen){that._showControlBar();}};var handleCloseLinkClick=function(e){Event.preventDefault(e);if(that._config.fullScreen){that.close();}};var handleFullScreenOpen=function(){that.pause();};var handleFullScreenClose=function(){that.play();};if(this._slide1&&this._slide2){Event.addListener(this._slide1,'webkitAnimationEnd',handleAnimationEnd);Event.addListener(this._slide2,'webkitAnimationEnd',handleAnimationEnd);}
if(this._config.fullScreen){Event.addListener(this._container,'click',handleContainerClick);Event.addListener(this._closeLink,'click',handleCloseLinkClick);}else{SM.Slideshow.fullScreenOpen.subscribe(handleFullScreenOpen);SM.Slideshow.fullScreenClose.subscribe(handleFullScreenClose);}},_removeDomElements:function(){if(this._container){while(this._container.hasChildNodes()){this._container.removeChild(this._container.childNodes[0]);}}},_removeEventListeners:function(){if(this._slide1&&this._slide2){Event.removeListener(this._slide1,'webkitAnimationEnd');Event.removeListener(this._slide2,'webkitAnimationEnd');}},_toggleControlBar:function(){if(this._controlBar&&Dom.hasClass(this._controlBar,'show')){this._hideControlBar();}else{this._showControlBar();}},_showControlBar:function(){var that=this;var handleTimeout=function(){that._hideControlBar();timeout.cancel();};if(this.controlBarTimeout){this.controlBarTimeout.cancel();}
if(this._controlBar){Dom.addClass(this._controlBar,'show');}
this.controlBarTimeout=Lang.later(4000,this,handleTimeout,null,false);},_hideControlBar:function(){if(this._controlBar){Dom.removeClass(this._controlBar,'show');}},_getImage:function(index){var page=Math.ceil((index+1)/this._imagesPerPage);var pageIndex=index-((page-1)*this._imagesPerPage);if(this._images[page]&&this._images[page][pageIndex]){return this._images[page][pageIndex];}else{return null;}},_loadGalleryData:function(page){var galleryInfo=this._galleryConfig;var galleryDataManager=new SM.Data.GalleryDataManager();var that=this;var handleGalleryDataLoad=function(e){that._loadGalleryDataInProgress=false;that._currentLoadedPage=this.galleryData.pageNumber;that._images[that._currentLoadedPage]=this.galleryData.images;that._totalImages=this.galleryData.totalNumberOfImages;that._totalPages=this.galleryData.numberOfPages;that._imagesOnPage=this.galleryData.numberOfImagesOnPage;that._totalImagesLoaded+=that._imagesOnPage;that._ready=true;var preLoadStartIndex=(that._currentLoadedPage-1)*that._imagesPerPage;var preLoadStopIndex=preLoadStartIndex+(that._imagesOnPage-1);galleryDataManager.unsubscribe('load');galleryDataManager.unsubscribe('failure');that._preLoadImages(preLoadStartIndex,preLoadStopIndex);if(that._playingQueued){that._play();}};var handleGalleryDataFailure=function(e){that._loadGalleryDataInProgress=false;that._images=[];galleryDataManager.unsubscribe('load');galleryDataManager.unsubscribe('failure');};galleryDataManager.subscribe('load',handleGalleryDataLoad);galleryDataManager.subscribe('failure',handleGalleryDataFailure);if(!this._loadGalleryDataInProgress){this._loadGalleryDataInProgress=true;galleryInfo.pageNumber=page;galleryInfo.numberOfImagesPerPage=this._imagesPerPage;galleryInfo.mainImageSize=this._customImageSize;this._pagesRequested[page]=true;galleryDataManager.getGalleryData(galleryInfo,null);}},_preLoadImages:function(startIndex,stopIndex){var preLoadImage=null;var currentImage=null;var that=this;var handleImageLoad=function(e,obj){var index=obj.index;Event.removeListener(this,'load');Event.removeListener(this,'error');Event.removeListener(this,'abort');that._preLoadedImages[index]=true;};var handleImageError=function(e,obj){var index=obj.index;Event.removeListener(this,'load');Event.removeListener(this,'error');Event.removeListener(this,'abort');that._preLoadedImages[index]=false;};for(var i=startIndex;i<=stopIndex;i++){currentImage=this._getImage(i);preLoadImage=new Image();preLoadImage.src=currentImage[this._customImageSize].src;Event.addListener(preLoadImage,'load',handleImageLoad,{'index':i});Event.addListener(preLoadImage,'error',handleImageError,{'index':i});Event.addListener(preLoadImage,'abort',handleImageError,{'index':i});}},_showSlide:function(index){var image=this._getImage(index);var backgroundCss='url('+image[this._customImageSize].src+')';var that=this;var inImage=null;var inSlide=null;var outSlide=null;var currentSlide=0;this._secondsOnSlide=0;this._currentSlideIndex=index;if(index===0){Dom.removeClass(this._container,'loading');}
Event.addListener((this._currentSlide<=1?this._image2:this._image1),'load',function(e,obj){if(that._config.centerHorizontally){Dom.setStyle(this,'margin-left',((that._containerWidth-this.width)/2)+'px');}
if(that._config.centerVertically){Dom.setStyle(this,'margin-top',((that._containerHeight-this.height)/2)+'px');}
Dom.addClass((that._currentSlide<=1?that._slide2:that._slide1),'dissolve-in');if(that._currentSlide!=0){Dom.addClass((that._currentSlide==1?that._slide1:that._slide2),'dissolve-out');}
that._currentSlide=that._currentSlide<=1?2:1;Event.removeListener(this,'load');});if((this._currentSlide<=1?this._image2:this._image1).src==image[this._customImageSize].src){Dom.addClass((this._currentSlide<=1?this._slide2:this._slide1),'dissolve-in');if(this._currentSlide!=0){Dom.addClass((this._currentSlide==1?this._slide1:this._slide2),'dissolve-out');}}else{(this._currentSlide<=1?this._image2:this._image1).src=image[this._customImageSize].src;}},_startSlideLoop:function(){if(this._ready){this._stopSlideLoop();this._slideLoop=Lang.later(1000,this,this._handleSlideLoop,null,true);}},_stopSlideLoop:function(){if(this._slideLoop){this._slideLoop.cancel();this._slideLoop=null;}},_handleSlideLoop:function(e){var nextIndex=this._currentSlideIndex+1;if(nextIndex>=this._totalImages||!this._getImage(nextIndex)){nextIndex=0;}
this._secondsOnSlide++;if(this._preLoadedImages[nextIndex]!==null){if(this._preLoadedImages[nextIndex]===true&&(this._secondsOnSlide>=this._slideDelaySeconds||this._currentSlideIndex<0)){this._stopSlideLoop();this._showSlide(nextIndex);}else if(this._preLoadedImages[nextIndex]===false){this._stopSlideLoop();this._currentSlideIndex=nextIndex;this._startSlideLoop();}
var nextPage=this._currentLoadedPage+1;if(this._currentLoadedPage<this._totalPages&&((this._totalImagesLoaded-1)-nextIndex)==5&&!this._pagesRequested[nextPage]){this._loadGalleryData(nextPage);}}},_play:function(){if(this._ready){this._playing=true;this._playingQueued=false;this._startSlideLoop();}else{this._playing=false;this._playingQueued=true;this._loadGalleryData(this._currentLoadedPage);}},_pause:function(){this._playing=false;this._playingQueued=false;this._stopSlideLoop();},open:function(){if(this._config.fullScreen&&!this._fullScreenOpen&&this._overlay){SM.Slideshow.fullScreenOpen.fire({});this._fullScreenOpen=true;this._overlay.show();Dom.addClass(this._overlayId+'_mask','black-out');}},close:function(){if(this._config.fullScreen&&this._fullScreenOpen&&this._overlay){this._pause();this._fullScreenOpen=false;this._overlay.hide();SM.Slideshow.fullScreenClose.fire({});}},play:function(){this._play();},pause:function(){this._pause();},remove:function(){this._pause();this._removeEventListeners();this._removeDomElements();if(this._config.fullScreen&&this._fullScreenOpen&&this._overlay){this._overlay.hide();}}};Lang.augmentProto(SM.Data.GalleryDataManager,YAHOO.util.EventProvider);}());