var menuMusic = [
	['Browse Categories', '2100', '1'],
	['Browse Artists ', '2200', '1'],
	['Browse Titles ', '2300', '1'],
	['Music Search ', '2400', '1'],
	['Best Sellers ', '2500', '1'],
	['New Recordings ', '2600', '1'],
	['New Additions ', '2700', '1'],
	/*['Clearance', '2800', '1'],*/
	['Our Favorites ', '2900', '1'],
	['Top 50 Recordings', '2110', '1']
];

var menuMusicBooks = [
	['Browse Categories', '3100', '1'],
	['Browse Authors ', '3200', '1'],
	['Browse Titles ', '3300', '1'],
	['Book Search ', '3400', '1'],
	['Best Sellers ', '3500', '1'],
	['New Books ', '3600', '1'],
	['New Additions ', '3700', '1'],
	/*['Clearance', '3800', '1'],*/
	['Our Favorites ', '3900', '1'],
	['Top 50 Books', '3110', '1']
];

var menuVideo = [
	['Browse Categories', '4100', '1'],
	['Browse Artists ', '4200', '1'],
	['Browse Titles ', '4300', '1'],
	['Video Search ', '4400', '1'],
	['Best Sellers ', '4500', '1'],
	['New Videos ', '4600', '1'],
	['New Additions ', '4700', '1'],
	/*['Clearance', '4800', '1'],*/
	['Our Favorites ', '4900', '1'],
	['Top 50 Videos', '4110', '1']
];

var menuSheetMusic = [
	['Browse Categories', '5100', '1'],
	['Browse Authors ', '5200', '1'],
	['Browse Titles ', '5300', '1'],
	['Sheet Music Search ', '5400', '1'],
	['Best Sellers ', '5500', '1'],
	['New Sheet Music ', '5600', '1'],
	['New Additions ', '5700', '1'],
	/*['Clearance', '5800', '1'],*/
	['Our Favorites ', '5900', '1'],
	['Top 50 Sheet Music', '5110', '1']
];

var menuDownloads = [
	['Browse Categories', '6100', '1'],
	['Browse Artists ', '6200', '1'],
	['Browse Titles ', '6300', '1'],
	['Music Download Search ', '6400', '1'],
	['Best Sellers ', '6500', '1'],
	['New Music Downloads ', '6600', '1'],
	['New Additions ', '6700', '1'],
	/*['Clearance', '6800', '1'],*/
	['Our Favorites ', '6900', '1'],
	['Top 50 Songs', '6110', '1']
];

var menuSoft = [
	['Browse Categories', '11100', '1'],
	['Browse by Company ', '11200', '1'],
	['Browse Titles ', '11300', '1'],
	['Software Search ', '11400', '1'],
	['Best Sellers ', '11500', '1'],
	['New Software ', '11600', '1'],
	['New Additions ', '11700', '1'],
	/*['Clearance', '11800', '1'],*/
	['Our Favorites ', '11900', '1'],
	['Top 50 Softwares', '11110', '1']
];

var menuBooks = [
	['Browse Categories', '12100', '1'],
	['Browse Authors ', '12200', '1'],
	['Browse Titles ', '12300', '1'],
	['Book Search ', '12400', '1'],
	['Best Sellers ', '12500', '1'],
	['New Books ', '12600', '1'],
	['New Additions ', '12700', '1'],
	/*['Clearance', '12800', '1'],*/
	['Our Favorites ', '12900', '1'],
	['Top 50 Books', '12110', '1']
];

var  menuCatalog = [
    ['Recordings', '9510', '1', '{11111111-1111-1111-1111-111111111111}'], 
	['Music Books', '9520', '1', '{22222222-2222-2222-2222-222222222222}'], 
	['Videos', '9530', '1', '{33333333-3333-3333-3333-333333333333}'] 
//	['Sheet Music Downloads', '9540', '1', '{44444444-4444-4444-4444-444444444444}'] 
//	['Music Downloads', '9550', '1', '{55555555-5555-5555-5555-555555555555}'] 
//	['Software', '9560', '1', '{66666666-6666-6666-6666-666666666666}'] 
//	['Judaic Books', '9570', '1', '{77777777-7777-7777-7777-777777777777}'] 
];

