/* * @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 <div id="Content0Sub1Div"> * 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)? "" : "<br>"                 DivContents += "<A HREF='javascript:LinkClick(" + j + "," + NoneVar + "); ShowContent(" + j + "," + NoneVar + ")' "                DivContents += "class='" + Head0Class + "' "                DivContents += "onmouseover=this.className='" + Head0Class + "Over' "                DivContents += "onmouseout=this.className='" + Head0Class + "'>"                DivContents += LinkText[j]                DivContents += "<" + "/A><br>" //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 += "<A HREF='javascript:LinkClick(" + j + "," + k + ");ShowContent(" + j + "," + k + ")' "                         DivContents += "class='" + Head1Class + "' "                         DivContents += "onmouseover=this.className='" + Head1Class + "Over' "                         DivContents += "onmouseout=this.className='" + Head1Class + "'>"                         DivContents += SubLinkText[j][k]                         DivContents += "<" + "/A><br>" //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.length;j++) {                //IF NO SUBHEADING CHOSEN...                if (SubConteNumbe == -1) {                        //...SHOW ONLY THE SPLASH LAYER AND...                          LayerName = "Content" + j + "Div"                        if (j == ConteNumbe) {                                ShowLayer(LayerName)                        } else { //INCLUDES IF null.                                HideLayer(LayerName)                        }                                                //...HIDE ALL THE SUBCONTENT LAYERS.                        if (SubLinkText[j]) { //In case user doesn't want a subheading for a certain heading.								for (var k=0;k<SubLinkText[j].length;k++) {										SubLayerName = "Content" + j + "Sub" + k + "Div"										HideLayer(SubLayerName)								}                        }                }                               //IF A SUBHEADING IS CHOSEN...                else {                        //...HIDE ALL SPLASH LAYERS AND...                        LayerName = "Content" + j + "Div"                        HideLayer(LayerName)                                                //...SHOW A SUBCONTENT LAYER.                        if (SubLinkText[j]) { //In case user doesn't want a subheading for a certain heading.           								for (var k=0;k<SubLinkText[j].length;k++) {										SubLayerName = "Content" + j + "Sub" + k + "Div"										if (j == ConteNumbe && k == SubConteNumbe) {												ShowLayer(SubLayerName)										}										else { //INCLUDES IF null.												HideLayer(SubLayerName)										}								}						}				}                        }}///////////////////// GENERATE PRINTABLE TEXT //////////////////////function GeneratePrintableText() {	PrintableTextVar = ""    for (var j=0; j< LinkText.length; j++) {   		PrintableTextVar += "<span class='Head1'>* " + LinkText[j] + " *<" + "/span><br><br>"   		PrintableTextVar += eval("document.getElementById('Content" + j + "Div').innerHTML") + "<br><br>"	    if (SubLinkText[j]) {			for (var i=0;i<SubLinkText[j].length;i++) {					PrintableTextVar += "<span class='Head2'>" + SubLinkText[j][i] + "<" + "/span><br>"					PrintableTextVar += eval("document.getElementById('Content" + j + "Sub" + i + "Div').innerHTML") + "<br><br>"			}		}	}}///////////////////// 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 = "<span class='Head0'>The Open Art Network: Project Description<" + "/span><br><br><span class='Cont1'>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><br><br><br>"		htmlVar += PrintableTextVar		PrintableWindowVar = window.open('empty.html','PrintableWindowName','status=yes,scrollbars=yes,width=600,height=550,top=0,left=200')		htmlVar = "<LINK REL=stylesheet HREF='tech/print_styles.css' TYPE='text/css'>" + 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 = "<span class='Highp'>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 = "<span class='Highp'>Browser<" + "/span> A program that recognizes, interprets, and views Web documents (usually coded in <a href=javascript:WriteGloss('html')>HTML<" + "/a>) on the <a href=javascript:WriteGloss('world')>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 = "<span class='Plain'>" + htmlVar + "<" + "/span>"		document.GlossDiv.document.write(htmlVar)		document.GlossDiv.document.close()	} else {		document.getElementById('GlossDiv').innerHTML = htmlVar 	}}function OpenGlossWindow() {	var htmlVar = "<span class='Entit'>Internet Art Glossary<" + "/span><br>This is an alphabetized, noninteractive version of the glossary in printable form. "	htmlVar += "You can find the interactive version at www.guggenheim.org/internetart.<br><br><br>"	for (prop in GlossText) {		htmlVar += eval("GlossText." + prop) + "<br><br>"	}	GlossWindowVar = window.open('empty.html','GlossWindowName','status=yes,scrollbars=yes,width=600,height=550,top=0,left=200')	htmlVar = "<span class='Plain'>" + htmlVar + "<" + "/span>"		htmlVar = "<LINK REL=stylesheet HREF='css/iac_styles.css' TYPE='text/css'>" + 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')}