// Copyright (c) 1998,2001, John Lloyd-Jones. All rights reserved.
var agent = navigator.userAgent;
var nVer = parseInt (navigator.appVersion);
var isNS = (navigator.appName == 'Netscape') && nVer > 2;
var isIE = (navigator.userAgent.indexOf ("MSIE ") > 0);
var isNS4 = (navigator.appName == 'Netscape') && (nVer >= 4);
var isIE4 = isIE && (nVer >= 4) 
                        && agent.indexOf ("b1") <= -1
                        && agent.indexOf ("p1") <= -1;
var isIE5 = (navigator.userAgent.indexOf ("MSIE 5") > 0);
var oldPop = null;

function nsReload() { if (innerWidth != origWidth || innerHeight != origHeight) location.reload(); }
function noerror () { return true;}
// onerror = noerror;

if (isNS4)
{
	origWidth = innerWidth;
	origHeight = innerHeight;
	onresize = nsReload;
}

var is95NT = agent.indexOf ("Windows 95") > -1
|| agent.indexOf ("Windows NT") > -1
|| agent.indexOf ("Win32") > -1;

var isIE432 = is95NT && (isIE4 || isIE5);

aLivingRoom = new Array (
'CoffeeTable.htm', 'The Living Room...', 0, 
'Faith.htm', 'Faith', 1,
'HotOrCold.htm', 'Hot and Cold', 1,
'AntIntelligence.htm', 'Ants and Intelligence', 1, 
'Nothing.htm', 'Nothing', 1,
'Dreams.htm', 'Dreams', 1,
'Conscious.htm', 'Conscious Thinking', 1,
'DogsBestFriend.htm', 'Confidence trick', 1,
'Believing.htm', '&quot;I don\'t believe in Sex&quot;', 1,
'AboutTime.htm', 'About Time', 1
);

aLibrary = new Array (
'Library.htm#top"', 'The Library...', 0,
'Library.htm#top', 'Articles', 1,
'The-pc.htm', 'The PC', 2,
'ArcticTerns.htm', 'Arctic Terns', 2,
'Scream.htm', 'Suddenly I heard a shrill cry', 2,
'Shake.htm', 'Shake him well', 2,
'Visitor-1.htm', 'Surprise visitor', 2,
'Library.htm#FolkTales', 'Folk Tales', 1,
'CockerelAndHen.htm', 'The Cockerel and the Hen', 2,
'Pancake.htm', 'The Pancake', 2,
'Princess.htm', 'The Princess and the Pea',2,
'EastoftheSun.htm', 'East of the sun and West of the moon&nbsp;', 2,
'LittleFrikk.htm', 'Little Frikk and his Fiddle', 2,
'SoriaMoria.htm', 'Soria Moria',2,
'Library.htm#Myths', 'Words and Wisdom', 1,
'Wisdom.htm', 'Wisdom from the North', 2,
'EmptyInfinity.htm', 'Wise words from the east', 2,
'FirstLove.htm', 'The first love story', 2,
'Quotes.htm', 'I hate quotations', 2
);

aMusic = new Array (
'Music.htm', 'The Music Room...', 0,
'Music.htm#Bach', 'Bach', 1,
'Music.htm#OscarPeterson', 'Oscar Peterson', 1,
'Music.htm#ScottJoplin', 'Scot Joplin', 1,
'Music.htm#Wagner', 'Wagner', 1
);

aKitchen = new Array (
'WhatsCooking.htm#Savouries', 'Savouries', 0,
'AubergineWithApple.htm', 'Aubergine with apple', 1,
'EggInANest.htm', 'Egg in a Nest', 1,
'FennelWithBroccoli.htm', 'Fennel with Broccoli', 1,
'MexicanPita.htm', 'Mexican Pita Bread', 1,
'PohaRecipe.htm', 'Poha', 1,
'SpicyFlorentine.htm', 'Spicy Egg Florentine', 1,
'SesamePotatoes.htm', 'Sesame Potatoes', 1,
'MushroomStirfry.htm', 'Mushroom Stir-fry', 1,
'WhatsCooking.htm#RiceAndDal', 'Rice & Dal', 0,
'KalpanasPulao.htm', 'Pulao rice', 1,
'LemonRice.htm', 'Lemon Rice', 1,
'YellowDal.htm', 'Yellow dal', 1,
'WhatsCooking.htm#Desserts', 'Desserts', 0,
'BakedApple.htm', 'Baked Apple', 1,
'CheeseCake.htm', 'Cheese cake', 1
);

