//var root="/IthacaReef/";
var root="/";

var pagelen=5;
var pagewid=2;
var curpage=1;

//0 = reef , 1 = hatchery
var pictinfo = new Array(
 '',
 '0|Sailfin Tang (<i>Zebrasoma veliferum</i>) in our 180 gal reef tank # 2.',
 '1|Male Clark\'s Clownfish (<i>Amphiprion clarkii</i>) fans his eggs. Female usually hides behind the pot.',
 '1|Female Two-Banded Clownfish (<i>Amphiprion bicinctus</i>) and her nest',
 '1|Male Fireclown (<i>Amphiprion ephippium</i>) guards eggs laid on aquarium glass',
 '1|A pair of True Perculas (<i>Amphiprion percula</i>) at the front of their nesting pot. Eggs are laid on the underside of the pot.',
 '1|One of our pairs of Ocellaris Clownfish (<i>Amphiprion ocellaris</i>) clownfish. They impatiently wait for food ...',
 '1|Male Percula Clownfish (<i>Amphiprion percula</i>) checks his eggs. It is so called \"mouthing\", and it looks like he is eating them. In reality he eats only dead ones, while gently touching the others.',
 '1|A pair of Two-Banded Clownfish (<i>Amphiprion bicinctus</i>) and their nest.',
 '1|A pair of True Perculas (<i>Amphiprion percula</i>) in their pot. This is a new pair, and they are getting familiar with their tank.',
 '0|Reef tank #1. Ocellaris Clownfish (<i>Amphiprion ocellaris</i>) and her long tentacle anemone (<i>Macrodactyla doreensis </i>)..',

 '0|Reef tank #1 - soft corals.',
 '0|Reef tank #1. Yellow Tang (<i>Zebrasoma flavescens</i>) hiding under a soft (colt) coral.',
 '0|Reef tank #1. Yellow Tang (<i>Zebrasoma flavescens</i>) hiding under a soft (colt) coral.',
 '0|Reef tank #1. Anemone corner: yellow tang (<i>Zebrasoma flavescens</i>), yellow wrasse (<i>Halichoeres chrysus</i>) and long tentacle anemone (<i>Macrodactyla doreensis </i>) with Ocellaris Clownfish (<i>Amphiprion ocellaris</i>).',
 '1|Juvenile Ocellaris clownfish (<i>Amphiprion ocellaris</i>) exhibit schooling behavior when feeling unsafe or when sleeping at night.',
 '1|Juvenile Ocellaris clownfish (<i> Amphiprion ocellaris</i>) exhibit schooling behavior when feeling unsafe, or when sleeping at night.',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>) schooling together.',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>). Is it food coming?.',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>). Feeding time ...',
 '1| A pair of Ocellaris Clownfish in their anemone. A batch of eggs has been laid on the side glass of the tank.',

 '1| Male Ocellaris Clownfish guards his batch of eggs laid on the side glass of the tank.',
 '1| Male Ocellaris Clownfish guards his batch of eggs laid on the side glass of the tank.',
 '1| A pair of Ocellaris Clownfish in their anemone. A batch of eggs has been laid on the side glass of the tank.',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>)',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>)',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>)',
 '1| Juvenile Ocellaris Clownfish (<i> Amphiprion ocellaris</i>)',
 '1| Ocellaris clownfish (<i> Amphiprion ocellaris</i>) : early juveniles',
 '0|Reef tank #2. Frogspawn coral (<i>Euphylla divisa</i>).',

 '0|Reef tank #2. Female Maroon Clownfish (<i>Premnas biaculeatus</i>) in her long tentacle anemone (<i>Macrodactyla doreensis </i>).',
 '0|Reef tank #2. Sailfin Tang.',
 '0|Reef tank #2. Kenya Tree Coral',
 '0|Reef tank #2. A pair of Maroon Clownfish (<i>Premnas biaculeatus</i>) in their anemone.',
 '0|Reef tank #2. Xenia',
 '1|Male Clark\'s Clownfish (<i>Amphiprion clarkii</i>) fans his eggs.',
 '1|Juvenile Ocellaris are being moved to a different grow-out tank.',
 '0|Reef tank #2, a side view.',
 '0|Reef tank #2, a side view.',
 '0|Reef tank #2, a side view.',

 '0|Reef tank #2, a side view.',
 '0|Sailfin Tang (<i>Zebrasoma veliferum</i>) in our 180 gal reef tank # 2. \"Is there anything left?\"',
 '0|Reef tank #2. A pair of Maroon Clownfish (<i>Premnas biaculeatus</i>) in their anemone.',
 '0| Reef tank #2. Male Blue Throat Triggerfish (<i> Xanthichthys auromarginatus</i>) in his favorite hiding spot.',
 '0| Reef tank #2. Male Blue Throat Triggerfish (<i> Xanthichthys auromarginatus</i>) in his favorite hiding spot.',
 '0|Reef tank #2. Purple Ribbon Gorgonian (<i>Gorgonia sp.</i>).',
 '0|Reef tank #2. Purple Ribbon Gorgonian (<i>Gorgonia sp.</i>).',
 '0|Reef tank #2. Purple Tree Gorgonian (<i>Eunicea sp.</i>).',
 '0|Reef tank #2. Green Lace Gorgonian (<i>Pterogorgia citrina</i>)',
 '0|Reef tank #2. Soft tree coral',
 
 '0|Reef tank #2. Soft coral',
 '0|Reef tank #2. Coral Banded Shrimp (<i>Stenopus hispidus</i>).',
 '0|Reef tank #1. Soft coral',
 '0|Reef tank #1, a side view',
 '0|Reef tank #1. Kole Tang (<i>Ctenochaetus strigosus</i>)',
 '0|Reef tank #1. Giant Anthelia (<i>Anthelia sp.</i>)',
 '0|Reef tank #1. Green Star Polyps (<i> Pachyclavularia sp.</i>)',
 '0|Reef tank #1. A stand of <i> Sarcophyton</i> corals.',
 '0|Reef tank #1. A stand of <i> Sarcophyton</i> corals. ',
 '0|Reef tank #1. Green Star Polyps (<i> Pachyclavularia sp.</i>) ',

 '0|Reef tank #1. Giant Anthelia (<i>Anthelia sp.</i>) ',
 '0|Reef tank #1. Giant Anthelia (<i>Anthelia sp.</i>) ',
 '0|Reef tank #1. Leather coral <i> Sarcophyton sp.</i>',
 '0|Reef tank #1. Soft tree coral.',
 '0|Reef tank #1. Hermit Crab',
 '1|A pair of Two-Banded Clownfish (<i>Amphiprion bicinctus</i>) and their nest.',
 '1|Soft coral frag tank. Xenia and Green Star Polyps',
 '1|Soft coral frag tank. Xenia',
 '1|Soft coral frag tank. Green Star Polyps',
 '1|Soft coral frag tank. Sarcophyton coral.',

 '0|Reef tank #1. A stand of <i> Sarcophyton</i> corals.',
 '0|Reef tank #1. Middle of the tank. Yellow Tang, Green Chromis and Scott’s Fairy Wrasse.',
 '0|Reef tank #1.',
 '0|Reef tank #1.',
 '0|Reef tank #2.',
 '0|Reef tank #2.',
 '1|Ocellaris Clownfish (<i> Amphiprion ocellaris</i>) laying eggs.',
