// without beginning special symbol = mainmenu
// % submenu separator
// * subsubmenu separator

//var root="/IthacaReef/";
var root="/";

var tbbb=2;
var bgActiveC="#FFCB6A";
var bgTopandSide="#6699FF";
var bgMiddle="#66CCFF";
var pgActive;

if(navigator.appName=="Netscape")tbbb=0;
var menutable= new Array(

"Home|index.htm|1",

"Hatchery|hatchery.htm|0"+
"%Currently available / in stock|availability.htm|0"+
"%Retail locations|shops.htm|0"+
"%Price list|pricelist.htm|0"+
"%Broodstock pairs|broodstock.htm|0"+
"*Black Saddleback|breeding/black_polymnus.htm|0"+
"*Cinnamon Clownfish|breeding/blueline.htm|0"+
"*Clark's Clownfish|breeding/clarkii.htm|0"+
"*Fire Clownfish|breeding/ephippium.htm|0"+
"*Maroon Clownfish|breeding/maroon.htm|0"+
"*Ocellaris Clownfish|breeding/ocellaris.htm|0"+
"*Orchid Dottybacks|breeding/orchid.htm|0"+
"*Percula Clownfish|breeding/percula.htm|0"+
"*Tomato Clownfish|breeding/frenatus.htm|0"+
"*Two Banded Clownfish|breeding/bicinctus.htm|0"+
"%Broodstock tanks|tanks_shelves.htm|0"+
"%Larval tanks|tanks_table.htm|0"+
"%Grow-out tanks|tanks_growout.htm|0",

"Breeding|breeding.htm|0"+
"%Breeding pairs|broodstock1.htm|0"+
"%Pairing clowns|breeding/pairing.htm|0"+
"%Spawning|breeding/spawning.htm|0"+
"%Collecting larvae|breeding/collecting.htm|0"+
"%Larval care|breeding/lcare.htm|0"+
"%Juvenile care|breeding/jcare.htm|0"+
"%<i>Chromis</i> spawning|chromis/index.htm|1",

"Reef Aquaria|reef_tanks.htm|0"+
"%180 gal Reef #1|180_1/index.htm|0"+
"*livestock:fish|180_1/fish.htm|0"+
"*livestock:corals|180_1/corals.htm|0"+
"*livestock:other|180_1/other.htm|0"+
"*hardware|180_1/hardware.htm|0"+
"*maintenance|180_1/maintenance.htm|0"+
"*gallery|180_1/gallery.htm|0"+
"%180 gal Reef #2|180_2/index.htm|0"+
"*livestock:fish|180_2/fish.htm|0"+
"*livestock:corals|180_2/corals.htm|0"+
"*livestock:other|180_2/other.htm|0"+
"*hardware|180_2/hardware.htm|0"+
"*maintenance|180_2/maintenance.htm|0"+
"*gallery|180_2/gallery.htm|0",

"Gallery|gallery.htm|1"+
"%Photos - All|gallery_all.htm|1"+
"%Photos - Reef tanks|gallery_reef.htm|1"+
"%Photos - Hatchery|gallery_hatchery.htm|1"+
"%Movies|gallery_movies.htm|1",

"Hobby info|info.htm|0",

"Resources|resources.htm|0"+
"%Books|books.htm|0"+
"%Video/DVD|video.htm|0"+
"%Internet Stores|stores.htm|0"+
"*Livestock|stores_live.htm|0"+
"*Dry goods|stores_dry.htm|0"+
"%Message Boards|boards.htm|0"+
"%Other resources|links_other.htm|0",

"About us|aboutus.htm|0");

var status=0;
var i1_pos=0, i2_pos=0, popupHandle;

function make_stat(key){
for(i=0; i<menutable.length; i++){
  if(menutable[i].split("%")[0].split("*")[0].split("|")[1]==key){
   status=10000*i;
   return;
   }
  for(j=1; j<menutable[i].split("%").length; j++){
   if(menutable[i].split("%")[j].split("*")[0].split("|")[1]==key){
    status=10000*i+100*j;
    return;
    }
   for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
    if(menutable[i].split("%")[j].split("*")[k].split("|")[1]==key){
     status=10000*i+100*j+k;
     return;
     }
    }
   } 
  }
