/*var photoList = {"photos": [
        {"thumbnail": "photos/leeds.jpg",       "dirName": "photos/Leeds",                              "label": "Leeds",                                "tags": [ { "tag": "2000" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/imlp.jpg",        "dirName": "photos/IMLP",                               "label": "IMLP",                                 "tags": [ { "tag": "2000" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/newyork.jpg",     "dirName": "photos/New York",                           "label": "New York",                             "tags": [ { "tag": "2000" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/boston.jpg",      "dirName": "photos/Boston",                             "label": "Boston",                               "tags": [ { "tag": "2001" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/amersfoort.jpg",  "dirName": "photos/Amersfoort",                         "label": "Amersfoort",                           "tags": [ { "tag": "2001" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/ireland.jpg",     "dirName": "photos/Ireland",                            "label": "Ireland",                              "tags": [ { "tag": "2001" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/vatican.jpg",     "dirName": "photos/Vatican City",                       "label": "Vatican City",                         "tags": [ { "tag": "2002" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/rome.jpg",        "dirName": "photos/Rome",                               "label": "Rome",                                 "tags": [ { "tag": "2002" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/zurich.jpg",      "dirName": "photos/Zurich",                             "label": "Zurich",                               "tags": [ { "tag": "2002" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/interlaken.jpg",  "dirName": "photos/Interlaken",                         "label": "Interlaken",                           "tags": [ { "tag": "2002" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/switzerland.jpg", "dirName": "photos/Switzerland",                        "label": "Switzerland",                          "tags": [ { "tag": "2002" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/tunisia.jpg",     "dirName": "photos/Tunisia",                            "label": "Tunisia",                              "tags": [ { "tag": "2003" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/london.jpg",      "dirName": "photos/London",                             "label": "London",                               "tags": [ { "tag": "2003" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/whitby.jpg",      "dirName": "photos/Whitby",                             "label": "Whitby",                               "tags": [ { "tag": "2004" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/stockholm.jpg",   "dirName": "photos/Stockholm",                          "label": "Stockholm",                            "tags": [ { "tag": "2004" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/canada.jpg",      "dirName": "photos/Canada",                             "label": "Canada (Honeymoon)",                   "tags": [ { "tag": "2004" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/hatherlywedding.jpg","dirName": "photos/Wedding Pics",                    "label": "Our Wedding",                          "tags": [ { "tag": "2004" }, { "tag": "Celebrations" } ] },
        {"thumbnail": "photos/manchester.jpg",  "dirName": "photos/Manchester",                         "label": "Manchester",                           "tags": [ { "tag": "2005" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/wales.jpg",       "dirName": "photos/Wales",                              "label": "Wales",                                "tags": [ { "tag": "2005" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/budapest.jpg",    "dirName": "photos/Budapest",                           "label": "Budapest",                             "tags": [ { "tag": "2005" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/owl.jpg",         "dirName": "photos/Bird Of Prey Centre",                "label": "Lightwater Valley Bird of Prey Centre","tags": [ { "tag": "2005" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/sculpture.jpg",   "dirName": "photos/Yorkshire Sculpture Park",           "label": "Yorkshire Sculpture Park",             "tags": [ { "tag": "2006" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/cleckheaton.jpg", "dirName": "photos/Cleckheaton",                        "label": "Cleckheaton &amp; Our new House",      "tags": [ { "tag": "2006" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/dublin.jpg",      "dirName": "photos/Dublin",                             "label": "Dublin",                               "tags": [ { "tag": "2006" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/sandlwedding.jpg","dirName": "photos/Steph and Loz Wedding",              "label": "Steph and Loz Wedding",                "tags": [ { "tag": "2006" }, { "tag": "Celebrations" } ] },
        {"thumbnail": "laura/scan.jpg",         "dirName": "laura/ScanPics",                            "label": "Laura Scan Pictures",                  "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Before Birth" } ] },
        {"thumbnail": "laura/30mins.jpg",       "dirName": "laura/0Days",                               "label": "Laura aged 30 Minutes",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Newborn" } ] },
        {"thumbnail": "laura/2d.jpg",           "dirName": "laura/2Days",                               "label": "Laura aged 2 Days",                    "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Newborn" } ] },
        {"thumbnail": "laura/1w.jpg",           "dirName": "laura/1Week",                               "label": "Laura aged 1 Week",                    "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Newborn" } ] },
        {"thumbnail": "laura/1m.jpg",           "dirName": "laura/1Month",                             "label": "Laura aged 1 Month",                   "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/family.jpg",       "dirName": "laura/FriendsAndFamily",                    "label": "Laura Meeting Family and Friends",     "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/2-4m.jpg",         "dirName": "laura/2-4Months",                           "label": "Laura aged 2-4 Months",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/4-5m.jpg",         "dirName": "laura/4-5Months",                           "label": "Laura aged 4-5 Months",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/candtwedding.jpg","dirName": "photos/Charlie and Tania Wedding",          "label": "Charlie &amp; Tania Wedding",          "tags": [ { "tag": "2007" }, { "tag": "Celebrations" } ] },
        {"thumbnail": "laura/5-6m.jpg",         "dirName": "laura/5-6Months",                           "label": "Laura aged 5-6 Months",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/6-7m.jpg",         "dirName": "laura/6-7Months",                           "label": "Laura aged 6-7 Months",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/7-8m.jpg",         "dirName": "laura/7-8Months",                           "label": "Laura aged 7-8 Months",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/8-9m.jpg",         "dirName": "laura/8-9Months",                           "label": "Laura aged 8-9 Months",                "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/spain.jpg",       "dirName": "photos/Spain",                              "label": "Spain - Andalucia",                    "tags": [ { "tag": "2007" }, { "tag": "Places" } ] },
        {"thumbnail": "laura/9-10m.jpg",        "dirName": "laura/9-10Months",                          "label": "Laura aged 9-10 Months",               "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/10-11m.jpg",       "dirName": "laura/10-11Months",                         "label": "Laura aged 10-11 Months",              "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/eye.jpg",         "dirName": "photos/Random Assortment",                  "label": "Random Assortment of Images",          "tags": [ { "tag": "2007" } ] },
        {"thumbnail": "laura/1xmas.jpg",        "dirName": "laura/FirstChristmas",                      "label": "Laura's First Christmas",              "tags": [ { "tag": "2007" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/1bday.jpg",        "dirName": "laura/FirstBirthday",                       "label": "Laura's First Birthday",               "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/centerparcs.jpg", "dirName": "photos/Center Parcs",                       "label": "Center Parcs",                         "tags": [ { "tag": "2008" }, { "tag": "Places" } ] },
        {"thumbnail": "laura/12-13m.jpg",       "dirName": "laura/12-13Months",                         "label": "Laura aged 12-13 Months",              "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age 1" } ] },
        {"thumbnail": "laura/14m.jpg",          "dirName": "laura/ProfessionalPhotos",                  "label": "Laura aged 14 Months (Professional)",  "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age 1" } ] },
        {"thumbnail": "laura/13-16m.jpg",       "dirName": "laura/13-16Months",                         "label": "Laura aged 13-16 Months",              "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age 1" } ] },
        {"thumbnail": "laura/16-17m.jpg",       "dirName": "laura/16-17Months",                         "label": "Laura aged 16-17 Months",              "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age 1" } ] },
        {"thumbnail": "photos/zoo.jpg",         "dirName": "photos/Bristol Zoo",                        "label": "Bristol Zoo",                          "tags": [ { "tag": "2008" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/california.jpg",  "dirName": "photos/California",                         "label": "California",                           "tags": [ { "tag": "2008" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/birthday.jpg",    "dirName": "photos/Joint 88th and 90th Birthday Party", "label": "Joint 88th and 90th Birthday Party",   "tags": [ { "tag": "2008" }, { "tag": "Celebrations" } ] },
        {"thumbnail": "photos/giraffe.jpg",     "dirName": "photos/Whipsnade Zoo",                      "label": "Whipsnade Zoo",                        "tags": [ { "tag": "2008" }, { "tag": "Places" } ] },
        {"thumbnail": "luke/scan.jpg",          "dirName": "luke/ScanPhotos",                           "label": "Luke: 3d Scan Pictures",               "tags": [ { "tag": "2008" }, { "tag": "Luke" }, { "tag": "Before Birth" } ] },
        {"thumbnail": "laura/17-21m.jpg",       "dirName": "laura/17-21Months",                         "label": "Laura aged 17-21 Months",              "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age 1" } ] },
        {"thumbnail": "luke/justborn.jpg",      "dirName": "luke/JustBorn",                             "label": "Luke: Just Born",                      "tags": [ { "tag": "2008" }, { "tag": "Luke" }, { "tag": "Newborn" } ] },
        {"thumbnail": "luke/firstweek.jpg",     "dirName": "luke/FirstWeek",                            "label": "Luke: First Week",                     "tags": [ { "tag": "2008" }, { "tag": "Luke" }, { "tag": "Newborn" } ] },
        {"thumbnail": "photos/christmas08.jpg", "dirName": "photos/Christmas08",                        "label": "Christmas 2008",                       "tags": [ { "tag": "2008" }, { "tag": "Celebrations" } ] },
        {"thumbnail": "luke/1-8weeks.jpg",      "dirName": "luke/1-8Weeks",                             "label": "Luke aged 1-8 Weeks",                  "tags": [ { "tag": "2008" }, { "tag": "Luke" }, { "tag": "Age <1" } ] },
        {"thumbnail": "laura/21-25m.jpg",       "dirName": "laura/21-25Months",                         "label": "Laura aged 21-25 Months",              "tags": [ { "tag": "2008" }, { "tag": "Laura" }, { "tag": "Age 1" } ] },
        {"thumbnail": "luke/2-3m.jpg",          "dirName": "luke/2-3Months",                            "label": "Luke aged 2-3 Months",                 "tags": [ { "tag": "2009" }, { "tag": "Luke" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/eureka.jpg",      "dirName": "photos/Eureka Halifax",                     "label": "Eureka - Halifax",                     "tags": [ { "tag": "2009" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/scarborough.jpg", "dirName": "photos/Scarborough",                        "label": "Scarborough",                          "tags": [ { "tag": "2009" }, { "tag": "Places" } ] },
        {"thumbnail": "laura/25-28m.jpg",       "dirName": "laura/25-28Months",                         "label": "Laura aged 25-28 Months",              "tags": [ { "tag": "2009" }, { "tag": "Laura" }, { "tag": "Age 2" } ] },
        {"thumbnail": "luke/3-4m.jpg",          "dirName": "luke/3-4Months",                            "label": "Luke aged 3-4 Months",                 "tags": [ { "tag": "2009" }, { "tag": "Luke" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/isleofman.jpg",   "dirName": "photos/IsleOfMan",                          "label": "Isle of Man",                          "tags": [ { "tag": "2009" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/lauraandluke.jpg","dirName": "photos/Laura and Luke",                     "label": "Laura and Luke, Summer 09",            "tags": [ { "tag": "2009" }, { "tag": "Laura" }, { "tag": "Luke" } ] },
        {"thumbnail": "photos/folkfestival.jpg","dirName": "photos/Cleckheaton Folk Festival",          "label": "Cleakheaton Folk Festival",            "tags": [ { "tag": "2009" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/laura28-30m.jpg", "dirName": "photos/Laura28-30Months",                   "label": "Laura aged 28-30 Months",              "tags": [ { "tag": "2009" }, { "tag": "Laura" }, { "tag": "Age 2" } ] },
        {"thumbnail": "photos/luke5-7m.jpg",    "dirName": "photos/Luke5-7Months",                      "label": "Luke aged 5-7 Months",                 "tags": [ { "tag": "2009" }, { "tag": "Luke" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/magna.jpg",       "dirName": "photos/Magna Sheffield",                    "label": "Magna - Sheffield",                    "tags": [ { "tag": "2009" }, { "tag": "Places" } ] },
        {"thumbnail": "photos/diamond.jpg",     "dirName": "photos/DiamondAnniversary",                 "label": "Diamond Wedding Anniversary",          "tags": [ { "tag": "2009" }, { "tag": "Celebrations" } ] },
        {"thumbnail": "photos/laura30-33m.jpg", "dirName": "photos/Laura30-33Months",                   "label": "Laura aged 30-33 Months",              "tags": [ { "tag": "2009" }, { "tag": "Laura" }, { "tag": "Age 2" } ] },
        {"thumbnail": "photos/luke7-9m.jpg",    "dirName": "photos/Luke7-9Months",                      "label": "Luke aged 7-9 Months",                 "tags": [ { "tag": "2009" }, { "tag": "Luke" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/luke9-11m.jpg",   "dirName": "photos/Luke9-11Months",                     "label": "Luke aged 9-11 Months",                "tags": [ { "tag": "2009" }, { "tag": "Luke" }, { "tag": "Age <1" } ] },
        {"thumbnail": "photos/lauraandlukeoct09.jpg" ,"dirName": "photos/Laura and Luke Oct 09",        "label": "Laura and Luke, October 09",           "tags": [ { "tag": "2009" }, { "tag": "Laura" }, { "tag": "Luke" } ] },
        {"thumbnail": "photos/centerparcssep09.jpg"  ,"dirName": "photos/Center Parcs Sep 09",          "label": "Center Parcs September 09",            "tags": [ { "tag": "2009" }, { "tag": "Places" }, { "tag": "Laura" }, { "tag": "Luke" } ] },
        {"thumbnail": "photos/lukefirstbirthday.jpg" ,"dirName": "photos/LukeFirstBirthday",            "label": "Luke's First Birthday",                  "tags": [ { "tag": "2009" }, { "tag": "Celebrations" }, { "tag": "Luke" } ] }
    ]
};*/