var mnClear = [
	['Recordings', '9620', '1', '{11111111-1111-1111-1111-111111111111}'],
	['Music Books', '9630', '1', '{22222222-2222-2222-2222-222222222222}'],
	['Videos', '9640', '1', '{33333333-3333-3333-3333-333333333333}']
//	['Sheet Music Downloads', '9650', '1', '{44444444-4444-4444-4444-444444444444}'] 
//	['Music Downloads', '9660', '1', '{55555555-5555-5555-5555-555555555555}'] 
//	['Software', '9670', '1', '{66666666-6666-6666-6666-666666666666}'] 
//	['Judaic Books', '9680', '1', '{77777777-7777-7777-7777-777777777777}'] 
];

var mnSale = [
	['Recordings', '9720', '1', '{11111111-1111-1111-1111-111111111111}'],
	['Music Books', '9730', '1', '{22222222-2222-2222-2222-222222222222}'],
	['Videos', '9740', '1', '{33333333-3333-3333-3333-333333333333}']
//	['Sheet Music Downloads', '9750', '1', '{44444444-4444-4444-4444-444444444444}'] 
//	['Music Downloads', '9760', '1', '{55555555-5555-5555-5555-555555555555}'] 
//	['Software', '9770', '1', '{66666666-6666-6666-6666-666666666666}'] 
//	['Judaic Books', '9780', '1', '{77777777-7777-7777-7777-777777777777}'] 
];
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var arMenuList = [
	['shalom', null, '1000', '1', '', 'Shalom'], 
	['music', menuMusic, '2000', '1', '{11111111-1111-1111-1111-111111111111}', 'Recordings'], 
	['musicbooks', menuMusicBooks, '3000', '1', '{22222222-2222-2222-2222-222222222222}', 'Music Books'], 
	['videos', menuVideo, '4000', '1', '{33333333-3333-3333-3333-333333333333}', 'Videos'], 
	['sheetmusic', menuSheetMusic, '5000', '1', '{44444444-4444-4444-4444-444444444444}', 'Sheet Music Downloads'], 
	['downloads', menuDownloads, '6000', '1', '{55555555-5555-5555-5555-555555555555}', 'Music Downloads'],
//	['soft', menuSoft, '11000', '1', '{66666666-6666-6666-6666-666666666666}', 'Software'],
//	['books', menuBooks, '12000', '1', '{77777777-7777-7777-7777-777777777777}', 'Judaic Books'], 
	['catalog', menuCatalog, '9501', '1', '', 'Online Catalog'],
	['clearance', mnClear, '9610', '1', '', 'Clearance'],
	['sale', mnSale, '9710', '1', '', 'Sale']
//	['join', null, '7000', '1', '', 'Join Assosiates']	
];
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function SelectSearchItem() {
  with(document.form) {
    id=document.form.ID_Grp.value;
     for(i=0; i<SearchGroup.options.length; i++) {
	    if(SearchGroup.options[i].value==id) SearchGroup.selectedIndex=i;
	 }
  }
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function IsOpenMenu(x, y) {
  x1=x.charAt(0);
  y1=y.charAt(0);
  x2=x.substr(0,2);
  y2=y.substr(0,2);
  
  if(x1!='9') return (x1==y1);
  else return (x2==y2);
}

function IsNetscape() {
  return ( (document.layers) && (parseInt(navigator.appVersion)<5) ) ;
}

function mnDrawItem(index) {
  var name=arMenuList[index][0];
  var menu=arMenuList[index][1];
  var fid=arMenuList[index][2];
  var act=arMenuList[index][3];
  var id_group=arMenuList[index][4];
  
  document.write('<tr><td>');
  if(id_group!="") document.write('<a href="javascript:mnFullSubmitWithGroup(\''+fid+'\', \''+act+'\', \''+id_group+'\');">');
  else document.write('<a href="javascript:mnFullSubmit(\''+fid+'\', \''+act+'\');">');
  document.write('<img src="images/buttons/left_'+name+'.gif" width="153" height="21" name="img_'+name+'" vspace="0" hspace="0" border="0"></a></td>');
  document.write('<tr><td valign="top">'); 
  
  document.write('<table width="153" border="0" cellspacing="0" cellpadding="0">');
	  if((menu)&&(IsOpenMenu(document.form.FID.value, fid))) {
		  for(j=0; j<menu.length; j++) {
			  if(menu[j][3])  script='mnFullSubmitWithGroupAndName(\''+menu[j][1]+'\', \''+menu[j][2]+'\',\''+menu[j][3]+'\', \''+menu[j][0]+'\');';
			  else script='mnFullSubmitWithCategory(\''+menu[j][1]+'\', \''+menu[j][2]+'\',\'\',\''+menu[j][0]+'\');';
			 document.write('<tr>');
			 if(IsNetscape()) document.write('<td class="menu_passive">&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:'+script+'">'+menu[j][0]+'</td>')
			 else document.write('<td class="menu_passive" onMouseOver="mnAction(this, 0)" onMouseOut="mnAction(this, 1)" onClick="'+script+'">'+menu[j][0]+'</td>');
			 document.write('</tr>');
		  }
  }	  
  document.write('</table>');  
  
  document.write('</td></tr>');
  document.write('</tr><tr> <td height="2"></td></tr>');
}

function DrawMenu() {
  document.write('<table width="153" border="0" cellspacing="0" cellpadding="0" background="images/bg02.gif"><tr> <td height="2" valign="top"><img src="images/img02.gif" width="153" height="2"></td></tr>');
  for(i=0;i<arMenuList.length; i++) mnDrawItem(i);
  document.write('</table>');
  SelectSearchItem();
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function mnDrawSmallItem(index)  {
  var name=arMenuList[index][0];
  var menu=arMenuList[index][1];
  var fid=arMenuList[index][2];
  var act=arMenuList[index][3];
  var id_group=arMenuList[index][4];
  
  document.write('<td>');
  if(id_group!="") document.write('<a href="javascript:mnFullSubmitWithGroup(\''+fid+'\', \''+act+'\', \''+id_group+'\');">');
  else document.write('<a href="javascript:mnFullSubmit(\''+fid+'\', \''+act+'\');">');
  document.write('<img src="images/top_'+name+'.gif" height="23" name="img_'+name+'" vspace="0" hspace="0" border="0"></a></td>');
}

function DrawSmallMenu() {
   document.write('<table height="23" border="0" cellspacing="0" cellpadding="0" ><tr>');
   for(i=0;i<arMenuList.length; i++) mnDrawSmallItem(i);
   document.write('</tr></table>');
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function GetGroupName() {
  if(!document.form.ID_Grp) return '';
  var gr_id=document.form.ID_Grp.value;
  if(gr_id=='') return '';
  for(i=0;i<arMenuList.length; i++)
  {
   if(arMenuList[i][4]==gr_id)
   { 
   	return arMenuList[i][5];
   };
   };
 return '';
}

function WriteSubGroup() {
   var fid=document.form.FID.value;
   var grp_ind=parseInt(fid.charAt(0))-1;
   var subgrp_ind=parseInt(fid.charAt(1))-1;
   var is_link=parseInt(fid.charAt(3));

   var menu=arMenuList[grp_ind][1];
   if (!menu) return
   var txt=menu[subgrp_ind][0];
   
   var gr_name=GetGroupName();
   if(gr_name!='') document.write('<a href="javascript:mnFullSubmit(\''+arMenuList[grp_ind][2]+'\', \''+arMenuList[grp_ind][3]+'\');" class="link_menu">'+gr_name+'</a>&nbsp;|&nbsp;');
   if(is_link>0) document.write('<a href="javascript:mnFullSubmitWithCategory(\''+menu[subgrp_ind][1]+'\', \''+menu[subgrp_ind][2]+'\',\'\',\''+menu[subgrp_ind][0]+'\');" class="link_menu">'+txt+'</a>');
   else document.write(txt);
}