status=0;
alert("ERROR in index "+key); 
}

function load_page(stat,act){
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
tmph=root+menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[1];
//tmph="/"+menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[1];
window.location=tmph;
}

function make_menu_bottom(){
 document.write("<p><hr>\n");
 document.write("<p align=\"center\">\n");
 for(i=0; i<menutable.length; i++){
  document.write("<a href='http://www.ithacareef.com/"+menutable[i].split("%")[0].split("*")[0].split("|")[1]+
   "'>"+menutable[i].split("%")[0].split("*")[0].split("|")[0]+"</a> | ");
  }
 document.write("<a href=\"javascript:open_contact_us('Contact',event)\">Contact Ithaca Reef</a></font><p><b>© Ithaca Reef 2004</b>");
}

function make_menu_html(stat,func){
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
//alert("stat="+stat+" "+stat1+" "+stat2+" "+stat3);
tempmenu='<table border="'+tbbb+'" borderColor="#66CCFF" borderColorDark="#66CCFF" borderColorLight="#66CCFF" width="100%" bgcolor="#66CCFF">';
for(i=0; i<menutable.length; i++){
 if(stat1!=i){
  tempmenu += 
        '<tr><td bordercolor="blue" id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
        ' onclick="'+func+'('+i*10000+',1)">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
  }
 if(stat1==i){
  tempmenu += 
        '<tr><td bgColor="#66CCFF" bordercolor="blue">'+
        '<table border="'+tbbb+'" bgColor="#66CCFF" width="100%"><tr><td bordercolor="yellow"'+                       
        ' id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
        ' bgColor='+bgActiveC+' '+
        ' onclick="'+func+'('+i*10000+',1)">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
  for(j=1; j<menutable[i].split("%").length; j++){
   if(stat2!=j){
    tempmenu += 
      '<tr><td bgColor="#66CCFF" bordercolor="black" id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
      ' onclick="'+func+'('+(i*10000+j*100)+',1)">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'   
    }
   if(stat2==j){ 
    tempmenu += 
      '<tr><td border=1 bgColor="#66CCFF" bordercolor="black">'+
      '<table bgColor="#66CCFF" border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="orange"'+
      ' id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
      ' bgColor='+bgActiveC+' '+
      ' onclick="'+func+'('+(i*10000+j*100)+',1)">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'  
    for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
     if(stat3!=k){
      tempmenu += 
       '<tr><td bgColor="#66CCFF" bordercolor=royalblue id="menu'+(i*10000+j*100+k)+'" width="100%"'+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
       ' onclick="'+func+'('+(i*10000+j*100+k)+',1)">'+
       '<p align="right"><font color=royalblue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr>\n'    
      }
     else{
      tempmenu += 
       '<tr><td bgColor="#66CCFF" bordercolor=royalblue>'+
       '<table width="100%" bgColor="#66CCFF" border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr>'+
       '<td bordercolor="orange" '+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)" '+
       ' id="menu'+(i*10000+j*100+k)+'" bgColor='+bgActiveC+' '+
       ' onclick="'+func+'('+(i*10000+j*100+k)+',1)">'+
       '<p align="right"><font color=royalblue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr></table></td></tr>\n'
      }
     }
    tempmenu += '</td></tr></table>';
    }
   }
  tempmenu += '</td></tr></table>';
  }                       
 }
tempmenu += '</table>';
return tempmenu;
}

function draw_menu(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=make_menu_html(stat,"load_page");
pgActive=menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[2];
if(pgActive=="0"){
 tttmp=top.document.getElementById("textcell");
 ttitle=menutable[stat1].split("%")[0].split("*")[0].split("|")[0];
 if(stat2!=0){
  ttitle+=" : "+menutable[stat1].split("%")[stat2].split("*")[0].split("|")[0];
  }
 if(stat3!=0){
  ttitle+=" : "+menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[0];
  }
 txt="<b><center><font size=6>"+ttitle+"</b></font><p>";
 txt+="This page is currently under construction. Please come here again shortly. We apologize for any inconvenience. <p>Currently available pages on the Ithaca Reef web site are<p>"; 
 txt+=print_all_active_pages();
 tttmp.innerHTML=txt+tttmp.innerHTML;
 }

//tttmp.innerHTML=make_menu_html(stat,"draw_menu");
}