var photoSubHeadings = { "headingList": [
                           { "tag" : "Laura", "headings": [ { "heading": "Before Birth" }, { "heading": "Newborn" }, { "heading": "Age <1" }, { "heading": "Age 1" }, { "heading": "Age 2" } ] },
                           { "tag" : "Luke",  "headings": [ { "heading": "Before Birth" }, { "heading": "Newborn" }, { "heading": "Age <1" }, { "heading": "Age 1" }, { "heading": "Age 2" } ] },
                           { "tag" : "All",   "headings": [ { "heading": "2000" }, { "heading": "2001" }, { "heading": "2002" }, { "heading": "2003" }, { "heading": "2004" }, { "heading": "2005" }, { "heading": "2006" }, { "heading": "2007" }, { "heading": "2008" }, { "heading": "2009" } ] }
                         ]
                       };


var tagListHTML="<a href='#' onclick='updatePhotoListHTML(\"Celebrations\");'>Celebrations</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2009\");'>2009</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2008\");'>2008</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2007\");'>2007</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2006\");'>2006</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2005\");'>2005</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2004\");'>2004</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2003\");'>2003</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2002\");'>2002</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2001\");'>2001</a> | "+
               "<a href='#' onclick='updatePhotoListHTML(\"2000\");'>2000</a> | " +
               "<a href='#' onclick='updatePhotoListHTML(\"Age 2\");'>Age 2</a> | " +
               "<a href='#' onclick='updatePhotoListHTML(\"Age 1\");'>Age 1</a> | " +
               "<a href='#' onclick='updatePhotoListHTML(\"Age <1\");'>Age &lt;1</a> | " +
               "<a href='#' onclick='updatePhotoListHTML(\"Newborn\");'>Newborn</a> | " +
               "<a href='#' onclick='updatePhotoListHTML(\"Before Birth\");'>Before Birth</a> | " +
               "<a onclick='hideTagList()'>Cancel</a>";

