var sThumbnailTemplate='';var sPhotoAreaTemplate='';var nAlbumPos=-10;var aMURL=new Array();function load(sFunction){if(sFunction=='WALL'){wall_show(1);};};function image_mouseover(){$('#idTagList').show();};function image_mouseout(){$('#idTagList').hide();};function tag_show(sTag){$('#idTagList').show();$('#'+sTag+'_Box').show();};function tag_hide(sTag){$('#'+sTag+'_Box').hide();};function pagenav_move(sSelectorBar,nPage){$('#'+sSelectorBar+'Top').html('Loading..');$('#'+sSelectorBar+'Bottom').html('Loading..');var nIdx=0;aPos[nIdx]=nPage;wall_show(aPos[nIdx]);} function album_load(nLID){nActiveLID=nLID;if(sThumbnailTemplate=='')sThumbnailTemplate=$('#idPictureTemplate').html();AJAX('op=media_thumbnails_fetch&sAuthKey='+sAuthKey+'&sFunction=MEDIA_TAGGED&nType='+nType+'&nOID='+nUUID+'&nUUID='+nUUID+'&nLID=' +nActiveLID+"&nPos=1&nPerPage=500&sTemplate="+escape(sThumbnailTemplate),'album_load_result');};function album_load_result(nResult,sResponse){if(nResult!=-1){nAlbumPos=0;var sAlbumSet=unescape(nResult);$('#idPictureList').html(unescape(sResponse));aMURL=sAlbumSet.split(',');media_load(aMURL[0],'');};};function album_showpicture(sDir){if(nAlbumPos==-10){alert('Please select an album first (or the All-Media album). Then you can scroll through the pictures.');return;};if(sDir=='next'&&nAlbumPos<=aMURL.length) nAlbumPos=nAlbumPos+1;else if(nAlbumPos>-1) nAlbumPos=nAlbumPos-1;if(nAlbumPos>-1&&nAlbumPos<=aMURL.length){sMURL=aMURL[nAlbumPos];media_load(sMURL,'');};};function media_passwordprompt(){$('#idPhotoArea').hide();$('#idPasswordPrompt').show();};function media_password(){sMediaPassword=$('#idMediaPassword').val();AJAX('op=media_password&sAuthKey='+sAuthKey+'&nUUID='+nUUID+'&sMURL='+sMURL+'&sMediaPassword='+sMediaPassword,'media_password_result');show_result('idPasswordBox',2000,"trying... ",'');};function media_password_result(nResult,sResponse){if(nResult>-1){show_result('idPasswordBox',100,"success... ",'');media_load(sMURL,'');}else{show_result('idPasswordBox',2000,"wrong password... ",'');};};function media_load(sURL,sMURLDisplay){if(sMURLDisplay!=undefined&&sMURLDisplay!='')location.href=sMURLDisplay;if(sURL!=undefined&&sURL!=''){sMURL=sURL;if(sPhotoAreaTemplate=='')sPhotoAreaTemplate=$('#idPhotoTemplate').html();AJAX('op=media_image_fetch&sAuthKey='+sAuthKey+'&nUUID='+nUUID+'&sMURL='+sMURL+'&nLID='+nActiveLID+'&nType='+nType +'&sMediaPassword='+sMediaPassword+'&sTemplate='+escape(sPhotoAreaTemplate),'media_load_result');if(location.href.indexOf('#')>0) var sURL=location.href.replace(/#/,'')+'/';else var sURL=location.href;$('#idQuickLink').html(sURL).attr('href',sURL);};};function media_load_result(nResult,sResponse){if(nResult>-1){$('#idPhotoArea').show();$('#idPasswordPrompt').hide();nMID=nResult;nOID=nMID;nROID=nMID;$('#idPhotoArea').html(unescape(sResponse)).show();wall_show(1);}else if(nResult==-2){media_passwordprompt();};};$(document).ready(function(){var nPos=location.href.indexOf('#')+1;var sMURL=location.href.substr(nPos,location.href.length-nPos);if(nPos>2&&sMURL!=''){media_load(sMURL,'');}else if(nPasswordPrompt==1){media_passwordprompt();};});