home *** CD-ROM | disk | FTP | other *** search
- //
- // Global variables shared with the other pages
- //
-
-
- //
- // Methods shared with the other pages
- //
- function BodyOnKeyPress(nCode)
- {
- if (nCode == 27) //ESC
- {
- window.close();
- return;
- }
- }
-
- function GetText(oTextInput)
- {
- var szValue = oTextInput.value;
- return (szValue && szValue != oTextInput.initialText) ? szValue : '';
- }
-
- function PopulateLeftPane(szRelatedTasks, szLearnAbout, szDescription)
- {
- idDescription.innerHTML = szDescription ? szDescription : '';
-
- if (szRelatedTasks && szRelatedTasks.length > 0)
- {
- idRelatedTaskLinks.innerHTML = szRelatedTasks;
- idRelatedTasks.style.display = 'block';
- }
- else
- idRelatedTasks.style.display = 'none';
-
- if (szLearnAbout && szLearnAbout.length > 0)
- {
- idLearnAboutLinks.innerHTML = szLearnAbout;
- idLearnAbout.style.display = 'block';
- }
- else
- idLearnAbout.style.display = 'none';
- }
-
-
- //
- // Methods specific to the main frame
- //
-
-
- function PageInit()
- {
- // Initialize globals
- g_Navigator = new Navigator(idContent);
- if (g_Navigator)
- {
- var ibarOC = window.dialogArguments;
- var ibarStart = ibarOC.start;
- if (ibarStart=="")
- {
- g_Navigator.navigate("mainpage.htm");
- }
- else
- {
- g_Navigator.navigate("settings.htm");
- }
- }
- }
-
- // Since this is a web page the user can select elements on the
- // page. Since this is an app, selecting element is undesireable.
- // Therefore we catch the start of a selection event and cancel it.
- function OnSelectStart()
- {
- // We still want to be able to select text in entry fields though.
- if (!event.srcElement.isTextEdit)
- event.returnValue = false;
- }
-
-
- //
- // Navigator object implementation
- //
- var g_Navigator = null;
-
- function push(url)
- {
- if (url)
- {
- if (this.current < 0 || url != this.stack[this.current])
- this.stack[++this.current] = url;
-
- // Make sure there's nothing left on the stack after this
- this.stack.length = this.current + 1;
- }
- }
-
- function navigate(urlTo, bTrim)
- {
- // Check for empty stack
- if (this.current < 0)
- bTrim = false;
-
- if (bTrim)
- {
- // Look backwards for the page, trimming as we go
- while (this.current >= 0)
- {
- // Trim the stack to the current location
- this.stack.length = this.current + 1;
-
- // Is the page here on the stack?
- if (urlTo == this.stack[this.current])
- break;
-
- if (0 == this.current)
- {
- // Got all the way back to the beginning and didn't
- // find it. Push it and stop.
- this.push(urlTo);
- break;
- }
-
- --this.current;
- }
- }
- else
- {
- // Normal navigation
- this.push(urlTo);
- }
-
- this.SetBtnState();
- this.frame.navigate(urlTo);
- }
-
- function back(nCount)
- {
- if (this.current > 0)
- {
- if (!nCount)
- nCount = 1;
-
- if (-1 == nCount)
- this.current = 0;
- else
- this.current = Math.max(0, this.current - nCount);
-
- this.frame.navigate(this.stack[this.current]);
- }
- this.SetBtnState();
- }
-
- function forward()
- {
- if (this.current < this.stack.length - 1)
- this.frame.navigate(this.stack[++this.current]);
- this.SetBtnState();
- }
-
- function SetBtnState()
- {
- idBackBtn.disabled = (this.current <= 0);
- if (idBackBtn.disabled)
- idBackBtn.src = "back.bmp";
-
- idForwardBtn.disabled = (this.current == this.stack.length - 1);
- if (idForwardBtn.disabled)
- idForwardBtn.src = "fwd.bmp";
-
- idHomeBtn.disabled = (this.current <= 0);
- if (idHomeBtn.disabled)
- idHomeBtn.src = "home.bmp";
- }
-
- function UpdateSelection()
- {
- var ibarOC = window.dialogArguments;
-
- var iCount = ibarOC.count;
- var newHTML = "";
-
- if (iCount==0)
- {
- newHTML = "<I>There are currently no items on your Show menu</i>";
- }
- else if (iCount==1)
- {
- newHTML = "<I>Item currently on your Show menu</i><br><br>" + ibarOC.item(0).title;
- }
- else
- {
- newHTML = "<I>Items currently on your Show menu</i><br><br>";
- for (var i=0; i < iCount - 1; i++)
- {
- var itemClsid = ibarOC.item(i);
- newHTML = newHTML + itemClsid.title + ", ";
- }
- newHTML = newHTML + "and " + ibarOC.item(i).title;
- }
- // idSelection.innerHTML = newHTML;
- }
-
- function UpdateStack()
- {
- var ibarOC = window.dialogArguments;
- var ibarStack = ibarOC.stack;
- var iCount = ibarStack.count;
- var newHTML = "";
-
- if (iCount==0)
- {
- newHTML = "<I>There are currently no items on My Bar</i>";
- }
- else if (iCount==1)
- {
- newHTML = "<I>Item currently on My Bar</i><br><br>" + ibarStack.item(0).title;
- }
- else
- {
- newHTML = "<I>Items currently on My Bar</i><br><br>";
- for (var i=0; i < iCount - 1; i++)
- {
- var itemClsid = ibarStack.item(i);
- newHTML = newHTML + itemClsid.title + ", ";
- }
- newHTML = newHTML + "and " + ibarStack.item(i).title;
- }
- // idSelection.innerHTML = newHTML;
- }
-
- function Navigator(frame)
- {
- // methods
- this.push = push;
- this.navigate = navigate;
- this.back = back;
- this.forward = forward;
- this.SetBtnState = SetBtnState;
- this.UpdateSelection = UpdateSelection;
- this.UpdateStack = UpdateStack;
-
- // properties
- this.frame = frame;
- this.current = -1;
- this.stack = new Array();
-
- this.SetBtnState();
- }
-
-