<!--    
//javascript file

menuTimeOut = 200; //time in milliseconds
iamloaded = false;
menuOn= 0;
if (typeof(root)=='undefined')
{
	root = '../'; //this is used to handle relative references
}

var ua = navigator.userAgent.toLowerCase();
var v = ''+parseInt(navigator.appVersion);
var a = navigator.appName;

var NN2 = false;
var NN3 = false;
var NN4 = false;
var NN6 = false; //use this Netscape 6 and also for Opera
var IE2 = false;
var IE3 = false;
var IE4 = false; // this for IE 4+
if (ua.indexOf('opera') != -1)
{
	NN6 = true;
} else if (a.indexOf('Netscape')> -1 )
{
	if (v.indexOf('2')> -1)
	{
		NN2 = true;
	} else if (v.indexOf('3')> -1)
	{
		NN3 = true;
	} else if (v.indexOf('4')> -1 && document.layers)
	{
		NN4 = true;
	} else 
	{
		NN6 = true;
	}
} else
{
	if (v.indexOf('2')> -1)
	{
		IE2 = true;
	} else if (v.indexOf('3')> -1)
	{
		IE3 = true;
	} else if (v.indexOf('4')> -1 && document.all)
	{
		IE4 = true;
	} else 
	{
		IE4 = true;        
	}
}
var menuOK = (NN4 |IE4 | NN6);

function imgobj(on,off)
{
    this.on = on;
    this.off = off;
    var ion = new Image();
    ion.src = this.on;
    var ioff = new Image();
    ioff.src = this.off;	
}
//src references and preload images

var nav1 = new Array();
var b_img = new Array();

function preload()
{
	b_img[0] = new imgobj(root+"images/gateway_arrow.gif",root+"images/space.gif");
	ball_on = new Image();
	ball_on.src = b_img[0].on;
    	ball_off = new Image();
    	ball_off.src = b_img[0].off;

	nav1[0] = new imgobj(root+'images/gateway_news_ro.gif',root+'images/gateway_news.gif');
	nav1[1] = new imgobj(root+'images/gateway_events_ro.gif',root+'images/gateway_events.gif');
	nav1[2] = new imgobj(root+'images/gateway_contact_ro.gif',root+'images/gateway_contact.gif');
	nav1[3] = new imgobj(root+'images/gateway_personal_ro.gif',root+'images/gateway_personal.gif');
	nav1[4] = new imgobj(root+'images/gateway_search_ro.gif',root+'images/gateway_search.gif');

	//home only
	nav1[5] = new imgobj(root+'images/what_is_adidam_ro.gif',root+'images/what_is_adidam.gif');
}

function styleRef(layerID, nestRef) {
	if(NN4) {
		if(nestRef) {
			return document.layers[nestRef].document.layers[layerID];
		} else {
			return document.layers[layerID];
		}
	} else if(IE4) {
		return document.all[layerID].style;
	} else if(NN6){
		return document.getElementById(layerID).style;	
	}
}

// returns a reference to an image object on a layer.
function imageRef(layerID, imgName, nestRef) {
	if(NN4) {
		if(nestRef) {
			return document.layers[nestRef].document.layers[layerID].document.images[imgName];
		} else {
			return document.layers[layerID].document.images[imgName];
		}
	} else if(IE4) {
		return document.images[imgName];
	} else if(NN6) { 
		return document.images[imgName];	
	}
}

function killMenu(which) 
{
	if (typeof(aTimer)!='undefined')
	{
		clearTimeout(aTimer);
	}
	imageRoll(which, 'off');
	if(which == intActiveMenu) {
		// get the list of menu layers
		arMenuList = eval("arMenu" + which + "List");
	
		// loop through the list, hiding all the menu layers
		for(i=0; i<arMenuList.length; i++) {
			strCurrLayer = arMenuList[i];
			styleRef(strCurrLayer).visibility = strHide;
		}
	}
}

function killSub(which)
{
    arMenuList = eval("arMenu" + which + "List");
    // loop through the list, hiding all the submenu layers
    for(i=1; i<arMenuList.length; i++) {
        strCurrLayer = arMenuList[i];
        styleRef(strCurrLayer).visibility = strHide;
    }
}

function doMenu() 
{
    killSub(intActiveMenu);
	intActiveMenu = arguments[0];
	
	 // show the top level menu
	strMenuItem = "menu" + arguments[0];
	styleRef(strMenuItem).visibility = strShow;
	
	// show the lower level menus
	for(i=1; i<arguments.length; i++) {
		strMenuItem += "sub" + arguments[i];
		styleRef(strMenuItem).visibility = strShow;
	}
}

