function NavOver(cell)
{
var thiscell = "Cell_" + cell;
// var oSrc = event.srcElement;
oCell = document.getElementById(thiscell);
oCell.style.backgroundColor = "white";
//var HTMLtext = oSrc.innerHTML;
//if (HTMLtext.search("
10) {
alert (warning);
}
else
{
window.document.forms[0].totalselected.value = Number(totalchosen) + 1;
window.document.forms[0].selectmenu.value = newselection;
window.parent.result.location.href="/publicinfo.nsf/NutritionResult?Openform&ID=" + newselection;
}
}
function addItem_FR(menucode)
{
var newselection = window.document.forms[0].selectmenu.value;
var totalchosen = window.document.forms[0].totalselected.value;
var newselection = newselection + menucode + "@";
var warning = "Veuillez prendre note que vous ne pouvez afficher qu'un maximum de 10 articles du menu à la fois. Retirez certains des articles sélectionnés ou cliquer sur la touche EFFACER ci-dessous pour recommencer. "
if ( totalchosen > 10) {
alert (warning);
}
else
{
window.document.forms[0].totalselected.value = Number(totalchosen) + 1;
window.document.forms[0].selectmenu.value = newselection;
window.parent.result.location.href="/publicinfo.nsf/NutritionResult_FR?Openform&ID=" + newselection;
}
}
//Functions to hide the popup menu
//The popup menu is a div named '"dropDown" + menu', where menu=0,1,2,3,4
function hideMe() {
var el = document.getElementsByTagName('DIV');
for(i=0;i
";
sHref = "";
//Add the row to the table.
sTemp += "| " + sHref + sText + " |
";
}
}
//Finish up the table.
sTemp = ""
var oMenu = document.getElementById("ViewsMenu");
//Write the table to the document.
oMenu.innerHTML = sTemp;
}
function initiateDrag()
{
//Programmer: L. Palm
//Date: 08/02
//Called when a drag is started.
//What is being dragged?
var oSource = event.srcElement;
if (oSource.tagName != "A")
{window.event.returnValue = false;
return false;}
//Store the href of what is being dragged in the event.dataTransfer object.
//This is how the drop knows what was dragged.
event.dataTransfer.setData("url", oSource.href);
}
function FinishDrag()
{
//Programmer: L. Palm
//Date: 08/02
//Called when a drag is finished (drop).
//Forget about what would normally happen on a drop.
window.event.returnValue=false;
//Record the current location so we can refresh it after delete.
var sCurrent = window.location.href;
//Find out what was dragged in.
var sHref = event.dataTransfer.getData("url");
//Slice the last 12 characters off of what was dragged (OpenDocument).
var sBase = sHref.slice(0, -12);
//Instead, replace with "DeleteDocument."
var sFinal = sBase + "DeleteDocument";
//Really?
var bReally = confirm("Really Delete This Document?");
//If user really wants to delete, change the location to the sFinal HREF,
//which will delete the document. Then tell user the document was deleted,
//then reload the original location.
if (bReally == true)
{
window.location.href = sFinal;
alert("Document Deleted");
window.location.href = sCurrent;
window.location.reload(true);
}
}
function OverDrag(){
//Programmer: L. Palm
//Date: 08/02
//Called when a drag is being performed.
//Simply tells browser to not handle the drag
//the way it normally would.
window.event.returnValue=false;
}
function setCookie(sName, sValue)
{
//Programmer: L. Palm
//Date: 08/02
//Sets a cookie with sName and sValue. Cookie will expire in 5 years.
var inFiveYears = new Date();
inFiveYears.setFullYear(inFiveYears.getFullYear() + 5);
document.cookie = sName+ "=" + escape(sValue) + "; expires=" + inFiveYears.toGMTString();
}
function openPreferenceDialog(sDialog)
{
//Programmer: L. Palm
//Date: 08/02
//Opens preferences form specified by sDialog.
//Also sets cookies on return and applies preferences.
//by reloading document.
var vCookie;
var vArgs = new Array();
hideAllMenus();
//What was clicked?
var oWhatWasClicked = event.srcElement;
//Igore normal action of the click.
oWhatWasClicked.returnValue = false;
//What was the text of what was clicked?
var sWhatToShow = oWhatWasClicked.innerText;
//Set the window parameters.
var sURL = sDialog + "?openForm";
var sHeight = "dialogHeight: 200px;";
var sWidth = "dialogWidth: 400px;";
var sStatus = "status: no;";
var sHelp = "help: no;";
var sScroll = "scroll: no";
var sFeatures = sHeight + sWidth + sStatus + sHelp + sScroll;
//Get the cookie values if available.
if (sWhatToShow == "Colors")
{
vArgs[0] = document.forms[0].OddRows.value;
vArgs[1] = document.forms[0].EvenRows.value;
}
else
{vArgs[0] = document.forms[0].TwistiePreference.value;}
//Show the url as a modal dialog box (IE 5.5).
vCookie = window.showModalDialog(sURL , vArgs , sFeatures);
//If something comes back, set the cookie value(s).
if (vCookie[0] != "")
{
setCookie(vCookie[0], vCookie[1]);
//If it was the Colors dialog, there were two cookies.
if (sWhatToShow == "Colors")
{setCookie(vCookie[2], vCookie[3]);}
}
window.location.reload(true);
}
function replaceTwisties()
{
//Programmer: L. Palm
//Date: 08/02
//Replaces twisties in the view with those chosen in preferences.
//Find all the images on the document.
oImages = document.getElementsByTagName("IMG");
var sExpandSrc;
var sCollapseSrc;
//Get twistie preference from cookie if available.
var sTwistiePref = document.forms[0].TwistiePreference.value;
//If there is no twistie preference, make it standard.
if (sTwistiePref == "")
{sTwistiePref = "Standard"}
//If the twistie preference is standard, get out of here. Your
//work is done.
if (sTwistiePref == "Standard")
{return false;}
//Define what images to use depending on the twistie preference.
switch(sTwistiePref)
{
case "Folders":
{sExpandSrc = "closedfolder.gif";
sCollapseSrc = "openfolder.gif";
break;}
case "Animated":
{sExpandSrc = "downani.gif";
sCollapseSrc = "upani.gif";
break;}
case "None":
{sExpandSrc = "blank.gif";
sCollapseSrc = "blank.gif";
break;}
}
//Cycle through all the images. When you find an expand.gif, replace
//it with the desired twistie. Do the same for collapse.
//While you're there, add a more descriptive message for the ALT tag
//of the twistie.
for (i = 0; i < oImages.length; i++)
{
if(oImages[i].src.slice(-10)=="expand.gif")
{oImages[i].src = sExpandSrc;
oImages[i].alt = "Click to show documents.";}
else
if(oImages[i].src.slice(-12)=="collapse.gif")
{oImages[i].src = sCollapseSrc;
oImages[i].alt = "Click to hide documents.";}
}
}
function addRelatedTerm(sTerm)
{
//Programmer: L. Palm
//Date: 08/02
//Shows related terms dialog, then sets SeeAlso field to what was chosen.
var vLinks;
//Find what was clicked.
var oWhatWasClicked = event.srcElement;
var sWhatToShow = oWhatWasClicked.innerText;
//Then hide the menu.
var oMenu = document.getElementById("AddRelatedTerms");
oMenu.style.display = "none";
//Create the URL.
var sURL = document.forms[0].dbPath.value + "/links?openform&" + sWhatToShow;
//Set the modal dialog parameters.
var sHeight = "dialogHeight: 350px;";
var sWidth = "dialogWidth: 350px;";
var sStatus = "status: no;";
var sHelp = "help: no";
var sFeatures = sHeight + sWidth + sStatus + sHelp;
//Show the modal dialog.
vLinks = window.showModalDialog(sURL , "LinksPickList" , sFeatures);
//If something came back from the modal dialg value add it to the SeeAlso field.
//SeeAlso field has input translation statement that will handle duplicates.
if (vLinks != false)
{document.forms[0].SeeAlso.value += vLinks;}
}
function OKColorsClicked()
{
//Programmer: L. Palm
//Date: 08/02
//Called when OK clicked in Color Prefs.
var vCookieInfo = new Array();
vCookieInfo[0] = "OddRows";
vCookieInfo[2] = "EvenRows";
var oFlds = document.forms[0].elements;
//Cycle through all the radio buttons.
for (i = 0; i < oFlds.length; i++)
{
//If a button is checked, find out if it's even or odd.
if (oFlds[i].checked)
{
//If it's an odd button, set the odd cookie.
if (oFlds[i].name.slice(0, 3) == "Odd")
{vCookieInfo[1] = oFlds[i].value;}
//Must be an even button, so set the even cookie.
else
{vCookieInfo[3] = oFlds[i].value;}
}
}
window.returnValue = vCookieInfo;
window.close();
}
function hideOdd(oButThis)
{
//Programmer: L. Palm
//Date: 08/02
//Sets all odd radio buttons to false except for the one that was clicked (this).
//Necessary because each radio button is its own field so it can have a separate
//background color.
//red
document.forms[0].Oddfeb2b2.checked = false;
//green
document.forms[0].Odd93d9ae.checked = false;
//blue
document.forms[0].Odda4c8ed.checked = false;
//grey
document.forms[0].Oddc5c5c5.checked = false;
//tan
document.forms[0].Odde3cc9e.checked = false;
oButThis.checked = true;
}
function hideEven(oButThis)
{
//Programmer: L. Palm
//Date: 08/02
//Sets all even radio buttons to false except for the one that was clicked (this).
//Necessary because each radio button is its own field so it can have a separate
//background color.
//red
document.forms[0].Evenfeb2b2.checked = false;
//green
document.forms[0].Even93d9ae.checked = false;
//blue
document.forms[0].Evena4c8ed.checked = false;
//grey
document.forms[0].Evenc5c5c5.checked = false;
//tan
document.forms[0].Evene3cc9e.checked = false;
oButThis.checked = true;
}
function loadColors()
{
//Programmer: L. Palm
//Date: 08/02
//Sets the proper radio buttons to what was passed in the dialog arguments.
var vColors = new Array();
vColors = window.dialogArguments;
//If nothing was passed for odd, choose Tan e3cc9e.
if (vColors[0] != "")
{sOdd = "Odd" + vColors[0];}
else
{sOdd = "Odde3cc9e";}
//If nothing was passed for even, choose Grey - c5c5c5.
if (vColors[1] != "")
{sEven = "Even" + vColors[1];}
else
{sOdd = "Oddc5c5c5";}
//Set the proper radio buttons.
document.forms[0].elements(sOdd).checked=true;
document.forms[0].elements(sEven).checked=true;
}
function OKPickListClicked()
{
//Programmer: L. Palm
//Date: 08/02
//Called when OK is clicked in the Add Related Term dialog.
var nl = "\n";
//Find all the table cells.
var oCells = document.getElementsByTagName("TD");
var oCellsLen = oCells.length;
var sTemp = "";
//Cycle through each cell.
for (i = 0; i < oCellsLen; i++)
{
oCell = oCells[i];
//If the cell is yellow, it is selected.
if (oCell.style.backgroundColor == "yellow")
{
//So find the link that was selected and add it to sTemp (plus a new line.)
oAtag = oCell.getElementsByTagName("A");
oAtag[0].removeAttribute("onclick");
sTemp += "[" + oAtag[0].outerHTML + "]" + nl;
}
}
//Return sTemp to the calling window.
window.returnValue = sTemp;
window.close();
}
function handlePickListClick()
{
//Programmer: L. Palm
//Date: 08/02
//Called when table cell is clicked in the Add Related Term dialog.
//Find all the table cells.
oCells = document.getElementsByTagName("TD");
oCellsLen = oCells.length;
//If the control key is not being held down, set the background of all
//cells to silver. If the control key is clicked, this will be ignored,
//so all yellow cells will stay yellow. Enables multi-select.
if (event.ctrlKey == false )
{
for (i = 0; i < oCellsLen; i++)
{
oCells[i].style.backgroundColor = "silver";
document.selection.clear;
document.selection.empty;
}
}
//Now figure out what was clicked.
var oSrc = event.srcElement;
//There are links within the table cells, so if you clicked the table cell,
//what you will change is the cell background.
if (oSrc.tagName == "TD")
{oSrcToChange = oSrc;}
//If you clicked the actual link, change the background color of its parent (the table cell).
else if (oSrc.tagName == "A")
{oSrcToChange = oSrc.parentElement;}
if (oSrcToChange.style.backgroundColor == "silver")
{oSrcToChange.style.backgroundColor = "yellow";}
else
{oSrcToChange.style.backgroundColor = "yellow";}
}
function handlePickListMouseOver()
{
//Programmer: L. Palm
//Date: 08/02
//Handles mouseovers in PickList.
oSrc = event.srcElement;
if (oSrc.tagName == "TD")
{
oSrc.style.cursor = "hand"
}
}
function handlePickListMouseOut()
{
//Programmer: L. Palm
//Date: 08/02
//Handles mouseouts in PickList.
oSrc = event.srcElement;
if (oSrc.tagName == "TD")
{
oSrc.style.cursor = "default"
}
}
function getElementPosition(oElement)
{
var offsetTrail = oElement;
var offsetLeft = 0;
var offsetTop = 0;
while (offsetTrail)
{
offsetLeft += offsetTrail.offsetLeft;
offsetTop += offsetTrail.offsetTop;
offsetTrail = offsetTrail.offsetParent;
}
return {left:offsetLeft, top:offsetTop};
}
function resizeView()
{
var oBody = document.getElementById("MainBody").clientHeight;
var oTheView = document.getElementById("TheView");
oTheView.style.height = oBody - 100;
}
function helpAbout()
{
alert("DHTML Playroom 2.0");
}
function quickSearch()
{
var sChoice = prompt("Enter term: ", "");
if (sChoice != null)
{location.href = "FindTerm?OpenAgent&" + sChoice;}
}