Hi all,

Although new to this forum, I am a member of many others. I found this forum and would like to ask your help with a javascript...

At http://www.bartlett-family.net/sokhan I am putting together my most advanced html ever. Getting into uncharted territory for me! I got a little bit of help from a friend in starting out, but he is no longer available and I have now found that the site only works properly in IE. Truthfully, it would be nice if it worked in all browsers, but if it doesn't in Opera, oh well...

In IE, it works great...

In NS and Mozilla, here are the problems:

The four links at the top (the ones with the red arrows pointing down) do not react at all when clicked.
The three links on the left (the ones NOT in the green area) do not expand when clicked.
Everything else seems to work fine!

In Opera, here are the problems:

The three links on the left (the ones NOT in the green area) do not expand when clicked.

The four links at the top work when clicked on (they DO produce the drop-down menu), but when clicking on one of THOSE links, I get a javascript error message saying:
Code:
Event thread: onclick
Error:
name: TypeError
message: Statement on line 188: Expression evaluated to null or undefined and is not convertible to Object: sURL
Backtrace:
  Line 188 of linked script http://www.bartlett-family.net/sokhan/wcd00074.js
    sFrameURL = sURL.substring(0, sURL.indexOf("#"));
  Line 204 of linked script http://www.bartlett-family.net/sokhan/wcd00074.js
    sURL = hackURL(window.event.srcElement.myURL);
  At unknown location
    {event handler trampoline}
Obviously, there are javascript errors, and I suspect that those are the true culprits. I got the javascripts from God-only-knows-where, and I have to be honest in saying that I know nothing about javascript.

I am also getting this javascript error:
Code:
Event thread: onclick
Error:
name: TypeError
message: Statement on line 279: Expression evaluated to null or undefined and is not convertible to Object: sURL
Backtrace:
  Line 279 of linked script http://www.bartlett-family.net/sokhan/wcd00074.js
    sFrameURL = sURL.substring(0, sURL.indexOf("#"));
  Line 308 of linked script http://www.bartlett-family.net/sokhan/wcd00074.js
    sURL = hackURL(window.event.srcElement.myURL);
  At unknown location
    {event handler trampoline}