//77
 '1|Larval tank ready for new larvae.',
//78
 '1|Larval tank ready for new larvae.',
//79
 '1|New larvae just after moving to their larval tank.',
//80
 '1|New larvae just after moving to their larval tank.',
//81
 '1|New larvae just after moving to their larval tank.',
//82
 '1|New Ocellaris larvae in the morning after hatching. Starting to learn how to eat rotifers.',
//83
 '1|Breeding pair of Clarkii (<i>A. clarkii</i>) abd their nest.',
//84
 '0|Reef tank #1. November 2005.',
//85
 '0|Reef tank #1. November 2005.',
//86
 '0|Reef tank #1. November 2005.',
//87
 '1|Brine shrimp nauplii.',
//88
 '1|Juvenile Tomato Clownfish (<i>A. frenatus</i>).',
//89
 '1|Rotifers.',
//90
 '0|Reef tank #1. November 2005.',
//91
 '1|Juvenile Two-Banded Clownfish (<i>A. bicinctus</i>).',
//92
 '1|Juvenile Clarkii Clownfish <<i>A. clarkii</i>) in the grow-out tank.',
//93
 '1|Juvenile Two-Banded Clownfish (<i>A. bicinctus</i>) sleep a the bottom of their tank.',
//94
 '1|Juvenile Clarkii Clownfish <<i>A. clarkii</i>) in the grow-out tank',