function draw_menu_restore(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=make_menu_html(stat,"load_page");
pgActive=menutable[stat1].split("%")[stat2].split("*")[stat3].split("|")[2];

//tttmp.innerHTML=make_menu_html(stat,"draw_menu");
}

function print_all_active_pages(){
 txt="";

 for(i=0; i<menutable.length; i++){
  if(menutable[i].split("%")[0].split("*")[0].split("|")[2]=="1"){
   txt += "<a href='javascript:load_page("+(i*10000)+")'>"+menutable[i].split("%")[0].split("*")[0].split("|")[0]+"</a><br>";
   }
  for(j=1; j<menutable[i].split("%").length; j++){
   if(menutable[i].split("%")[j].split("*")[0].split("|")[2]=="1"){
    txt += "<a href='javascript:load_page("+(i*10000+j*100)+")'>"+
           menutable[i].split("%")[0].split("*")[0].split("|")[0]+" : "+
           menutable[i].split("%")[j].split("*")[0].split("|")[0]+
           "</a><br>";
    }
   for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
    if(menutable[i].split("%")[j].split("*")[k].split("|")[2]=="1"){
     txt += "<a href='javascript:load_page("+(i*10000+j*100+k)+")'>"+
            menutable[i].split("%")[0].split("*")[0].split("|")[0]+" : "+
            menutable[i].split("%")[j].split("*")[0].split("|")[0]+" : "+
            menutable[i].split("%")[j].split("*")[k].split("|")[0]+
            "</a><br>";
     }
    }
   }
  }
 return txt;
 }

function redraw_menu(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
top.frames[1].window.name=stat;
tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=make_menu_html(stat,"load_page");
//tttmp.innerHTML=make_menu_html(stat,"draw_menu");
}

function draw_menu_all(stat){
status=stat;
stat1=(stat-stat%10000)/10000;
stat2=stat-stat1*10000;
stat2=(stat2-stat2%100)/100;
stat3=stat-stat2*100-stat1*10000;
//alert("stat="+stat+" "+stat1+" "+stat2+" "+stat3);
tempmenu='<table border="'+tbbb+'" borderColor="#66CCFF" borderColorDark="#66CCFF" borderColorLight="#66CCFF" width="100%" bgcolor="#66CCFF">';
for(i=0; i<menutable.length; i++){
 if(stat1!=i){
  tempmenu += 
        '<tr><td bordercolor="blue">'+
        '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="#66CCFF" id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
        ' onclick="load_page('+i*10000+')">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
  }
 if(stat1==i){
  tempmenu += 
        '<tr><td bordercolor="blue">'+
        '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="yellow" id="menu'+i*10000+'" width="100%" height="24"'+
        ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
        ' bgColor='+bgActiveC+' '+
        ' onclick="load_page('+i*10000+')">'+
        '<p align="center"><b><font size="4">'+menutable[i].split("%")[0].split("*")[0].split("|")[0]+
        '</font></b></p></td></tr>\n';
   }
  for(j=1; j<menutable[i].split("%").length; j++){
   if(stat2!=j || stat1!=i){
    tempmenu += 
      '<tr><td bordercolor="black">'+
      '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="#66CCFF" id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
      ' onclick="load_page('+(i*10000+j*100)+')">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'
    }
   if(stat2==j && stat1==i){ 
    tempmenu += 
      '<tr><td bordercolor="black">'+
      '<table border="'+tbbb+'" bordercolor="#66CCFF" width="100%"><tr><td bordercolor="orange" id="menu'+(i*10000+j*100)+'" width="100%"'+
      ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
      ' bgColor='+bgActiveC+' '+
      ' onclick="load_page('+(i*10000+j*100)+')">'+
      '<p align="center"><font size="3">'+menutable[i].split("%")[j].split("*")[0].split("|")[0]+
      '</font></p></td></tr>\n'
     }  
    for(k=1; k<menutable[i].split("%")[j].split("*").length; k++){
     if(stat3!=k || stat2!=j || stat1!=i){
      tempmenu += 
       '<tr><td bordercolor=royalblue id="menu'+(i*10000+j*100+k)+'" width="100%"'+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOff(this)"'+
       ' onclick="load_page('+(i*10000+j*100+k)+')">'+
       '<p align="right"><font color=blue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr>\n'    
      }
     if(stat3==k && stat2==j && stat1==i){
      tempmenu += 
       '<tr><td bordercolor=royalblue id="menu'+(i*10000+j*100+k)+'" width="100%"'+
       ' onmouseover="switchBackOn(this)" onmouseout="switchBackOffs(this)"'+
       ' bgColor='+bgActiveC+' '+
       ' onclick="load_page('+(i*10000+j*100+k)+')">'+
       '<p align="right"><font color=blue size="2">'+menutable[i].split("%")[j].split("*")[k].split("|")[0]+
       '</font></p></td></tr>\n'    
      }
     }
    tempmenu += '</td></tr></table>';
   }
  tempmenu += '</td></tr></table>';                    
 }
tempmenu += '</table>';

tttmp=top.document.getElementById("menu_main");
tttmp.innerHTML=tempmenu;
} 

