function addEvent(obj, type, fn) { if (obj.attachEvent) { obj['e' + type + fn] = fn; obj[type + fn] = function(){obj['e' + type + fn]( window.event );} obj.attachEvent( 'on' + type, obj[type + fn] ); } else obj.addEventListener(type, fn, false); } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function'){ window.onload = func; } else { window.onload = function(){ oldonload(); func(); } } } /* The functions in here create a pop-up window /* or dynamically place a button for Live Chat *********************************************************/ function popUp(URL, width, height) { var wHeight = height; var wWidth = width; var day = new Date(); var id = day.getTime(); eval("page" + id + " = window.open(URL, '" + id + "','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + wWidth + ",height=" + wHeight + ",left = 100,top = 100');"); } /* add Live Chat Button to Footer ********************************************************/ function addLCFooter() { linkLC=document.createElement('a'); var parent = document.getElementById('liveButton'); if(parent != null) { parent.appendChild(linkLC); linkLC.setAttribute('href','/page/1/live-chat.jsp'); linkLC.setAttribute('title','Live Chat'); linkLC.id = 'liveChat' pic=document.createElement('img'); pic.src = "/media/image/1/btnchat.gif"; // add the text as a child of the link linkLC.appendChild(pic); linkLC.onclick = function(){ popUp(this.href, "550", "560"); return false; } } } /* HELP DESK POP-UP ********************************************************/ addEvent(window, 'load', popUpHelp, false); function popUpHelp(){ linkLC=document.createElement('a'); var parent = document.getElementById('chatButton'); if(parent != null) { parent.appendChild(linkLC); linkLC.setAttribute('href','http://valtira.com/page/help_desk.jsp'); linkLC.setAttribute('title','Help Desk'); linkLC.id = 'helpDesk' pic=document.createElement('img'); pic.src = "/media/image/1/btnhelpdesk.gif"; // add the text as a child of the link linkLC.appendChild(pic); linkLC.onclick = function(){ popUp(this.href, "900", "500"); return false; } } }