﻿var PumFoundPreviewCommandSource=null;var PumFoundPreviewPhotoId=null;var PumFoundPreviewTypeId=null;var PumFoundPreviewDataSet=new Object();function PumFoundPreviewFilterOnPopup(commandSource,PhotoId,TypeId){PumFoundPreviewCommandSource=commandSource;PumFoundPreviewPhotoId=PhotoId;PumFoundPreviewTypeId=TypeId;$get('dvPumFoundPreviewFilterOn').style.display='block';$get('btnPumFoundPreviewSafeFilterClose').style.display='none';$get('btnPumFoundPreviewSafeFilterOk').style.display='';PhArtAjax.Animation.ModalPopup.Show('dvPumFoundPreviewSafeFilterHolder',true)}function PumFoundPreviewFilterOnSubmit(){if($get('rdoPumFoundPreviewTurnOnYes').checked){$Communicator.fireClient2ServerListener(PumFoundPreviewCommandSource,"PhArt.UI.Modules.Foundation.Preview.TurnOffSafeFilter",PumFoundPreviewPhotoId+':'+PumFoundPreviewTypeId)}else{PhArtAjax.Animation.ModalPopup.Hide('dvPumFoundPreviewSafeFilterHolder')}}function PumFoundPreviewShow(commandSource,commandType,commandArgument){if(commandType=='PhArt.UI.Modules.Foundation.Preview.Show'){PhArtAjax.GoogleAnalytics.Event.Type='Preview';PhArtAjax.GoogleAnalytics.Event.Property=commandArgument.PhotoId;PhArtAjax.GoogleAnalytics.Track();PumFoundPreviewPhotoId=commandArgument.PhotoId;PumFoundPreviewTypeId=commandArgument.TypeId;$get('lblPumFoundPreviewTitle').innerHTML='';$get('lblPumFoundPreviewPhArtist').innerHTML='';$get('dvPumFoundPreviewTopRight').innerHTML='';$get('dvPumFoundPreviewCommission').innerHTML='';$get('dvPumFoundPreviewCommission').style.display='none';$get('dvPumFoundPreviewPrice').innerHTML='';$get('dvPumFoundPreviewPrice').style.display='none';PumFoundPreviewClearCells();$get('imgPumFoundPreviewPhoto').src="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/images/Preview/bg_phartholder.gif";if(typeof(PumFoundPreviewDataSet[commandArgument.PhotoId])==='undefined'||PumFoundPreviewDataSet[commandArgument.PhotoId]==null){$Communicator.fireClient2ServerListener(commandSource,"PhArt.UI.Modules.Foundation.Preview.Load",commandArgument.PhotoId+":"+commandArgument.TypeId)}else{PumFoundPreviewBind(commandArgument.PhotoId,commandArgument.TypeId)}PhArtAjax.Animation.Popup.Show(commandSource,'dvPumFoundPreview','mouse',0,0)}}function PumFoundPreviewBind(photoId,typeId){var htmlPhotoStatus='<b>Status:</b> {0}';if(typeof(PumFoundPreviewDataSet[photoId])==='undefined')return false;$get('imgPumFoundPreviewPhoto').src=String.format(PhArtAjax.AppConfig.PhotoClientUrl,300,300,photoId,PumFoundPreviewDataSet[photoId].Ticks);$get('lblPumFoundPreviewTitle').innerHTML=PumFoundPreviewDataSet[photoId].Title;$get('lblPumFoundPreviewPhArtist').innerHTML=PumFoundPreviewDataSet[photoId].PhArtist;var htmlPhArtistProfile='<a id="lnkPumFoundPreviewAdd2Phavorites" class="btnArtistProfile" href="{0}">Ph.Artist Profile</a>';if(typeId==1){$get('dvPumFoundPreviewTopRight').innerHTML=PumFoundPreviewDataSet[photoId].GalleryTypeText;$get('dvPumFoundPreviewPrice').innerHTML=PumFoundPreviewDataSet[photoId].Price;PumFoundPreviewBindCell(String.format(htmlPhArtistProfile,PumFoundPreviewDataSet[photoId].ProfileUrl));if($get('tblPumFoundPreviewBtn').rows[0].cells[0].innerHTML=='')$get('tblPumFoundPreviewBtn').rows[0].cells[0].innerHTML='&nbsp;';if($get('tblPumFoundPreviewBtn').rows[0].cells[1].innerHTML=='')$get('tblPumFoundPreviewBtn').rows[0].cells[1].innerHTML='&nbsp;';PumFoundPreviewBindCell(String.format(htmlPhotoStatus,PumFoundPreviewDataSet[photoId].PhotoStatusText));var flashSrc="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/Flash/app_metadataRating.swf";var flashVars={rating:PumFoundPreviewDataSet[photoId].CommissionRate};PhArtAjax.Animation.CreateFlash("dvPumFoundPreviewCommission",flashSrc,"42px","32px",flashVars,{wmode:"transparent"},null)}else if(typeId==2||typeId==3||typeId==5){var htmlAdd2Phavorites='<a id="lnkPumFoundPreviewAdd2Phavorites" class="btnAddToPhavourites" href="javascript:PumFoundPreviewAdd2Phavorites({0});">Ph.Avourites</a>';var htmlRemove='<a id="lnkPumFoundPreviewRemove" class="btnRemoveFromPublic" href="javascript:PumFoundPreviewRemove({0});">Remove</a>';var htmlRequestRemoval='<a id="lnkPumFoundPreviewRequestRemoval" class="btnRequestRemoval" href="javascript:PumFoundPreviewRequestRemoval({0});">Request removal</a>';var htmlWithdraw='<a id="lnkPumFoundPreviewWithdraw" class="btnRemoveFromPublic" href="javascript:PumFoundPreviewWithdraw({0});">Withdraw this Ph.Art</a>';var htmlComments='<a id="lnkPumFoundPreviewComments" class="btnComments" href="javascript:PumFoundPreviewShowComments({0});">{1} comments</a>';var htmlOrderPrint='<a id="lnkPumFoundPreviewOrderPrint" class="btnOrderPrint" href="javascript:PumFoundPreviewOrderPrint({0});">Order print</a>';var htmlBuyOut='<a id="lnkPumFoundPreviewBuyOut" class="btnBuyOut" href="javascript:PumFoundPreviewBuyOut({0});">Buy out</a>';var htmlMark4Review='<a id="lnkPumFoundPreviewMark4Review" class="btnMarkForReview" href="javascript:PumFoundPreviewMark4Review('+photoId+');">Mark for review</a>';if(PumFoundPreviewDataSet[photoId].PhotoStatus==2||PumFoundPreviewDataSet[photoId].PhotoStatus==6){PumFoundPreviewBindCell(String.format(htmlAdd2Phavorites,photoId));if($get('tblPumFoundPreviewBtn').rows[0].cells[0].innerHTML=='')$get('tblPumFoundPreviewBtn').rows[0].cells[0].innerHTML='&nbsp;';if($get('tblPumFoundPreviewBtn').rows[0].cells[1].innerHTML=='')$get('tblPumFoundPreviewBtn').rows[0].cells[1].innerHTML='&nbsp;';PumFoundPreviewBindCell(String.format(htmlPhotoStatus,PumFoundPreviewDataSet[photoId].PhotoStatusText));if(typeId==2&&(PumFoundPreviewDataSet[photoId].UserType&2)!=0)PumFoundPreviewBindCell(String.format(htmlWithdraw,photoId))}else{var flashSrc="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/Flash/app_Rating.swf";var flashVars={photoId:photoId,wsdl:PhArtAjax.AppConfig.WebServicePath+"/Service.asmx?wsdl"};PhArtAjax.Animation.CreateFlash("dvPumFoundPreviewTopRight",flashSrc,"114px","96px",flashVars,{wmode:"transparent"},null);$get('dvPumFoundPreviewPrice').innerHTML=PumFoundPreviewDataSet[photoId].Price;if(typeId!=5)PumFoundPreviewBindCell(String.format(htmlAdd2Phavorites,photoId));PumFoundPreviewBindCell(String.format(htmlComments,photoId,PumFoundPreviewDataSet[photoId].Comments));if(PumFoundPreviewDataSet[photoId].SoldStatus<4)PumFoundPreviewBindCell(String.format(htmlOrderPrint,photoId));if(PumFoundPreviewDataSet[photoId].GalleryType==3&&PumFoundPreviewDataSet[photoId].SoldStatus==1)PumFoundPreviewBindCell(String.format(htmlBuyOut,photoId));if(typeId==2&&PumFoundPreviewDataSet[photoId].GalleryType==2&&(PumFoundPreviewDataSet[photoId].UserType&2)!=0)PumFoundPreviewBindCell(String.format(htmlRemove,photoId));if(typeId==2&&PumFoundPreviewDataSet[photoId].GalleryType==3&&(PumFoundPreviewDataSet[photoId].UserType&2)!=0)PumFoundPreviewBindCell(String.format(htmlRequestRemoval,photoId));if(typeId!=2&&(PumFoundPreviewDataSet[photoId].UserType&4)!=0)PumFoundPreviewBindCell(String.format(htmlMark4Review,photoId));if((PumFoundPreviewDataSet[photoId].UserType&2)!=0){var flashSrc="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/Flash/app_metadataRating.swf";var flashVars={rating:PumFoundPreviewDataSet[photoId].CommissionRate};PhArtAjax.Animation.CreateFlash("dvPumFoundPreviewCommission",flashSrc,"42px","32px",flashVars,{wmode:"transparent"},null)}}PumFoundPreviewBindCell(String.format(htmlPhArtistProfile,PumFoundPreviewDataSet[photoId].ProfileUrl))}else if(typeId==4){$get('dvPumFoundPreviewTopRight').innerHTML=PumFoundPreviewDataSet[photoId].GalleryTypeText;PumFoundPreviewBindCell(String.format(htmlPhArtistProfile,PumFoundPreviewDataSet[photoId].ProfileUrl))}}function PumFoundPreviewBindCell(html){for(var rowIndex=0;rowIndex<3;rowIndex++){for(var cellIndex=0;cellIndex<3;cellIndex++){if($get('tblPumFoundPreviewBtn').rows[rowIndex].cells[cellIndex].innerHTML==''){$get('tblPumFoundPreviewBtn').rows[rowIndex].cells[cellIndex].innerHTML=html;return}}}}function PumFoundPreviewClearCells(){for(var rowIndex=0;rowIndex<3;rowIndex++){for(var cellIndex=0;cellIndex<3;cellIndex++){$get('tblPumFoundPreviewBtn').rows[rowIndex].cells[cellIndex].innerHTML=''}}}function PumFoundPreviewShowDetailsView(){PhArtAjax.Animation.Popup.Hide();var flashSrc="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/Flash/app_DetailsView.swf";var flashVars={};if(PumFoundPreviewTypeId==1)flashVars={appRoot:"http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/",photoId:PumFoundPreviewPhotoId,wsdl:PhArtAjax.AppConfig.WebServicePath+"/Service.asmx?wsdl",type:"review",imgThumb:PhArtAjax.AppConfig.ThumbnailClientUrl,img:PhArtAjax.AppConfig.PhotoClientUrl,closeFunction:"PumFoundPreviewHideDetailsView",refreshListFunction:"PumFoundPreviewRefreshList"};else if(PumFoundPreviewTypeId==2||PumFoundPreviewTypeId==3||PumFoundPreviewTypeId==5)flashVars={appRoot:"http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/",photoId:PumFoundPreviewPhotoId,wsdl:PhArtAjax.AppConfig.WebServicePath+"/Service.asmx?wsdl",type:"public",imgThumb:PhArtAjax.AppConfig.ThumbnailClientUrl,img:PhArtAjax.AppConfig.PhotoClientUrl,closeFunction:"PumFoundPreviewHideDetailsView",orderPrintFunction:"PumFoundPreviewOrderPrintFlash",loginURL:PumFoundPreviewLoginUrl};else if(PumFoundPreviewTypeId==4)flashVars={appRoot:"http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/",photoId:PumFoundPreviewPhotoId,wsdl:PhArtAjax.AppConfig.WebServicePath+"/Service.asmx?wsdl",type:"visitor",imgThumb:PhArtAjax.AppConfig.ThumbnailClientUrl,img:PhArtAjax.AppConfig.PhotoClientUrl,closeFunction:"PumFoundPreviewHideDetailsView"};PhArtAjax.Animation.CreateFlash("dvPumFoundPreviewDetailsView",flashSrc,"100%","100%",flashVars,{wmode:"transparent"},null,true)}function PumFoundPreviewHideDetailsView(){PhArtAjax.Animation.ModalPopup.Destroy('dvPumFoundPreviewDetailsView')}function PumFoundPreviewRefreshList(){$Communicator.fireClientListener('dvPumFoundPreviewDetailsView','PhArt.UI.Modules.Foundation.Preview.RefreshList','')}function PumFoundPreviewOrderPrintFlash(photoId,type){PumFoundPreviewHideDetailsView();PhArtAjax.Animation.Popup.Hide();PumFoundPreviewDataSet[photoId]=null;$Communicator.fireClientListener('dvPumFoundPreviewDetailsView','PhArt.UI.Modules.Foundation.OrderPrint.Show',{PhotoId:photoId,IsBuyout:(type=="buyout")})}function PumFoundPreviewOrderPrint(photoId){PhArtAjax.Animation.Popup.Hide();PumFoundPreviewDataSet[photoId]=null;$Communicator.fireClientListener('lnkPumFoundPreviewOrderPrint','PhArt.UI.Modules.Foundation.OrderPrint.Show',{PhotoId:photoId,IsBuyout:false})}function PumFoundPreviewBuyOut(photoId){PhArtAjax.Animation.Popup.Hide();PumFoundPreviewDataSet[photoId]=null;$Communicator.fireClientListener('lnkPumFoundPreviewBuyOut','PhArt.UI.Modules.Foundation.OrderPrint.Show',{PhotoId:photoId,IsBuyout:true})}function PumFoundPreviewAdd2Phavorites(photoId){PhArtAjax.Animation.Popup.Hide();PhArtAjax.GoogleAnalytics.Event.Type='AddFavouritePhArt';PhArtAjax.GoogleAnalytics.Event.Property=photoId;$Communicator.fireClient2ServerListener('lnkPumFoundPreviewAdd2Phavorites','PhArt.UI.Modules.Foundation.Preview.Add2Phavorites',photoId)}function PumFoundPreviewShowComments(photoId){PhArtAjax.Animation.Popup.Hide();PumFoundPreviewDataSet[photoId]=null;var flashSrc="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/Flash/app_Comments.swf";var flashVars={appRoot:"http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/",photoId:photoId,wsdl:PhArtAjax.AppConfig.WebServicePath+"/Service.asmx?wsdl",imgThumb:PhArtAjax.AppConfig.ThumbnailClientUrl,closeFunction:"PumFoundPreviewHideComments"};PhArtAjax.Animation.CreateFlash("dvPumFoundPreviewComments",flashSrc,"100%","100%",flashVars,{wmode:"transparent"},null,true)}function PumFoundPreviewHideComments(){PhArtAjax.Animation.ModalPopup.Destroy('dvPumFoundPreviewComments')}function PumFoundPreviewMark4Review(photoId){PhArtAjax.Animation.Popup.Hide();var flashSrc="http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/DesktopModules/Foundation/Flash/app_markForReview.swf";var flashVars={appRoot:"http://"+PhArtAjax.AppConfig.GalleryPortalAlias+"/",photoId:photoId,wsdl:PhArtAjax.AppConfig.WebServicePath+"/Service.asmx?wsdl",imgThumb:PhArtAjax.AppConfig.ThumbnailClientUrl,closeFunction:"PumFoundPreviewHideMark4Review"};PhArtAjax.Animation.CreateFlash("dvPumFoundPreviewMark4Review",flashSrc,"100%","100%",flashVars,{wmode:"transparent"},null,true)}function PumFoundPreviewHideMark4Review(){PhArtAjax.Animation.ModalPopup.Destroy('dvPumFoundPreviewMark4Review')}function PumFoundPreviewWithdraw(photoId){PhArtAjax.Animation.Popup.Hide();$Communicator.fireClientListener('lnkPumFoundPreviewWithdraw','PhArt.UI.Modules.MyLiveGallery.Withdraw',photoId)}function PumFoundPreviewRemove(photoId){PhArtAjax.Animation.Popup.Hide();$Communicator.fireClientListener('lnkPumFoundPreviewRemove','PhArt.UI.Modules.MyLiveGallery.Remove',photoId)}function PumFoundPreviewRequestRemoval(photoId){PhArtAjax.Animation.Popup.Hide();$Communicator.fireClientListener('lnkPumFoundPreviewRequestRemoval','PhArt.UI.Modules.MyLiveGallery.RequestRemoval',photoId)}function imgPumFoundPreviewPhoto_load(){$get('dvPumFoundPreviewPhotoHolder').style.width=$get('imgPumFoundPreviewPhoto').offsetWidth+'px';$get('dvPumFoundPreviewPhotoHolder').style.height=$get('imgPumFoundPreviewPhoto').offsetHeight+'px';if($get('dvPumFoundPreviewCommission').innerHTML=='')$get('dvPumFoundPreviewCommission').style.display='none';else $get('dvPumFoundPreviewCommission').style.display='block';if($get('dvPumFoundPreviewPrice').innerHTML=='')$get('dvPumFoundPreviewPrice').style.display='none';else $get('dvPumFoundPreviewPrice').style.display='block'}function PumFoundPreviewReloadAllImages(){PumFoundPreviewReloadAllImages_Recursive(document.body)}function PumFoundPreviewReloadAllImages_Recursive(obj){for(var i=0;i<obj.childNodes.length;i++){if(obj.childNodes[i].tagName=='IMG'&&PumFoundPreviewReloadAllImages_CheckUrl(obj.childNodes[i].src)){obj.childNodes[i].src=obj.childNodes[i].src+'#'}else if(obj.childNodes[i].childNodes.length>0){PumFoundPreviewReloadAllImages_Recursive(obj.childNodes[i])}}}function PumFoundPreviewReloadAllImages_CheckUrl(src){var isValid=false;src=src.toLowerCase();if(src.endsWith('.jpg')){var imgName=src.substring(src.lastIndexOf('/')+1,src.lastIndexOf('.jpg'));if(imgName.split('_').length==5)isValid=true}return isValid}