home *** CD-ROM | disk | FTP | other *** search
Wrap
//*[global.js]**************************************************************** // // Global Functions/Variables // (for archived Neil's C++ Stuff articles) // //-[History]------------------------------------------------------------------ // 2006-05-18 by NeilO .... Created. // //**************************************************************************** var fPrintPreview = false; if (location.href.match(/[&?]pf=1[&]?$/)) fPrintPreview = true; var sc_project=1574541; var sc_invisible=1; var sc_partition=14; var sc_security="b93fcbe3"; var SectionTitle = "This part of NeilStuff.com"; var SectionLink = "http://www.neilstuff.com/"; var Topic = "Stuff"; var SiteID = "04"; var PickedBooks = [ { title : "Joel on Software", url : "http://www.amazon.com/exec/obidos/redirect?link_code=as2&path=ASIN/1590593898&tag=neiscstu&camp=1789&creative=9325", img : "http://www.neilstuff.com/amazon/1590593898.01._AA_SCMZZZZZZZ_.jpg", hurl : "http://www.assoc-amazon.com/e/ir?t=neiscstu&l=as2&o=1&a=1590593898" }, { title : "The Pragmatic Programmer", url : "http://www.amazon.com/exec/obidos/redirect?link_code=as2&path=ASIN/020161622X&tag=neiscstu&camp=1789&creative=9325", img : "http://www.neilstuff.com/amazon/020161622X.01._AA_SCMZZZZZZZ_.jpg", hurl : "http://www.assoc-amazon.com/e/ir?t=neiscstu&l=as2&o=1&a=020161622X" } ]; if (location.href.match(/\/qb\/.*/)) { SectionTitle = "Neil's QBasic Tutorial"; SectionLink = "http://www.neilstuff.com/qb/qbtut1.htm"; Topic = "QBasic"; SiteID = "03"; } else if (location.href.match(/\/cpp\/.*/)) { SectionTitle = "Neil's C++ Stuff"; SectionLink = "http://www.neilstuff.com/cpp/"; Topic = "C++"; SiteID = "01"; } else if (location.href.match(/\/guide_to_c\+\+\/.*/)) { SectionTitle = "Neil's Guide to C++"; SectionLink = "http://www.neilstuff.com/guide_to_c++/"; Topic = "C++"; SiteID = "05"; sc_project=1574537; sc_invisible=1; sc_partition=14; sc_security="5044d449"; } else if (location.href.match(/\/vss\/.*/)) { SectionTitle = "Neil's VSS Help"; SectionLink = "http://www.neilstuff.com/vss/"; Topic = "VSS"; SiteID = "02"; } if ("VSS" == Topic) { PickedBooks.push ({ title : "Essential SourceSafe", url : "http://www.amazon.com/exec/obidos/redirect?link_code=as2&path=ASIN/1930919050&tag=neiscstu&camp=1789&creative=9325", img : "http://www.neilstuff.com/amazon/1930919050.01._AA_SCMZZZZZZZ_.jpg", hurl : "http://www.assoc-amazon.com/e/ir?t=neiscstu&l=as2&o=1&a=1930919050" }); } if ("C++" == Topic) { PickedBooks.push ({ title : "C++ in Plain English", url : "http://www.amazon.com/exec/obidos/redirect?link_code=as2&path=ASIN/0764535455&tag=neiscstu&camp=1789&creative=9325", img : "http://www.neilstuff.com/amazon/0764535455.01._AA_SCMZZZZZZZ_.jpg", hurl : "http://www.assoc-amazon.com/e/ir?t=neiscstu&l=as2&o=1&a=0764535455" }); PickedBooks.push({ title : "C How To Program", url : "http://www.amazon.com/exec/obidos/redirect?link_code=as2&path=ASIN/0131426443&tag=neiscstu&camp=1789&creative=9325", img : "http://www.neilstuff.com/amazon/0131426443.01._AA_SCMZZZZZZZ_.jpg", hurl : "http://www.assoc-amazon.com/e/ir?t=neiscstu&l=as2&o=1&a=0131426443" }); PickedBooks.push({ title : "C For Dummies", url : "http://www.amazon.com/exec/obidos/redirect?link_code=as2&path=ASIN/0764570684&tag=neiscstu&camp=1789&creative=9325", img : "http://www.neilstuff.com/amazon/0764570684.01._AA_SCMZZZZZZZ_.jpg", hurl : "http://www.assoc-amazon.com/e/ir?t=neiscstu&l=as2&o=1&a=0764570684" }); } // // trim PickedBooks to only two // PickedBooks.sort(function(x,y){return Math.random() - Math.random();}); PickedBooks = PickedBooks.slice(0,2); var ArchivedMessage = [ "<B><A HREF=\"" + SectionLink + "\">" + SectionTitle + "</A></B> and this page are being preserved, but not actively maintained. I hope you find this to be useful and I encourage you to link it. Visit <A HREF=\"http://www.neilstuff.com/\">NeilStuff.com</A> to see what else I'm up to or drop me a line at <A HREF=\"mailto:webmaster@neilstuff.com\">webmaster@neilstuff.com</A> for comments/corrections." ].join("<BR/><BR/>"); var HotSpots = [ "Otechski JS", "Industrial strength JavaScript for scheduled tasks, quick scripts, ASP, and maybe more!", "http://www.otechski/js/", "del.icio.us " + Topic, Topic + " links from del.icio.us users", "http://del.icio.us/tag/" + Topic.toLowerCase() ]; //**************************************************************************** //**************************************************************************** // Client JS for "Test Your Knowledge" Form //**************************************************************************** //**************************************************************************** var js_iseed = 0, js_iseed1 = 0, js_iseed2 = 0, formnum = 0; var answ = new Array(6); var scratch = "", j = 0, k = 0; var goodmsg = "Right on!"; var badmsg = "Try again!"; var childbub=0; // child bubble var bTime; // bubble timer ID var bubblei=0;// desired bubble var bubblecfg = false; var bmsg=0; // index of current bubble: var mdata; function config_bubble() { } function tyk(question, ans1, ans2, ans3, ans4, cans, explanation) { formnum++; answ[0]=ans1; answ[1]=ans2; answ[2]=ans3; answ[3]=ans4; answ[4]=cans; for (var i = 0; i < 10; i++) { j = random(5); if (j > 4) alert("ack!"); scratch = answ[j]; answ[j] = ""; k = j; while (answ[k] == "") k = random(5); answ[j] = answ[k]; answ[k] = scratch; } for (var i = 0; i < 5; i++) if (answ[i] == cans) k = i; document.write ( "<CENTER><TABLE BORDER=0 CELLBORDER=0 CELLSPACING=0 CELLPADDING=0>"+ "<TD ALIGN=CENTER>"+ "<TABLE WIDTH=570 BORDER=0 CELLBORDER=0 CELLSPACING=0 CELLPADDING=0>"+ "<TR><TD COLSPAN=3 WIDTH=570 HEIGHT=54>"+ "<IMG SRC=tyk_gfx/top_title.GIF WIDTH=570 HEIGHT=54></TD></TR>"+ "<TR><TD WIDTH=32 HEIGHT=135>"+ "<IMG SRC=tyk_gfx/left_q.GIF WIDTH=32 HEIGHT=135></TD>"+ "<TD WIDTH=505 HEIGHT=135 BGCOLOR=FFFFFF>"+ "<IMG SRC=tyk_gfx/blank.GIF WIDTH=505 HEIGHT=1><BR>"+ "<FORM NAME=ex" + formnum + ">" + question + "</TD>" + "<TD WIDTH=33 HEIGHT=135>"+ "<IMG SRC=tyk_gfx/right_q.GIF WIDTH=32 HEIGHT=135></TD></TR>"+ "<TR><TD COLSPAN=3 WIDTH=570 HEIGHT=12>"+ "<IMG SRC=tyk_gfx/middle_div.GIF WIDTH=570 HEIGHT=12></TR></TABLE>"+ "<TABLE WIDTH=570 BORDER=0 CELLBORDER=0 CELLSPACING=0 CELLPADDING=0>"+ "<TR><TD ROWSPAN=2 WIDTH=42 HEIGHT=200>"+ "<IMG SRC=tyk_gfx/left_bot.GIF WIDTH=42 HEIGHT=200></TD>"+ "<TD WIDTH=496 HEIGHT=182 BGCOLOR=FFFFFF>" ); for (var i = 0; i < 5; i++) document.write("<INPUT TYPE=RADIO NAME=exchc>" + answ[i] + "<BR>"); document.write ( "<CENTER><INPUT TYPE=BUTTON VALUE='Am I Right?' ONCLICK=\"(document.ex" + formnum + ".exchc[" + k + "].checked)?alert('" + goodmsg ); if (explanation != "") { document.write("\\n\\n" + explanation); } document.write ( "'):alert(badmsg);\"></CENTER></FORM></TD>" + "<TD ROWSPAN=2 WIDTH=32 HEIGHT=200>"+ "<IMG SRC=tyk_gfx/right_bot.GIF WIDTH=32 HEIGHT=200></TD></TR>"+ "<TR><TD WIDTH=496 VALIGN=BOTTOM BGCOLOR=FFFFFF>"+ "<IMG SRC=tyk_gfx/middle_bot.GIF WIDTH=496 HEIGHT=9></TD></TR>"+ "<TR><TD COLSPAN=3 WIDTH=570 HEIGHT=9>"+ "<IMG SRC=tyk_gfx/bottom.GIF WIDTH=570 HEIGHT=9></TD></TR></TABLE>" + "</TD></TABLE></CENTER>" ); } // ripped this function from a script on www.javascripts.com, can't remember // the original script or author, sorry function random(n) { var js_mult1=3141 var js_mult2=5821 var js_m1=100000000 var js_m2=10000 if (js_iseed == 0) { now = new Date() js_iseed = now.getHours() + now.getMinutes() * 60 + now.getSeconds() * 3600 } js_iseed1 = js_iseed / js_m2 js_iseed2 = js_iseed % js_m2 var tmp = (((js_iseed2 * js_mult1 + js_iseed1 * js_mult2) % js_m2) * js_m2 + (js_iseed2 * js_mult2)) % js_m1 js_iseed = (tmp + 1) % js_m1 return (Math.floor((js_iseed/js_m1) * n)) }