var p_Menu_Dir = 'ltr';
var ArrowIcon = new Image();
ArrowIcon.src = 'http://www.israeline.com/images-cms/icon-arrow_ltr.gif';
var BulletOn = new Image();
BulletOn.src = 'media/images/subnav-bullet.gif';
var BulletOff = new Image();
BulletOff.src = 'media/images/subnav-bullet-off.gif';


		function fPopulateMenu(nMenuID, nSourceWidth){
			fHideMenu();
			var sContent = new String();
					
			sContent = '<table class="oMenuItem" border=0 cellspacing=0 cellpadding=2 dir="'+p_Menu_Dir+'" width="' + nSourceWidth + '">';
			for(var a = 0; a < aMenu[nMenuID].length; a++){
				sContent += '<tr class="oMenuTd" onmouseout="this.className=\'oMenuTd\';document.subbullet'+a+'.src=BulletOff.src;" onmouseover="document.subbullet'+a+'.src=BulletOn.src;this.className=\'oMenuTdOnMouseOver\'" > ' +
				'<td style="padding-top:5px;"><img SRC="Media/images/subnav-bullet-off.gif" name="subbullet'+a+'"></td>' +
				'<td class="oMenuItem" style="padding-right:8px;padding-left:3px;" '
				if(aMenu[nMenuID][a][0].length!=0){
					sContent += ' onClick="location.href=\'' + aMenu[nMenuID][a][0] + '\'" '
				}
				if(aMenu[nMenuID][a][2]){
					sContent += 'onmouseover="g_bSubMenuOn = true; fShowSubMenu(this, ' + nMenuID + ', ' + a + ')" ' +
						' nowrap>' + 
						aMenu[nMenuID][a][1] + '</td><td style="padding-left:4px;padding-right:4px;"><img SRC="'+ArrowIcon.src+'"></td></tr>\n';
				}else{
					sContent += 'nowrap>' + 
						aMenu[nMenuID][a][1] + '</td><td></td></tr>\n';
				}
			}
			sContent += '</table>';
			return sContent;
		}
		
		function fPopulateSubMenu(oSource, nMenuID, nOptionID){
			fHideMenu();
			var sContent = new String();
			sContent = '<table width="100" class="oMenuItem" dir="'+p_Menu_Dir+'" cellpadding=2 cellspacing=0>';
			if(aMenu[nMenuID][nOptionID][2]){
				for(var a = 0; a < aMenu[nMenuID][nOptionID][2].length; a++){
					sContent += '<tr class="oMenuTd" onmouseout="this.className=\'oMenuTd\';document.subbullet'+a+a+'.src=BulletOff.src;" onmouseover="document.subbullet'+a+a+'.src=BulletOn.src;this.className=\'oMenuTdOnMouseOver\'" > ' +
								'<td style="padding-top:5px;"><img SRC="Media/images/subnav-bullet-off.gif" name="subbullet'+a+a+'"></td>' +
								'<td class="oMenuItem" style="padding-right:8px;padding-left:3px;" '
								if(aMenu[nMenuID][nOptionID][2][a][1].length!=0){
									sContent += ' onClick="location.href=\'' + aMenu[nMenuID][nOptionID][2][a][1] + '\'" '
								}
					sContent += ' nowrap>' + 
								aMenu[nMenuID][nOptionID][2][a][0] + '</td></tr>\n';
				}
			}
			sContent += '</table>';
			return sContent;
		}
		
		function fShowMenu(oSource, nMenuID){
			g_bMenuOn = true;
			g_bSubMenuOn = false;
			var oElement = eval('document.all.oMenu');
			oElement.style.visibility = 'hidden';
			oElement.innerHTML = fPopulateMenu(nMenuID, oSource.offsetWidth);
			
			//oElement.style.left = fGetLeft(oSource) + oSource.offsetWidth - oElement.offsetWidth;
			oElement.style.left = fGetLeft(oSource);
			oElement.style.top = fGetTop(oSource) + oSource.offsetHeight;

			if(aMenu[nMenuID].length > 0){
				oElement.style.visibility = 'visible';
			}
		}
		
		function fShowSubMenu(oSource, nMenuID, nOptionID){
			g_bMenuOn = true;
			var oElement = eval('document.all.oSubMenu');
			oElement.style.visibility = 'hidden';
			oElement.innerHTML = fPopulateSubMenu(oSource, nMenuID, nOptionID);

			oElement.style.left = fGetLeft(oSource)+oSource.offsetWidth;
			//oElement.style.left = fGetLeft(oSource)+1;
			oElement.style.top = fGetTop(oSource)+1;
			if(aMenu[nMenuID].length > 0){
				oElement.style.visibility = 'visible';
			}
		}
		
		function fHideMenu(){
			if(!g_bMenuOn){
				var oElement = eval('document.all.oMenu');
				oElement.style.visibility = 'hidden';
				oElement.innerHtml = '';
			}
			
			if(!g_bSubMenuOn){
				var oElement = eval('document.all.oSubMenu');
				oElement.style.visibility = 'hidden';
				oElement.innerHtml = '';
			}
		}
		
		function fDelayedHide(){
			setTimeout('fHideMenu()', 1000);
		}
		
		function fGetLeft(obj){
		   return(obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+fGetLeft(obj.offsetParent));
		}

		function fGetTop(obj){
		   return(obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+fGetTop(obj.offsetParent));
		}


	document.write('<div id="oMenu" class="oMenuStyle" style="z-index:100;VISIBILITY: hidden; POSITION: absolute;" onmouseover="g_bMenuOn = true;" onmouseout="g_bMenuOn = false; g_bSubMenuOn = false; fDelayedHide();"></div>')
	document.write('<div id="oSubMenu" class="oMenuStyle" style="z-index:100;VISIBILITY: hidden; POSITION: absolute;" onmouseover="g_bMenuOn = true; g_bSubMenuOn = true;" onmouseout="g_bMenuOn = false; g_bSubMenuOn = false; fDelayedHide();"></div>')