//95
 '1|Juvenile Fireclown Clownfish (<i>A. ephippium</i>). Some still have two white bars. Fireclowns start with two bars, which gradually disappear.',
//96
 '1|Juvenile Ocellaris (<i>A. ocellaris</i>) sleep in "balls".',
//97
 '1|Juvenile Fireclown (<i>A. ephippium</i>) are ready to eat.',
//98
 '1|Juvenile Two-Banded Clownfish (<i>A. bicinctus</i>).',
//99
 '1|Juvenile Ocellaris (<i>A. ocellaris</i>) sleep in "balls".',
//100
 '1|Juvenile Ocellaris (<i>A. ocellaris</i>) are almost jumping out of the water to get food.',
//101
 '1|Juvenile Ocellaris (<i>A. ocellaris</i>)',
//102
 '1|Juvenile Ocellaris (<i>A. ocellaris</i>) sleep in "balls".',
//103
 '1|Juvenile Ocellaris (<i>A. ocellaris</i>)',
//104
 '1|Breeding pair of Black Ocellaris (<i>A. ocellaris</i>).',
//105
 '1|Early juvenile Ocellaris (<i>A. ocellaris</i>)',
//106
 '1|Ithaca Reef hatchery. Larval tanks system #2.',
//107
 '1|Ithaca Reef hatchery. Broodstock system #2',
//108
 '1|Ithaca Reef hatchery. Broodstock system #2 - plumbing.',
//109
 '1|Ithaca Reef hatchery. Fluidized bed filters for grow-out system #1',
//110
 '1|Ithaca Reef hatchery. Sump for grow-out system #1.',
//111
 '1|Ithaca Reef hatchery. Sump for broodstock system #2.',
//112
 '1|Ithaca Reef hatchery. Retention box for broodstock system #2.',
//113
 '1|Ithaca Reef hatchery. Broodstock system #1.',
//114
 '1|Ithaca Reef hatchery. Grow-out system #1.',
//115
 '1|Ithaca Reef hatchery. Rotifer cultures.',
//116
 '1|Ithaca Reef hatchery. Larval system #2.',
//117
 '1|Ithaca Reef hatchery. Broodstock system #1 and grow-out system #1.',
//118
 '1|Ithaca Reef hatchery.',
//119
 '1|Ithaca Reef hatchery. Water containers.',
//120
 '1|Ithaca Reef hatchery. RO/DI systems.',
//121
 '1|Ithaca Reef hatchery. Kold-Steril water filter.',
//122
 '1|Breeding pair of Percula Clownfish (<i>A. percula</i>)',
//123
 '1|Breeding pair of Ocellaris Clownfish (<i>A. ocellaris </i>)',
//124
 '1|Juvenile Fireclown.',
//126
 '1|Juvenile Ocellaris Clownfish feeding on gel food.',
//127
 '1|Male Fireclown (<i>A. ephippium</i>) and his nest. Eggs are ready to hatch.',
//128
 '1|Breeding pair of Two-Banded Clownfish (<i>A. bicinctus</i>) and their freshly laid eggs.',
//129
 '1|Preparing fish for shipment using plastic spoon.',
//130
 '1|Preparing fish for shipment.',
//131
 '1|Preparing fish for shipment - catching fish with plastic bag.',
//132
 '1|Preparing fish for shipment - catching fish with plastic bag.'
 );

var movieinfo = new Array(
 '',
 'chromis/chromis|Chromis spawning: movie 1.',
 'chromis/chromis2|Chromis spawning: movie 2.',
 'chromis/chromis3|Chromis spawning: movie 3.',
 'chromis/chromis4|Chromis spawning: movie 4.',
 'chromis/chromis5|Chromis spawning: movie 5.',
 'chromis/chromis6|Chromis spawning: movie 6.',
 'chromis/chromis7|Chromis spawning: movie 7.',
 'movies/bicinctus|A pair of Two-banded Clownfish and their eggs (laid on the underside of the pot).',
 'movies/clarks2|Male Clark\'s Clownfish guarding and fanning his eggs.',
 'movies/ocellaris|A pair of Ocellaris Clownfish and their nest.',
 'movies/percula|A pair of Percula Clownfish and their nest.',
 'movies/ocellaris_laying_eggs|Pair of Ocellaris Clownfish laying eggs (clip 1)',
 'movies/ocellaris_laying_eggs_1|Pair of Ocellaris Clownfish laying eggs (clip 2)',
 'movies/reef1_1|Reef tank #1 - clip 1.',
 'movies/reef1_2|Reef tank #1 - clip 2.',
 'movies/reef2|Reef tank #2.',
 'movies/feeding_bicinctus|Juvenile Two-Banded Clownfish (<i>A. bicinctus</i>) feeding.',
 'movies/feeding_clark|Juvenile Clarkii Clownfish (<i>A. clarkii</i>) feeding.',
 'movies/feeding_fireclown|Juvenile Fireclown (<i>A. ephippium</i>) feeding.',
 'movies/feeding_ocellaris|Juvenile Ocellaris Clownfish (<i>A. ocellaris</i>) feeding.',
 'movies/fireclown1|Breeding pair of Fireclown and their eggs (clip 1).',
 'movies/fireclown2|Breeding pair of Fireclown and their eggs (clip 2).',
 'movies/hatching00|Breeding pair of Ocellaris Clownfish.',
 'movies/hatching03|Ocellaris larvae in the morning after hatching. They learn how to eat rotifers.',
 'movies/percula2|Breeding pair of Percula Clownfish (<i>A. percula</i>).'
 );
 

