function addEvent(obj, evType, fn) { if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', initializeDHTMLHistory); function initializeDHTMLHistory() { // initialize the RSH framework dhtmlHistory.initialize(); // add callback listener to history change events dhtmlHistory.addListener(onHistoryChange); } function onHistoryChange(newLocation, historyData) { //alert('newLocation: ' + base64_decode(newLocation) + ' container: ' + historyData); if (historyData != undefined) { wtGet(historyData, base64_decode(newLocation), true); } } /* * This function looks for a bookmark on the URL. Should be used * when the (client) page first loads. */ function wtInit(container, url) { // if a URL exists in the anchor, use it as a bookmark if (window.location.href.lastIndexOf('#') >= 0) { var loc = window.location.href; var url = loc.substring(loc.lastIndexOf('#') + 1); wtGet(container, base64_decode(url), true); } else { wtGet(container, url, true); } } function wtPost(container, url) { /* remove any previous script tags */ if (document.getElementById(container + '_script')) { var old = document.getElementById(container + '_script'); document.getElementsByTagName("head")[0].removeChild(old); } url = base64_encode(url); host = window.location.hostname; var params = ""; var inputs = document.frmSubmit.elements; /* Take all the name=value pairs from the form and assemble a GET-like string */ for (var i=0;i */ var e = document.createElement("script"); e.src = 'http://www.myschoolalerts.org/business/webtools/wt_post.php?key=' + key + '&bid=' + bid + '&tid=' + tid + '&host=' + host + '&c=' + container + '&u=' + url + '&p=' + params; e.type="text/javascript"; e.setAttribute('id', container + '_script'); document.getElementsByTagName("head")[0].appendChild(e); } /* * This function will load a URL in a new page (given in * the 'target' variable), only if the intended container * does not exist. */ function wtSetContext(container, url) { if (document.getElementById(container)) { wtGet(container, url); } else { window.location.href=target + '#' + base64_encode(url); } } function wtGet() { var url = wtGet.arguments[1]; var container = wtGet.arguments[0]; var historyIsOff = wtGet.arguments[2]; /* remove any previous script tags */ if (document.getElementById(container + '_script')) { var old = document.getElementById(container + '_script'); document.getElementsByTagName("head")[0].removeChild(old); } url = base64_encode(url); /* if third argument does not exist, add to history */ if (historyIsOff == undefined) { dhtmlHistory.add(url, container); } host = window.location.hostname; /* * The following adds to the DOM a script tag like: * */ var e = document.createElement("script"); e.src = 'http://www.myschoolalerts.org/business/webtools/wt_get.php?key=' + key + '&bid=' + bid + '&tid=' + tid + '&host=' + host + '&c=' + container + '&u=' + url; e.type="text/javascript"; e.setAttribute('id', container + '_script'); document.getElementsByTagName("head")[0].appendChild(e); } /********************************************************************************/ /********************************************************************************/ /* The following are helper functions grabbed from the internet */ //First things first, set up our array that we are going to use. var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + //all caps "abcdefghijklmnopqrstuvwxyz" + //all lowercase "0123456789+/="; // all numbers plus +/= //Heres the encode function function base64_encode(inp) { var out = ""; //This is the output var chr1, chr2, chr3 = ""; //These are the 3 bytes to be encoded var enc1, enc2, enc3, enc4 = ""; //These are the 4 encoded bytes var i = 0; //Position counter do { //Set up the loop here chr1 = inp.charCodeAt(i++); //Grab the first byte chr2 = inp.charCodeAt(i++); //Grab the second byte chr3 = inp.charCodeAt(i++); //Grab the third byte //Here is the actual base64 encode part. //There really is only one way to do it. enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) { enc3 = enc4 = 64; } else if (isNaN(chr3)) { enc4 = 64; } //Lets spit out the 4 encoded bytes out = out + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4); // OK, now clean out the variables used. chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < inp.length); //And finish off the loop //Now return the encoded values. return out; } //Heres the decode function function base64_decode(inp) { var out = ""; //This is the output var chr1, chr2, chr3 = ""; //These are the 3 decoded bytes var enc1, enc2, enc3, enc4 = ""; //These are the 4 bytes to be decoded var i = 0; //Position counter // remove all characters that are not A-Z, a-z, 0-9, +, /, or = var base64test = /[^A-Za-z0-9\+\/\=]/g; if (base64test.exec(inp)) { //Do some error checking alert("There were invalid base64 characters in the input text.\n" + "Valid base64 characters are A-Z, a-z, 0-9, ?+?, ?/?, and ?=?\n" + "Expect errors in decoding."); } inp = inp.replace(/[^A-Za-z0-9\+\/\=]/g, ""); do { //Here’s the decode loop. //Grab 4 bytes of encoded content. enc1 = keyStr.indexOf(inp.charAt(i++)); enc2 = keyStr.indexOf(inp.charAt(i++)); enc3 = keyStr.indexOf(inp.charAt(i++)); enc4 = keyStr.indexOf(inp.charAt(i++)); //Heres the decode part. There’s really only one way to do it. chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; //Start to output decoded content out = out + String.fromCharCode(chr1); if (enc3 != 64) { out = out + String.fromCharCode(chr2); } if (enc4 != 64) { out = out + String.fromCharCode(chr3); } //now clean out the variables used chr1 = chr2 = chr3 = ""; enc1 = enc2 = enc3 = enc4 = ""; } while (i < inp.length); //finish off the loop //Now return the decoded values. return out; } /**************************************************** Author: Eric King Url: http://redrival.com/eak/index.shtml This script is free to use as long as this info is left in Featured on Dynamic Drive script library (http://www.dynamicdrive.com) ****************************************************/ var win=null; function NewWindow(mypage,myname,w,h,scroll,pos) { if(pos=="random") { LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100; } if(pos=="center") { LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100; } else if((pos!="center" && pos!="random") || pos==null) { LeftPosition=0;TopPosition=20 } settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes'; win=window.open(mypage,myname,settings); } function NewWindowNoMenu(mypage,myname,w,h,scroll,pos) { if(pos=="random") { LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100; } if(pos=="center") { LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100; } else if((pos!="center" && pos!="random") || pos==null) { LeftPosition=0;TopPosition=20 } settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes'; win=window.open(mypage,myname,settings); } /*********************************************** * Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code ***********************************************/ var loadedobjects=""; function loadobjs() { if (!document.getElementById) return; for (i=0; i