aIndia = new Array (
'India.htm', 'India...', 0,
'Bombay.htm', 'Bombay', 1,
'BombayStyle.htm', 'Served Bombay Style', 1,
'BombayTraffic.htm', 'Driving', 1,
'DrivingRules.htm', 'Traffic rules', 1,
'AndThenItRains.htm', 'Monsoon', 1,
'TwoNames.htm', 'Two Names', 1,
'ParleMarket.htm', 'At the Market', 1,
'TajMahal.htm', 'Taj Mahal', 1,
'Tirupathi.htm', 'Tirupathi', 1,
'GaneshChathurthi.htm', 'Festival!', 1,
'DowryDeaths.htm', 'Dowry Deaths', 1,
'Lakshmi.htm', 'Lakshmi', 1,
'Ganesh.htm', 'Ganesh', 1,
'Ramayana.htm', 'Ramayana', 1,
'Krishna.htm', 'Krishna', 1,
'Miniatures.htm', 'Miniatures', 1,
'Omkar.htm', 'Om&nbsp;<img src="images/Omkar-s.gif" width="16" height="16" border="0" alt="" align="middle" />', 1,
'Wedding.htm', 'Wedding', 1
);

aNorge = new Array (
'NorskeSider.htm', 'Norway/Norge...', 0,
'Vigeland.htm', 'Vigeland', 1,
'ArcticTerns.htm', 'Arktiske Terner (Engelsk)', 1
);

aLotus = new Array (
'Nameless.htm', 'Without Name or Limit', 0,
'GoldenRule.htm', 'The Golden Rule', 0,
'EmptyInfinity.htm', 'Empty Infinity', 0,
'Emptiness.htm', 'True Emptiness', 0
);

aMenu = new Array (
aLivingRoom,
aLibrary,
aMusic,
aKitchen,
aIndia,
aNorge,
aLotus
);
var strSpaces = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
var mnuCurrent = null;

if (isIE4)
	HideMenu = ieHideMenu;
else
	HideMenu = nsHideMenu;
	
function ieHideMenu ()
{
	if (mnuCurrent)
	{
		mnu = mnuCurrent;
		if (mnu && mnu.style.display == 'block')
		{
			clearTimeout (mnu.nTimer);
			mnu.style.display = "none";
		}
		mnuCurrent = null;
	}
}
function doMenu ()
{
	if (isIE432)
	{
	   HideMenu ();
		var eSrc = window.event.srcElement;
		if (eSrc.className == "Menu")
		{
			window.event.cancelBubble = true;
			var nMenuNum = eSrc.id.substring (eSrc.id.length - 1, eSrc.id.length);

			var mnu = document.all ["idMenu" + nMenuNum];
			mnu.style.clip = "rect(0 0 0 0)";
			mnu.style.display = "block";
		   mnu.onmouseover = ieMenuIn;
		   mnu.onmouseout = ieMenuOut;
		   mnu.onmousemove = ieMenuMove;
			mnu.nShow = 10;
			mnuCurrent = mnu;
			dropMenu ();
		}
	}
}
function ieMenuOut ()
{
	if (mnuCurrent)
	{
   		mnuCurrent.nTimer = setTimeout ('HideMenu ();', 1500);
		mnuCurrent.inMenu = false;
	}
}
function ieMenuIn ()
{
	if (mnuCurrent)
	{
		clearTimeout (mnuCurrent.nTimer);
		mnuCurrent.inMenu = true;
	}
}
function ieMenuMove ()
{
	if (mnuCurrent)
	{
		ieMenuIn ();
		mnuCurrent.inMenu = true;
		mnuCurrent.onmousemove = null;
	}
}
function dropMenu ()
{
	if (! mnuCurrent)
		return;

	if (isIE4)
		mnuCurrent.style.clip = "rect(0 100% " + mnuCurrent.nShow + "% 0)";
	else
		mnuCurrent.clip.bottom = mnuCurrent.clip.top + (mnuCurrent.nShow * mnuCurrent.nMenuHeight) / 100; 

	mnuCurrent.nShow += 10;
	if (mnuCurrent.nShow <= 100)
	{
		mnuCurrent.nTimer = window.setTimeout ("dropMenu()", 10);
		mnuCurrent.nTimerOn = true;
	}
	else
	{
		window.clearTimeout (mnuCurrent.nTimer);
		if (isNS4)
		{
			mnuCurrent.onmouseover = nsMenuIn;
			mnuCurrent.onmouseout = nsMenuOut;
			mnuCurrent.onmousemove = nsMenuMove;
		}
		if (! mnuCurrent.inMenu)
 			mnuCurrent.nTimer = setTimeout ('HideMenu ();', 4000);
	}
}

function nsGetMenuItem (nItem)
{
   return document.layers ['mnu' + nItem];
}