var popupHandle, currpict, currpictdes;

function display_movie(nm){
 filecore=movieinfo[nm].split("|")[0];
 desc=movieinfo[nm].split("|")[1];
 txt  = "<img border=\"0\" src=\""+root+filecore+".jpg\" height=\"150\" align=\"left\"><p>";
 txt += "<a href=\""+root+filecore+"_modem.ram\"><img border=\"0\" src=\""+root+"movie_icon.jpg\" width=\"39\" height=\"33\"></a>dial-up<br>"; 
 txt += "<a href=\""+root+filecore+"_cable.ram\"><img border=\"0\" src=\""+root+"movie_icon.jpg\" width=\"39\" height=\"33\"></a>cable<br>";
 txt += "<a href=\""+root+filecore+".ram\"><img border=\"0\" src=\""+root+"movie_icon.jpg\" width=\"39\" height=\"33\"></a>LAN";
 txt += "<p>"+desc;
 document.write(txt);
 }

function display_movie_nowrite(nm){
 filecore=movieinfo[nm].split("|")[0];
 desc=movieinfo[nm].split("|")[1];
 txt  = "<img border=\"0\" src=\""+root+filecore+".jpg\" height=\"150\" align=\"left\"><p>";
 txt += "<a href=\""+root+filecore+"_modem.ram\"><img border=\"0\" src=\""+root+"movie_icon.jpg\" width=\"39\" height=\"33\"></a>dial-up<br>"; 
 txt += "<a href=\""+root+filecore+"_cable.ram\"><img border=\"0\" src=\""+root+"movie_icon.jpg\" width=\"39\" height=\"33\"></a>cable<br>";
 txt += "<a href=\""+root+filecore+".ram\"><img border=\"0\" src=\""+root+"movie_icon.jpg\" width=\"39\" height=\"33\"></a>LAN";
 txt += "<p>"+desc;
 return txt;
 }

function display_album(nm,evnt){
 var  properties="toolbar=0,location=0,menubar=no,scrollbars=auto,resizable=yes,width=800,height=800";
 
 currpict=nm;
 if(popupHandle==null || popupHandle.closed){
  popupHandle = window.open(root+"album.htm",nm,properties);
  }
 else{
  popupHandle.focus();
  popupHandle.location=root+"album.htm";
  }
 }

function display_picture(nm,des,evnt){
 var  properties="toolbar=0,location=0,menubar=no,scrollbars=auto,resizable=yes,width=800,height=800";
 
 currpict=nm;
 currpictdes=des;
 if(popupHandle==null || popupHandle.closed){
  popupHandle = window.open(root+"picture.htm","picture",properties);
  }
 else{
  popupHandle.focus();
  popupHandle.location=root+"picture.htm";
  }
 }