function activateMenu(which) {
    if (intActiveMenu != 0)
    {
        killSub(intActiveMenu);
    }
	if(which != intActiveMenu) {
		if((!which) | (typeof which == "object")) {
			which = intActiveMenu;
		}	
		if(intActiveMenu != 0) {
			killMenu(intActiveMenu);
			if(which == intActiveMenu) {
				intActiveMenu = 0;
				which = 0;
			}
		}		
		if(which != intActiveMenu) {
			styleRef("menu" + which).visibility = strShow;
			intActiveMenu = which;
		}	
	}
}
	

var laston = 0;
//rollover function
function imageRoll(imgref, state)
{
    if (state=='off')
    {
		menuActive=false;
		aTimer = setTimeout('autoKill()', menuTimeOut);
    } else
    {
		menuActive=true;
    }
    if (imgref > 0)
    {
		//submenu rolls are as 1.01, 1.02, 2.01, 2.02,2.10 etc
		imgref = imgref.toString();
		menu_idx = imgref.substring(0,imgref.indexOf('.'));
		
		if (menu_idx=='') menu_idx=0;	
        if (menu_idx<1) //only a menu rollver, not a submenu rollover
        {
	        menu_idx = imgref;
			if (((state=='on') | (state=='off' & menu_idx != menuOn)) && doRoll(menu_idx))
			{
				document.images['nav1_'+imgref].src = nav1[imgref-1][state];
			}
        } else
        {
		    charset = 'ABCDEFGHIJKLMN';
		    submenu_idx = '.'+imgref.substring(imgref.indexOf('.')+1);
		    submenu_idx = Math.round(100*parseFloat(submenu_idx))
		    submenu_name = charset.charAt(submenu_idx-1);           
	    	imageRef('menu'+menu_idx,submenu_name+menu_idx).src = b_img[0][state];
        }
    }
    return true;
}

//cover function
menuActive = false;
aTimer = 0;

function setMenuOn(idx)
{
	//for setting one menu roll always on;
	menuOn=idx;
}

function menuPower(idx,sub)
{
	if (!(menuOK && iamloaded))
	{
		return true;
	}
	imageRoll(idx, 'on');
    	idx = idx.toString();
    	if (idx.indexOf('.')>=0)
    	{
        	idx = idx.substring(0,idx.indexOf('.'));
    	}  
    	if (arguments.length==1)
	{
      	activateMenu(idx);            
	} else 
    	{
     		doMenu(idx,sub);
	}
	menuActive = true;
	return true;
}


function autoKill(idx)
{
	if (!menuActive)
	{ 	
		activateMenu(0);  
       	if (idx != null)
       	{
   		    idx = ''+idx;
   		    if (idx.indexOf('.')>=0)
   		    {
     		    idx = idx.substring(0,idx.indexOf('.'));               
                killSub(idx);
            }
        }
	}
}
function menuOut(idx,sub)
{
	if (!(menuOK && iamloaded))
	{
		return true;
	}
	outFunction = 'autoKill('+idx+')';
	aTimer = setTimeout(outFunction, menuTimeOut);           
	menuActive = false;
    	idx = idx.toString();
    	if (idx.indexOf('.')>=0)
    	{
        	imageRoll(idx, 'off');        
    	}    
	return true;
}


//DRAW STUFF
function getDecIndex(n)
{
	return (n<=9) ? '0'+n : ''+n;
}

function getChar(n)
{
	charset = 'ABCDEFGHIJKLMN';
	return charset.substring(n-1,n);
}


function DrawMenuSpec(l,t,w,iw,id)
{
	this.left = l;
	this.top = t;
	this.width = w;
	this.imgWidth=iw;
	this.imgDir = id;
	this.sub = new Array();
}

function DrawSubMenu(img,u)
{
	this.im = img;
	this.url = u;
}