function nsMenuOut ()
{
	if (mnuCurrent)
	{
		mnuCurrent.nTimer = window.setTimeout ('HideMenu ()', 1500);
		mnuCurrent.inMenu = false;
		mnuCurrent.nTimerOn = true;
	}
}
function nsMenuIn ()
{
   if (mnuCurrent.nTimerOn)
	   clearTimeout (mnuCurrent.nTimer);
	mnuCurrent.inMenu = true;
	mnuCurrent.nTimerOn = false;
}
function nsMenuMove ()
{
   if (mnuCurrent.nTimerOn)
	   clearTimeout (mnuCurrent.nTimer);
	mnuCurrent.inMenu = true;
	mnuCurrent.nTimerOn = false;
	mnuCurrent.onmousemove = null;
}
function nsShowMenu (nMenu, e)
{
   if (mnuCurrent != null && mnuCurrent.nMenu == nMenu)
	   return;
	   
	HideMenu ();
	mnuCurrent = null;

	if (aMenu [nMenu] == null)
	   return;

	array = aMenu [nMenu];
	
	mnuCurrent = new Layer (200, window);
	mnuCurrent.nMenu = nMenu;
	mnuCurrent.nTimerOn = false;
	
	strLayer = '<span id=MenuTitle' + (nMenu+1) + ' class=MenuItems>';
	for (i = 0; i < array.length; i += 3)
	{
	   	nIndent = array [i+2];
		strLayer += '&nbsp;' + strSpaces.substring(0, nIndent*12);
   		strLayer += '<a href="' + array [i] + '">' + array [i+1] + '<\/a><br />';
	}
	strLayer += '<\/span>';
	
	mnuCurrent.document.write (strLayer);
	mnuCurrent.document.close ();

	mnuCurrent.bgColor = '#FEF3B6';
	
	item = nsGetMenuItem (nMenu);
	if (item)
	{
		mnuCurrent.top = item.pageY + item.document.height;
   		mnuCurrent.left = item.pageX;
	}
	else
	{
		mnuCurrent.top = e.pageY;
   		mnuCurrent.left = e.pageX;
	}
	mnuCurrent.nMenuHeight = mnuCurrent.clip.height;
	mnuCurrent.clip.bottom = mnuCurrent.top;
	mnuCurrent.visibility = 'show';
	mnuCurrent.nShow = 10;
	dropMenu ();
}
function nsHideMenu (event)
{
	if (mnuCurrent)
	{
   		if (mnuCurrent.nTimerOn)
	   		clearTimeout (mnuCurrent.nTimer);
		mnuCurrent.visibility = 'hide';
		mnuCurrent = null; 
	}
}
function NSitem (file, text, nMenu)
{
	if (fname != file)
	{
		document.write ('<a class=clsMenuTitle id=mnu' + nMenu + ' href="' + file + '" ');
		if (isNS4)
			document.write ('onMouseOver="nsShowMenu (' + nMenu + ', event)"');
		document.write ('>' + text + '<\/a>&nbsp;&nbsp;');
	}
}
function IEitem (file, text)
{
	if (fname != file)
		document.write ('&nbsp;&nbsp;' + (IEitem.arguments.length == 2 ? '&nbsp;' : '') +
							 '<a href="' + file + '">' + text + '<\/a><br />');
}