function gallery(type,pagein){
 dspltxt="";
 page=pagein;
 pagetot=pagelen*pagewid;
 startnum=(page-1)*pagetot+1;
 endnum=page*pagetot;
 kk=0;
 for(i=1; i<pictinfo.length; i++){
  if(pictinfo[i].split("|")[0]==type || type==99){kk++}
  }
 totpages=Math.floor(kk/pagetot)+1;

 i=1;
 n=0;
 page1=page+1;
 page0=page-1;
 while(i<pictinfo.length && n<startnum){
  if(pictinfo[i].split("|")[0]==type || type==99){
   n++;
   }
  i++;
  }
// alert(page+" "+n+" "+startnum);
 if(n<startnum){
  return;
  }
 if(page>1){dspltxt+="<a href=\"javascript:gallery("+type+","+page0+")\"><b>Previous page</b></a>";}
 if(page<totpages){
  if(page>1){dspltxt+="&nbsp|&nbsp";}
  dspltxt+="<a href=\"javascript:gallery("+type+","+page1+")\"><b>Next page</b></a>";
  }
 if(totpages>1){dspltxt+="<b>&nbsp|&nbspGo to page:&nbsp";}
 if(totpages==1){dspltxt+="<b>Page:&nbsp";}
 for(k=1; k<=totpages; k++){
  if(k>1){dspltxt+="&nbsp|&nbsp ";}
  if(k==page){
   dspltxt+=k;
   }
  else{
   dspltxt+=" <a href=\"javascript:gallery("+type+","+k+")\">"+k+"</a>";
   }
  }
 dspltxt+="</b><table>";
 ir=1;
 ic=1;
 i--;
 while(i<pictinfo.length && n<=endnum){
    if(pictinfo[i].split("|")[0]==type || type==99){
     if(ic==1){
      dspltxt+="<tr>\n";
      }
     dspltxt+="<td><img border=\"0\" align=\"left\" src=\""+root+"album/" + i + "_resize.jpg\" height=\"100\" onclick=\"display_album("+i+",event)\">"+pictinfo[i].split("|")[1]+"</td>";
     n++;
     ic++;
     if(ic==pagewid+1){
      dspltxt+="</tr>\n";
      ic=1;
      }
     }
    i++;
  }
 dspltxt+="</table>";
 tttmp=top.document.getElementById("txtspan");
 tttmp.innerHTML=dspltxt; 
 }


function gallery_movies(pagein){
 dspltxt="";
 page=pagein;
 pagetot=pagelen*pagewid;
 startnum=(page-1)*pagetot+1;
 endnum=page*pagetot;

 totpages=Math.floor(movieinfo.length/pagetot)+1;

 i=0;
 n=0;
 page1=page+1;
 page0=page-1;
 while(i<movieinfo.length && n<startnum){
//  if(picttype[i]==type || type==99){
   n++;
//   }
  i++;
  }
// alert(page+" "+n+" "+startnum);
 if(n<startnum){
  return;
  }
 if(page>1){dspltxt+="<a href=\"javascript:gallery_movies("+page0+")\"><b>Previous page</b></a>";}
 if(page<totpages){
  if(page>1){dspltxt+="&nbsp|&nbsp";}
  dspltxt+="<a href=\"javascript:gallery_movies("+page1+")\"><b>Next page</b></a>";
  }
 if(totpages>1){dspltxt+="<b>&nbsp|&nbspGo to page:&nbsp";}
 if(totpages==1){dspltxt+="<b>Page:&nbsp";}
 for(k=1; k<=totpages; k++){
  if(k>1){dspltxt+="&nbsp|&nbsp ";}
  if(k==page){
   dspltxt+=k;
   }
  else{
   dspltxt+=" <a href=\"javascript:gallery_movies("+k+")\">"+k+"</a>";
   }
  }
 dspltxt+="</b><table>";

 dspltxt+="<table>";
 ir=1;
 ic=1;
 while(i<movieinfo.length && n<=endnum){
//    if(picttype[i]==type || type==99){
     if(ic==1){
      dspltxt+="<tr>\n";
      }
     dspltxt+="<td>"+display_movie_nowrite(n)+"</td>";
     n++;
     ic++;
     if(ic==pagewid+1){
      dspltxt+="</tr>\n";
      ic=1;
      }
//     }
    i++;
  }
 dspltxt+="</table>";
 tttmp=top.document.getElementById("txtspan");
 tttmp.innerHTML=dspltxt; 
 }


function gallery_movies_old(page){
 pagetot=pagelen*pagewid;
 startnum=(page-1)*pagetot+1;
 endnum=page*pagetot-1;
 i=startnum;
 document.write("<table border=0>\n");
 for(ir=1; ir<=pagelen; ir++){
  document.write("<tr>\n");
  for(ic=1; ic<=pagewid; ic++){
   if(i<movieinfo.length){
    document.write("<td>");
    display_movie(i);
    document.write("</td>");
    i++;
    }   
   }
  document.write("</tr>\n");
  }
 document.write("</table>\n");
 
 }

