// Umbraco SpeechBubble Javascript // Dependency Loader Constructor function UmbracoSpeechBubble(id) { this.id = id; this.ie = document.all ? true : false; this.GenerateSpeechBubble(); } UmbracoSpeechBubble.prototype.GenerateSpeechBubble = function() { theBody = document.getElementsByTagName('BODY')[0]; sbHtml = document.createElement('div'); sbHtml.id = this.id + 'Container'; sbHtml.innerHTML = '' + '
'; theBody.appendChild(sbHtml); } UmbracoSpeechBubble.prototype.ShowMessage = function(icon, header, message) { var speechBubble = document.getElementById(this.id); document.getElementById(this.id + "Header").innerHTML = header; document.getElementById(this.id + "Message").innerHTML = message; document.getElementById(this.id + "IconSrc").src = '/umbraco/images/speechBubble/' + icon + '.png'; speechBubble.style.right = "20px"; speechBubble.style.bottom = "20px"; speechBubble.style.visibility = 'visible'; this.Show(0); } UmbracoSpeechBubble.prototype.Show = function(opacity) { document.getElementById(this.id).style.filter = 'Alpha(Opacity=' + opacity + ')'; opacity = parseInt(opacity) + 10; var _self = this; if (opacity < 101) { setTimeout(function() {_self.Show(opacity+10);}, 50); } else { setTimeout(function() {_self.Hide(100);}, 5000); } } UmbracoSpeechBubble.prototype.Hide = function(opacity) { document.getElementById(this.id).style.filter = 'Alpha(Opacity=' + opacity + ')'; var _self = this; opacity = parseInt(opacity) - 10; if (opacity > 1) setTimeout(function() {_self.Hide(opacity-10);}, 50); else { document.getElementById(this.id).style.visibility = 'hidden'; } } // Initialize var UmbSpeechBubble = null function InitUmbracoSpeechBubble() { if (UmbSpeechBubble == null) UmbSpeechBubble = new UmbracoSpeechBubble("defaultSpeechbubble"); } //if (typeof(addEvent) !== 'undefined') { // addEvent(window, "load", InitUmbracoSpeechBubble); //}else if (Sys != undefined) { // Sys.Application.add_load(InitUmbracoSpeechBubble); //}