if (isIE432 || isNS4)
{
	document.write ('<style>');
	document.write ('.MenuItems {position: absolute;');
	if (isNS4)
	   document.write ('border-width: 1; border-style: outset;');
	else
		document.write ('font-family: Verdana, Arial, Helvetica; ' +
	   'border: solid 1; margin-top: 12pt; display: none;' +
		'text-decoration: none;' +
		'padding: 1px; padding-left: 5px;');
		
	document.write (' border-color: #FAFAD2 #D2B48C #D2B48C #FAFAD2; font-size: 8pt;' +
	'width: 16em; z-index: 10; color: black; background-color: #FFFACD; line-height: normal;}');
	
	document.write ('.MenuItems A {text-decoration: none;');
	if (isNS4)
		document.write ('font-family: Verdana, Arial, Helvetica; font-size: 8pt;');
	document.write ('}');		
    document.write ('.MenuItems a:link   {color: #191970;}' +
	                '.MenuItems a:visited {color: #B22222;}' +
						 '.MenuItems a:active {font-weight: bold}');
	if (isIE4)					 
    	document.write ('.MenuItems a:hover {color: #FF6347}');
  	document.write ('.clsMenuTitle {	position:relative; z-index: 1; }');
  	document.write ('.Menu { font-family: Verdana, Helvetica, sans-serif; font-size: "80%"; cursor: hand;' +
						 'position: relative; font-weight: bold;	color: #8B4513; }');
	
	document.write ('<\/style>');
}
if (isIE432 || isNS)
{
	var path = window.location.pathname;
	var fname = path.substring (path.lastIndexOf ("/") + 1);
	var bIsHome = (window.Peacock != null);
	var nLogoWidth = 0;
	if ((fname == "Library.htm") || (fname == "CoffeeTable.htm") || bIsHome)
		width = 164;
	else
		width = 124;
	width = 0;
}
document.write ('<div id="MenuBar">');
if (isIE432)
{
	document.write('<a href="index.html">' +
	               '<img name="logo" src="images/Logo.gif" width="100" height="30" border="0" ALT="[J-zine home]" align="left" /></a>&nbsp;&nbsp;&nbsp;&nbsp;');
	if (fname != "CoffeeTable.htm")
	{
	   document.write ('<div id="idMenu1" class="MenuItems">');
	   for (i = 0; i < aLivingRoom.length; i += 3)
		{
		   nIndent = aLivingRoom [i+2];
			if (fname != aLivingRoom [i])
				document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aLivingRoom [i] + '">' + aLivingRoom [i+1] + '<\/a><br />');
		}
		document.write ('<\/div><span id="MenuTitle1" class="Menu" onMouseover="doMenu();">' +
							 'Living Room<\/span>&nbsp;&nbsp;&nbsp;&nbsp;');
	}
	if (fname != "Library.htm")
	{
		document.write ('<div id=idMenu2 class=MenuItems>');
	   	for (i = 0; i < aLibrary.length; i += 3)
		{
		   nIndent = aLibrary [i+2];
			if (fname != aLibrary [i])
				document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aLibrary [i] + '">' + aLibrary [i+1] + '<\/a><br />');
		}
		document.write ('<\/div><span id="MenuTitle2" class="Menu" onMouseover="doMenu();">Library<\/span>&nbsp;&nbsp;&nbsp;&nbsp;');
	}
	if (fname != "Music.htm")
	{
		document.write ('<div id=idMenu3 class=MenuItems>');
	   for (i = 0; i < aMusic.length; i += 3)
		{
		   nIndent = aMusic [i+2];
			if (fname != aMusic [i])
				document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aMusic [i] + '">' + aMusic [i+1] + '<\/a><br />');
		}
		document.write ('<\/div><span id="MenuTitle3" class="Menu" onMouseover="doMenu();">Music Room<\/span>&nbsp;&nbsp;&nbsp;&nbsp;');
	}
	if (fname != "WhatsCooking.htm")
	{
		document.write ('<div id="idMenu4" class="MenuItems">');
	   for (i = 0; i < aKitchen.length; i += 3)
		{
		   nIndent = aKitchen [i+2];
			if (fname != aKitchen [i])
				document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aKitchen [i] + '">' + aKitchen [i+1] + '<\/a><br />');
		}
		document.write ('<\/div><span id="MenuTitle4" class="Menu" onMouseover="doMenu();">Kitchen<\/span>&nbsp;&nbsp;&nbsp;&nbsp;');
	}
	document.write ('<div id="idMenu5" class="MenuItems">');
	if (fname != "India.htm")
	{
	   for (i = 0; i < aIndia.length; i += 3)
		{
		   nIndent = aIndia [i+2];
			document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aIndia [i] + '">' + aIndia [i+1] + '<\/a><br />');
		}
	}
	if (fname != "NorskeSider.htm")
	{
	   for (i = 0; i < aNorge.length; i += 3)
		{
		   nIndent = aNorge [i+2];
			document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aNorge [i] + '">' + aNorge [i+1] + '<\/a><br />');
		}
	}
	document.write ('<\/div><span id="MenuTitle5" class="Menu" onMouseover="doMenu();">' +
						 'International<\/span>&nbsp;&nbsp;&nbsp;&nbsp;');

	if (fname != "GoldenRule.htm")
	{
		document.write ('<div id="idMenu6" class="MenuItems">');
	   for (i = 0; i < aLotus.length; i += 3)
		{
		   nIndent = aLotus [i+2];
			document.write ('&nbsp;' + strSpaces.substring(0, nIndent*12) +
							 '<a href="' + aLotus [i] + '">' + aLotus [i+1] + '<\/a><br />');
		}
		document.write ('<\/div><img id="MenuTitle6" class="Menu"  onMouseover="doMenu();" src="images/GoldenFlower.gif" width="19" height="12" border="0" alt="" />');
	}
}
else
{
	NSitem ('index.html', '<img name="logo" src="images/Logo.gif" width="100" height="30" border="0" alt="[J-zine home]" align="left" />', -1);
	NSitem ('CoffeeTable.htm', 'Living Room', 0);
	NSitem ('Library.htm', 'Library', 1);
	NSitem ('Music.htm', 'Music Room', 2);
	NSitem ('WhatsCooking.htm', 'Kitchen', 3);
	NSitem ('India.htm', 'India', 4);
	NSitem ('NorskeSider.htm', 'Norway/Norge', 5);
	NSitem ('GoldenRule.htm', '<img src="images/GoldenFlower.gif" width="19" height="12" border="0" alt="" align="absmiddle" />', 6);
}
document.write ('<br clear="left" /><\/div><br />');