function open_contact_us(nm,evnt){
 var  properties="toolbar=0,location=0,menubar=no";
 properties = properties+",height=650,width=650";
 if(evnt != null){
  if(navigator.appName == "Microsoft Internet Explorer") {
  properties = properties+",left="+(evnt.screenX + 10);
  properties = properties+",top="+(evnt.screenY + 10);
  }
 else{ // Navigator coordinates must be adjusted for scrolling
  properties = properties+",left="+(evnt.screenX - pageXOffset + 10);
  properties = properties+",top="+(evnt.screenY - pageYOffset + 10);
  }
 properties = properties+",scrollbars=auto,resizable=yes";
 }
 popupHandle = window.open("http://www.ithacareef.com/contactus.htm",nm,properties);
}

function open_mailinglist(nm,evnt){
 var  properties="toolbar=0,location=0,menubar=no";
 properties = properties+",height=350,width=500";
 if(evnt != null){
  if(navigator.appName == "Microsoft Internet Explorer") {
  properties = properties+",left="+(evnt.screenX + 10);
  properties = properties+",top="+(evnt.screenY + 10);
  }
 else{ // Navigator coordinates must be adjusted for scrolling
  properties = properties+",left="+(evnt.screenX - pageXOffset + 10);
  properties = properties+",top="+(evnt.screenY - pageYOffset + 10);
  }
 properties = properties+",scrollbars=auto,resizable=yes";
 }
 popupHandle = window.open("http://www.ithacareef.com/email_subscription.htm",nm,properties);
}

function draw_menu_rest(){
tmph="<table border="+tbbb+" borderColor=\"#66CCFF\" borderColorDark=\"#66CCFF\" borderColorLight=\"#66CCFF\" width=\"100%\" height=\"35\" bgcolor=\"#66CCFF\">";
tmph+="<tr> <td bordercolor=\"blue\" id=\"contactus\" align=\"Center\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"open_contact_us('Contact',event)\"><font size=\"3\"><B>Contact <i>Ithaca Reef</i></B></font></td> </tr> <tr>";
tmph+="<td bordercolor=\"blue\" id=\"mailinglist\" align=\"Center\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"open_mailinglist('mailinglist',event)\"><font size=\"3\"><B>Mailing list</B></font></td> </tr> </table>";

tmph+="<p align=\"right\"><table bordercolor=\"#66CCFF\" border=\""+tbbb+"\">";
tmph+="<tr> <td bordercolor=\"blue\" id=\"expandall\" align=\"right\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"draw_menu_all(status)\"><font size=\"2\">Expand all</font></td> </tr><tr>";
tmph+="<td bordercolor=\"blue\" id=\"expandallr\" align=\"right\" onmouseover=\"switchBackOn(this)\" onmouseout=\"switchBackOff(this)\" onclick=\"draw_menu_restore(status)\"><font size=\"2\">Restore all</font></td> </tr> </table>";
tmph+="<p align=\"right\"><p align=\"right\"><font face=\"Arial\" size=\"1\">Welcome to<br><i>Ithaca Reef</i><br>";
tmph += "<p align=\"right\">Please send comments or questions about this site to the <A href=\"mailto:web@ithacareef.com\">Ithaca Reef webmasters</A></font>";
tmph += "<p align=\"right\"><font face=\"Arial\" size=\"1\" style=\"BORDER-LEFT-COLOR: black; BORDER-BOTTOM-WIDTH: thin; BORDER-BOTTOM-COLOR: black; BORDER-TOP-COLOR: black; BORDER-RIGHT-COLOR: black\">This site is best viewed with Internet Explorer.</font></p>";
tttmp=top.document.getElementById("menu_main_rest");
tttmp.innerHTML=tmph;
}