function menuWrite()
{
	M = new Array();
	M[0] = new DrawMenuSpec(212,30,79,68,root+'images');
	M[0].sub[0] = new DrawSubMenu('general.gif',root+'news/index.htm');
	M[0].sub[1] = new DrawSubMenu('personal.gif',root+'personal/news/index.jsp');
	M[0].sub[2] = new DrawSubMenu('archive.gif',root+'news/archive.htm');
	//M[0].sub[3] = new DrawSubMenu('preferences.gif',root+'news/preferences.htm');

	M[1] = new DrawMenuSpec(260,30,79,68,root+'images');
	M[1].sub[0] = new DrawSubMenu('calendar.gif',root+'events/index.htm');
	M[1].sub[1] = new DrawSubMenu('locations.gif',root+'events/locations.htm');
	//M[1].sub[2] = new DrawSubMenu('preferences.gif',root+'events/preferences.htm');

	M[2] = new DrawMenuSpec(311,30,79,68,root+'images');
	M[2].sub[0] = new DrawSubMenu('contact_us.gif',root+'contact/index.htm');
	M[2].sub[1] = new DrawSubMenu('locations.gif',root+'contact/locations.htm');

	M[3] = new DrawMenuSpec(385,30,101,90,root+'images');
	M[3].sub[0] = new DrawSubMenu('profile.gif',root+'personalization/index.htm');
	M[3].sub[1] = new DrawSubMenu('subscriptions.gif',root+'personalization/subscriptions.htm');
	//M[3].sub[2] = new DrawSubMenu('favorites.gif',root+'personalization/favorites.htm');
	//M[3].sub[3] = new DrawSubMenu('personal_library.gif',root+'personalization/library.htm');
	//M[3].sub[4] = new DrawSubMenu('mailbox.gif',root+'personalization/mailbox.htm');

	M[4] = new DrawMenuSpec(458,30,79,68,root+'images');
	M[4].sub[0] = new DrawSubMenu('site_search.gif',root+'search/index.htm');
	M[4].sub[1] = new DrawSubMenu('site_map.gif',root+'search/site_map.htm');
	M[4].sub[2] = new DrawSubMenu('site_index.gif',root+'search/site_index.htm');

	for (i=0;i<M.length;i++)
	{
		idx = i+1;
		document.write('<div id="menu'+idx+'" style="position:absolute; left:'+M[i].left+'; top:'+M[i].top+'; visibility:hidden; z-index:108">');
		document.write('<table width="'+M[i].width+'" height="62" border="0" cellpadding="0" cellspacing="0">');	
		document.write('<tr><td><img src="'+M[i].imgDir+'/space.gif" width="1" height="2" border="0"></td>');
		document.write('<td valign="top" rowspan="6" width="1" height="62"><img src="'+M[i].imgDir+'/nav2/gateway_white_line.gif" width="1" height="62" border="0"></td></tr>');

		for (j=0;j<M[i].sub.length;j++)
		{
			j_idx = idx+'.'+getDecIndex(j+1);
			rollID = getChar(j+1)+idx;
			document.write('<tr><td valign="bottom" height="12"><a href="'+M[i].sub[j].url+'" onmouseover="menuPower('+j_idx+')" onmouseout="menuOut('+j_idx+')"><img src="'+M[i].imgDir+'/space.gif" name="'+rollID+'" width="10" height="10" border="0"><img src="'+M[i].imgDir+'/nav2/'+M[i].sub[j].im+'" width="'+M[i].imgWidth+'" height="12" border="0"></a></td></tr>');
		}
		addspace = 5 - M[i].sub.length;
		if (addspace > 0)
		{
			v = addspace*12;
			document.write('<tr><td><img src="'+M[i].imgDir+'/space.gif" width="1" height="'+v+'" border="0"></td></tr>');
		}
		document.write('</table></div>');
	}
	addHomeMenu();
}

function addHomeMenu()
{
	document.writeln('<div id="menu6" style="position:absolute; left:0;top:800"></div>');
}

function doRoll(idx)
{
	if (idx<=6) //the first 5 are util, and 6 is what is adidam
	{
		return true;
	} else 
	{
		return false;
	}
}

function init() {
	strHide = "hidden";
	strShow = "visible";

	if(document.all) {
		document.body.onclick = activateMenu;
	} else if(document.layers) {
		strHide = "hide";
		strShow = "show";
		window.captureEvents(Event.MOUSEUP);
		window.onmouseup = activateMenu;
	} else {
	//	alert('???');
	}

	strLastCommand = "";
	intActiveMenu = 0;
	preload();
	menuWrite();

	arMenu1List = new Array("menu1");
	arMenu2List = new Array("menu2");
	arMenu3List = new Array("menu3");
	arMenu4List = new Array("menu4");
	arMenu5List = new Array("menu5");	

	//home only
	arMenu6List = new Array("menu6");
	arMenu7List = new Array("menu7");
	arMenu8List = new Array("menu8");
	arMenu9List = new Array("menu9");
	arMenu10List = new Array("menu10");
	arMenu11List = new Array("menu11");
	arMenu12List = new Array("menu12");
	arMenu13List = new Array("menu13");
	arMenu14List = new Array("menu14");
	arMenu15List = new Array("menu15");

	iamloaded= true;
}

function getSiteBackLink()
{
	//default
	out = '<a href="/gateway/home.htm" title="Adidam Gateway">back to gateway home</a>';
	return out;	
}


//-->

