myspliceWidget = new function() { var BASE_URL = 'http://www.mysplice.net/'; var STYLESHEET = BASE_URL + 'widget/widget.css'; var ROOT = 'mysplice_widget'; function requestStylesheet(stylesheet_url) { stylesheet = document.createElement("link"); stylesheet.rel = "stylesheet"; stylesheet.type = "text/css"; stylesheet.href = stylesheet_url; stylesheet.media = "all"; document.lastChild.firstChild.appendChild(stylesheet); } function requestContent(username) { var script = document.createElement('script'); // How you'd pass the current URL into the request // script.src = CONTENT_URL + '&url=' + escape(local || location.href); script.src = BASE_URL+'widget/loadWidget?uid='+username; // IE7 doesn't like this: document.body.appendChild(script); // Instead use: document.getElementsByTagName('head')[0].appendChild(script); } this.load= function( data ) { if (!data) return; requestContent(data); } this.update = function(info) { var div = document.getElementById(ROOT); div.innerHTML = info; div.style.display = 'block'; var icon = document.getElementById('_mysplice_icon'); var linkBox = document.getElementById('_mysplice_splicecontainer'); div.onmouseover = function(){toggleBox(linkBox,'show')}; div.onmouseout = function(){toggleBox(linkBox,'hide')}; } function toggleBox(box,action) { if(action=='show') { box.style.display = 'block'; } else { box.style.display = 'none'; } } requestStylesheet(STYLESHEET); document.write(""); }