function PopupClient() { this.id = null; this.popUpObject = new ComponentArt_PopUp(); this.popUpObjectShowing = false; this.documentMouseUpHandler = null; this.callbackRes = null; this.imageCount = 0; this.hasImage = false; this.proxy = null; this.loadingPlaceHolderName = ''; this.tempResPlaceHolderName = ''; this.loadingMsg = ''; this.clientSideAfterCallback = null; this.clientSideAfterPopupClose = null; this.clientSideOnError = null; this.popupExpandSlide = cart_slidetype_exponentialdecelerate; this.popupExpandTransition = 0; this.popupExpandDirection = cart_slidedirection_left; this.forceCloseOnly = false; }; PopupClient.prototype.nullFunc = function() {}; PopupClient.prototype.doPopup = function(link, param) { if(this.popUpObjectShowing || !this.proxy) { return; } this.imageCount = 0; this.popUpObjectShowing = true; this.popUpObject.Id = this.id + '.popUpObject'; this.popUpObject.AlignElement = link.id; this.popUpObject.qzvc = 0; eval(this.proxy + '(param, this.ajaxCallbackComplete, this)'); document.getElementById(this.loadingPlaceHolderName).innerHTML = this.loadingMsg; var posX = document.body.scrollLeft; var posY = document.body.scrollTop; document.getElementById(this.loadingPlaceHolderName).style.left = posX + 'px'; document.getElementById(this.loadingPlaceHolderName).style.top = posY + 'px'; document.getElementById(this.loadingPlaceHolderName).style.visibility = 'visible'; }; PopupClient.prototype.popupImageLoaded = function(trg, imgCnt, evt) { if(!this.callbackRes || !this.hasImage) { return; } if(imgCnt != ++this.imageCount) { return; } setTimeout(this.id + '.doPopupInner()', 100); }; PopupClient.prototype.ajaxCallbackComplete = function(res) { if(!res) { return; } var This = res.context; if(res.error) { document.getElementById(This.loadingPlaceHolderName).innerHTML = ''; document.getElementById(This.tempResPlaceHolderName).innerHTML = ''; // just to make sure This.popUpObjectShowing = false; if(typeof(This.clientSideOnError) == 'function') { This.clientSideOnError(This, res.error.description); } else { alert(res.error.description); } return; } This.callbackRes = res; document.getElementById(This.tempResPlaceHolderName).innerHTML = res.value; if(This.hasImage) { return; } if(typeof(This.clientSideAfterCallback) == 'function') { This.clientSideAfterCallback(This); } This.doPopupInner(); }; PopupClient.prototype.doPopupInner = function() { document.getElementById(this.loadingPlaceHolderName).innerHTML = ''; this.popUpObject.ExpandSlideDirection = this.popupExpandDirection; this.popUpObject.ExpandSlideType = this.popupExpandSlide; this.popUpObject.ExpandTransition = this.popupExpandTransition; this.popUpObject.Contents = document.getElementById(this.tempResPlaceHolderName).innerHTML; this.popUpObject.AlignElement = document.getElementById(this.popUpObject.AlignElement); this.popUpObject.Init(); this.popUpObject.Show(); this.documentMouseUpHandler = new Function('event', this.id + '.closePopup(' + this.id + '.popUpObject, event)'); ComponentArt_AddEventHandler(document, 'mouseup', this.documentMouseUpHandler); document.getElementById(this.tempResPlaceHolderName).innerHTML = ''; } PopupClient.prototype.closePopup = function(popup, evt) { if(this.forceCloseOnly) { return; } evt = evt ? evt : window.event; var srcElement = evt.target ? evt.target : evt.srcElement; if(!ComponentArt_Contains(this.popUpObject.qzcg, srcElement)){ this.forceClose(); }; }; PopupClient.prototype.forceClose = function() { this.popUpObject.Hide(true); ComponentArt_RemoveEventHandler(document, 'mouseup', this.documentMouseUpHandler); this.documentMouseUpHandler = null; setTimeout(this.id + '.resetShowing()', 100); if(typeof(this.clientSideAfterPopupClose) == 'function') { this.clientSideAfterPopupClose(this); } } PopupClient.prototype.resetShowing = function() { this.popUpObjectShowing = false; };