/* wcschat.js */ //-- include the js for iframe dragging document.write(''); //-- add the onload event to create the chat window try { window.onload = null; var safari = navigator.userAgent.indexOf('Safari') != -1; //-- create the chat window (document.addEventListener&&!window.opera)?window.addEventListener('load',createChatWindow,false):window.attachEvent('onload',createChatWindow); //-- add the unload event to display the chat if(safari) { (document.addEventListener&&!window.opera)?window.addEventListener('beforeunload',bunload,false):window.attachEvent('onbeforeunload',bunload); } } catch(e) {} var exit_pop = true; //################################################ // //################################################ function setBool() { exit_pop = false; //if(!window.parent.exit_pop) return false; window.onbeforeunload = null; if(document.addEventListener&&!window.opera) window.removeEventListener('beforeunload',bunload,false); //-- this function may be called before the txp iframe has loaded try { window.frames.iframe1.disableUnload(); } catch(e) { } } //################################################ // //################################################ function bunload(){ if(!exit_pop) return false; window.onbeforeunload = null; if(document.addEventListener&&!window.opera) window.removeEventListener('beforeunload',bunload,false); hideShowWindow(false); alert("Wait, a representative is here to assist you with any questions you might have about online education. Please hit CANCEL on the next window to remain on the page."); mess = "\n\n--------------------------------------\n\nAre you sure you want to navigate away? Press CANCEL below for help with any questions or press ok to continue.\n\n--------------------------------------\n\n"; return mess; } //################################################ // //################################################ function hideShowWindow(hide) { var ref = document.getElementById("iframe1"); var cover = document.getElementById("coverDiv"); var bodyRef=(document.compatMode=="CSS1Compat")?document.documentElement:document.body; if(hide) { ref.style.display = "none"; cover.style.visibility = "hidden"; bodyRef.style.overflow = "auto"; //-- add hack to force scrollbars to display in safari var scrollStr = (safari)?"scroll":"auto"; bodyRef.style.overflowX = scrollStr; bodyRef.style.overflowY = scrollStr; hideSelects('hidden'); hideEmbeds('visible'); } else { ref.style.display = "inline"; cover.style.visibility = "visible"; cover.style.height = "100%"; bodyRef.style.overflow = "hidden"; ref.focus(); bodyRef.scrollTop = "0px"; bodyRef.scrollLeft = "0px"; hideSelects('visible'); hideEmbeds('hidden'); //var p = ref.document || ref.contentWindow.document; //ref.initChat(); window.frames.iframe1.initChat(); } } //################################################ // hide all select boxes for IE //################################################ function hideSelects(action) { if (action!='visible'){action='hidden';} if (/msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent)) { window.status = "hideSelects"; var sels = document.getElementsByTagName("SELECT"); for (var S = 0; S < document.forms.length; S++){ for (var R = 0; R < document.forms[S].length; R++) { if (document.forms[S].elements[R].options) { document.forms[S].elements[R].style.visibility = action; } } } } } //################################################ // hide all embed objects so popup window will // not be hidden under flash elements //################################################ function hideEmbeds(action) { if (action!='visible') action='hidden'; var collection = new Array(); collection = document.getElementsByTagName("EMBED");//[0].style.visibility = 'hidden'; for(var x in collection) { if(collection[x].tagName == "EMBED") collection[x].style.visibility = action; } } //################################################ // //################################################ function createChatWindow () { //alert("createChatWindow() called"); var cif = document.createElement("IFRAME"); cif.id = "iframe1"; cif.name = "iframe1"; cif.frameBorder = 0; //-- we need to determine the server for the persistent session //var ip = "192.168.106.30"; //var server = (ip=="76.12.1.7")?"bart":(ip=="76.12.1.8")?"rod":"todd"; //alert("http://"+server+".earnmydegree.com/txp/txpChat.aspx"); cif.src = "txpChat.aspx?fid=videogame_v4"; cif.allowTransparency = "true"; cif.className = "iframe1"; cif.style.width = "400px"; cif.style.height = "305px"; cif.style.position = "absolute"; cif.style.display = "inline"; cif.style.top = "20px"; cif.style.left = "20px"; cif.style.zIndex = "100001"; cif.style.border = "0px"; cif.style.display = "none"; document.body.appendChild(cif); //-- create cover div for lightbox effect var cdiv = document.createElement("DIV"); cdiv.id = "coverDiv"; cdiv.style.position = "absolute"; cdiv.style.top = "0px"; cdiv.style.left = "0px"; cdiv.style.zIndex = "100000"; cdiv.style.filter = "alpha(opacity=80)"; //-- this is only needed for older versions of mozilla //cdiv.style.-moz-opacity = ".80"; cdiv.style.opacity = ".80"; cdiv.style.background = "#666666"; cdiv.style.height = "100%"; cdiv.style.width = "100%"; cdiv.style.visibility = "hidden"; document.body.appendChild(cdiv); }