Advertisement
Guest User

Web-based Windows 3.1 simulator source code

a guest
May 31st, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 66.23 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  5. <meta name="keywords" lang="en" content="Michael Vincent" />
  6. <meta name="author" content="Michael Vincent" />
  7. <meta name="robots" content="NOODP" />
  8. <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  9. <title>michaelv.org</title>
  10. <link rel="stylesheet" href="/css.css" type="text/css" />
  11. <script type="text/javascript">
  12. //<![CDATA[
  13. var args='';
  14. var scrollTimer; var scrollY=-1; var scrollSave; var scrollObj=null;
  15. var refScreen; var gCallback; var refModal; var uniqueID=0; var refProgman;
  16. var modalActive=0; var menuBarCB; var menuBarI; var menuBarS=null;
  17. var modalPreviousZ; var filePickerCB=null; var filePickerPath; var filePickerfilter;
  18. var filePickerFile; var filePickerFileSelected=-1; var filePickerDirSelected=-1;
  19. var resizeActive = -1; var menuActive=0; var systemMenuA=0;
  20. var resizeArray = ['nw-resize', 'w-resize', 'sw-resize', 'n-resize', '', 's-resize', 'ne-resize', 'e-resize', 'se-resize'];
  21. var windowCount = 0; var iconSelected=0;
  22. var highestZ = 0; highestZGroup=0;
  23. var externalFileList = new Array();
  24. //name, icon, type (0=real program), minimized (1/0), code, width, height, left, top, maxed (1/0), cicons (3/1/0), closing callback, ismodal, resize callback, isprogmangrp
  25. //var windows = [['Program Manager', 0, 0, 0, 'progman', 640, 480, 0, 0, 1, cb, modal, resizecb, 0]];
  26. var windows = new Array();
  27. var mouseX; var mouseY; var dragObject; var dragX; var dragY; var lastButton = -1;
  28. var proggroups = [['Main',3,'main'],['Accessories',3,'accessories'],['Games',3,'games'],['Internet Browser',3,'browser'],['Explore Content',3,'content']];
  29. var progManGroupsCount=5; //UPDATE THIS IF A NEW GROUP IS ADDED IN THE LINE ABOVE
  30. var progManMenuStructure=[[['Run...',1],['Exit Windows...',1]],[['1: Main',1],['2: Accessories',1],['3: Games',1],['4: Internet Browser',1],['5: Explore Content',1],['-',1],['<no open programs>',0]],[['About Program Manager...',1]]];
  31. var grouplists = [[['Control Panel',9,'\\windows\\cpanel.exe'],['MS-DOS Prompt',8,'\\command.com'],['Read Me',11,'\\windows\\notepad.exe \\windows\\about.txt'],['michaelv.org Forum',14,'\\windows\\ibrowser.exe http://www.michaelv.org/forum/']],[['Calculator',7,'\\windows\\calc.exe'],['Media Player',5,'\\windows\\mplayer.exe'],['Notepad',4,'\\windows\\notepad.exe'],['Picture Viewer',13,'\\windows\\pviewer.exe']],[['Minesweeper',12,'\\windows\\winmine.exe']],[['Internet Browser',6,'\\windows\\ibrowser.exe'],['User\'s Guide',11,'\\windows\\notepad.exe \\windows\\ibrowser.txt']],[['Computers',19,'\\windows\\ibrowser.exe http://www.michaelv.org/computers/?i=1'],['michaelv.org Forum',14,'\\windows\\ibrowser.exe http://www.michaelv.org/forum/'],['Music',16,'\\windows\\ibrowser.exe http://www.michaelv.org//projects/telephone/?i=1'],['Projects',15,'\\windows\\ibrowser.exe http://www.michaelv.org/projects.php?i=1'],['Radiation',21,'\\windows\\ibrowser.exe http://www.michaelv.org/radiation/?i=1'],['Writings',17,'\\windows\\ibrowser.exe http://www.michaelv.org/writing/?i=1'],['Et Cetera',20,'\\windows\\ibrowser.exe http://www.michaelv.org/index2.php']]];
  32. function hide(self) { self.parentNode.parentNode.parentNode.style.display = 'none'; }
  33. function dragDown(e) {
  34.     if (e == null)
  35.         var e = window.event;
  36.     dragObject = document.getElementById(this.getAttribute('tag'));
  37.     if (dragObject.getAttribute('tag_grp') != 1) {
  38.         if (dragObject.style.zIndex != highestZ)
  39.             dragObject.style.zIndex = ++highestZ;
  40.     } else {
  41.         if (dragObject.style.zIndex != highestZGroup)
  42.             dragObject.style.zIndex = ++highestZGroup;
  43.     }
  44.     lastButton = getMouseButton(e.button);
  45.     if (lastButton != 0)
  46.         return false;
  47.     if (dragObject.getAttribute('tag2') == '1')
  48.         return false;
  49.     if (this.style.cursor != 'move')
  50.         this.style.cursor = 'move';
  51.     mouseX = e.clientX; mouseY = e.clientY;
  52.     dragX = parseInt(dragObject.style.left); dragY = parseInt(dragObject.style.top);
  53.     refScreen.onmousemove = mouseDragger;
  54.     refModal.onmousemove=mouseDragger;
  55.     return false;
  56. }
  57. function getMouseButton(button) {
  58.     if (navigator.userAgent.indexOf('MSIE') == -1)
  59.         return button;
  60.     return --button;
  61. }
  62. function dragUp(e) {
  63.     e = e || window.event;
  64.     if (lastButton != 0)
  65.         return;
  66.     if (document.getElementById(this.getAttribute('tag')).getAttribute('tag2') != '1')
  67.         mouseDragger(e);
  68.     this.style.cursor = 'default';
  69.     refScreen.onmousemove=null;
  70.     refModal.onmousemove=null;
  71. }
  72. function mouseDragger(e) {
  73.     var x; var y; var w; var h;
  74.     var refScreenTemp=refScreen;
  75.     var refScreen_top=refScreen.offsetTop;
  76.     var refScreen_left=refScreen.offsetLeft;
  77.     var refScreen_height=refScreen.offsetHeight;
  78.     var refScreen_width=refScreen.offsetWidth;
  79.     if (dragObject.getAttribute('tag_grp')==1) {
  80.         refScreenTemp=refProgman;
  81.         refScreen_top=0;
  82.         refScreen_left=0;
  83.         refScreen_width=parseInt(refScreenTemp.style.width);
  84.         refScreen_height=parseInt(refScreenTemp.style.height);
  85.     }
  86.     if (e == null)
  87.         var e = window.event;
  88.     if (resizeActive != -1)
  89.     {
  90.         x = dragX; y = dragY; w = dragW; h = dragH;
  91.         if (getMouseButton(e.button) != 0)
  92.             { resizeUp(e); return false; }
  93.         if (resizeActive < 3)
  94.         {
  95.             x = dragX + (e.clientX - mouseX);
  96.             w = dragW - (e.clientX - mouseX);
  97.         }
  98.         if (resizeActive > 5)
  99.             w = dragW + (e.clientX - mouseX);
  100.         if (resizeActive % 3 == 0)
  101.         {
  102.             y = dragY + (e.clientY - mouseY);
  103.             h = dragH - (e.clientY - mouseY);
  104.         }
  105.         if (resizeActive % 3 == 2)
  106.             h = dragH + (e.clientY - mouseY);
  107.         if (w < 125)
  108.             { w = 125; x = parseInt(dragObject.style.left); }
  109.         if (h < 125)
  110.             { h = 125; y = parseInt(dragObject.style.top); }
  111.         if (x < refScreen_left-4 || y < refScreen_top-4 || (x+w)>refScreen_left+refScreen_width || (y+h)>refScreen_top+refScreen_height)
  112.             return false;
  113.         if (dragObject.getAttribute('tag_grp') == 1) {
  114.             if (x<refScreen_left-2 || y<(refScreen_top+document.getElementById('progman_menubar').offsetHeight+25) || (x+w)>refScreen_left+refScreen_width-7 || (y+h)>refScreen_top+refScreen_height-8)
  115.             return false;
  116.         }
  117.         dragObject.style.left = x + 'px';
  118.         dragObject.style.top = y + 'px';
  119.         dragObject.style.width = w + 'px';
  120.         dragObject.style.height = h + 'px';
  121.         var k = document.getElementById(dragObject.id+'_bt');
  122.         resizeBoxText(dragObject,k);
  123.         for (var i=0;i<windowCount;i++) {
  124.             if (windows[i][4]==dragObject.id) {
  125.                 windows[i][13](dragObject); break; }
  126.         }
  127.         return false;
  128.     }
  129.     if (lastButton != 0)
  130.         return false;
  131.     if (getMouseButton(e.button) != 0)
  132.         { document.getElementById(dragObject.id + '_tbar').style.cursor = 'default'; refScreen.onmousemove = null; return false; }
  133.     x = dragX + (e.clientX - mouseX);
  134.     y = dragY + (e.clientY - mouseY);
  135.     if (dragObject.getAttribute('tag_grp')==1) {
  136.         if (x < refScreen_left)
  137.             { x=refScreen_left; mouseDraggerSpecial(); }
  138.         if (y < document.getElementById('progman_menubar').offsetHeight+25)
  139.             { y=document.getElementById('progman_menubar').offsetHeight+25; mouseDraggerSpecial(); }
  140.         if (x > refScreen_width-parseInt(dragObject.style.width)-8)
  141.             { x=refScreen_width-parseInt(dragObject.style.width)-8; mouseDraggerSpecial(); }
  142.         if (y >= refScreen_height-parseInt(dragObject.style.height)-8)
  143.             { y=refScreen_height-parseInt(dragObject.style.height)-8; mouseDraggerSpecial(); }
  144.     } else {
  145.         if (x > refScreen_left + refScreen_width-4)
  146.             x = refScreen_width+refScreen_left-4;
  147.         if (y < refScreen_top-4)
  148.             y = refScreen_top-4;
  149.         if (y > refScreen_top + refScreen_height-4)
  150.             y = refScreen_top + refScreen_height-4;
  151.     }
  152.     dragObject.style.left = x + 'px';
  153.     dragObject.style.top = y + 'px';
  154.     return false;
  155. }
  156. function mouseDraggerSpecial() {
  157.     document.getElementById(dragObject.id + '_tbar').style.cursor = 'default';
  158.     refScreen.onmousemove=null;
  159.     refModal.onmousemove=null;
  160. }
  161. function boxnestCancel(e) {
  162.     e = e || window.event;
  163.     bringTopmost(this.parentNode);
  164.     if (menuActive != 1)
  165.         e.cancelBubble = true;
  166. }
  167. function boxnestCancel2(e) {
  168.     e = e || window.event;
  169.     bringTopmostGroup(this.parentNode);
  170.     bringTopmost(refProgman);
  171.     if (menuActive != 1)
  172.         e.cancelBubble=true;
  173. }
  174. function bringTopmostGroup(t) {
  175.     if (t.style.zIndex != highestZGroup)
  176.         t.style.zIndex = ++highestZGroup;
  177. }
  178. function bringTopmost(t) {
  179.     if (t.style.zIndex != highestZ)
  180.         t.style.zIndex = ++highestZ;
  181. }
  182. function resizeDown(e) {
  183.     e = e || window.event;
  184.     var o_left=this.offsetLeft; var o_top=this.offsetTop;
  185.     var o_width=this.offsetWidth; var o_height=this.offsetHeight;
  186.     if (this.getAttribute('tag_grp') != 1) {
  187.         bringTopmost(this);
  188.     } else {
  189.         var pma=refProgman;
  190.         o_left += parseInt(pma.style.left)+3;
  191.         o_top += parseInt(pma.style.top)+3;
  192.     }
  193.     if (menuActive == 1) {
  194.         menuModalClick(e);
  195.         return;
  196.     }
  197.     if (getMouseButton(e.button) != 0)
  198.         return false;
  199.     var a = 1; var b = 1;
  200.     var x = e.clientX; var y = e.clientY;
  201.     if (Math.abs(x - o_left - 2) < 4)
  202.         a=0;
  203.     if (Math.abs(o_width+o_left - x) < 4)
  204.         a=2;
  205.     if (Math.abs(y - o_top - 2) < 4)
  206.         b=0;
  207.     if (Math.abs(o_height+o_top - y) < 4)
  208.         b=2;
  209.     resizeActive = (3*a)+b;
  210.     mouseX = e.clientX; mouseY = e.clientY;
  211.     dragX = parseInt(this.style.left); dragY = parseInt(this.style.top);
  212.     dragW = parseInt(this.style.width); dragH = parseInt(this.style.height);
  213.     dragObject = this;
  214.     document.body.style.cursor = resizeArray[resizeActive];
  215.     refScreen.onmousemove = mouseDragger;
  216.     document.body.onmouseup = resizeUp;
  217.     if (this.getAttribute('tag_grp') == 1)
  218.         e.cancelBubble=true;
  219. }
  220. function resizeUp(e) {
  221.     e = e || window.event;
  222.     if (resizeActive == -1)
  223.         return;
  224.     resizeActive = -1;
  225.     document.body.style.cursor = 'default';
  226.     refScreen.onmousemove = null;
  227. }
  228. function mouseMoveBox(e) {
  229.     e = e || window.event;
  230.     var a = 1; var b = 1;
  231.     var o_left=this.offsetLeft; var o_top=this.offsetTop;
  232.     var o_width=this.offsetWidth; var o_height=this.offsetHeight;
  233.     if (this.getAttribute('tag_grp')==1) {
  234.         var pg=refProgman;
  235.         o_left += parseInt(pg.offsetLeft);
  236.         o_top += parseInt(pg.offsetTop);
  237.     }
  238.     var x = e.clientX; var y = e.clientY;
  239.     if (Math.abs(x - o_left - 2) < 4)
  240.         a=0;
  241.     if (Math.abs(o_width+o_left - x) < 4)
  242.         a=2;
  243.     if (Math.abs(y - o_top - 2) < 4)
  244.         b=0;
  245.     if (Math.abs(o_height+o_top - y) < 4)
  246.         b=2;
  247.     if (resizeActive==-1)
  248.         this.style.cursor = resizeArray[(a*3)+b];
  249. }
  250. function blockDefault(e) {
  251.     e = e || window.event;
  252.     if (typeof e.preventDefault != 'undefined')
  253.         e.preventDefault();
  254. }
  255. function minIconDoubleClick() {
  256.     iconSelected=0;
  257.     var i=this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('tag');
  258.     var id=windows[i][4];
  259.     showWindow(id);
  260.     bringTopmost(document.getElementById(id));
  261.     windows[i][3]=0;
  262.     drawDesktop();
  263. }
  264. function minIconClick(e) {
  265.     var o;
  266.     e = e || window.event;
  267.     var z=this.parentNode.parentNode.parentNode.parentNode.parentNode;
  268.     var m=z.getAttribute('tag');
  269.     if (m != '-1') {
  270.         o=document.getElementById('minIcon'+m).childNodes[1];
  271.         o.style.backgroundColor='transparent';
  272.         o.style.color='#000000';
  273.     }
  274.     iconSelected=1;
  275.     o=this.parentNode.childNodes[1]
  276.     o.style.backgroundColor = "#000080";
  277.     o.style.color = "white";
  278.     z.setAttribute('tag',this.getAttribute('tag'));
  279.     e.cancelBubble = true;
  280.     return false;
  281. }
  282. function minIconUnselect() {
  283.     var obj = document.getElementById('minIconText'+document.getElementById('iconlist').getAttribute('tag'));
  284.     obj.style.backgroundColor = "transparent";
  285.     obj.style.color = "black";
  286.     iconSelected=0;
  287. }
  288. function minDepressed() { this.style.backgroundPosition='-81px 0px'; }
  289. function minRestored() { this.style.backgroundPosition='-54px 0px'; }
  290. function maxDepressed() { this.style.backgroundPosition='-135px 0px'; }
  291. function maxRestored() { this.style.backgroundPosition='-108px 0px'; }
  292. function rDepressed() { this.style.backgroundPosition='-189px 0px'; }
  293. function rRestored() { this.style.backgroundPosition='-162px 0px'; }
  294. function sysD() { this.style.backgroundPosition='-27px 0px'; }
  295. function sysR() { this.style.backgroundPosition='0px 0px'; }
  296. function systemMenu(e,w)
  297. {
  298.     e = e || window.event;
  299.     if (getMouseButton(e.button) != 0)
  300.         return;
  301.     var i = findWindow(w);
  302.     var m = [['Restore',(windows[i][9])],['Move',0],['Size',0],['Minimize',windows[i][10]&1],['Maximize',((windows[i][10]&2)>>1)&&(!(windows[i][9]))],['-',1],['Close',1]];
  303.     var o = document.getElementById(w);
  304.     if (systemMenuA==1) {
  305.         closeWindow(w); closeMenu();
  306.         return false;
  307.     }
  308.     menuActive=1;
  309.     dragX=e.clientX; dragY=e.clientY;
  310.     window.setTimeout("systemMenuA=0",550);
  311.     dragObject=document.getElementById(w+'_lb');
  312.     systemMenuA=1;
  313.     if (o.getAttribute('tag_grp') == 1) {
  314.         var cqd=refProgman;launchMenu(parseInt(o.style.left)+parseInt(cqd.style.left)+12,parseInt(o.style.top)+parseInt(cqd.style.top)+39,m,syscb);
  315.     } else {
  316.         launchMenu(parseInt(o.style.left)+7,parseInt(o.style.top)+34,m,syscb);
  317.     }
  318. }
  319. function syscb(v) {
  320.     var a = dragObject.id.substr(0,dragObject.id.length-3);
  321.     v=parseInt(v);
  322. switch(v) {
  323. case 0:
  324.     restoreWindow(a); break;
  325. case 3:
  326.     if (document.getElementById(a).getAttribute('tag_grp')==1)
  327.         destroyGroupWindow(a);
  328.     else
  329.         minimizeWindow(a);
  330.     break;
  331. case 4:
  332.     maximizeWindow(a); break;
  333. case 6:
  334.     closeWindow(a); break;
  335. } }
  336. function launchMenu(x, y, mStruct, cb, wname) {
  337.     var c; var d;
  338.     gCallback=cb;
  339.     menuActive=1;
  340.     var a = document.createElement("div");
  341.     a.setAttribute("class","popupmenu");
  342.     a.setAttribute("className","popupmenu");
  343.     a.setAttribute("id","pmenu");
  344.     a.style.zIndex = highestZ + 1;
  345.     a.style.left=x+'px'; a.style.top=y+'px';
  346.     var b = document.createElement("div");
  347.     b.setAttribute("class","popupinside");
  348.     b.setAttribute("className","popupinside");
  349. b.onselectstart = new Function("return false;");
  350.     for (var i=0;i<mStruct.length;i++) {
  351.         c = document.createElement("div");
  352.         if (mStruct[i][0] != '-')
  353.         {
  354.             c.setAttribute("class","menuc");
  355.             c.setAttribute("className","menuc");
  356.             c.setAttribute("tag",i);
  357.             c.setAttribute('tag_window',wname);
  358.             c.setAttribute("id","menu_"+i);
  359.             if (mStruct[i][1] == 0)
  360.             {
  361.                 c.style.color='#C0C0C0';
  362.             } else {
  363.                 c.onmouseout=menuOut; c.onmousedown=menuDown;
  364.                 c.onmouseup=menuClick; c.onmousemove=menuMove;
  365.             }
  366.             d = document.createElement("span");
  367.             d.setAttribute("class","pop");
  368.             d.setAttribute("className","pop");
  369.             d.appendChild(document.createTextNode(mStruct[i][0]));
  370.             c.appendChild(d);
  371.             c.onselectstart = new Function("return false;");
  372.         } else {
  373.             c.setAttribute("class","menus");
  374.             c.setAttribute("className","menus");
  375.             c.style.width=b.style.width;
  376.         }
  377.         b.appendChild(c);
  378.     }
  379.     a.appendChild(b);
  380.     a.onselectstart = new Function("return false;");
  381.     refScreen.appendChild(a);
  382.     refScreen.onmousedown=menuModalClick;
  383.     a.style.visibility='visible';
  384. }
  385. function menuClick(e) {
  386.     var e = e || window.event;
  387.     lastButton = -1;
  388.     var a = this.getAttribute('tag');
  389.     menuModalClick(e);
  390.     gCallback(a,this.getAttribute('tag_window'));
  391. }
  392. function menuDown(e) {
  393.     e = e || window.event;
  394.     lastButton = getMouseButton(e.button);
  395.     this.style.backgroundColor='#000080';
  396.     this.style.color='white';
  397.     e.cancelBubble=true;
  398.     blockDefault(e);
  399.     return false;
  400. }
  401. function menuMove(e) {
  402.     e = e || window.event;
  403.     if (lastButton == 0) {
  404.         this.style.backgroundColor='#000080';
  405.         this.style.color='white';
  406.         e.cancelBubble=true;
  407.         blockDefault(e);
  408.         return false;
  409.     }
  410. }
  411. function menuOut() {
  412.     this.style.backgroundColor='white';
  413.     this.style.color='black';
  414. }
  415. function modalclick(e) {
  416.     e = e || window.event;
  417.     if (modalActive==1)
  418.         return false;
  419. }
  420. function menuModalClick(e) {
  421.     e = e || window.event;
  422.     var obj = document.getElementById('pmenu'); var z;
  423.     refScreen.onmousedown=null;
  424.     closeMenu();
  425. }
  426. function closeMenu(c) {
  427.     if (!document.getElementById('pmenu'))
  428.         return;
  429.     var obj=document.getElementById('pmenu');
  430.     var z;
  431.     if (c != 201)
  432.         menuActive=0;
  433.     obj.style.visibility='hidden';
  434.     while (obj.firstChild) { z=obj.removeChild(obj.firstChild); z=null; }
  435.     z=refScreen.removeChild(obj); z=null;
  436.     if (menuBarS) {
  437.         menuBarS.style.backgroundColor='#FFFFFF';
  438.         menuBarS.style.color='#000000';
  439.         menuBarS=null;
  440.     }
  441. }
  442. function globalClick() {
  443.     if (iconSelected == 1)
  444.         minIconUnselect();
  445. }
  446. function startProgMan() {
  447.     refScreen = document.getElementById('screen');
  448.     refModal = document.getElementById('modal');
  449.     refScreen.style.width = parseInt(document.documentElement.clientWidth) + 'px';
  450.     refScreen.style.height = parseInt(document.documentElement.clientHeight) + 'px';
  451.     refModal.style.left = refScreen.offsetLeft + 'px';
  452.     refModal.style.top = refScreen.offsetTop + 'px';
  453.     refModal.style.width = refScreen.style.width;
  454.     refModal.style.height = refScreen.style.height;
  455.     refScreen.style.visibility = 'visible';
  456.     var a=setCoords(.85,.80,0.055,.07);
  457.     newWindow('Program Manager', 0, 'progman', a[0], a[1], a[2], a[3], 0, 3, progManClose,0,progManResize);
  458.     refProgman=document.getElementById('progman');
  459.     highestZGroup=0;
  460.     addMenuBar(progManMenuStructure,['File','Windows','Help'],document.getElementById('progman_bt'),progManMenu,'progman');
  461.     var z=document.getElementById('progman_bt');
  462.     z.style.position='relative';
  463.     var y=document.createElement('div');
  464.     y.setAttribute('class','alistoficons');
  465.     y.setAttribute('className','alistoficons');
  466.     y.setAttribute('id','progman_groups');
  467.     var x=document.createElement('table');
  468.     x.setAttribute('id','progman_groups_table');
  469.     y.appendChild(x);
  470.     z.appendChild(y);
  471.     progManGroupsAdd('progman',proggroups,progManGroupsDblClick,progManGroupsClick);
  472.     showWindow('progman');
  473.     window.onresize=browserResized;
  474.     //Desktop wallpaper
  475.     var f=readCookie('desktopwallpaper');
  476.     if (f) {
  477.         f=unescape(f);
  478.         var g=f.split('~');
  479.         var zz='no-repeat'; var yy='center center';
  480.         if (g[1] == '1') {
  481.             zz='repeat';
  482.             yy='top left';
  483.         }
  484.             getFile(g[0],function (c,f,i,f2) { progManStartDesktop(c,f,i,f2,zz,yy); });
  485.     }
  486.     //Pre-load images
  487.     var img0=new Image();
  488.     img0.src='/images/icons/buttons1.png';
  489.     var img1=new Image();
  490.     img1.src='/images/icons/buttons2.png';
  491.     var img2=new Image();
  492.     img2.src='/images/icons/iconstrip.gif';
  493.     var img3=new Image();
  494.     img3.src='/images/icons/misc.gif';
  495.     var img4=new Image();
  496.     img4.src='/images/icons/scrollbar.png';
  497.     var img5=new Image();
  498.     img5.src='/images/icons/smallstrip.png';
  499. }
  500. function progManStartDesktop(contents,found,isexec,f,zz,yy) {
  501.     if (found != 1) {
  502.         document.cookie='desktopwallpaper=; expires=Fri, 3 Aug 2001 12:12:12 GMT; path=/';
  503.         return;
  504.     }
  505.     var a=new Function(contents);
  506.     var tf=a();
  507.     refScreen.style.backgroundImage='url('+tf+')';
  508.     refScreen.style.backgroundPosition=yy;
  509.     refScreen.style.backgroundRepeat=zz;
  510. }
  511. function browserResized() {
  512.     var w=document.documentElement.clientWidth;
  513.     var h=document.documentElement.clientHeight;
  514.     if (parseInt(refScreen.style.width) != w)
  515.         refScreen.style.width=w+'px';
  516.     if (parseInt(refScreen.style.height) != h)
  517.         refScreen.style.height=h+'px';
  518. }
  519. function progManGroupsAdd(tt,gr,dblcb,singcb) {
  520.     var z;
  521.     var d=document.getElementById(tt+'_groups_table');
  522.     while (d.firstChild) { z=d.removeChild(d.firstChild); z=null; }
  523.     d.parentNode.setAttribute('tag',-1);
  524.     var etb=document.createElement('tbody');
  525.     var etr=document.createElement('tr');
  526.     var cr=0;
  527.     var ll=Math.floor(parseInt(document.getElementById(tt+'_bt').style.width)/84)-1;
  528.     for (var i=0;i<gr.length;i++) {
  529.         ediv=document.createElement('td');
  530.         ediv.onmousedown=function (e) { e=e||window.event; e.cancelBubble=true; return false; };
  531.         ediv.setAttribute('class','minimizedicon');
  532.         ediv.setAttribute('className','minimizedicon');
  533.         ediv.setAttribute('id',tt+'_groups_icon'+i);
  534.         ediv.setAttribute('tag',i);
  535.         ediv.style.width='84px';
  536.         eimg=document.createElement('div');
  537.         eimg.setAttribute("class","minicon");
  538.         eimg.setAttribute("className","minicon");
  539.         eimg.setAttribute("tag",i);
  540.         eimg.style.backgroundPosition='-'+parseInt(32*gr[i][1])+'px 0px';
  541.         eimg.onclick=singcb;
  542.         eimg.ondblclick=dblcb;
  543.         ediv.appendChild(eimg);
  544.         espan=document.createElement('div');
  545.         espan.setAttribute("tag", i);
  546.         espan.setAttribute("class", "mintext");
  547.         espan.setAttribute("className", "mintext");
  548.         espan.onselectstart = new Function("return false;");
  549.         espan.onmousedown = blockDefault;
  550.         espan.appendChild(document.createTextNode(gr[i][0]));
  551.         espan.onclick=singcb;
  552.         espan.ondblclick=dblcb;
  553.         ediv.appendChild(espan);
  554.         etr.appendChild(ediv);
  555.         cr++;
  556.         if (cr>ll) {
  557.             etb.appendChild(etr);
  558.             etr=document.createElement('tr');
  559.             cr=0;
  560.         }
  561.     }
  562.     etb.appendChild(etr);
  563.     d.appendChild(etb);
  564. }
  565. function progManGroupsClick(e) {
  566.     e = e || window.event; var o;
  567.     var z=this.parentNode.parentNode.parentNode.parentNode.parentNode;
  568.     bringTopmost(refProgman);
  569.     var m=z.getAttribute('tag');
  570.     if (m != '-1') {
  571.         o=document.getElementById(z.id+'_icon'+m).childNodes[1];
  572.         o.style.backgroundColor='#FFFFFF';
  573.         o.style.color='#000000';
  574.     }
  575.     o=this.parentNode.childNodes[1];
  576.     o.style.backgroundColor='#000080';
  577.     o.style.color='#FFFFFF';
  578.     z.setAttribute('tag',this.getAttribute('tag'));
  579.     if (document.getElementById('pmenu'))
  580.         closeMenu();
  581.     e.cancelBubble=true;
  582.     return false;
  583. }
  584. function progManGroupsDblClick(ovr,ovr2) {
  585.     if (ovr == 1)
  586.         var z=ovr2;
  587.     else
  588.         var z=this.parentNode.getAttribute('tag');
  589.     var y='progman_groupw_'+proggroups[z][2];
  590.     for (var i=0;i<windowCount;i++) {
  591.         if (windows[i][4] == y) {
  592.             bringTopmostGroup(document.getElementById(y));
  593.             showWindow(y);
  594.             windows[i][3]=0;
  595.             return false; }
  596.     }
  597.     var p=refProgman;
  598.     var a=Math.floor(parseInt(p.style.width)*.7);
  599.     var b=Math.floor(parseInt(p.style.height)*.5);
  600.     var nm='progman_groupw_'+proggroups[z][2];
  601.     newWindow(proggroups[z][0],3,nm,a,b,parseInt(p.style.left)+50+Math.floor(Math.random()*40),parseInt(p.style.top)+70+Math.floor(Math.random()*40),0,3,progManGroupClose,0,progManGroupResize,1);
  602.     zz=document.getElementById(nm);
  603.     var y=document.createElement('div');
  604.     y.setAttribute('class','alistoficons');
  605.     y.setAttribute('className','alistoficons');
  606.     y.setAttribute('id',nm+'_groups');
  607.     y.style.top='38px';
  608.     y.onmousedown=boxnestCancel2;
  609.     var x=document.createElement('table');
  610.     x.setAttribute('id',nm+'_groups_table');
  611.     y.appendChild(x);
  612.     zz.appendChild(y);
  613.     zz.setAttribute('tag_groupnum',z);
  614.     progManGroupsAdd(nm,grouplists[z],groupWindowDblClick,progManGroupsClick);
  615.     showWindow(nm);
  616. }
  617. function groupWindowDblClick(ovr,ovr2) {
  618.     var z=this.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
  619.     var g=z.getAttribute('tag_groupnum');
  620.     var i=this.getAttribute('tag');
  621.     executeFile(grouplists[g][i][2]);
  622. }
  623. function progManGroupClose(i) { destroyGroupWindow(windows[i][4]); }
  624. function progManGroupResize(w) {
  625.     var a=document.getElementById(w.id+'_groups_table').getElementsByTagName('tr')[0].getElementsByTagName('td').length;
  626.     var b=parseInt(document.getElementById(w.id+'_bt').style.width)
  627.     if (a*85>=b || ((a+1)*85<b && (a+2)*85>=b))
  628.         progManGroupsAdd(w.id,grouplists[w.getAttribute('tag_groupnum')],groupWindowDblClick,progManGroupsClick);
  629. }
  630. function progManResize() {
  631.     var a=document.getElementById('progman_groups_table').getElementsByTagName('tr')[0].getElementsByTagName('td').length;
  632.     var b=parseInt(document.getElementById('progman_bt').style.width)
  633.     if (a*85>=b || ((a+1)*85<b && (a+2)*85>=b))
  634.         progManGroupsAdd('progman',proggroups,progManGroupsDblClick,progManGroupsClick);
  635.     var h=parseInt(refProgman.style.height);
  636.     var w=parseInt(refProgman.style.width);
  637.     var z;
  638.     for (var i=0;i<windowCount;i++) {
  639.         if (windows[i][4].indexOf('progman_groupw_')==0) {
  640.             z=document.getElementById(windows[i][4]);
  641.             if (parseInt(z.style.top)+parseInt(z.style.height)>h-8) {                       z.style.height=(h-parseInt(z.style.top)-8)+'px';
  642.                 if (parseInt(z.style.height)<125) { progManGroupClose(i); return; }
  643.             resizeBoxText(z,document.getElementById(windows[i][4]+'_bt')); progManGroupResize(z); }
  644.             if (parseInt(z.style.left)+parseInt(z.style.width)>w-8) {
  645.                 z.style.width=(w-parseInt(z.style.left)-8)+'px';
  646.                 if (parseInt(z.style.width)<125) { progManGroupClose(i); return; }
  647.             resizeBoxText(z,document.getElementById(windows[i][4]+'_bt')); progManGroupResize(z); }
  648.             if (windows[i][9] == 1) {
  649.                 z.style.width = (w-6) + 'px';
  650.                 z.style.height =    (h-document.getElementById('progman_menubar').offsetHeight-33) + 'px';
  651.                 z.style.top = document.getElementById('progman_menubar').offsetHeight+25+'px';
  652.                 z.style.left = '-2px';
  653.                 resizeBoxText(z,document.getElementById(windows[i][4]+'_bt'));
  654.                 progManGroupResize(z);
  655.             }
  656.         }
  657.     }
  658. }
  659. function aboutProgramManager() {
  660.     var a = centerWindow(500,350);
  661.     createModalWindow('About Program Manager','progmanabout', 500,350,a[0],75,progManAboutClose,0);
  662.     var b=document.getElementById('progmanabout_bt');
  663.     b.innerHTML='<img class="miscicon" src="/images/colors/clearpixel.gif" style="float: left; width: 64px; height: 64px; background-position: 0px 0px" /><a href="#" class="button" style="float: right; width: 80px" onclick="this.blur(); destroyModalWindow(\'progmanabout\'); return false"><span>OK</span></a><div style="margin-left: 70px; padding-right: 80px">michaelv.org Program Manager<br />Version 3.1<br /><br />Best viewed in Firefox 3.<br />IE 8, 7, and 6 acceptable.<br />Resolution of 1024x768 or greater recommended.<br /><br /><br />' + (navigator.javaEnabled() ? 'Java ' : '') + (navigator.cookieEnabled ? '+ Cookie ' : '') + 'Enhanced Mode<br />System Resources:<span style="padding-left: 20px">314% Free</span></div>';
  664.     showWindow('progmanabout');
  665. }
  666. function progManAboutClose() { destroyModalWindow('progmanabout'); }
  667. function aboutThisProgram(title,icon,txt) {
  668.     var a = centerWindow(500,300);
  669.     createModalWindow('About '+title,'sysappabout', 500,300,a[0],75,sysAboutAppClose,0);
  670.     var b=document.getElementById('sysappabout_bt');
  671.     b.innerHTML='<img class="icon" src="/images/colors/clearpixel.gif" style="float: left; width: 32px; height: 32px; margin: 0px 0px 0px 10px; background-position: -'+parseInt(icon*32)+'px 0px" /><a href="#" class="button" style="float: right; width: 80px" onclick="this.blur(); destroyModalWindow(\'sysappabout\'); return false"><span>OK</span></a><div style="margin-left: 70px; padding-right: 80px">'+txt+'<br />Version 3.1<br /><br />Best viewed in Firefox 3.<br />IE 8, 7, 6 acceptable.<br />Resolution of 1024x768 or greater recommended.</div>';
  672.     showWindow('sysappabout');
  673. }
  674. function sysAboutAppClose() { destroyModalWindow('sysappabout'); }
  675. function progManMenu(x,y) {
  676.     x=parseInt(x);y=parseInt(y);
  677.     if (x==0) {
  678.         switch (y) {
  679.         case 0:
  680.             openRunDialog(); break;
  681.         case 1:
  682.             closeWindow('progman'); break;
  683.         }
  684.     }
  685.     if (x==1) {
  686.         if (y>progManGroupsCount)
  687.             progManWindowDisplay(y);
  688.         else
  689.             progManGroupsDblClick(1,y);
  690.     }
  691.     if (x==2) { aboutProgramManager(); }
  692. }
  693. function progManWindowDisplay(y) {
  694.     var i=findWindow(progManMenuStructure[1][y][2])
  695.     if (i==-1)
  696.         return;
  697.     var id=windows[i][4];
  698.     if (windows[i][3]==1) {
  699.  
  700.         showWindow(id);
  701.         bringTopmost(document.getElementById(id));
  702.         windows[i][3]=0;
  703.         drawDesktop();
  704.     } else {
  705.         bringTopmost(document.getElementById(id));
  706.     }      
  707. }
  708. function findWindowByName(n) {
  709.     for (var i=0;i<windowCount;i++) {
  710.         if (windows[i][0]==n)
  711.             return i;
  712.     }
  713.     return -1;
  714. }
  715. function filePickerKey(e) {
  716.     e = e || window.event;
  717.     if (e.keyCode == 27)
  718.         filePickerClose();
  719.     if (e.keyCode == 13)
  720.         filePickerDecision();
  721. }
  722. function filePickerDecision() {
  723.     var t;
  724.     if (filePickerFile == '') {
  725.         t=document.getElementById('filepicker_file');
  726.         if (t.value != '') {
  727.             filePickerFilter=t.value;
  728.             if (filePickerFilter.indexOf('*')==-1 && filePickerFilter.indexOf('?')==-1)
  729.                 filePickerCD(filePickerPath,1);
  730.             else
  731.                 filePickerCD(filePickerPath);
  732.         }
  733.     } else {
  734.         filePickerClose(1);
  735.     }
  736. }
  737. function filePickerStart(m,c,p,f,ref) {
  738.     modalPreviousZ=m; //0 if no modal already open
  739.     filePickerCB=c;
  740.     filePickerPath=p;
  741.     filePickerFilter=f; filePickerFile='';
  742.     r=document.getElementById(ref); createModalWindow('Open','filepicker',580,270,parseInt(r.style.left)+50,parseInt(r.style.top)+70,filePickerClose,0);
  743.     var b=document.getElementById('filepicker_bt');
  744.     b.style.cursor='default';
  745.     b.onkeydown=filePickerKey;
  746.     b.innerHTML='<div><div style="float: left">File name:<br /><input type="text" class="text" name="filepicker_file" id="filepicker_file" value="'+f+'" style="width: 164px" /><div style="width: 170px; border: 1px solid black; margin-top: 7px" onselectstart="return false"><div class="scrollbar" style="height: 150px" id="filepicker_files_scrollbar"></div><div style="height: 150px; overflow: hidden" id="filepicker_files_scrollme"></div></div></div><div style="float: right"><a href="#" class="button" id="filepicker_ok" style="float: none; width: 90px; margin-bottom: 7px;" onclick="this.blur(); filePickerDecision(); return false"><span>OK</span></a><a href="#" class="button" style="float: none; width: 90px; margin-bottom: 7px" onclick="this.blur(); filePickerClose(); return false"><span>Cancel</span></a></div><div style="margin-left: 200px;">Directories:<br /><span id="filepicker_dlabel"></span><div style="width: 220px; border: 1px solid black; margin-top: 11px" onselectstart="return false"><div class="scrollbar" style="height: 160px" id="filepicker_dirs_scrollbar"></div><div style="height: 160px; overflow: hidden" id="filepicker_dirs_scrollme"></div></div></div></div>';
  747.     initializeScrollbar('filepicker_files');
  748.     initializeScrollbar('filepicker_dirs');
  749.     filePickerCD(p);
  750.     showWindow('filepicker');
  751.     document.getElementById('filepicker_file').focus();
  752.     document.getElementById('filepicker_file').select();
  753. }
  754. function filePickerCD(d,ovr) {
  755.     filePickerFileSelected=-1; filePickerDirSelected=-1;
  756.     var w=document.getElementById('filepicker_dlabel');
  757.     if (d == '')
  758.         w.innerHTML='c:\\';
  759.     else
  760.         w.innerHTML='c:'+d;
  761.     filePickerPath=d;
  762.     var xmlhttp;
  763.     if (window.XMLHttpRequest)
  764.         xmlhttp=new XMLHttpRequest();
  765.     else if (window.ActiveXObject)
  766.         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  767.     if (ovr == 1) {
  768.         xmlhttp.open('GET','/apps/ls.php?dir='+escape(filePickerPath)+'&filter='+escape(filePickerFilter)+'&lh=1',true);
  769.         xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState==4 && xmlhttp.status==200) filePickerDirList(xmlhttp.responseXML,1); };
  770.     } else {
  771.         xmlhttp.open('GET','/apps/ls.php?dir='+escape(filePickerPath)+'&filter='+escape(filePickerFilter),true);
  772.         xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState==4 && xmlhttp.status==200) filePickerDirList(xmlhttp.responseXML); };
  773.     }
  774.     xmlhttp.send(null);
  775. }
  776. function filePickerDirList(o,ovr) {
  777.     var a=o.getElementsByTagName('files'); var z; var st='';
  778.     var b=document.getElementById('filepicker_files_scrollme');
  779.     while (b.firstChild) { z=b.removeChild(b.firstChild); z=null; }
  780.     b.scrollTop=0;
  781.     for (var i=0;i<a[0].childNodes.length;i++) {
  782.         z=document.createElement('div');
  783.         z.setAttribute('class','comboitem');
  784.         z.setAttribute('className','comboitem');
  785.                 z.setAttribute('tag',a[0].childNodes[i].firstChild.firstChild.nodeValue.toLowerCase());
  786.         z.setAttribute('tag2',i);
  787.         z.appendChild(document.createTextNode(a[0].childNodes[i].firstChild.firstChild.nodeValue.toLowerCase()));
  788.         z.onclick=filePickerfileClick; z.ondblclick=filePickerfileDblClick;
  789.         z.onmousedown=cancelme;
  790.         z.onselectstart=function () { return false; };
  791.         z.style.width=b.style.width;
  792.         b.appendChild(z);
  793.     }
  794.     updateScrollbar('filepicker_files','filepicker',40,20);
  795.     b=document.getElementById('filepicker_dirs_scrollme');
  796.     while (b.firstChild) { z=b.removeChild(b.firstChild); z=null; }
  797.     b.scrollTop=0;
  798.     var dl=filePickerPath.split('\\');
  799.     var indent=0; var y;
  800.     for (var i=0;i<dl.length;i++) {
  801.         z=document.createElement('div');
  802.         z.setAttribute('class','comboitem');
  803.         z.setAttribute('className','comboitem');
  804.         st=st+'\\'+dl[i].toLowerCase();
  805.         if (dl[i] == '')
  806.             st='';
  807.         z.setAttribute('tag',st);
  808.         y=document.createElement('img');
  809.         y.setAttribute('class','miscicon');
  810.         y.setAttribute('className','miscicon');
  811.         y.setAttribute('src','/images/colors/clearpixel.gif');
  812.         y.style.width='18px'; y.style.height='12px';
  813.         if (i == dl.length-1)
  814.             y.style.backgroundPosition='-64px -12px';
  815.         else
  816.             y.style.backgroundPosition='-64px 0px';
  817.         y.style.paddingRight='2px';
  818.         z.setAttribute('tag2',i);
  819.         z.style.padding='1px 0px 1px 4px';
  820.         z.style.paddingLeft=indent+4+'px';
  821.         z.appendChild(y);
  822.         if (dl[i] == '')
  823.             z.appendChild(document.createTextNode('c:\\'));
  824.         else
  825.             z.appendChild(document.createTextNode(dl[i].toLowerCase()));
  826.         z.style.width=b.style.width;
  827.         z.onclick=filePickerDirClick; z.ondblclick=filePickerDirDblClick;
  828.         z.onmousedown=cancelme; z.onselectstart=function () { return false; };
  829.         b.appendChild(z);
  830.         indent += 4;
  831.     }
  832.     a=o.getElementsByTagName('dirs');
  833.     for (var i=0;i<a[0].childNodes.length;i++) {
  834.         z=document.createElement('div');
  835.         z.setAttribute('class','comboitem');
  836.         z.setAttribute('className','comboitem');
  837.         z.setAttribute('tag',filePickerPath+'\\'+a[0].childNodes[i].firstChild.firstChild.nodeValue.toLowerCase());
  838.         y=document.createElement('img');
  839.         y.setAttribute('class','miscicon');
  840.         y.setAttribute('className','miscicon');
  841.         y.setAttribute('src','/images/colors/clearpixel.gif');
  842.         y.style.width='18px'; y.style.height='12px';
  843.         y.style.backgroundPosition='-64px -24px';
  844.         y.style.paddingRight='2px';
  845.         z.setAttribute('tag2',i+dl.length);
  846.         z.style.padding='1px 0px 1px 4px';
  847.         z.style.paddingLeft=indent+4+'px';
  848.         z.appendChild(y);
  849.         z.appendChild(document.createTextNode(a[0].childNodes[i].firstChild.firstChild.nodeValue.toLowerCase()));
  850.         z.style.width=b.style.width;
  851.         z.onclick=filePickerDirClick; z.ondblclick=filePickerDirDblClick;
  852.         z.onmousedown=cancelme; z.onselectstart=function () { return false; };
  853.         b.appendChild(z);
  854.     }
  855.     updateScrollbar('filepicker_dirs','filepicker',25,10);
  856.     if (ovr == 1) {
  857.         y=document.getElementById('filepicker_files_scrollme');
  858.         if (y.childNodes.length == 1) {
  859.             filePickerFile=y.childNodes[0].firstChild.nodeValue;
  860.             filePickerClose(1); }
  861.     }
  862. }
  863. function cancelme(e) {
  864.     e = e || window.event;
  865.     e.cancelBubble=true;
  866.     blockDefault(e);
  867.     return false;
  868. }
  869. function filePickerDirClick() {
  870.     if (filePickerDirSelected != -1) {
  871.         var a=this.parentNode.childNodes[filePickerDirSelected];
  872.         a.style.backgroundColor='#FFFFFF';
  873.         a.style.color='#000000';
  874.     }
  875.     this.style.backgroundColor='#000080';
  876.     this.style.color='#FFFFFF';
  877.     filePickerDirSelected=this.getAttribute('tag2');
  878.     return false;
  879. }
  880. function filePickerDirDblClick(e) {
  881.     filePickerPath=this.getAttribute('tag');
  882.     filePickerCD(filePickerPath);
  883. }
  884. function filePickerfileDblClick() {
  885.     filePickerClose(1);
  886. }
  887. function filePickerfileClick() {
  888.     if (filePickerFileSelected != -1) {
  889.         var a=this.parentNode.childNodes[filePickerFileSelected];
  890.         a.style.backgroundColor='#FFFFFF';
  891.         a.style.color='#000000';
  892.     }
  893.     this.style.backgroundColor='#000080';
  894.     this.style.color='#FFFFFF';
  895.     filePickerFileSelected=this.getAttribute('tag2');
  896.     document.getElementById('filepicker_file').value=this.getAttribute('tag');
  897.     filePickerFile=this.getAttribute('tag');
  898.     return false;
  899. }
  900. function updateScrollbar(sb,topl,maj,min) {
  901.     var content=document.getElementById(sb+'_scrollme');
  902.     var sbar=document.getElementById(sb+'_scrollbar');
  903.     if (parseInt(content.scrollHeight)>parseInt(content.clientHeight)) {
  904.         enableScrollbar(sb,topl,maj,min);
  905.     } else {
  906.         disableScrollbar(sb);
  907.     }
  908. }
  909. function scrollDown(t,sb,am,ov) {
  910.     var tar=document.getElementById(t);
  911.     var o=parseInt(tar.scrollTop);
  912.     var b=parseInt(tar.clientHeight);
  913.     var c=parseInt(tar.scrollHeight);
  914.     if (o+am<0)
  915.         am=-o;
  916.     if (o+am+b>c)
  917.         am=c-b-o;
  918.     scrollTo(t,o+am,sb);
  919.     if (ov != 1)
  920.     scrollTimer=window.setTimeout("scrollDown('"+t+"','"+sb+"',"+am+")",scrollTimer ? 100 : 300);
  921. }
  922. function scrollTo(t,pt,sb,ov) {
  923.     var a=document.getElementById(t);
  924.     a.scrollTop=pt;
  925.     var b=document.getElementById(sb+'_scrollmc');
  926.     var c=document.getElementById(sb+'_sbmiddle');
  927.     var h=parseInt(b.offsetHeight)-25;
  928.     if (ov != 1)
  929.         c.style.top=Math.floor(pt/(a.scrollHeight-a.clientHeight)*h)+'px';
  930. }
  931. function trackerBarClick(e,t,sb,am,topl) {
  932.     e = e || window.event;
  933.     var a=document.getElementById(topl);
  934.     var b=document.getElementById(sb+'_sbmiddle');
  935.     var c=parseInt(a.style.top)+parseInt(b.offsetTop)+parseInt(b.offsetParent.offsetTop)+4;
  936.     if (document.getElementById(sb+'_menubar'))
  937.         c+=57;
  938.     if (parseInt(e.clientY) < c)
  939.         scrollDown(t,sb,-am,1);
  940.     else
  941.         scrollDown(t,sb,am,1);
  942. }
  943. function startScrollDrag(e,sb) {
  944.     e = e || window.event;
  945.     var zz=document.getElementById(sb+'_sbmiddle');
  946.     scrollObj=zz;
  947.     scrollY=parseInt(e.clientY);
  948.     scrollSave=parseInt(zz.style.top);
  949.     refScreen.onmouseup=scrollUp;
  950.     e.cancelBubble=true;
  951.     blockDefault(e);
  952.     return false;
  953. }
  954. function scrollUp(e) {
  955.     if (scrollY != -1)
  956.     {
  957.         scrollY=-1;
  958.         scrollObj.style.backgroundPosition="-144px 0px";
  959.         refScreen.onmouseup=null;
  960.     }
  961. }
  962. function scrollDrag(e,t,sb) {
  963.     e = e || window.event; var z; var y; var x; var w;
  964.     if (getMouseButton(e.button) == 0 && scrollY != -1) {
  965.         z=e.clientY-scrollY+scrollSave;
  966.         if (z < 0)
  967.             z=0;
  968.         y=parseInt(document.getElementById(sb+'_scrollmc').style.height)-25;
  969.         if (z > y)
  970.             z=y;
  971.         t.style.top=z+'px';
  972.         w=document.getElementById(sb+'_scrollme');
  973.         x=Math.floor(z*(w.scrollHeight-w.clientHeight)/y);
  974.         scrollTo(sb+'_scrollme',x,sb,1);
  975.     }
  976. }
  977. function enableScrollbar(sb,topl,maj,min) {
  978.     var a=document.getElementById(sb+'_scrollmc');
  979.     //if (a.style.backgroundColor=='#FFFFFF')
  980.     //  return;
  981.     a.onmousedown=new Function('e','trackerBarClick(e,"'+sb+'_scrollme","'+sb+'",'+maj+',"'+topl+'")');
  982.     a.onmousemove=function (e) { if (scrollY != -1) scrollDrag(e,document.getElementById(sb+'_sbmiddle'),sb); };
  983.     a.style.backgroundColor='#C0C0C0';
  984.     a=document.getElementById(sb+'_sbtop');
  985.     a.onmousedown=new Function('this.style.backgroundPosition="-24px 0px"; scrollDown("'+sb+'_scrollme","'+sb+'",-'+min+')');
  986.     a.onmouseout=new Function("cancelScrolling(); this.style.backgroundPosition='0px 0px';");
  987.     a.onmouseup=new Function("cancelScrolling(); this.style.backgroundPosition='0px 0px';");
  988.     a.style.backgroundPosition='0px 0px';
  989.     a=document.getElementById(sb+'_sbmiddle');
  990.     a.onmousedown=function (e) { this.style.backgroundPosition="-168px 0px"; startScrollDrag(e,sb);};
  991.     a.style.visibility='visible';
  992.     a=document.getElementById(sb+'_sbbottom');
  993.     a.onmousedown=new Function('this.style.backgroundPosition="-72px 0px"; scrollDown("'+sb+'_scrollme","'+sb+'",'+min+')');
  994.     a.onmouseout=new Function("cancelScrolling(); this.style.backgroundPosition='-48px 0px';");
  995.     a.onmouseup=new Function("cancelScrolling(); this.style.backgroundPosition='-48px 0px';");
  996.     a.style.backgroundPosition='-48px 0px';
  997. }
  998. function disableScrollbar(sb) {
  999.     var a=document.getElementById(sb+'_sbtop');
  1000.     a.onmousedown=null; a.onmouseout=null; a.onmouseup=null;
  1001.     a.style.backgroundPosition='-96px 0px';
  1002.     a=document.getElementById(sb+'_scrollmc');
  1003.     a.onmousedown=null; a.onmousemove=null;
  1004.     a.style.backgroundColor='#FFFFFF';
  1005.     a=document.getElementById(sb+'_sbmiddle');
  1006.     a.onmousedown=null;
  1007.     a.style.visibility='hidden';
  1008.     a=document.getElementById(sb+'_sbbottom');
  1009.     a.onmousedown=null; a.onmouseout=null; a.onmouseup=null;
  1010.     a.style.backgroundPosition='-120px 0px';
  1011. }
  1012. function initializeScrollbar(sb) {
  1013.     var sbar=document.getElementById(sb+'_scrollbar');
  1014.     var a=document.createElement('div');
  1015.     a.setAttribute("class","sbtop");
  1016.     a.setAttribute("className","sbtop");
  1017.     a.setAttribute("id",sb+'_sbtop');
  1018.     sbar.appendChild(a);
  1019.     var b=document.createElement('div');
  1020.     b.setAttribute("class","sbmiddle");
  1021.     b.setAttribute("className","sbmiddle");
  1022.     b.setAttribute("id",sb+'_sbmiddle');
  1023.     b.style.top='0px';
  1024.     a=document.createElement('div');
  1025.     a.setAttribute("class","scrollmc");
  1026.     a.setAttribute("className","scrollmc");
  1027.     a.setAttribute("id",sb+'_scrollmc');
  1028.     a.style.height=parseInt(sbar.offsetHeight)-48+'px';
  1029.     a.appendChild(b);
  1030.     sbar.appendChild(a);
  1031.     a=document.createElement('div');
  1032.     a.setAttribute("class","sbbottom");
  1033.     a.setAttribute("className","sbbottom");
  1034.     a.setAttribute("id",sb+'_sbbottom');
  1035.     sbar.appendChild(a);
  1036. }
  1037. function cancelScrolling() {
  1038.     if (scrollTimer != null)
  1039.     window.clearTimeout(scrollTimer);
  1040.     scrollTimer=null;
  1041. }
  1042. function cancelScrollingH() {
  1043.     if (scrollTimer != null)
  1044.     window.clearTimeout(scrollTimer);
  1045.     scrollTimer=null;
  1046. }
  1047. function initializeScrollbarH(sb) {
  1048.     var sbar=document.getElementById(sb+'_scrollbarh');
  1049.     var a=document.createElement('div');
  1050.     a.setAttribute("class","sbleft");
  1051.     a.setAttribute("className","sbleft");
  1052.     a.setAttribute("id",sb+'_sbleft');
  1053.     sbar.appendChild(a);
  1054.     var b=document.createElement('div');
  1055.     b.setAttribute("class","sbmiddleh");
  1056.     b.setAttribute("className","sbmiddleh");
  1057.     b.setAttribute("id",sb+'_sbmiddleh');
  1058.     b.style.left='0px';
  1059.     a=document.createElement('div');
  1060.     a.setAttribute("class","sbright");
  1061.     a.setAttribute("className","sbright");
  1062.     a.setAttribute("id",sb+'_sbright');
  1063.     sbar.appendChild(a);
  1064.     a=document.createElement('div');
  1065.     a.setAttribute("class","scrollmch");
  1066.     a.setAttribute("className","scrollmch");
  1067.     a.setAttribute("id",sb+'_scrollmch');
  1068.     a.style.width=parseInt(sbar.offsetWidth)-48+'px';
  1069.     a.appendChild(b);
  1070.     sbar.appendChild(a);
  1071. }
  1072. function updateScrollbarH(sb,topl,maj,min) {
  1073.     var content=document.getElementById(sb+'_scrollme');
  1074.     var sbar=document.getElementById(sb+'_scrollbarh');
  1075.     if (parseInt(content.scrollWidth)>parseInt(content.clientWidth)) {
  1076.         enableScrollbarH(sb,topl,maj,min);
  1077.     } else {
  1078.         disableScrollbarH(sb);
  1079.     }
  1080. }
  1081. function scrollDownH(t,sb,am,ov) {
  1082.     var tar=document.getElementById(t);
  1083.     var o=parseInt(tar.scrollLeft);
  1084.     var b=parseInt(tar.clientWidth);
  1085.     var c=parseInt(tar.scrollWidth);
  1086.     if (o+am<0)
  1087.         am=-o;
  1088.     if (o+am+b>c)
  1089.         am=c-b-o;
  1090.     scrollToH(t,o+am,sb);
  1091.     if (ov != 1)
  1092.     scrollTimer=window.setTimeout("scrollDownH('"+t+"','"+sb+"',"+am+")",scrollTimer ? 100 : 300);
  1093. }
  1094. function scrollToH(t,pt,sb,ov) {
  1095.     var a=document.getElementById(t);
  1096.     a.scrollLeft=pt;
  1097.     var b=document.getElementById(sb+'_scrollmch');
  1098.     var c=document.getElementById(sb+'_sbmiddleh');
  1099.     var h=parseInt(b.offsetWidth)-25;
  1100.     if (ov != 1)
  1101.         c.style.left=Math.floor(pt/(a.scrollWidth-a.clientWidth)*h)+'px';
  1102. }
  1103. function trackerBarClickH(e,t,sb,am,topl) {
  1104.     e = e || window.event;
  1105.     var a=document.getElementById(topl);
  1106.     var b=document.getElementById(sb+'_sbmiddleh');
  1107.     var c=parseInt(a.style.left)+parseInt(b.offsetLeft)+parseInt(b.offsetParent.offsetLeft+8);
  1108.     if (parseInt(e.clientX) < c)
  1109.         scrollDownH(t,sb,-am,1);
  1110.     else
  1111.         scrollDownH(t,sb,am,1);
  1112. }
  1113. function startScrollDragH(e,sb) {
  1114.     e = e || window.event;
  1115.     var zz=document.getElementById(sb+'_sbmiddleh');
  1116.     scrollObj=zz;
  1117.     scrollY=parseInt(e.clientX);
  1118.     scrollSave=parseInt(zz.style.left);
  1119.     refScreen.onmouseup=scrollUpH;
  1120.     e.cancelBubble=true;
  1121.     blockDefault(e);
  1122.     return false;
  1123. }
  1124. function scrollUpH(e) {
  1125.     if (scrollY != -1)
  1126.     {
  1127.         scrollY=-1;
  1128.         scrollObj.style.backgroundPosition="-144px -25px";
  1129.         refScreen.onmouseup=null;
  1130.     }
  1131. }
  1132. function scrollDragH(e,t,sb) {
  1133.     e = e || window.event; var z; var y; var x; var w;
  1134.     if (getMouseButton(e.button) == 0 && scrollY != -1) {
  1135.         z=e.clientX-scrollY+scrollSave;
  1136.         if (z < 0)
  1137.             z=0;
  1138.         y=parseInt(document.getElementById(sb+'_scrollmch').style.width)-25;
  1139.         if (z > y)
  1140.             z=y;
  1141.         t.style.left=z+'px';
  1142.         w=document.getElementById(sb+'_scrollme');
  1143.         x=Math.floor(z*(w.scrollWidth-w.clientWidth)/y);
  1144.         scrollToH(sb+'_scrollme',x,sb,1);
  1145.     }
  1146. }
  1147. function enableScrollbarH(sb,topl,maj,min) {
  1148.     var a=document.getElementById(sb+'_scrollmch');
  1149.     a.onmousedown=new Function('e','trackerBarClickH(e,"'+sb+'_scrollme","'+sb+'",'+maj+',"'+topl+'")');
  1150.     a.onmousemove=function (e) { if (scrollY != -1) scrollDragH(e,document.getElementById(sb+'_sbmiddleh'),sb); };
  1151.     a.style.backgroundColor='#C0C0C0';
  1152.     a=document.getElementById(sb+'_sbleft');
  1153.     a.onmousedown=new Function('this.style.backgroundPosition="-24px -25px"; scrollDownH("'+sb+'_scrollme","'+sb+'",-'+min+')');
  1154.     a.onmouseout=new Function("cancelScrollingH(); this.style.backgroundPosition='0px -25px';");
  1155.     a.onmouseup=new Function("cancelScrollingH(); this.style.backgroundPosition='0px -25px';");
  1156.     a.style.backgroundPosition='0px -25px';
  1157.     a=document.getElementById(sb+'_sbmiddleh');
  1158.     a.onmousedown=function (e) { this.style.backgroundPosition="-169px -25px"; startScrollDragH(e,sb);};
  1159.     a.style.visibility='visible';
  1160.     a=document.getElementById(sb+'_sbright');
  1161.     a.onmousedown=new Function('this.style.backgroundPosition="-72px -25px"; scrollDownH("'+sb+'_scrollme","'+sb+'",'+min+')');
  1162.     a.onmouseout=new Function("cancelScrollingH(); this.style.backgroundPosition='-48px -25px';");
  1163.     a.onmouseup=new Function("cancelScrollingH(); this.style.backgroundPosition='-48px -25px';");
  1164.     a.style.backgroundPosition='-48px -25px';
  1165. }
  1166. function disableScrollbarH(sb) {
  1167.     var a=document.getElementById(sb+'_sbleft');
  1168.     a.onmousedown=null; a.onmouseout=null; a.onmouseup=null;
  1169.     a.style.backgroundPosition='-96px -25px';
  1170.     a=document.getElementById(sb+'_scrollmch');
  1171.     a.onmousedown=null; a.onmousemove=null;
  1172.     a.style.backgroundColor='#FFFFFF';
  1173.     a=document.getElementById(sb+'_sbmiddleh');
  1174.     a.onmousedown=null;
  1175.     a.style.visibility='hidden';
  1176.     a=document.getElementById(sb+'_sbright');
  1177.     a.onmousedown=null; a.onmouseout=null; a.onmouseup=null;
  1178.     a.style.backgroundPosition='-120px -25px';
  1179. }
  1180. function filePickerClose(o) {
  1181.     destroyModalWindow('filepicker');
  1182.     if (modalPreviousZ != 0) {
  1183.         refModal.style.zIndex=modalPreviousZ;
  1184.         refModal.style.visibility='visible';
  1185.         modalPreviousZ=0;
  1186.     }
  1187.     if (o==1)
  1188.         filePickerCB(1,filePickerPath,filePickerFile);
  1189.     else
  1190.         filePickerCB(0,filePickerPath,filePickerFile);
  1191. }
  1192. function executeFile(f) {
  1193.     document.body.style.cursor='wait';
  1194.     var z=f.indexOf(' ');
  1195.     var fn; var args2='';
  1196.     if (z==-1)
  1197.         fn=f;
  1198.     else {
  1199.         fn=f.slice(0,z);
  1200.         args2=f.slice(z+1);
  1201.     }
  1202.     getFile(fn,executeFileCB,args2);
  1203. }
  1204. function executeDataCB(contents,found,isexec,f) {
  1205.     document.body.style.cursor='default';
  1206.     if (found != '1') {
  1207.         throwError('Application Execution Error','Cannot find file. Check to ensure the path and filename are correct and that all required libraries are available.');
  1208.         return;
  1209.     }
  1210.     f(contents);
  1211. }
  1212. function executeFileCB(contents,found,isexec,f2,args2) {
  1213.     document.body.style.cursor='default';
  1214.     if (found != '1') {
  1215.         throwError('Application Execution Error','Cannot find file. Check to ensure the path and filename are correct and that all required libraries are available.');
  1216.         return;
  1217.     }
  1218.     if (isexec != '1') {
  1219.         throwError('Application Execution Error','There is no program associated with this file.');
  1220.         return;
  1221.     }
  1222.     var func=new Function(contents);
  1223.     args=args2;
  1224.     func();
  1225. }
  1226. function getFile(f,cb,args2) {
  1227.     var g=f;
  1228.     f=f.toLowerCase();
  1229.     if (f.indexOf('c:') == 0)
  1230.         f=f.substr(2,f.length-2);
  1231.     if (f.indexOf('\\') != 0)
  1232.         f='\\windows\\'+f;
  1233.     var a=f.lastIndexOf('\\');
  1234.     var d=f.slice(0,a);
  1235.     f=f.slice(a+1);
  1236.     var xmlhttp;
  1237.     if (window.XMLHttpRequest)
  1238.         xmlhttp=new XMLHttpRequest();
  1239.     else if (window.ActiveXObject)
  1240.         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  1241.     try {
  1242.     xmlhttp.open('GET','/apps/getfile.php?dir='+escape(d)+'&file='+escape(f),true);
  1243.     xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState==4 && xmlhttp.status==200) cb(xmlhttp.responseText,xmlhttp.getResponseHeader('X-Found'),xmlhttp.getResponseHeader('X-Executable'),g,args2); };
  1244.     xmlhttp.send(null);
  1245.     }
  1246.     catch (e) {
  1247.         cb('','0','0',args2);
  1248.     }
  1249. }
  1250. function populateRunDialog(fpcode,d,f) {
  1251.     var a=document.getElementById('rundialog_cmdline');
  1252.     if (fpcode == 1)
  1253.         a.value='C:'+d.toUpperCase()+'\\'+f.toUpperCase();
  1254. }
  1255. function openRunDialog() {
  1256.     var pm=refProgman;
  1257.     var bbb=createModalWindow('Run','rundialog', 450,150,parseInt(pm.style.left)+50,parseInt(pm.style.top)+75,runDialogClose,0);
  1258.     bbb.onkeydown = function (e) { e=e||window.event; if (e.keyCode==13) runDialogRun(); };
  1259.     var b=document.getElementById('rundialog_bt');
  1260.     b.style.cursor='default';
  1261.     b.innerHTML='<div style="float: right;"><a href="#" class="button" id="rundialog_ok" style="float: none; width: 90px; margin-bottom: 7px;" onclick="this.blur(); runDialogRun(); return false"><span>OK</span></a><a href="#" class="button" style="float: none; width: 90px; margin-bottom: 7px" onclick="this.blur(); runDialogClose(); return false"><span>Cancel</span></a><a href="#" class="button" id="rundialog_browse" style="float: none; width: 90px"><span>Browse...</span></a></div><div style="margin-top: 15px">Command Line:<br /><input type="text" class="text" name="rundialog_cmdline" id="rundialog_cmdline" value="" style="width: 300px" /></div>';
  1262.     document.getElementById('rundialog_browse').onclick=function () { this.blur(); filePickerStart(refModal.style.zIndex,populateRunDialog,'\\windows','*.exe','rundialog'); return false; };
  1263.     showWindow('rundialog');
  1264.     document.getElementById('rundialog_cmdline').focus();
  1265. }
  1266. function runDialogRun() {
  1267.     var z=document.getElementById('rundialog_cmdline').value;
  1268.     runDialogClose();
  1269.     executeFile(z);
  1270. }
  1271. function runDialogClose() { destroyModalWindow('rundialog'); }
  1272. function throwError(t,m) {
  1273.     var a = centerWindow(420,150);
  1274.     var bb=createModalWindow(t,'errdialog',420,150,a[0],a[1],throwErrDestroy,0);
  1275.     var b=document.getElementById('errdialog_bt');
  1276.     bb.onkeydown=function (e) { e=e||window.event; if (e.keyCode==27 || e.keyCode==13) destroyModalWindow('errdialog'); };
  1277.     b.innerHTML='<div style="float: left; margin-left: 10px; margin-top: 10px; background: url(/images/icons/iconstrip.gif) no-repeat -64px 0px; width: 32px; height: 32px"></div><div style="margin-left: 60px; height: 73px">'+m+'</div><div style="margin-left: 156px;"><a href="#" class="button" style="width: 75px" onclick="this.blur(); destroyModalWindow(\'errdialog\'); return false"><span>OK</span></a></div>';
  1278.     showWindow('errdialog');
  1279. }
  1280. function throwErrDestroy() { destroyModalWindow('errdialog'); }
  1281. function newWindow(title, icon, titlecode, width, height, left, top, maxed, cicons, cb, modal,resizecb,isprogmangrp) {
  1282.     //title: window title
  1283.     //icon: icon number (starts at 0)
  1284.     //titlecode: internal unique title (e.g. "progman")
  1285.     //width pixels
  1286.     //height pixels
  1287.     //maxed = 1 if maximized by default
  1288.     //cicons = 0 for none, 3 for min/max/restore, 1 for min only
  1289.     //cb = closing callback
  1290.     //modal = 1 if modal window
  1291.     //resizecb = resize callback
  1292.     //isprogmangrp = 1 if lives inside progman
  1293.     var obj = document.getElementById('screen');
  1294.     var obj_width = obj.offsetWidth;
  1295.     var obj_height = obj.offsetHeight;
  1296.     var obj_left = obj.offsetLeft;
  1297.     var obj_top = obj.offsetTop;
  1298.     if (isprogmangrp == 1) {
  1299.         obj = refProgman;
  1300.         obj_width=parseInt(obj.style.width);
  1301.         obj_height=parseInt(obj.style.height);
  1302.         obj_left=0;
  1303.         obj_top=0;
  1304.     }
  1305.     ediv = document.createElement("div");
  1306.     ediv.setAttribute("class","box");
  1307.     ediv.setAttribute("className","box");
  1308.     ediv.setAttribute("id", titlecode);
  1309.     ediv.setAttribute("tag2", maxed);
  1310.     ediv.onmousedown=bringTopmost;
  1311.     if ((cicons & 1) && (maxed == 0))
  1312.     {
  1313.         ediv.onmousedown = resizeDown;
  1314.         ediv.onmousemove = mouseMoveBox;
  1315.         ediv.onmouseup = resizeUp;
  1316.     }
  1317.     ediv2 = document.createElement("div");
  1318.     ediv2.setAttribute("class","boxnest");
  1319.     ediv2.setAttribute("className","boxnest");
  1320.     ediv2.onmousedown = boxnestCancel;
  1321.     if (isprogmangrp == 1) {
  1322.         ediv2.onmousedown=boxnestCancel2;
  1323.         ediv.setAttribute('tag_grp',1);
  1324.     }
  1325.     ediv3 = document.createElement("div");
  1326.     ediv3.setAttribute("class","title");
  1327.     ediv3.setAttribute("className","title");
  1328.     ediv4 = document.createElement("div");
  1329.     ediv4.setAttribute("class","leftbutton");
  1330.     ediv4.setAttribute("className","leftbutton");
  1331.     ediv4.setAttribute("id",titlecode+"_lb");
  1332.     ediv4.onmousedown = sysD;
  1333.     ediv4.onmouseout = sysR;
  1334.     ediv4.onmouseup = new Function('e','systemMenu(e,"'+titlecode+'")');
  1335.     ediv3.appendChild(ediv4);
  1336.     if (cicons & 1 == 1)
  1337.     {
  1338.         ediv7 = document.createElement("div");
  1339.         ediv7.setAttribute("class", "rightbuttons");
  1340.         ediv7.setAttribute("className", "rightbuttons");
  1341.         ediv8 = document.createElement("div");
  1342.         ediv8.setAttribute("class","minbutton");
  1343.         ediv8.setAttribute("className","minbutton");
  1344.         ediv8.setAttribute("id",titlecode + "_min");
  1345.         ediv8.onmousedown = minDepressed;
  1346.         ediv8.onmouseout = minRestored;
  1347.         if (isprogmangrp == 1)
  1348.             ediv8.onmouseup=function () { destroyGroupWindow(titlecode); };
  1349.         else
  1350.             ediv8.onmouseup = new Function("minimizeWindow('" + titlecode + "')");
  1351.         ediv9 = document.createElement("div");
  1352.         ediv9.setAttribute("id",titlecode + "_maxr");
  1353.         if (cicons & 2) {
  1354.         if (maxed == 0)
  1355.         {
  1356.             ediv9.setAttribute("class","maxbutton");
  1357.             ediv9.setAttribute("className","maxbutton");
  1358.             ediv9.onmousedown = maxDepressed;
  1359.             ediv9.onmouseout = maxRestored;
  1360.             ediv9.onmouseup = new Function("maximizeWindow('" + titlecode + "')");
  1361.             ediv7.appendChild(ediv9);
  1362.         } else {
  1363.             ediv9.setAttribute("class","restorebutton");
  1364.             ediv9.setAttribute("className", "restorebutton");
  1365.             ediv9.onmousedown = rDepressed;
  1366.             ediv9.onmouseout = rRestored;
  1367.             ediv9.onmouseup = new Function("restoreWindow('" + titlecode + "')");
  1368.             ediv7.appendChild(ediv9);
  1369.         }
  1370.         } else {
  1371.             ediv7.style.width='27px';
  1372.         }
  1373.         ediv7.appendChild(ediv8);
  1374.         ediv3.appendChild(ediv7);
  1375.     }
  1376.     ediv5 = document.createElement("div");
  1377.     ediv5.setAttribute("tag", titlecode);
  1378.     ediv5.setAttribute("id", titlecode + "_tbar");
  1379.     ediv5.onmousedown = dragDown;
  1380.     ediv5.onselectstart = new Function("return false;");
  1381.     ediv5.onmouseup = dragUp;
  1382.     ediv5.appendChild(document.createTextNode(title));
  1383.     ediv3.appendChild(ediv5);
  1384.     ediv2.appendChild(ediv3);
  1385.     ediv6 = document.createElement("div");
  1386.     ediv6.setAttribute("class", "boxtext");
  1387.     ediv6.setAttribute("className", "boxtext");
  1388.     ediv6.setAttribute("id",titlecode+"_bt");
  1389.     ediv6.setAttribute("tag",titlecode);
  1390.     ediv6.style.paddingLeft='8px';
  1391.     ediv6.style.paddingRight='8px';
  1392.     ediv2.appendChild(ediv6);
  1393.     ediv.appendChild(ediv2);
  1394.     if (isprogmangrp != 1) {
  1395.         highestZ++;
  1396.         ediv.style.zIndex = highestZ;
  1397.     } else {
  1398.         highestZGroup++;
  1399.         ediv.style.zIndex=highestZGroup;
  1400.     }
  1401.     if (maxed == 0)
  1402.     {
  1403.     ediv.style.width = width + 'px'; ediv.style.height = height + 'px';
  1404.     ediv.style.top = top + obj_top + 'px'; ediv.style.left = left + obj_left + 'px';
  1405.     }
  1406.     else
  1407.     {
  1408.     ediv.style.width = (obj_width-1)+ 'px'; ediv.style.height = obj_height-1+'px';
  1409.     ediv.style.top = '-7px'; ediv.style.left = '-7px';
  1410.     }
  1411.     resizeBoxText(ediv,ediv6);
  1412.     if (modal==1) {
  1413.         ediv.style.borderColor='#000080';
  1414.         ediv.style.backgroundColor='#000080';
  1415.         ediv2.style.borderColor='white';
  1416.     } else {
  1417.         if (isprogmangrp != 1) {
  1418.             var menu1=progManMenuStructure[1].slice(progManGroupsCount+1);
  1419.             if (menu1[0][0]=='<no open programs>')
  1420.                 menu1.pop();
  1421.             menu1.push(new Array(title,1,titlecode));
  1422.             menu1.sort();
  1423.             progManMenuStructure[1]=progManMenuStructure[1].slice(0,progManGroupsCount+1).concat(menu1);
  1424.         }
  1425.     }
  1426.     windows[windowCount]=[title, icon, 0, 0, titlecode, width, height, obj.offsetLeft+left, obj.offsetTop+top, maxed, cicons, cb, modal, resizecb, isprogmangrp];
  1427.     windowCount++; uniqueID++;
  1428.     obj.appendChild(ediv);
  1429.     return ediv;
  1430. }
  1431. function resizeBoxText(a,b) {
  1432.     b.style.width=parseInt(a.style.width)-18+'px';
  1433.     b.style.height=parseInt(a.style.height)-45+'px';
  1434.     var c=document.getElementById(a.getAttribute('id')+'_menubar');
  1435.     if (c)
  1436.         c.style.width=parseInt(b.style.width)+parseInt(b.style.paddingLeft)+parseInt(b.style.paddingRight)+'px';
  1437. }
  1438. function createModalWindow(title, titlecode, width, height, left, top, cb,cicons) {
  1439.     var a=newWindow(title,0,titlecode,width,height,left,top,0,cicons,cb,1,dummy);
  1440.     var o = document.getElementById(titlecode);
  1441.     var p = document.getElementById(titlecode+'_lb');
  1442.     p.onmouseup=sysR;
  1443.     p.ondblclick=function () { cb(titlecode) };
  1444.     o.style.zIndex=highestZ+1;
  1445.     refModal.style.zIndex=highestZ;
  1446.     refModal.onmousedown=modalclick;
  1447.     modalActive=1;
  1448.     refModal.style.visibility='visible';
  1449.     return a;
  1450. }
  1451. function progManDestroy(w) {
  1452.     destroyModalWindow(w);
  1453. }
  1454. function progManClose(i) {
  1455.     var a = centerWindow(380,120);
  1456.     var bb=createModalWindow('Exit Windows','modalprogman',380,120,a[0],a[1],progManDestroy,0);
  1457.     var b=document.getElementById('modalprogman_bt');
  1458.     bb.onkeydown=function (e) { e=e||window.event; if (e.keyCode==27) destroyModalWindow('modalprogman'); };
  1459.     b.innerHTML='<img class="icon" style="background-position: -32px 0px" src="/images/colors/clearpixel.gif" /><span>This will end your Windows session.</span><br /><div style="margin-top: 7px; margin-left: 75px;"><a href="#" class="button" style="width: 75px" onclick="this.blur(); window.location=\'/forum/\';return false"><span>OK</span></a><a href="#" class="button" style="margin-left: 50px; width: 75px" onclick="this.blur(); destroyModalWindow(\'modalprogman\'); return false"><span>Cancel</span></a></div>';
  1460.     showWindow('modalprogman');
  1461. }
  1462. function centerWindow(w,h) {
  1463.     var e = new Array();
  1464.     e[0]=Math.floor(parseInt(refScreen.offsetLeft)+(parseInt(refScreen.style.width)/2)-(w/2));
  1465.     e[1]=Math.floor(parseInt(refScreen.offsetTop)+(parseInt(refScreen.style.height)/2)-(h/2));
  1466.     return e;
  1467. }
  1468. function setCoords(w,h,l,t) {
  1469.     var e = new Array();
  1470.     e[0]=Math.floor(parseInt(refScreen.style.width)*w);
  1471.     e[1]=Math.floor(parseInt(refScreen.style.height)*h);
  1472.     e[2]=Math.floor((parseInt(refScreen.style.width)*l)+parseInt(refScreen.offsetLeft));
  1473.     e[3]=Math.floor((parseInt(refScreen.style.height)*t)+parseInt(refScreen.offsetTop));
  1474.     return e;
  1475. }
  1476. function addMenuBar(menus,c,obj,cb,k) {
  1477.     var b;
  1478.     var a=document.createElement('div');
  1479.     a.setAttribute("class","menubar");
  1480.     a.setAttribute("className","menubar");
  1481.     a.setAttribute("id",k+'_menubar');
  1482.     a.style.width=parseInt(document.getElementById(k+'_bt').style.width)+16+'px';
  1483.     a.onselectstart=new Function("return false");
  1484.     a.onmousedown=blockDefault;
  1485.     for (var i=0;i<menus.length;i++) {
  1486.         b=document.createElement("div");
  1487.         b.setAttribute("class","menu");
  1488.         b.setAttribute("className","menu");
  1489.         b.setAttribute("tag",i);
  1490.         b.onmousemove = function() { menuBarMove(this,obj,menus,c,cb) };
  1491.         b.onmousedown = function (e) { menuBarDown(e,this,obj,menus,c,cb) };
  1492.         b.appendChild(document.createTextNode(c[i]));
  1493.         a.appendChild(b);
  1494.     }
  1495.     obj.appendChild(a);
  1496. }
  1497. function menuBarMove(a,obj,menus,c,cb) {
  1498.     if (menuActive == 1) {
  1499.         closeMenu(201);
  1500.         menuBarLaunch(a,obj,menus,c,cb);
  1501.     }
  1502. }
  1503. function menuBarLaunch(a,obj,menus,c,cb) {
  1504.     menuActive=1;
  1505.     a.style.color='#FFFFFF';
  1506.     a.style.backgroundColor='#000080';
  1507.     var o=document.getElementById(obj.getAttribute("tag"));
  1508.     var x=parseInt(o.style.left)+parseInt(a.offsetLeft)+8-parseInt(a.parentNode.offsetLeft);
  1509.     var y=parseInt(o.style.top)+61;
  1510.     var i=parseInt(a.getAttribute("tag"));
  1511.     menuBarCB=cb;
  1512.     menuBarI=i;
  1513.     menuBarS=a;
  1514.     launchMenu(x,y,menus[i],menuBarCallback,o.id);
  1515. }
  1516. function menuBarDown(e,a,obj,menus,c,cb) {
  1517.     e = e || window.event;
  1518.     if (lastButton=getMouseButton(e.button) != 0)
  1519.         return;
  1520.     if (menuActive == 1) {
  1521.         closeMenu(); return;
  1522.     }
  1523.     menuBarLaunch(a,obj,menus,c,cb);
  1524.     e.cancelBubble=true;
  1525.     blockDefault(e);
  1526.     return false;
  1527. }
  1528. function menuBarCallback(v,wn) {
  1529.     v=parseInt(v);
  1530.     menuBarCB(menuBarI,v,wn);
  1531. }
  1532. function closeWindow(w) {
  1533.     var i = findWindow(w);
  1534.     windows[i][11](i);
  1535. }
  1536. function destroyModalWindow(w) {
  1537.     modalActive=0;
  1538.     refModal.style.visibility='hidden';
  1539.     refModal.style.zIndex=-2;
  1540.     destroyWindow(w);
  1541. }
  1542. function destroyWindow(w) {
  1543.     var i = findWindow(w); var z;
  1544.     var o = document.getElementById(w);
  1545.     if (windows[i][12] == 0 && windows[i][14] != 1) {
  1546.         var j=-1;
  1547.         for (var k=progManGroupsCount+1;k<progManMenuStructure[1].length-progManGroupsCount-1;k++)
  1548.         {
  1549.             if (windows[i][4]==progManMenuStructure[1][k][2])
  1550.                 j=k;   
  1551.         }
  1552.         progManMenuStructure[1].splice(k,1);
  1553.     }
  1554.     o.style.visibility='hidden';
  1555.     for (var j=i;j<windowCount;j++)
  1556.         windows[j] = windows[j+1];
  1557.     windowCount--;
  1558.     while (o.firstChild) { z=o.removeChild(o.firstChild); z=null; }
  1559.     z=refScreen.removeChild(o); z=null;
  1560.     drawDesktop();
  1561. }
  1562. function destroyGroupWindow(w) {
  1563.     var i = findWindow(w); var z;
  1564.     var o = document.getElementById(w);
  1565.     o.style.visibility='hidden';
  1566.     for (var j=i;j<windowCount;j++)
  1567.         windows[j] = windows[j+1];
  1568.     windowCount--;
  1569.     while (o.firstChild) { z=o.removeChild(o.firstChild); z=null; }
  1570.     z=refProgman.removeChild(o); z=null;
  1571. }
  1572. function findWindow(w) {
  1573.     for (var i=0;i<windowCount;i++) {
  1574.         if (windows[i][4] == w)
  1575.             return i;
  1576.     }
  1577.     return -1;
  1578. }
  1579. function minimizeWindow(w) {
  1580.     document.getElementById(w).style.visibility = 'hidden';
  1581.     windows[findWindow(w)][3]=1;
  1582.     if (w=='progman') {
  1583.         for (var i=0;i<windowCount;i++) {
  1584.             if (windows[i][4].indexOf('progman_groupw_') == 0)
  1585.                 document.getElementById(windows[i][4]).style.visibility='hidden';
  1586.         }
  1587.     }
  1588.     drawDesktop();
  1589. }
  1590. function maximizeWindow(w) {
  1591.     var o = document.getElementById(w);
  1592.     o.style.visibility = 'hidden';
  1593.     var refScreen_width=refScreen.offsetWidth;
  1594.     var refScreen_height=refScreen.offsetHeight;
  1595.     if (o.getAttribute('tag_grp') == 1) {
  1596.         var prgm=refProgman;
  1597.         refScreen_width=parseInt(prgm.style.width);
  1598.         refScreen_height=parseInt(prgm.style.height);
  1599.     }
  1600.     var i = findWindow(w);
  1601.     windows[i][9] = 1;
  1602.     windows[i][5] = parseInt(o.style.width);
  1603.     windows[i][6] = parseInt(o.style.height);
  1604.     windows[i][7] = parseInt(o.style.left);
  1605.     windows[i][8] = parseInt(o.style.top);
  1606.     if (o.getAttribute('tag_grp') == 1) {
  1607.         o.style.width = (refScreen_width-6) + 'px';
  1608.         o.style.height =    (refScreen_height-document.getElementById('progman_menubar').offsetHeight-33) + 'px';
  1609.         o.style.top = document.getElementById('progman_menubar').offsetHeight+25+'px';
  1610.         o.style.left = '-2px';
  1611.     } else {
  1612.         o.style.width = refScreen_width+'px';
  1613.         o.style.height = (refScreen_height-1)+'px';
  1614.         o.style.top='-7px';
  1615.         o.style.left='-7px';
  1616.     }
  1617.     var q = document.getElementById(w+'_bt');
  1618.     resizeBoxText(o,q);
  1619.     windows[i][13](o);
  1620.     var p = document.getElementById(w + '_maxr');
  1621.     p.className = 'restorebutton';
  1622.     p.setAttribute("class","restorebutton");
  1623.     p.onmouseup = new Function("restoreWindow('" + w + "')");
  1624.     p.onmousedown = rDepressed;
  1625.     p.onmouseout = rRestored;
  1626.     p.style.backgroundPosition='-162px 0px';
  1627.     o.setAttribute('tag2', '1');
  1628.     o.onmousedown = null;
  1629.     o.onmousemove = null;
  1630.     o.onmouseup = null;
  1631.     o.style.visibility = 'visible';
  1632. }
  1633. function restoreWindow(w) {
  1634.     var o = document.getElementById(w);
  1635.     o.style.visibility = 'hidden';
  1636.     var i = findWindow(w);
  1637.     windows[i][9] = 0;
  1638.     o.style.top = windows[i][8] + 'px';
  1639.     o.style.left = windows[i][7] + 'px';
  1640.     o.style.width = windows[i][5] + 'px';
  1641.     o.style.height = windows[i][6] + 'px';
  1642.     var p = document.getElementById(w + '_maxr');
  1643.     var q = document.getElementById(w+'_bt');
  1644.     resizeBoxText(o,q);
  1645.     windows[i][13](o);
  1646.     p.className = 'maxbutton';
  1647.     p.setAttribute("class","maxbutton");
  1648.     p.onmouseup = new Function("maximizeWindow('" + w + "')");
  1649.     p.onmousedown = maxDepressed;
  1650.     p.onmouseout = maxRestored;
  1651.     p.style.backgroundPosition='-108px 0px';
  1652.     o.setAttribute('tag2', '0');
  1653.     o.onmousedown = resizeDown;
  1654.     o.onmousemove = mouseMoveBox;
  1655.     o.onmouseup = resizeUp;
  1656.     o.style.visibility = 'visible';
  1657. }
  1658. function showWindow(titlecode) {
  1659.     var a=document.getElementById(titlecode);
  1660.     a.style.visibility = 'visible';
  1661.     a.focus();
  1662.     if (titlecode=='progman') {
  1663.         for (var j=0;j<windowCount;j++) {
  1664.             if (windows[j][4].indexOf('progman_groupw_') == 0)
  1665.                 document.getElementById(windows[j][4]).style.visibility='visible';
  1666.         }
  1667.     }
  1668. }
  1669. function loadExternalFile(f,type) {
  1670.     var z='launchapp_'+f.split('.')[0]+'js';
  1671.     for (var i=0; i<externalFileList.length; i++)
  1672.     {
  1673.         if (externalFileList[i]==f) {
  1674.             if (type=='js') { var a=new Function(z+'();'); a(); }
  1675.             return;
  1676.         }
  1677.     }
  1678.     externalFileList[externalFileList.length]=f;
  1679.     var ref;
  1680.     if (type=='css') {
  1681.         ref=document.createElement('link');
  1682.         ref.setAttribute('rel','stylesheet');
  1683.         ref.setAttribute('type','text/css');
  1684.         ref.setAttribute('href','/apps/'+f);   
  1685.     } else if (type=='js') {
  1686.         ref=document.createElement('script');
  1687.         ref.setAttribute('type','text/javascript');
  1688.         ref.setAttribute('src','/apps/'+f);
  1689.     }
  1690.     document.getElementsByTagName('head')[0].appendChild(ref);
  1691. }
  1692. function dummy() { return; }
  1693. function drawDesktop()
  1694. {
  1695.     var obj = document.getElementById('icontable'); var z;
  1696.     obj.parentNode.setAttribute('tag',-1);
  1697.     while (obj.firstChild) { z=obj.removeChild(obj.firstChild); z=null; }
  1698.     var etb=document.createElement("tbody");
  1699.     var etr=document.createElement("tr");
  1700.     var cr=0;
  1701.     var ll=Math.floor(parseInt(refScreen.style.width)/84)-1;
  1702.     for (var i=0;i<windowCount;i++)
  1703.     {
  1704.         if (windows[i][3] == 1)
  1705.         {
  1706.             eDIV = document.createElement("td");
  1707.             eDIV.setAttribute("class","minimizedicon");
  1708.             eDIV.setAttribute("className","minimizedicon");
  1709.             eDIV.setAttribute("id", "minIcon" + i);
  1710.             eimg = document.createElement("div");
  1711.             eimg.setAttribute("class","minicon");
  1712.             eimg.setAttribute("className","minicon");
  1713.             eimg.setAttribute("tag", i);
  1714.             eimg.ondblclick = minIconDoubleClick;
  1715.             eimg.onclick = minIconClick;
  1716.             eimg.style.backgroundPosition="-" + (windows[i][1]*32) + 'px 0px';
  1717.             eDIV.appendChild(eimg);
  1718.             espan = document.createElement("div");
  1719.             espan.setAttribute("id", "minIconText" + i);
  1720.             espan.setAttribute("class", "mintext");
  1721.             espan.setAttribute("className", "mintext"); //IE workaround
  1722.             espan.ondblclick = minIconDoubleClick;
  1723.             espan.setAttribute("tag", i);
  1724.             espan.onclick = minIconClick;
  1725.             espan.onselectstart = new Function("return false;");
  1726.             espan.onmousedown = blockDefault;
  1727.             espan.appendChild(document.createTextNode(windows[i][0]));
  1728.             eDIV.appendChild(espan);
  1729.             etr.appendChild(eDIV);
  1730.             cr++;
  1731.             if (cr>ll) {
  1732.                 etb.appendChild(etr);
  1733.                 etr=document.createElement("tr");
  1734.                 cr=0;
  1735.             }
  1736.         }
  1737.     }
  1738.     etb.appendChild(etr);
  1739.     obj.appendChild(etb);
  1740. }
  1741. function readCookie(name) {
  1742.     var nameEQ = name + "=";
  1743.     var ca = document.cookie.split(';');
  1744.     for(var i=0;i < ca.length;i++) {
  1745.         var c = ca[i];
  1746.         while (c.charAt(0)==' ') c = c.substring(1,c.length);
  1747.         if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  1748.     }
  1749.     return null;
  1750. }
  1751. function radioButtonActive() {
  1752.     this.style.backgroundPosition='-232px 0px';
  1753. }
  1754. function radioButtonInactive() {
  1755.     this.style.backgroundPosition='-216px 0px';
  1756. }
  1757. function radioButtonOut() {
  1758.     var cb=this.parentNode.parentNode.getAttribute('tag');
  1759.     if (cb == this.id)
  1760.         this.style.backgroundPosition='-248px 0px';
  1761.     else
  1762.         this.style.backgroundPosition='-216px 0px';
  1763. }
  1764. function radioButtonChange() {
  1765.     var cb=this.parentNode.parentNode.getAttribute('tag');
  1766.     document.getElementById(cb).style.backgroundPosition='-216px 0px';
  1767.     this.style.backgroundPosition='-248px 0px';
  1768.     this.parentNode.parentNode.setAttribute('tag',this.id);
  1769.     this.parentNode.parentNode.setAttribute('tag_num',this.getAttribute('tag_num'));
  1770. }
  1771. //]]>
  1772. </script>
  1773. </head>
  1774. <body onload="startProgMan()">
  1775. <div id="screen" onclick="globalClick();">
  1776. <div id="iconlist"><table id="icontable"><tr><td></td></tr></table></div>
  1777. </div>
  1778. <div id="modal" onmousedown="modalClick();"></div>
  1779. <noscript><div>Please enable JavaScript in order to view the full michaelv.org experience. If you are unable to, <a href="/index2.php">click here</a> to view the vanilla XHTML index page.</div></noscript>
  1780. </body>
  1781. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement