

self.name = "main"; // If you are using frames, change "main" to the name of the frame that the photoalbum is in.

// PpCategory:  Add your new category names.  Be sure to leave in the 'all' category!
PpCategory = new Array("todas", "con_amigos", "fotos_del_recuerdo", "en_concierto", "Augusto_solo")

MainVar = 0; // Sets up the variable that counts the pictures.
function Fix(DatVal, PicVal, TitVal, CatVal, TxtVal) { // Allows you to use variables for the array instead of numbers.
   this.DatVal = DatVal 
   this.PicVal = PicVal 
   this.TitVal = TitVal 
   this.CatVal = CatVal
   this.TxtVal = TxtVal 
} 
var MainArray = new Array() // Sets up the main array.
// MainArray[MainVar++] = new Fix("date", "picname.jpg", "pic title", "category", "pic description")
MainArray[MainVar++] = new Fix("10/15/2003",  "marco_ab.jpg", "Augusto escribiendo",     "Augusto_solo",   "BIENVENIDOS al Album de FOTOS de Augusto Blanca.")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conlennon.jpg", "Augusto con Lennon",     "Augusto_solo",   "Augusto en el parque Lennon.")
MainArray[MainVar++] = new Fix("05/05/2005",  "./album/conbaglietto.jpg", "con Juan Carlos Baglietto en Argentina",     "con_amigos",   "Augusto con Juan Carlos Baglietto en Argentina")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conliuba.jpg", "con Liuba Ma Hevia",     "con_amigos",   "Augusto con Liuba Ma Hevia")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/concorina.jpg", "con Corina Mestre",     "con_amigos",   "Augusto Blanca y Corina Mestre")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/consanti.jpg", "con santi",     "con_amigos",   "Augusto con Santiago Feliú e Ignacio Navarro")
MainArray[MainVar++] = new Fix("10/15/2003",   "./album/agustico1953.jpg", "Agustico", "fotos_del_recuerdo", "En su debut el 28 de enero de 1953")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/Recital2.jpg", "Recital", "con_amigos",    "Augusto y Corina Mestre en Ginebra")
MainArray[MainVar++] = new Fix("10/15/2003",   "./album/silvioyaugusto12nov2003.jpg", "con Silvio",     "con_amigos", " Augusto Blanca y Silvio Rodríguez 12 de Nov del 2003.")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/ultimoconciertoenmexico.jpg", "ultimo concierto en México",        "en_concierto",   "Último conicerto en México de la gira 'regalo' al lado de Pepe Ordaz, Waldo Leyva, Rochy")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/patricio-augusto.jpg", "con Patricio",        "con_amigos",   "con el trovador chileno Patricio Anabalon.")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conrochy.jpg", "con Rochy",        "en_concierto",   "con Rochy Mendoza, en el concierto por la paz, noviembre 5 del 2003.")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conppyrochy.jpg", "con Pepe y Rochy",        "en_concierto",   "Ppe Ordaz, Augusto Blanca y Rochy Mendoza, en el concierto por la paz, noviembre 5 del 2003.")
MainArray[MainVar++] = new Fix("10/15/2003",  "vicentelazaroaugusto.jpg", "Vicente, Lazaro y Augusto",        "en_concierto",   "Lázaro García, Vicente Feliú y Auguto Blanca. Concierto 'la mano amiga', Centro Cultural Pablo de la Toriiente Brau. Dic 2002")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/encentropablo.jpg", "en el Centro Pablo",        "en_concierto",   "en el espacio 'a guitarra limpia' del Centro Cultural Pablo de la Torriente Brau. Concierto de Lázaro    8-NOV-03")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conamigos.jpg", "con amigos",        "con_amigos",   "Miriam Ramos,Numamoraes, Augusto, Walter Roldán")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/coautoria.jpg", "con amigo",        "con_amigos",   "con Marcello Guimaraes")

MainArray[MainVar++] = new Fix("10/15/2003",  "./album/flordecuba2.jpg", "Teatrova",        "fotos_del_recuerdo",   "con Maria Eugenia Garcia -TEATROVA- 1985")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/flordecuba.jpg", "flor de cuba ",        "fotos_del_recuerdo",   "EN 'PERSONAJE'   ...   TEATROVA 1985   ...      CON LA OBRA LA FLOR DE CUBA")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/enlabienal.jpg", "en la bienal",        "en_concierto",   "en concierto")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/enitalia.jpg", "con Rosy en Italia",        "fotos_del_recuerdo",   "con Rosy en Italia.        En el Lago de Como        Italia, abril  2003")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/encadiz98.jpg", "con Rosy en Cadiz",        "fotos_del_recuerdo",   "con Rosy en Cadiz")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conpepe.jpg", "con pepe ordaz",        "en_concierto",   "PEÑA DE PEPE ORDÁS (GUANABACOA 7-NOV-03)")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conmihermana1955.jpg", "con su hermana",        "fotos_del_recuerdo",   "con su hermana (1955)")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/conciertoporlapaz.jpg", "concierto por la paz",        "en_concierto",   "concierto por la paz")
MainArray[MainVar++] = new Fix("10/15/2003",  "./album/afichemomo.jpg", "con Corina",        "en_concierto",   "con Corina Mestre en la obra 'MOMO'")

MainArray[MainVar++] = new Fix("10/15/2003",  "augusto_blanca08.jpg", "Augusto",     "Augusto_solo",   "Augusto Blanca.")
MainArray[MainVar++] = new Fix("10/15/2003",  "augusto_blanca04.jpg", "en el Amadeo Roldan",     "en_concierto",   "Teatro Amadeo Roldan presentación CD 'regresaré' Oct 2002 ")
MainArray[MainVar++] = new Fix("10/15/2003",  "augusto_blanca12.jpg", "Augusto",     "con_amigos",   "Seminario Internacional Nueva Trova Cubana julio 2002.")
 



current = 0; // Sets the current picture being shown to the first one.

ActiveVar = 0; // Sets up the variable that counts the pictures.
var ActiveArray = new Array() // Sets up the active array.
for (loop=0; loop < MainVar; loop++) {
  ActiveArray[ActiveVar++] = new Fix(MainArray[loop].DatVal, MainArray[loop].PicVal, MainArray[loop].TitVal, MainArray[loop].CatVal, MainArray[loop].TxtVal)
}


function FindPic() { // The search for a photo feature.
  TotalFound = 0;
  SearchString = document.PpForm.SearchWord.value;
  SearchString = SearchString.toLowerCase();
  WriteResults = window.open("","resultwindow","height=300, width=300, toolbar=0, status=0, menubar=0, resizable=1, scrollbars=1");
  WriteResults.document.open();
  WriteResults.document.write('<div style="text-align:center; font:8pt verdana">'
    + 'You searched for:<br><i>' + SearchString + '</i><br><b>Results:</b><br>');
  for (loop=0; loop < MainVar ; loop++) {
    Keyword = ActiveArray[loop].TxtVal;
    Keyword = Keyword.toLowerCase();
    URL = ActiveArray[loop].PicVal;
    title = ActiveArray[loop].TitVal;
    title = title.toLowerCase();
    SearchResult = Keyword.indexOf(SearchString);
    SearchResult2 = title.indexOf(SearchString);
    if (SearchResult != "-1" || SearchResult2 != "-1") {
      WriteResults.document.write('<br><a href=javascript:ShowPpPic(' + loop + '); target="main">' + title + '</a>');
      TotalFound++;
    }
  }
  WriteResults.document.write('<p><b>Returned ' + TotalFound + ' results.</b><p><a href="javascript:window.close();">close window</a>');
  WriteResults.document.close();
} 

function NextPpPic() { // Flips to the next photo.
  TotalImages = document.PpForm.PpDropdown.options.length;
  current++;
  if (current>=ActiveVar) current = 0;
  ShowPpPic(current);
}

function PreviousPpPic() { // Flips to the previous photo.
  current--;
  if(current<0) current = ActiveVar - 1;
  ShowPpPic(current);
}

function RandomPpPic() { // Shows a random photo.
  randompic = Math.floor(Math.random()*ActiveVar);
  ShowPpPic(randompic);
}

function RunSlideShow() { // Shuffles the photos in a slide show.
    timerSlideShow = setTimeout("NextPpPic();",document.PpForm.Timer.value*1000)
}

function ShowPpCategory(picked) { // Shows the pictures in that category.
  ActiveArray.length = 0;
  PicList = "<SELECT size=10 style='font:8pt verdana' name='PpDropdown' onChange='ShowPpPic(PpForm.PpDropdown.options.selectedIndex);'>";
  ActiveVar = 0;
  current = 0;
  for (loop=0; loop < MainVar; loop++) {
    if (MainArray[loop].CatVal.toLowerCase() == picked.toLowerCase() || picked == "todas") {
      ActiveArray[ActiveVar++] = new Fix(MainArray[loop].DatVal, MainArray[loop].PicVal, MainArray[loop].TitVal, MainArray[loop].CatVal, MainArray[loop].TxtVal)
     PicList = PicList + "<option value=" + MainArray[loop].PicVal + ">" + MainArray[loop].TitVal + "</option>"; 
	} 
  }
  PicList = PicList + "</select>";
  document.getElementById("PicSpot").innerHTML = PicList;
}

function ShowPpPic(newpic) { // Shows the photo and text on the page.
  current = newpic;
  SelectionBox = document.PpForm.PpDropdown;
  SelectionBox.options[current].selected = true;
  document.getElementById("PpSpot").innerHTML = '<a href=javascript:PpPicRemote("' + ActiveArray[current].PicVal + '");><img name="PicShowing" src=' + ActiveArray[current].PicVal + ' height=200 border=0></a>';
  document.getElementById("Journal").outerHTML = '<div id=journal><br>' + ActiveArray[current].DatVal + '<p style="text-align:justify; text-indent:25px">' + ActiveArray[current].TxtVal + '</div>';
  if (document.PpForm.WhereView[1].checked) {
    timerID = setTimeout("PpPicRemote(ActiveArray[current].PicVal)",1000)
  }
  if (document.PpForm.SelectedMode[0].checked) {
    timerSlideShow = setTimeout("NextPpPic();",document.PpForm.Timer.value*1000)
	NextImage = new Image();
	NextPic = current + 1;
    if (NextPic>=ActiveVar) NextPic = 0;
    NextImage.src = ActiveArray[NextPic].PicVal;
  }
}


function PpPicRemote(picName) { // Pops up the photo in a remote window.
    ShowingImage = new Image();
    ShowingImage.src = picName;
    wid = ShowingImage.width + 50;
    hei = ShowingImage.height + 60;
  if (wid < 30 || hei < 30) {
    wid=650;
    hei=490;
  }
  if (screen.width < wid || screen.height < hei) {
    wid = screen.width - 50;
    hei = screen.height - 50;
  }
  OpenWindow = window.open("", "remoteWin", "resizable=1, scrollbars=1, toolbar=0, left=15, top=10, width=" + wid + ", height=" + hei);
  OpenWindow.document.open();
  OpenWindow.document.write('<html><head><title>' + ActiveArray[current].TitVal + '</title></head>'
    + '<body style="background:url(parchment.jpg); font:8pt verdana; margin:2px"><center>' + ActiveArray[current].DatVal + '<br>'
    + '<img src=' + picName + '><br>' + ActiveArray[current].TxtVal
	+ '<br><a href="javascript:window.close();">close window</a></center></body></html>');
  OpenWindow.document.close();
}

