\n'); } function mainLoop() { var movie = InternetExplorer() ? ttmovie : document.ttmovie; var installer = InternetExplorer() ? installerCtrl : document.ns_installer; installer.RunInstaller(); switch(installer.getStateCode()) { case 15: // ask user if default directory is OK break; case 20: stopMainLoop(); // navigate to troubleshooting webpage showHelp(); break; case 23: // display "updating Toontown..." movie.LoadMovie(0,installer.getMessagesFilename()); break; case 25: // going to check if the launcher is current... break; case 30: // start game1 in flash movie.LoadMovie(0,installer.getGame1Filename()); break; case 35: // waiting for movie to download... break; case 37: // waiting for game2 to download... break; case 40: // tell game1 it can exit movie.SetVariable("_root.game_can_exit", "true"); // wait for game1 to exit break; case 50: // start movie in flash movie.LoadMovie(0,installer.getMovieFilename()); movie.SetVariable("_root.rec:percent_loaded", "0"); break; case 53: // starting launcher download... break; case 55: // waiting for launcher to download... break; case 60: // waiting for launcher to self-extract... break; case 85: // going to start downloading launcher patch... break; case 87: // waiting for patch to download... break; case 90: // start movie movie.LoadMovie(0,installer.getMovieFilename()); break; case 95: // going to check if launcher is valid... break; case 97: // going to run launcher... break; case 110: // updating "percent loaded"... movie.SetVariable("_root.rec:percent_loaded", installer.getPercentLoaded().toString()); break; case 115: // waiting for panda window to open... break; case 120: // shut down stopMainLoop(); closeWindowNormalExit(); break; case 13: // major error stopMainLoop(); showHelp(); break; default: // error, unknown StateCode stopMainLoop(); alert("Installer Javascript Error: unknown StateCode " + installer.getStateCode()); showHelp(); break; } } function read_value(s,r,d) { if(s) { index = s.indexOf(r); if (index != -1) { countbegin = (s.indexOf("=", index) + 1); countend = s.indexOf(d, index); if (countend == -1) { countend = s.length; } count = s.substring(countbegin, countend); return (count); } } } // removes everything after the last "/" function stripFilename(p) { index = p.lastIndexOf("/"); if ((index == -1) || (index == 0)) return ""; return p.substring(0,index+1); } // make sure the string does not start with "/" function unPreSlashify(p) { while ((p.length > 0) && (p.charAt(0) == "/")) { p = p.substring(1, p.length); //alert (p); } return p; } function window_onload() { // check and initialize the installer if(InternetExplorer()) { if(initInstallerCtrl() == 0) { alert("To play Toontown, you must allow the ActiveX control to download."); closeWindow(); return; } } else { // this may not come back if(initNSP()) return; } var installer = InternetExplorer() ? installerCtrl : document.ns_installer; initialized = 1; installer.setUserName(read_value(location.search, "UN", '&')); installer.setChat(read_value(location.search, "ToontownChat", '&')); installer.setSwid(read_value(location.search, "SWID", '&')); // Test server -- dcranall-d01 // installer.setDownloadServer("206.16.11.195"); // Test server -- jack // installer.setDownloadServer("206.16.11.193"); // Mike's server -- johnson // installer.setDownloadServer("206.16.11.26"); // Test server -- shochet // installer.setDownloadServer("206.16.11.182"); // Production server //installer.setDownloadServer("206.18.65.33"); // determine download server URL from this page's URL; // assume that this page came from base directory of // download server var dlServerURL = location.protocol + "//" + location.host + "/" + unPreSlashify(stripFilename(location.pathname)); //alert(dlServerURL); installer.setDownloadServer(dlServerURL); mainLoop(); timerID = setInterval("mainLoop()", 100); } //-->