I have been told that this javascript is not cross-browser compliant. Forgive my ignorance, but like I said, I know nothing about javascript. Generally, the only time I use it is when I think an effect is neat. Well, I like this javascript, but I don't have the slightest idea how to make it cross-browser compliant. Can anyone help? I know I'm not supposed to post the entire script, but I will simply because I don't know which part is causing the trouble! Sorry.
Code:
	// -----------------------------------------------------------------------

	// menu-gb.htm HTML for INetSDK

	// -----------------------------------------------------------------------


	var sMenuGB = '<DIV CLASS="clsMenu"><TABLE ID="idNavMenu" BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD VALIGN="middle" CLASS="clsMenuTitleLabel"><A HREF="www.bartlett-family.net/sokhan" TARGET="_top" expNoTOC><IMG HEIGHT=34 WIDTH=90 BORDER=0 SRC="sokhanlogo.gif" ALT="Home"></A></TD><TD CLASS="clsMenuTD" ALIGN="center" VALIGN="top"><NOBR><DIV ID="idMenuTitle1" CLASS="clsMenuTitle">&nbsp;Menu&nbsp;</DIV></NOBR><IMG HEIGHT=4 WIDTH=7 BORDER=0 SRC="images/arrow.gif"></TD><TD CLASS="clsMenuDivider" VALIGN="top">|</TD><TD CLASS="clsMenuTD" ALIGN="center" VALIGN="top"><NOBR><DIV ID="idMenuTitle2" CLASS="clsMenuTitle">&nbsp;Menu&nbsp;</DIV></NOBR><IMG HEIGHT=4 WIDTH=7 BORDER=0 SRC="images/arrow.gif"></TD><TD CLASS="clsMenuDivider" VALIGN="top">|</TD><TD CLASS="clsMenuTD" ALIGN="center" VALIGN="top"><NOBR><DIV ID="idMenuTitle3" CLASS="clsMenuTitle">&nbsp;Menu&nbsp;</DIV></NOBR><IMG HEIGHT=4 WIDTH=7 BORDER=0 SRC="images/arrow.gif"></TD><TD CLASS="clsMenuDivider" VALIGN="top">|</TD><TD CLASS="clsMenuTD" ALIGN="center" VALIGN="top"><NOBR><DIV ID="idMenuTitle4" CLASS="clsMenuTitle" >&nbsp;Menu&nbsp;</DIV></NOBR><IMG HEIGHT=4 WIDTH=7 BORDER=0 SRC="images/arrow.gif"></TD><TD CLASS="clsMenuDivider" VALIGN="top">|</TD><TD CLASS="clsMenuTD" ALIGN="center" VALIGN="top"><NOBR><DIV ID="idMenuTitle5" CLASS="clsMenuTitle" >&nbsp;Menu&nbsp;</DIV></NOBR><IMG HEIGHT=4 WIDTH=7 BORDER=0 SRC="images/arrow.gif"></TD><TD CLASS="clsMenuDivider" VALIGN="top">|</TD><TD CLASS="clsMenuTD" ALIGN="center" VALIGN="top"><NOBR><DIV ID="idMenuTitle6" CLASS="clsMenuTitle" >&nbsp;Site Info&nbsp;</DIV></NOBR><IMG HEIGHT=4 WIDTH=7 BORDER=0 SRC="images/arrow.gif"></TD></TR></TABLE></DIV>'



	// -----------------------------------------------------------------------

	// 	MENU BUILDING CODE

	// -----------------------------------------------------------------------


	var aMenus = new Array()
	function addMenuItem(iMenuNumber,sText,sURL) {

		if (aMenus[iMenuNumber] == null) {

			aMenus[iMenuNumber] = new Array();

		}

    iIndex = aMenus[iMenuNumber].length

    aMenus[iMenuNumber][iIndex] = new Array(1);

		aMenus[iMenuNumber][iIndex][0] = sText;

		aMenus[iMenuNumber][iIndex][1] = sURL;

	}

	function writeMenus() {

		for (var i=1;i<aMenus.length;i++) {

			document.write("<DIV ID='idMenu" + i + "' CLASS='clsMenuItemList'>");

			for (var j=0;j<aMenus[i].length;j++) {

				document.write("<DIV CLASS='clsMenuItem' myURL='" + aMenus[i][j][1] + "'>" + aMenus[i][j][0] + "</DIV>");

			}

			document.write("</DIV>");

		}

	}




	// -----------------------------------------------------------------------
	

	// 	FOLKS, PLEASE EDIT MENUS HERE BELOW AND DON'T WORRY ABOUT ALL THE OTHER CRAPOLA!
	// 	-----------------------------------------------------------------------

	



// My Obnoxious Husband
	
addMenuItem(1,"Chris Bartlett","../chris")

addMenuItem(1,"His Hobbies","../chris/hobbies")

addMenuItem(1,"His Friends","../chris/friends")

addMenuItem(1,"His Music","../chris/tunes")

addMenuItem(1,"His Thoughts","../chris/T&O")

addMenuItem(1,"His Resume","../chris/resume.pdf")

addMenuItem(1,"School Stuff","../chris/myschoolstuff")
  


// My Beautiful Son

addMenuItem(2,"Jonathan Bartlett","../jonathan")

addMenuItem(2,"Having trouble?","password.html")

addMenuItem(2,"Pictures","../jonathan/pics.htm")

addMenuItem(2,"Videos","../jonathan/videos")




//My Family

addMenuItem(3,"Our History","samfamilyhistory.html")

addMenuItem(3,"Mom & Dad","momdad.html")

addMenuItem(3,"Siblings","siblings.html")

addMenuItem(3,"Nieces & Nephews","nn.html")

addMenuItem(3,"The Family Biz","biz.html")



//My Extended Family

addMenuItem(4,"Their History","index.htm")

addMenuItem(4,"Mother-In_Law","../nancy")

addMenuItem(4,"Father-In_Law","../john")

addMenuItem(4,"Brother-In-Law","../Pat")

addMenuItem(4,"Grandottie","../G-Dot")