function draw_logo(){
//document.leftmargin="2";
//document.topmargin="2";
document.bgColor="#66CCFF";
tttmp=top.document.getElementById("maintb");
tttmp.border="0";
tttmp.cellpadding="2";
tttmp.bordercolor="#66CCFF";
tttmp.bgColor="#66CCFF";
tttmp.height="100%";

tttmp=top.document.getElementById("logocell");
tttmp.bgColor="#66CCFF";

tttmp=top.document.getElementById("menucell");
tttmp.bgColor="#66CCFF";
tttmp.width="170pt";
tttmp.vAlign="top";
tttmp.height="100%";

tttmp=top.document.getElementById("textcell");
tttmp.bgColor="#66CCFF";
tttmp.vAlign="top";
tttmp.height="100%";

i1=0;
i2=1;
totpic=pictinfo.length;
i1=Math.floor(totpic*Math.random()+1);
i2=Math.floor(totpic*Math.random()+1);
if(i1==i2){
 i2++;
 if(i2>totpic)i2=1;
 }
tmph = "<table border=\"1\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse; border-width: 0\" bordercolor=\"#111111\" width=\"100%\">";
tmph += "<tr>";
tmph += "    <td width=\"33%\" style=\"border-style: none; border-width: medium\" align=\"left\">";
tmph += "<img border=\"0\" src=\""+root+"album/" + i1 + "_resize.jpg\" height=\"100\" onclick=\"display_album("+i1+",event)\">";
tmph += "    </td>";
tmph += "    <td width=\"33%\" style=\"border-style: none; border-width: medium\" bgcolor=\"white\" >";
tmph += "    <p align=\"center\">";
tmph += "    <img border=\"0\" src=\""+root+"IthacaReefLogo.jpg\" width=\"272\" height=\"80\">";
tmph += "    </td>";
tmph += "    <td width=\"34%\" style=\"border-style: none; border-width: medium\"align=\"right\">";
tmph += "<img border=\"0\" src=\""+root+"album/" + i2 + "_resize.jpg\" height=\"100\" onclick=\"display_album("+i2+",event)\">";
tmph += "    </td>";
tmph += "  </tr>";
tmph += "  <tr>";
tmph += "    <td width=\"100%\" style=\"border-style: none; border-width: medium\" colspan=\"3\">";
tmph += "    <p align=\"center\"><i><b><font size=4>Marine fish hatchery in Ithaca, NY</font></b><br>";
tmph += "    <font style=\"font-size: 12.0pt; font-family: Technical\">Tank raised marine fish - different species - best adapted ";
tmph += "    to live in aquaria - preserving fish in the wild </i></font></td>";
tmph += "  </tr>";
tmph += "</table>";
tttmp=top.document.getElementById("menu_main_logo");
tttmp.innerHTML=tmph;

}

function switchBackOn(obj){
obj.bgColor="orange";
}
function switchBackOff(obj){
obj.bgColor="#66CCFF";
}
function switchBackOffs(obj){
//obj.bgColor="LightYellow";
obj.bgColor=bgActiveC;
}


