var sm_i18n=sm_i18n||{};sm_i18n.messages=sm_i18n.messages||{};if(typeof(SM)!=='undefined'&&SM.buttons&&SM.buttons.addCommentButton&&sm_i18n.messages.ButtonNewComment){SM.buttons.addCommentButton.setAttributes({label:sm_i18n.messages.ButtonNewComment},false);}
if(typeof(drawCommentsRPCResult)!=='undefined'){(function(){var translateDate=function(commentDate){var months={'Jan':sm_i18n.messages.CommentJan,'Feb':sm_i18n.messages.CommentFeb,'Mar':sm_i18n.messages.CommentMar,'Apr':sm_i18n.messages.CommentApr,'May':sm_i18n.messages.CommentMay,'Jun':sm_i18n.messages.CommentJun,'Jul':sm_i18n.messages.CommentJul,'Aug':sm_i18n.messages.CommentAug,'Sep':sm_i18n.messages.CommentSep,'Oct':sm_i18n.messages.CommentOct,'Nov':sm_i18n.messages.CommentNov,'Dec':sm_i18n.messages.CommentDec,'one':sm_i18n.messages.CommentOneYearAgo};var i18n_month=null;if(commentDate.length>=7&&(i18n_month=months[commentDate.substring(0,3)])){return parseInt(commentDate.substring(4,commentDate.length-2),10)+' '+i18n_month;}else{return commentDate;}};var old_drawCommentsRPCResult=drawCommentsRPCResult;sm_i18n.drawCommentsRPCResult=function(response){old_drawCommentsRPCResult(response);var commentsContainer=YD.get('comments');if(commentsContainer){var comments=YD.getChildrenBy(commentsContainer,function(e){return YD.hasClass(e,'box');});if(comments){var filterBoxTop=function(e){return YD.hasClass(e,'boxTop');};var filterDateSpan=function(e){return YD.hasClass(e,'title')&&e.innerHTML.search(/ *[A-Za-z]{3} +[0-9]+(th|st|nd) *$| *[a-z]+ *year.? *ago *$/)>-1;};for(var i=0;i<comments.length;i++){var boxTop=YD.getFirstChildBy(comments[i],filterBoxTop);if(boxTop){if(sm_i18n.messages.WroteAboutThis){boxTop.innerHTML=boxTop.innerHTML.replace(/wrote *about *this/,' '+sm_i18n.messages.WroteAboutThis+' ');}
if(sm_i18n.messages.WroteAboutPhoto){boxTop.innerHTML=boxTop.innerHTML.replace(/> *photo *</,'> '+sm_i18n.messages.WroteAboutPhoto+' <');}
if(sm_i18n.messages.WroteAboutGallery){boxTop.innerHTML=boxTop.innerHTML.replace(/> *gallery *</,'> '+sm_i18n.messages.WroteAboutPhoto+' <');}
if(sm_i18n.messages.WroteAboutOn){boxTop.innerHTML=boxTop.innerHTML.replace(/> *on *</,'> '+sm_i18n.messages.WroteAboutOn+' <');}
var dateSpan=YD.getFirstChildBy(boxTop,filterDateSpan);if(dateSpan){dateSpan.innerHTML=' '+translateDate(dateSpan.innerHTML)+' ';}}}}}
var sgc=YD.get('showGalleryComments');if(sgc&&sm_i18n.messages.HideGalleryComments){sgc.innerHTML=sgc.innerHTML.replace(/hide gallery comments/,sm_i18n.messages.HideGalleryComments);}
if(sgc&&sm_i18n.messages.GalleryCommentsHidden){sgc.innerHTML=sgc.innerHTML.replace(/[0-9]* *gallery comments hidden/,sm_i18n.messages.GalleryCommentsHidden);}
var cn=YD.get('comment_nav');if(cn&&sm_i18n.messages.CommentsPage){var span=YD.getFirstChildBy(cn,function(e){return YD.hasClass(e,'title');});if(span){span.innerHTML=span.innerHTML.replace(/page:/i,sm_i18n.messages.CommentsPage);}}};})();if(sm_i18n.drawCommentsRPCResult){drawCommentsRPCResult=sm_i18n.drawCommentsRPCResult;sm_i18n.drawCommentsRPCResult=null;}}
if(typeof(submitComment)!=='undefined'){(function(){var isProperImplementation=function(source){return source.search(/You must choose to either comment on the gallery or photo\./)>-1&&source.search(/You can not leave an empty comment\./)>-1&&source.search(/Submitting Comment/)>-1;};var functionSource=submitComment.toString();if(isProperImplementation(functionSource)){functionSource=functionSource.replace(/function +submitComment/,'function');if(sm_i18n.messages.CommentChoosePhotoOrGallery){functionSource=functionSource.replace(/You must choose to either comment on the gallery or photo\./,sm_i18n.protectQuotes(sm_i18n.messages.CommentChoosePhotoOrGallery));}
if(sm_i18n.messages.CommentCannotLeaveEmpty){functionSource=functionSource.replace(/You can not leave an empty comment\./,sm_i18n.protectQuotes(sm_i18n.messages.CommentCannotLeaveEmpty));}
if(sm_i18n.messages.SubmittingComment){functionSource=functionSource.replace(/Submitting Comment/,sm_i18n.messages.SubmittingComment);}
try{sm_i18n.submitComment=eval('submitComment='+functionSource);}catch(e){}}
if(!sm_i18n.submitComment){sm_i18n.submitComment=function(Type,TypeID,TypeKey){var postArray=[];postArray.tool='addComment';var submitThis=true;var commentType=YD.get('commentType');if(commentType){postArray.captchaType='Combined';if(commentType.value==='Image'){postArray.Type='Image';postArray.TypeID=ImageID;postArray.TypeKey=ImageKey;}else if(commentType.value==='Album'){postArray.Type='Album';postArray.TypeID=AlbumID;postArray.TypeKey=AlbumKey;}else{submitThis=false;if(sm_i18n.messages.CommentChoosePhotoOrGallery){alert(sm_i18n.messages.CommentChoosePhotoOrGallery);}else{alert("You must choose to either comment on the gallery or photo. asdjf");}}}else{postArray.captchaType=Type;postArray.Type=Type;postArray.TypeID=TypeID;postArray.TypeKey=TypeKey;}
if(!YD.inDocument('noCaptchaNeeded')){postArray.Captcha=YD.get('AlbumCaptcha').value;}
postArray.Rating=YD.get('albumCommentRating').value;postArray.Comment=YD.get('albumComment').value;if(YD.inDocument('albumCommentName')){postArray.Name=YD.get('albumCommentName').value;}
if(YD.inDocument('albumCommentLink')){postArray.Email=YD.get('albumCommentLink').value;}
if(SM.util.trimString(postArray.Comment)===''){if(sm_i18n.messages.CommentCannotLeaveEmpty){alert(sm_i18n.messages.CommentCannotLeaveEmpty);}else{alert('You can not leave an empty comment.');}}else if(submitThis===true){if(sm_i18n.messages.SubmittingComment){pageWorking(sm_i18n.messages.SubmittingComment);}else{pageWorking('Submitting Comment');}
ajax_query(handleJS,'/rpc/gallery.mg',postArray,true);}};}})();if(sm_i18n.submitComment){submitComment=sm_i18n.submitComment;sm_i18n.submitComment=null;}}
if(typeof(redoCaptcha)!=='undefined'){(function(){var isProperImplementation=function(source){return source.search(/Whoops, the spam-foiling code didn\'t match. *Please try again\./)>-1&&source.search(/['"]try again['"]/)>-1;};var functionSource=redoCaptcha.toString();if(isProperImplementation(functionSource)){functionSource=functionSource.replace(/function +redoCaptcha/,'function');if(sm_i18n.messages.CommentCaptchaDidNotMatch){functionSource=functionSource.replace(/Whoops, the spam-foiling code didn\'t match. *Please try again\./,sm_i18n.protectQuotes(sm_i18n.messages.CommentCaptchaDidNotMatch));}
if(sm_i18n.messages.CommentCaptchaTryAgain){functionSource=functionSource.replace(/['"]try again['"]/,'"'+sm_i18n.protectQuotes(sm_i18n.messages.CommentCaptchaTryAgain)+'"');}
try{sm_i18n.redoCaptcha=eval('redoCaptcha='+functionSource);}catch(e){}}
if(!sm_i18n.redoCaptcha){sm_i18n.redoCaptcha=function(Type,error){if(error==='true'){if(YD.inDocument('commentType')){Type='Album';}
YD.get(Type+'CaptchaConfirm').className="title alert";if(sm_i18n.messages.CommentCaptchaTryAgain){YD.get(Type+'Captcha').value=sm_i18n.messages.CommentCaptchaTryAgain;}else{YD.get(Type+'Captcha').value="try again";}
if(sm_i18n.messages.CommentCaptchaDidNotMatch){alert(sm_i18n.messages.CommentCaptchaDidNotMatch);}else{alert("Whoops, the spam-foiling code didn't match.  Please try again.");}}
if(YD.inDocument('commentType')){document.images.AlbumCaptchaSource.src="/photos/captcha.mg?width=100&height=25&Type=Combined&randomBits="+randomString(8);}else{document.images[Type+'CaptchaSource'].src="/photos/captcha.mg?width=100&height=25&Type="+Type+"&randomBits="+randomString(8);}
removePageWorking();};}})();if(sm_i18n.redoCaptcha){redoCaptcha=sm_i18n.redoCaptcha;sm_i18n.redoCaptcha=null;}}
if(typeof(drawGalleryNav)!=='undefined'){(function(){var i18n=function(el){if(sm_i18n.messages.GalleryNavigationPrev){var prev=YD.getFirstChildBy(el,function(e){return e.tagName==='A'&&YD.hasClass(e,'nav')&&YD.hasClass(e,'prev');});if(prev){prev.innerHTML='&lt; '+sm_i18n.messages.GalleryNavigationPrev;if(prev.nextSibling&&prev.nextSibling.nodeType===3&&prev.nextSibling.nodeValue&&sm_i18n.messages.GalleryNavigationPage){if(prev.nextSibling.nodeValue.indexOf('Page')>=0){prev.nextSibling.nodeValue=prev.nextSibling.nodeValue.replace(/Page/,sm_i18n.messages.GalleryNavigationPage);}}}}
if(sm_i18n.messages.GalleryNavigationNext){var next=YD.getFirstChildBy(el,function(e){return e.tagName==='A'&&YD.hasClass(e,'nav')&&YD.hasClass(e,'next');});if(next){next.innerHTML=sm_i18n.messages.GalleryNavigationNext+' &gt;';}}
var pageOn=YD.getFirstChildBy(el,function(e){return(e.tagName==='A'||e.tagName==='SPAN')&&YD.hasClass(e,'pageOn')&&YD.hasClass(e,'title');});if(pageOn&&sm_i18n.messages.GalleryNavigationOf){if(pageOn.nextSibling&&pageOn.nextSibling.nodeType===3&&pageOn.nextSibling.nodeValue&&pageOn.nextSibling.nodeValue.indexOf('of')>=0){pageOn.nextSibling.nodeValue=pageOn.nextSibling.nodeValue.replace(/of/,sm_i18n.messages.GalleryNavigationOf);}}};var old_drawGalleryNav=drawGalleryNav;sm_i18n.drawGalleryNav=function(totalPhotos,photosPerPage,pageOn){old_drawGalleryNav(totalPhotos,photosPerPage,pageOn);var pnt=YD.get('pageNavigation_top');var pnb=YD.get('pageNavigation_bottom');if(pnt){i18n(pnt);}
if(pnb){i18n(pnb);}};})();if(sm_i18n.drawGalleryNav){drawGalleryNav=sm_i18n.drawGalleryNav;sm_i18n.drawGalleryNav=null;}}
if(typeof(drawPhotoNav)!=='undefined'){(function(){var i18n=function(el){var selectorA=function(e){return e.tagName==='A'&&YD.hasClass(e,'nav');};var selectorSPAN=function(e){return e.tagName==='SPAN'&&YD.hasClass(e,'extraNav');};var children=YD.getChildrenBy(el,selectorA);for(var i=0;i<children.length;i++){var spans=YD.getChildrenBy(children[i],selectorSPAN);for(var j=0;j<spans.length;j++){if(sm_i18n.messages.PhotoNavigationNext){spans[j].innerHTML=spans[j].innerHTML.replace(/Next/,sm_i18n.messages.PhotoNavigationNext);}
if(sm_i18n.messages.PhotoNavigationPrev){spans[j].innerHTML=spans[j].innerHTML.replace(/Prev/,sm_i18n.messages.PhotoNavigationPrev);}}}
if(sm_i18n.messages.PhotoNavigationOf){var nOfn=YD.getFirstChildBy(el,function(e){return e.tagName==='SPAN'&&YD.hasClass(e,'title');});if(nOfn){nOfn.innerHTML=nOfn.innerHTML.replace(/of/,sm_i18n.messages.PhotoNavigationOf);}}};var old_drawPhotoNav=drawPhotoNav;sm_i18n.drawPhotoNav=function(){old_drawPhotoNav();var pnt=YD.get('photoNavTop');var pnb=YD.get('photoNavBottom');if(pnt){i18n(pnt);}
if(pnb){i18n(pnb);}};})();if(sm_i18n.drawPhotoNav){drawPhotoNav=sm_i18n.drawPhotoNav;sm_i18n.drawPhotoNav=null;}}
if(typeof(photoHover)!=='undefined'){(function(){var old_photoHover=photoHover;sm_i18n.photoHover=function(photoID,photoImageID,waited){old_photoHover(photoID,photoImageID,waited);if(waited){var pbc=YD.get('photoBarContent');if(sm_i18n.messages.PhotoSizes){pbc.innerHTML=pbc.innerHTML.replace(/Photo Sizes/,sm_i18n.messages.PhotoSizes);}
if(sm_i18n.messages.OwnerSave){pbc.innerHTML=pbc.innerHTML.replace(/Owner Save/,sm_i18n.messages.OwnerSave);}
if(sm_i18n.messages.SaveFile){pbc.innerHTML=pbc.innerHTML.replace(/Save File/,sm_i18n.messages.SaveFile);}
if(sm_i18n.messages.SavePhoto){pbc.innerHTML=pbc.innerHTML.replace(/Save Photo/,sm_i18n.messages.SavePhoto);}
pbc.innerHTML=sm_i18n.photoSizes(pbc.innerHTML);}};})();if(sm_i18n.photoHover){photoHover=sm_i18n.photoHover;sm_i18n.photoHover=null;}}
if(typeof(smugPopularResponse)!=='undefined'){(function(){var old_smugPopularResponse=smugPopularResponse;sm_i18n.smugPopularResponse=function(response){old_smugPopularResponse(response);var pr=YD.get('photoRank');if(pr){if(sm_i18n.messages.PhotoRank){pr.innerHTML=pr.innerHTML.replace(/>PhotoRank</,'>'+sm_i18n.messages.PhotoRank+'<');}
if(sm_i18n.messages.Help){pr.innerHTML=pr.innerHTML.replace(/help\?/,sm_i18n.messages.Help);}}
var pe=YD.get('photoExif');if(pe){if(sm_i18n.messages.PhotoInfo){pe.innerHTML=pe.innerHTML.replace(/>Photo Info</,'>'+sm_i18n.messages.PhotoInfo+'<');}}};})();if(sm_i18n.smugPopularResponse){smugPopularResponse=sm_i18n.smugPopularResponse;sm_i18n.smugPopularResponse=null;}}
if(typeof(prepLBimg)!=='undefined'){(function(){var old_prepLBimg=prepLBimg;sm_i18n.prepLBimg=function(response){try{var lbInfo=YAHOO.lang.JSON.parse(response);if(sm_i18n.messages.LightBoxSizes){lbInfo.Nav=lbInfo.Nav.replace(/Sizes:/,sm_i18n.messages.LightBoxSizes);}
if(lbInfo.Nav){lbInfo.Nav=sm_i18n.photoSizes(lbInfo.Nav);}
response=YAHOO.lang.JSON.stringify(lbInfo);}catch(x){}
old_prepLBimg(response);};})();if(sm_i18n.prepLBimg){prepLBimg=sm_i18n.prepLBimg;sm_i18n.prepLBimg=null;}}
if(typeof(lbLoading)!=='undefined'){(function(){var old_lbLoading=lbLoading;sm_i18n.lbLoading=function(count){old_lbLoading(count);var nav=YD.get('lightBoxNav');if(nav&&sm_i18n.messages.LightBoxClose){nav.innerHTML=nav.innerHTML.replace(/>Close</,'>'+sm_i18n.messages.LightBoxClose+'<');}
var lbNav=YD.get('lbNav');if(lbNav&&sm_i18n.messages.PhotoNavigationOf){lbNav.innerHTML=lbNav.innerHTML.replace(/ of /,' '+sm_i18n.messages.PhotoNavigationOf+' ');}};})();if(sm_i18n.lbLoading){lbLoading=sm_i18n.lbLoading;sm_i18n.lbLoading=null;}}
if(typeof(SM)!=='undefined'&&SM.photo&&SM.photo.ExifBox){(function(){var replaceUnknowns=function(exif){if(exif&&sm_i18n.messages.ExifBoxValueUnknown){for(var prop in exif){if(exif[prop].friendlyValue==='unknown'){exif[prop].friendlyValue=sm_i18n.messages.ExifBoxValueUnknown;}}}};var _updateExifContent=function(responseText){var basic,detailed,map;if(this._exifInfo.data){if(this._exifInfo.data.basic){basic=this._exifInfo.data.basic;if(sm_i18n.messages.ExifBoxDateTime&&this._exifInfo.data.basic.DateTime){this._exifInfo.data.basic.DateTime.friendlyName=sm_i18n.messages.ExifBoxDateTime;}
if(sm_i18n.messages.ExifBoxDateTimeOriginal&&this._exifInfo.data.basic.DateTimeOriginal){this._exifInfo.data.basic.DateTimeOriginal.friendlyName=sm_i18n.messages.ExifBoxDateTimeOriginal;}
if(sm_i18n.messages.ExifBoxDateTimeDigitized&&this._exifInfo.data.basic.DateTimeDigitized){this._exifInfo.data.basic.DateTimeDigitized.friendlyName=sm_i18n.messages.ExifBoxDateTimeDigitized;}
if(sm_i18n.messages.ExifBoxOriginalSize&&this._exifInfo.data.basic.originalSize){this._exifInfo.data.basic.originalSize.friendlyName=sm_i18n.messages.ExifBoxOriginalSize;}
if(sm_i18n.messages.ExifBoxFileName&&this._exifInfo.data.basic.fileName){this._exifInfo.data.basic.fileName.friendlyName=sm_i18n.messages.ExifBoxFileName;}
if(sm_i18n.messages.ExifBoxFileSize&&this._exifInfo.data.basic.fileSize){this._exifInfo.data.basic.fileSize.friendlyName=sm_i18n.messages.ExifBoxFileSize;}
replaceUnknowns(this._exifInfo.data.basic);}
if(this._exifInfo.data.detailed){detailed=this._exifInfo.data.detailed;if(sm_i18n.messages.ExifBoxColorSpace&&this._exifInfo.data.detailed.ColorSpace){this._exifInfo.data.detailed.ColorSpace.friendlyName=sm_i18n.messages.ExifBoxColorSpace;}
replaceUnknowns(this._exifInfo.data.detailed);}
if(this._exifInfo.data.map){map=this._exifInfo.data.map;if(sm_i18n.messages.ExifBoxGPSLatitude&&this._exifInfo.data.map.GPSLatitude){this._exifInfo.data.map.GPSLatitude.friendlyName=sm_i18n.messages.ExifBoxGPSLatitude;}
if(sm_i18n.messages.ExifBoxGPSLongitude&&this._exifInfo.data.map.GPSLongitude){this._exifInfo.data.map.GPSLongitude.friendlyName=sm_i18n.messages.ExifBoxGPSLongitude;}
replaceUnknowns(this._exifInfo.data.map);}
if(sm_i18n.messages.ExifBoxTabBasic){this._exifInfo.data[sm_i18n.messages.ExifBoxTabBasic.toLowerCase()]=basic;}
if(sm_i18n.messages.ExifBoxTabDetailed){this._exifInfo.data[sm_i18n.messages.ExifBoxTabDetailed.toLowerCase()]=detailed;}}};var _handleActiveTabChange=function(e){var exifBoxes=YD.getElementsByClassName('exifBox','DIV');var exifBox=exifBoxes&&exifBoxes.length>0?exifBoxes[0]:null;if(exifBox){var content=YD.getFirstChildBy(exifBox,function(e){return YD.hasClass(e,'content');});if(content){var h3=YD.getFirstChildBy(content,function(e){return e.tagName==='H3';});if(h3){if(sm_i18n.messages.ExifBoxPhotoInformation){h3.innerHTML=h3.innerHTML.replace(/photo information/i,sm_i18n.messages.ExifBoxPhotoInformation);}
if(sm_i18n.messages.ExifBoxArrowKeys){h3.innerHTML=h3.innerHTML.replace(/\(arrow keys change photo\)/,sm_i18n.messages.ExifBoxArrowKeys);}}}}
if(sm_i18n.messages.ExifBoxNoInformationAvailable){var noExifs=YD.getElementsByClassName('noExif','H4');for(var i=0;i<noExifs.length;i++){var ne=noExifs[i];ne.innerHTML=sm_i18n.messages.ExifBoxNoInformationAvailable;}}};var ExifBox=function(attr){superC.constructor.call(this,attr);var subscribers=[];var i;for(i=0;i<this._exifInfo.createEvent('load').subscribers.length;i++){subscribers[subscribers.length]={fn:this._exifInfo.createEvent('load').subscribers[i].fn,scope:this._exifInfo.createEvent('load').subscribers[i].getScope(null),override:this._exifInfo.createEvent('load').subscribers[i].override};}
this._exifInfo.unsubscribeAll('load');this._exifInfo.subscribe('load',_updateExifContent,this,true);for(i=0;i<subscribers.length;i++){this._exifInfo.subscribe('load',subscribers[i].fn,subscribers[i].scope,subscribers[i].override);}
var tvObj=this.get('tabViewObject');tvObj.addListener('activeTabChange',_handleActiveTabChange,this,true);if(sm_i18n.messages.ExifBoxTabBasic&&tvObj.getTab(0)){tvObj.getTab(0).setAttributes({label:sm_i18n.messages.ExifBoxTabBasic});}
if(sm_i18n.messages.ExifBoxTabDetailed&&tvObj.getTab(1)){tvObj.getTab(1).setAttributes({label:sm_i18n.messages.ExifBoxTabDetailed});}};YAHOO.extend(ExifBox,SM.photo.ExifBox);var superC=ExifBox.superclass;SM.photo.ExifBox=ExifBox;})();}