writeMenus();



	// -----------------------------------------------------------------------

	// 	NAVIGATION FOR MENUBAR AND MENUITEMS
	// -----------------------------------------------------------------------


	var sMenuDownID = ""

	var sMenuTitleDownID = ""


	function menuTitle_mouseover() {

		var eSrc = window.event.srcElement

		if (eSrc.className != "clsMenuTitleDown") {
			eSrc.className = "clsMenuTitleOver"

		}

		if (sMenuTitleDownID != "" && eSrc.className == "clsMenuTitleOver") {
			menuTitle_click()

		}

	}


	function menuTitle_mouseout() {

		var eSrc = window.event.srcElement

		if (eSrc.className != "clsMenuTitleDown") {

			eSrc.className = "clsMenuTitle"

		}

	}


	function closeMenu() {
		if (sMenuDownID != "") {

			document.all[sMenuDownID].style.visibility = "hidden"

			document.onclick = window.fOrigDocOnclick

			document.body.onclick = window.fOrigDocBodyOnclick

			document.onkeypress = window.fOrigDocOnkeypress

			document.body.onkeypress = window.fOrigDocBodyOnkeypress

		}

		if (sMenuTitleDownID != "") {

			document.all[sMenuTitleDownID].className = "clsMenuTitle"

		}

		if (window.event.srcElement.className != "clsMenuTitle") {

			sMenuDownID = ""

			sMenuTitleDownID = ""

		}

	}


	function menuTitle_click() {
		closeMenu()

		var eSrc = window.event.srcElement

		if (sMenuTitleDownID == eSrc.id) {

			eSrc.className = "clsMenuTitleOver"

			sMenuTitleDownID = ""

			sMenuDownID = ""

		}

		else {
			window.fOrigDocOnclick = document.onclick 

			window.fOrigDocBodyOnclick = document.body.onclick 

			window.fOrigDocOnkeypress = document.onkeypress 

			window.fOrigDocBodyOnkeypress = document.body.onkeypress 

			document.onclick = document_click

			document.onkeypress = document_keypress

			sMenuTitleDownID = eSrc.id

			eSrc.className = "clsMenuTitleDown"

			iMenuNumber = eSrc.id.substring(eSrc.id.length-1,eSrc.id.length)

			sMenuDownID = "idMenu" + iMenuNumber

			iTop = idNavMenu.offsetTop + eSrc.offsetHeight + 23

			iLeft = idNavMenu.offsetLeft + eSrc.parentElement.parentElement.offsetLeft + 8

			with (document.all[sMenuDownID]) {

				style.top = iTop
				style.left = iLeft

				style.visibility = "visible"

			}
			document.all[sMenuDownID].style.visibility = "visible"

		}

	}


	function menuItem_mouseover() {
		window.event.srcElement.className = "clsMenuItemOver"

	}


	function menuItem_mouseout() { 

		window.event.srcElement.className = "clsMenuItem"

	}


	function hackURL(sURL) {

		dDate = new Date().getTime();

		sFrameURL = sURL.substring(0,sURL.indexOf("#"));
		sHash = sURL.substring(sURL.indexOf("#"));

		if (sFrameURL != "")  {

			if (location.protocol.indexOf("file:") > -1) {

				sURL = sHash.substring(1);

			}

			else {

//				sURL = sFrameURL + "?" + dDate + sHash;

				sURL = sFrameURL + sHash;

			}

		}

		return sURL;
	}

	
function menuItem_click() {

		closeMenu();

		sURL = hackURL(window.event.srcElement.myURL);

		top.location.href = sURL;
	}


	function returnFalse() {

		window.event.returnValue = false;

	}


	function document_click() {

		if (window.event.srcElement.className != "clsMenuTitleDown") {

			closeMenu();

		}

	}


	function document_keypress() {
		if (window.event.keyCode == "27") {

			closeMenu()

		}

	}



	// -----------------------------------------------------------------------

	// EVENT-BINDING FOR MENUBAR AND MENUITEMS

	// -----------------------------------------------------------------------


	function bindMenus() {

		var cDivs = document.all.tags("DIV");
		var iNumDivs = cDivs.length;

		for (var i=0;i<iNumDivs;i++) {

			eTarget = cDivs[i];

			if (eTarget.className == "clsMenuTitle") {

				with (eTarget) {

					onmouseover = menuTitle_mouseover;
					onmouseout = menuTitle_mouseout;

					onclick = menuTitle_click;
					onselectstart = returnFalse;

				}

			}

			else {

				if (eTarget.className == "clsMenuItem") {

					with (eTarget) {

						onmouseover = menuItem_mouseover;
						onmouseout = menuItem_mouseout;

						onclick = menuItem_click;
						onselectstart = returnFalse;

					}

				}

			}
		}

	}


  if (typeof(g_bCO) == "undefined") {

		bindMenus();

	}
Please help if you can. I would very much appreciate it! Thank you!

Chris