function showActiveTag() {
  var tagVariable=window.chosenTag;
  var content="";
  var foundMatch=false;

  if (tagVariable=='false' || tagVariable=='All') {  
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"All\");'><div class='tagSelected'>All Photos<br/><img border='0' src='/images/photos/rome.jpg'></div></a>";
    foundMatch=true;
  } else {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"All\");'><div class='tagSection'>All Photos<br/><img border='0' src='/images/photos/rome.jpg'></div></a>";
  }

  if (tagVariable=='Laura') {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"Laura\")'><div class='tagSelected'>Laura<br/><img border='0' src='/images/photos/laura.jpg'></div></a>";
    foundMatch=true;
  } else {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"Laura\")'><div class='tagSection'>Laura<br/><img border='0' src='/images/photos/laura.jpg'></div></a>";
  }

  if (tagVariable=='Luke') {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"Luke\");'><div class='tagSelected'>Luke<br/><img border='0' src='/images/photos/luke.jpg'></div></a>";
    foundMatch=true;
  } else {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"Luke\");'><div class='tagSection'>Luke<br/><img border='0' src='/images/photos/luke.jpg'></div></a>";
  }

  if (tagVariable=='Places') {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"Places\");'><div class='tagSelected'>Places<br/><img border='0' src='/images/photos/isleofman.jpg'></div></a>";
    foundMatch=true;
  } else {
    content=content+"<a href='#' onclick='updatePhotoListHTML(\"Places\");'><div class='tagSection'>Places<br/><img border='0' src='/images/photos/isleofman.jpg'></div></a>";
  }

  if (foundMatch) {
    content=content+"<a href='#' onclick='showTagList()'><div id='moreOptionsTagList' class='tagSectionWide'>More Options</div></a>&nbsp;";
  } else {
    content=content+"<div id='moreOptionsTagList' class='tagSectionWide'>" + tagListHTML + "</div>&nbsp;";
  }

  document.getElementById('tagList').innerHTML=content;

}

