/*
* @title Expanding Menu
* @intent jon.ippolito@REMOVEME.umit.maine.edu
* @release jon.ippolito@REMOVEME.umit.maine.edu
* @version 1.2b
* @requires Client.js version 2.1
* @requires Netscape4ResizeFix.js
* @requires print_styles.css or variant
* @requires ope_styles.css or variant
* @description
* Jon modified 1.2 to trap Safari opening window problem.
* This hierarchic menu rewrites a div
* rather than relying on current standards like display,
* and hence is backward-compatible with Netscape 4.
* Div ids for content must match menu array numbers and end in Div,
* eg
* In a later version I hope to obviate these hard-coded numbers.
* Should be easy to do by loading the divs dynamically.
* Elements are positioned using CSS.
* @sample Here's how to call it from your HTML document:
* LinkText = new Array()
* SubLinkText = new Array()
* LinkText[LinkText.length] = "My Cats"
* SubLinkText[LinkText.length-1] = ["Max", "Morris"]
* LinkText[LinkText.length] = "Why I Don't Own A Rabbit"
* LinkText[LinkText.length] = "My Dogs"
* SubLinkText[LinkText.length-1]= ["Rover", "Fido", "Spot"]
* (etc.)
* MyPetsMenu = new ExpandingMenu(LinkText,SubLinkText)
*/
////////////////////// TEXT ARRAYS //////////////////////
function ExpandingMenu(linkArg,subLinkArg) {
LinkArray = linkArg
SubLinkText = subLinkArg
}
///////////// DYNAMICALLY WRITING HEADINGS ////////////
function LinkClick(LinkNumber,SubLinkNumber) {
var DivContents = ""
NoneVar = -1 //UPGRADE: DELETE THIS AND PUT -1 BELOW.
//WRITE THE MAIN HEADINGS INTO A VARIABLE.
for (var j=0; j< LinkText.length; j++) {
var Head0Class = (j == LinkNumber)? "Head0High0": "Head0Cate0"
DivContents += (j == 0)? "" : "
"
DivContents += "
"
DivContents += LinkText[j]
DivContents += "<" + "/A> " //UPGRADE: REMOVE SPACE.
//FOR THE CHOSEN MAIN HEADING, WRITE THE SUBHEADINGS.
if (LinkNumber != -1 && SubLinkText[j]) {
for (var k=0; k< SubLinkText[j].length; k++) {
if (j == LinkNumber) {
var Head1Class = (j == LinkNumber && k == SubLinkNumber)? "Head1High0": "Head1Cate0"//"Head1High" + j : "Head1Cate" + j
DivContents += " "
DivContents += SubLinkText[j][k]
DivContents += "<" + "/A> " //UPGRADE: REMOVE SPACE.
}
}
}
}
//WRITE THE DIV.
if (Client.ns4==1) { //Netscape 4
document.HeadingsDiv.document.write(DivContents)
document.HeadingsDiv.document.close()
} else {//w3c standard
document.getElementById('HeadingsDiv').innerHTML = DivContents
}
}
///////////// REVEALING CONTENTS ////////////
function ShowLayer(LayerName) {
if (Client.ns4==1) { //Netscape 4.
eval("document." + LayerName + ".visibility = 'show'")
} else {
document.getElementById(LayerName).style.visibility = 'visible'
}
}
function HideLayer(LayerName) {
if (Client.ns4==1) { //Netscape 4.
eval("document." + LayerName + ".visibility = 'hide'")
} else {
//alert("trying layername = " + LayerName)
document.getElementById(LayerName).style.visibility = 'hidden'
//DEBUG: alert("ok for layername = " + LayerName)
}
}
function ShowContent(ConteNumbe,SubConteNumbe) {
/* REINSTATE AFTER ADDING NEW DIVS */
if (ConteNumbe == -1) { //SPLASH.
ShowLayer("SplashDiv")
ShowLayer("TextADiv")
HideLayer("Hotlink1Div")
}
else { //NO LONGER ON SPLASH.
HideLayer("SplashDiv")
HideLayer("TextADiv")
ShowLayer("Hotlink1Div")
}
for (var j=0;j* " + LinkText[j] + " *<" + "/span> "
PrintableTextVar += eval("document.getElementById('Content" + j + "Div').innerHTML") + " "
if (SubLinkText[j]) {
for (var i=0;i" + SubLinkText[j][i] + "<" + "/span> "
PrintableTextVar += eval("document.getElementById('Content" + j + "Sub" + i + "Div').innerHTML") + " "
}
}
}
}
///////////////////// OPENING WINDOWS //////////////////////
// This function fails in Mozilla 1.0 but works in IE5 and NS6.
function OpenCaseStudyWindow(artist_title) {
eval( "var CaseStudyWindowVar = window.open('case_" + artist_title + ".html','CaseStudyWindowName','status=yes,scrollbars=yes,width=600,height=550,top=0,left=200')" )
}
function OpenPrintableWindow() {
if (Client().ns4) { //Netscape 4
alert("This option is unavailable for Netscape 4 and under. Please upgrade your browser.")
}
if (Client().saf) { // Safari.
alert("You appear to be browsing with Safari, which does not yet support this option.")
}
else {//Moz or NN 6 or IE
var htmlVar = "The Open Art Network: Project Description<" + "/span>This is a dynamically generated version of the Open Art Network project description in printable form. "
htmlVar += "You can find the updated version at http://three.org/openart.<" + "/span> "
htmlVar += PrintableTextVar
PrintableWindowVar = window.open('empty.html','PrintableWindowName','status=yes,scrollbars=yes,width=600,height=550,top=0,left=200')
htmlVar = " " + htmlVar
PrintableWindowVar.document.open()
PrintableWindowVar.document.write(htmlVar)
PrintableWindowVar.document.close()
}
}
///////////////////// FUTURE IMPLEMENTATION //////////////////////
// These functions have not been implemented since antiquity, but may be of use in the future.
GlossText = new Object()
GlossText.bandw = "Bandwidth<" + "/span> The amount of information that can be transmitted through a connection, usually measured in bits per second. Low bandwidth connections (10,000-50,000 bps) are acceptable for text, but viewing full-screen video remotely requires a bandwidth a thousand times faster."
GlossText.brows = "Browser<" + "/span> A program that recognizes, interprets, and views Web documents (usually coded in HTML<" + "/a>) on the World Wide Web.<" + "/a> Netscape and Microsoft Internet Explorer are the most common Web browsers that display graphics as well as texts; others include Opera and Amaya. The same Web page may appear different on a specific browser since browsers generally access and interpret codes differently."
function WriteGloss(glossName) {
var htmlVar = eval("GlossText." + glossName);
if (Client.ns4==1) { //Netscape 4
htmlVar = "" + htmlVar + "<" + "/span>"
document.GlossDiv.document.write(htmlVar)
document.GlossDiv.document.close()
} else {
document.getElementById('GlossDiv').innerHTML = htmlVar
}
}
function OpenGlossWindow() {
var htmlVar = "Internet Art Glossary<" + "/span> This is an alphabetized, noninteractive version of the glossary in printable form. "
htmlVar += "You can find the interactive version at www.guggenheim.org/internetart. "
for (prop in GlossText) {
htmlVar += eval("GlossText." + prop) + " "
}
GlossWindowVar = window.open('empty.html','GlossWindowName','status=yes,scrollbars=yes,width=600,height=550,top=0,left=200')
htmlVar = "" + htmlVar + "<" + "/span>"
htmlVar = " " + htmlVar
GlossWindowVar.document.open()
GlossWindowVar.document.write(htmlVar)
GlossWindowVar.document.close()
}
function OpenProjectWindow(ProjectName) {
var ProjectUrl = "http://" + ProjectName + ".guggenheim.org"
PrintWindowVar = window.open(ProjectUrl, 'ProjectWindowName', 'status=yes,scrollbars=auto,width=790,height=570,top=0,left=0')
}