rendered paste bodyfunction LoadVisual (){ this._timeUntilShow = 250; this._opacity = 0.8; this._waiting = true; this._loading = true; this._loadingelement = null; this._element = null; this._className = null; this.initilize = function() { } // Start waiting status - show loading element // element on which to display the loading progress // className picture to display // timeUntilShow default value is 250 this.startWaiting = function(element, className, timeUntilShow) { if (typeof(element) == 'string') this._element = $(element); else alert('loading error el'); if (typeof className == 'string') this._className = 'waiting'; else alert('loading error cl'); if (typeof timeUntilShow == 'number') this._timeUntilShow = timeUntilShow; else alert('loading error ti'); if (this._loading) { var e = document.createElement('div'); e.setAttribute('id','loadDiv'); e.innerHTML = '<img src="'+ this._className +'">'; this._loadingelement = e; this._element.appendChild(this._loadingelement); e.style.position = 'absolute'; try {e.style.opacity = this.opacity;} catch(e) {} try {e.style.MozOpacity = this.opacity;} catch(e) {} try {e.style.filter = 'alpha(opacity='+Math.round(this.opacity * 100)+')';} catch(e) {} try {e.style.KhtmlOpacity = this.opacity;} catch(e) {} this._loading = false; } this.displayWaiting(this._element,this._loadingelement,this._loading,this._timeUntilShow); }, function displayWaiting(ele,l,loading,ti) { window.setTimeout(function() { if (!loading) { alert(l); l.style.left = ele.offsetLeft+'px'; l.style.top = ele.offsetTop+'px'; l.style.width = ele.offsetWidth+'px'; l.style.height = ele.offsetHeight+'px'; l.style.display = 'inline'; } },ti); } // Stop waiting status - hide loading element this.stopWaiting = function() { if (this._waiting) { this._element.removeChild(this._loadingelement); this._waiting = false; this._loading = true; } }}