function showTagList() {
  document.getElementById('moreOptionsTagList').innerHTML=tagListHTML;
}
function hideTagList() {
  document.getElementById('moreOptionsTagList').innerHTML="<a href='#' onclick='showTagList()'>More Options</a>";
}

function updatePhotoListHTML(chosenTag) {
   window.chosenTag=chosenTag;
   makePhotoListHTML();
}

function makePhotoListHTML() {
   var tagVariable=window.chosenTag;
   var content="";
   var index = photoList.photos.length-1;
   var displayIndex = 0;

   showActiveTag();

   var headings;
   if (tagVariable=='Laura') {
     headings=photoSubHeadings.headingList[0].headings;
   } else if (tagVariable=='Luke') {
     headings=photoSubHeadings.headingList[1].headings;
   } else {
     headings=photoSubHeadings.headingList[2].headings;
   }
   var lastHeadingDisplayed="";


   for (var n=0; n<photoList.photos.length; n++) {

      var thumb = photoList.photos[index].thumbnail;
      var dir = photoList.photos[index].dirName;
      var tags = photoList.photos[index].tags;
      var label = photoList.photos[index].label;

      var showEntry = false;
      if (tagVariable=='All') {
        showEntry = true;
      } else {
         for (var m=0; m<tags.length; m++) {
            if (tags[m].tag==tagVariable) {
               showEntry = true;
            }
         }
      }

      if (showEntry==true) {

         /* If there is a tag on the list of subHeadings that does not match the last displayed subHeading, add a new subheading */
         for (var t=0; t<tags.length; t++) {
            var tempMatch=tags[t].tag;
            for (var s=0; s<headings.length; s++) {
               if ((tempMatch==headings[s].heading) && (tempMatch!=lastHeadingDisplayed)) {
                  content=content+"<div class='clear'></div><h3>" + tempMatch + "</h3>"
                  lastHeadingDisplayed=tempMatch;
                  displayIndex=0;
               }
            }
         }

         var elementID = 'photoBox'+n;
         var leftOrRight = '';

         if (displayIndex%2 == 0) {
            content=content+'<div class="leftcol">';
         } else {
            content=content+'<div class="rightcol">';
         }
         if (displayIndex<2) {
            content=content+'<div class="hr"><hr></div>';
         }

         content=content+'<p><img src="/images/' + thumb + '" /></p>';
         content=content+'<div class="photoIndexText"><a href="/' + dir + '/index.shtml">' + label + '</a>';
         content=content+'<br/><div class="tags">Tags: ';
         for (var m=0; m<tags.length; m++) {
           content=content+tags[m].tag;
           if (m<tags.length-1) {
             content=content+', ';
           }
         }
         content=content+'</div></div>';
         content=content+'<div class="clear"></div>';
         content=content+'<div class="hr"><hr></div></div>';
         if (displayIndex%2 != 0) {
            content=content+'<div class="clear"></div>';
         }
         displayIndex++;
      }
      index--;
   }
   document.getElementById('photoList').innerHTML=content;
   document.getElementById('photoTitle').innerHTML="Photos : "+tagVariable;
}


