// 
// photo album handling
// copyright 2005, Bob Swanson
// You may use this code for your own
// slideshows, but please retain this
// copyright notice
//
var numbers = Array(
    "100_2513.jpg",
    //     The new computer screen system was started after a few days. This lists availability of seating at the restaurants.
    "100_2515.jpg",
    // Full-screen view
    "100_1775.jpg",
    //  The Liberty Restaurant, the upper level of the two main dining areas. The lower level is the Skyline Restaurant. This restaurant is appointed with styles from 1776 and images of the Founding Fathers.
    "100_2516.jpg",
    //    The wall mural at the entrance to the Liberty Restaurant lights up.
    "100_2517.jpg",
    //    Unlighted
    "100_2577.jpg",
    //   One of our Cruisecritic group dinners at the Liberty. They have nice round tables for 6 with window views.
    "100_2349.jpg",
    //   The 'Teppanyaki Room' inside the 'East Meets West' restaurant. We really enjoyed this (extra cost) restaurant, and the price was worth it.
    "100_2350.jpg",
    //   Another view of the 'Teppanyaki Room'
    "100_2426.jpg",
    //   A view of the Aloha Cafe, which is the buffet area. There is a lot of seating, in several separate areas.
    "100_2427.jpg",
    //   More of the Aloha Cafe
    "100_2446.jpg",
    //   The Aloha Cafe in use. Both people and equipment have to pass each other in the walkway (similar to the Star).
    "100_2447.jpg",
    //   Food stations in the Aloha Cafe. These are well designed. The only crush we had was for beverages, but there are other beverage stations.
    "100_2448.jpg",
    //   Yum!
    "100_2449.jpg",
    //   More food stations
    "100_2450.jpg",
    //   More...
    "100_2471.jpg",
    //   The Cadillac Diner. This was our favorite eating place. They had troubles at the start, but it became very efficient, and the food is GOOD.
    "100_2472.jpg",
    //   Happy diners at the Cadillac Diner
    "100_2473.jpg",
    //   More Cadillac Diner...
    "100_2475.jpg",
    //   Oh yes, the Diner has outside seating, too. We enjoyed watching the Panama Canal slip by, while devouring our meat loaf and wings.
    "100_2452.jpg",
    //   The Gold Rush Saloon, our favorite bar. They had a great selection of microbrews (Anchor Libery Ale, Sierra Nevada, etc), at about the same price as the usual brands at the rest of the bars.
    "100_2457.jpg",
    //   The theme of the Gold Rush is Alaska's gold rush, including this stuffed bear on the wall.
    "100_1792.jpg",
    //   Balcony area of Grand Suite, 12006. One of our Cruisecritic groups bought this suite, and invited us up for a drink and view of our departure from Miami. There is a jacuzzi on this balcony.
    "100_1910.jpg",
    //   Inside the Grand Suite. You can see the bedroom area from the living/dining room.
    "100_1916.jpg",
    //   Also inside the Grand Suite. Looking across the living room. The Cruisecritic folks are watching the big-screen TV.
    "100_2127.jpg",
    //   The Lana'i Bar is foward at 13, part of the 'conference center', and used only for official events like the Cruisecritic get-together.
    "100_2568.jpg",
    //   Another view of the Lana'i Bar, this time it is formal night, and there is a Captain's reception.
    "100_1795.jpg",
    //   Our balcony cabin, 7168, looking at the bed. You can see the corner storage area in the reflection. The bathroom is behind the white bulkhead.
    "100_1794.jpg",
    //   Looking back at the door, Bob barring the way. Bathroom on the left, closet on the right
    "100_1796.jpg",
    //   Peeking into bathroom, you can see the vacuum toilet and the shower. The room and bathroom were very small, compared with those we've had on the NCL Star and RCCL Legend of the Seas.
    "100_1797.jpg",
    //   Looking toward the balcony, you see the bed, and 'the world's hardest couch' (same construction as on the NCL Star). The balcony was actually roomy enough for two people.
    "100_1798.jpg",
    //   Foot of bed, television/storage area (safe was located here). As you can see, the cabin decorations are actually quite nice.
    "100_2318.jpg",
    //   Taken at Panama, this photo shows that our room and balcony are set back from the edge of the ship.
    "100_2395.jpg",
    //   Looking up toward our cabin, note the inset. The folks nearest the stern would have their view greatly blocked.
    "100_2396.jpg",
    //   Closer view of our cabin balcony
    "100_1891.jpg",
    //   The 'atrium' is just over 2 decks high, with the lower floor having a beautiful Great Seal of the United States.
    "100_1892.jpg",
    //   Closeup of the Seal. This area is just in front of the purser's desk.
    "100_1893.jpg",
    //   Grand staircase from level 5 to 6. Level 6 here has the cigar bar (Bob's favorite) and Pink's Champagne Bar.
    "100_1894.jpg",
    //   Looking across the atrium. Yes, that is a glass sculpture of the Washington Monument.
    "100_1896.jpg",
    //   Looking down the grand staircase. Pink's Champagne Bar is in the background of the upper level.
    "100_2470.jpg",
    //   Entrance to the cigar area. They have two large air cleaners near the comfy chairs. (It took some coaxing, however, to get the staff to put our ash trays.)
    "100_2413.jpg",
    //   Bob in Cigar Bar
    "100_2415.jpg",
    //   Looking from Cigar Bar
    "100_2416.jpg",
    //   Pink's Champagne Bar
    "100_2417.jpg",
    //   More of Pink's Champagne Bar
    "100_2522.jpg",
    //   Entrance to the Hollywood Theatre, where the evening shows take place. 
    "100_1924.jpg",
    //   Inside the Hollywood Theatre. You can see that there is pretty good leg room. 'Oscar' statues line the walls.
    "100_1925.jpg",
    //   More theatre...
    "100_1928.jpg",
    //   Musician on stage at Hollywood Theatre
    "100_1935.jpg",
    //   Passengers waiting to debark. The stairs are crammed full, as people try to get down to level 3.
    "100_2418.jpg",
    //   The Library
    "100_2419.jpg",
    //   More Library...
    "100_2420.jpg",
    //   More Library...
    "100_2421.jpg",
    //   More Library...
    "100_2444.jpg",
    //   The stairways are decorated with stunning panoramic photos. The rear stairs are all Hawaiian themes, such as these beautiful hula dancers.
    "100_2445.jpg",
    //   Closeup of the 'kumu hula' (hula teacher/master).  Other stairways on the ship have photos of famous American sights.
    "100_2469.jpg"
    //   Looking into the Atrium, which is at the same level as the pool. This is a relatively quiet and well-lit place to read.
    
);
var total_photos = 56;
var narratives = Array(
    // "100_2513.jpg",
"The new computer screen system was started after a few days; this lists availability of seating at the restaurants",
    // "100_2515.jpg",
"Full-screen view of the restaurant listing",
    // "100_1775.jpg",
    "The Liberty Restaurant, the upper level of the two main dining areas; the lower level is the Skyline Restaurant; the Liberty restaurant is appointed with styles from 1776 and images of the Founding Fathers",
    // "100_2516.jpg",
    "The wall mural at the entrance to the Liberty Restaurant is a 'flag' that lights up",
    // "100_2517.jpg",
    "The wall mural unlighted",
    // "100_2577.jpg",
    "One of our Cruisecritic group dinners at the Liberty restaurant; they have nice round tables for 6 with window views",
        // "100_2349.jpg",
    "The 'Teppanyaki Room' inside the 'East Meets West' restaurant; the extra cost was well worth it",
    // "100_2350.jpg",
    "Another view of the 'Teppanyaki Room'",
    // "100_2426.jpg",
    "A view of the Aloha Cafe (buffet); there is a lot of seating, layed out in several separate areas",
    // "100_2427.jpg",
    "More of the Aloha Cafe",
    // "100_2446.jpg",
    "The Aloha Cafe in use; both people and equipment have to pass each other in the walkway (similar to the Star)",
        // "100_2447.jpg",
    "Well designed food stations in the Aloha Cafe; the only crush was for beverages, but there are more beverage stations nearby",
    // "100_2448.jpg",
    "Food station will delicious pastries",
    // "100_2449.jpg",
    "More food stations",
    // "100_2450.jpg",
    "There was always a food station with fresh fruit",
    // "100_2471.jpg",
    "Our favorite eating place: the Cadillac Diner; being new, they had troubles at the start, but it became very efficient, and the food is GOOD",
    // "100_2472.jpg",
    "Happy diners at the Cadillac Diner",
    // "100_2473.jpg",
    "More Cadillac Diner...",
    // "100_2475.jpg",
    "Oh yes, the Diner has outside seating, too; we enjoyed watching the Panama Canal slip by, while devouring our meat loaf and wings",
    // "100_2452.jpg",
    "Our favorite bar: the Gold Rush Saloon; the selection of microbrews (Anchor Libery Ale, Sierra Nevada, etc) was great, at about the same price as the usual brands at the other bars",
    // "100_2457.jpg",
    "Alaska's gold rush is the theme, including this stuffed bear on the wall",
    // "100_1792.jpg",
    "Balcony area of Grand Suite, 12006; one of our Cruisecritic groups bought this suite, and invited us up for a drink and view of our departure from Miami; there is a jacuzzi on this balcony",
    // "100_1910.jpg",
    "Inside the Grand Suite; you can see the bedroom area from the living/dining room",
    // "100_1916.jpg",
    "Also inside the Grand Suite; looking across the living room; the Cruisecritic folks are watching the big-screen TV",
    // "100_2127.jpg",
    "The Lana'i Bar is foward at 13, part of the 'conference center', and used only for official events like the Cruisecritic get-together",
    // "100_2568.jpg",
    "Another view of the Lana'i Bar; tonight it is formal night, and there is a Captain's reception",
    // "100_1795.jpg",
    "Our balcony cabin, 7168, looking at the bed; you can see the corner storage area in the reflection; the bathroom is behind the white bulkhead",
    // "100_1794.jpg",
    "Looking back at the door, Bob barring the way; bathroom on the left, closet on the right",
    // "100_1796.jpg",
    "Peeking into bathroom, you can see the vacuum toilet and the shower; the room and bathroom were very small, compared with those we've had on the NCL Star and RCCL Legend of the Seas",
    // "100_1797.jpg",
    "Looking toward the balcony, you see the bed, and 'the world's hardest couch' (same construction as on the NCL Star); the balcony was actually roomy enough for two people",
    // "100_1798.jpg",
    "Foot of bed, television/storage area (safe was located here); as you can see, the cabin decorations are actually quite nice",
    // "100_2318.jpg",
    "Taken at Panama, this photo shows that our room and balcony are set back from the edge of the ship",
    // "100_2395.jpg",
    "Looking up toward our cabin, note the inset; the folks nearest the stern would have their view greatly blocked",
    // "100_2396.jpg",
    "Closer view of our cabin balcony",
    // "100_1891.jpg",
    "The 'atrium' is just over 2 decks high, with the lower floor having a beautiful Great Seal of the United States",
    // "100_1892.jpg",
    "Closeup of the Seal; this area is just in front of the purser's desk",
    // "100_1893.jpg",
    "Grand staircase from level 5 to 6; level 6 has the cigar bar (Bob's favorite), a Hawaiian mini-museum, and Pink's Champagne Bar",
    // "100_1894.jpg",
    "Looking across the atrium; yes, that is a glass sculpture of the Washington Monument",
    // "100_1896.jpg",
    "Looking down the grand staircase; Pink's Champagne Bar is in the background of the upper level",
    // "100_2470.jpg",
    "Entrance to the cigar area; there are two large air cleaners and comfy chairs, but it took some coaxing to procure ash trays",
    // "100_2413.jpg",
    "Bob in Cigar Bar (really, its a GOOD cigar, really)",
    // "100_2415.jpg",
    "Looking across the atrium from Cigar Bar to the Hawaiian mini-museum",
    // "100_2416.jpg",
    "Pink's Champagne Bar",
    // "100_2417.jpg",
    "Looking across the atrium at Pink's Champagne Bar",
    // "100_2522.jpg",
    "Entrance to the Hollywood Theatre, where the evening shows take place",
    // "100_1924.jpg",
    "Inside the Hollywood Theatre, with very good leg room; 'Oscar' statues line the walls",
    // "100_1925.jpg",
    "The stage is on the left",
    // "100_1928.jpg",
    "Musician on stage at Hollywood Theatre",
    // "100_1935.jpg",
    "Passengers waiting to debark; the stairs are crammed full, as people try to get down to level 3",
    // "100_2418.jpg",
    "The Library with a nice ship model near the entrance",
    // "100_2419.jpg",
    "More Library...",
    // "100_2420.jpg",
    "The interior of the Library is paneled with dark wood",
    // "100_2421.jpg",
    "The lighting is quite muted in the Library",
    // "100_2444.jpg",
    "The main stairways are decorated with stunning panoramic photos; the rear stairs are all Hawaiian themes, such as these beautiful hula dancers",
    // "100_2445.jpg",
    "Closeup of the 'kumu hula' (hula teacher/master); other stairways on the ship are decorated with photos of famous American sights",
    // "100_2469.jpg",
    "The Conservatory (same level as the pool) is a relatively quiet and well-lit place to read"
);
var titles = Array(
    // "100_2513.jpg",
    "Restaurant Availability Computer",
    // "100_2515.jpg",
    "Live Restaurant Listing",
    // "100_1775.jpg",
    "Liberty Restaurant",
    // "100_2516.jpg",
    "Entrance to the Liberty Restaurant",
    // "100_2517.jpg",
    "Wall Mural",
    // "100_2577.jpg",
    "Table for Six",
    // "100_2349.jpg",
    "Teppanyaki Room",
    // "100_2350.jpg",
    "In East Meets West",
    // "100_2426.jpg",
    "Aloha Cafe (Buffet)",
    // "100_2427.jpg",
    "Aloha Cafe",
    // "100_2446.jpg",
    "Meal Time",
    // "100_2447.jpg",
    "Food Stations",
    // "100_2448.jpg",
    "Yum!",
    // "100_2449.jpg",
    "Food Stations",
    // "100_2450.jpg",
    "Food Stations",
    // "100_2471.jpg",
    "Cadillac Diner",
    // "100_2472.jpg",
    "Cadillac Diner",
    // "100_2473.jpg",
    "Cadillac Diner",
    // "100_2475.jpg",
    "Outside at the Diner",
    // "100_2452.jpg",
    "Gold Rush Saloon",
    // "100_2457.jpg",
    "Stuffed Bear",
    // "100_1792.jpg",
    "Grand Suite",
    // "100_1910.jpg",
    "Inside the Grand Suite",
    // "100_1916.jpg",
    "Inside the Grand Suite",
    // "100_2127.jpg",
    "Lana'i Bar",
    // "100_2568.jpg",
    "Lana'i Bar",
    // "100_1795.jpg",
    "Cabin 7168",
    // "100_1794.jpg",
    "Looking Toward Door",
    // "100_1796.jpg",
    "Bathroom",
    // "100_1797.jpg",
    "Looking Toward Balcony",
    // "100_1798.jpg",
    "More of Cabin 7168",
    // "100_2318.jpg",
    "Picture from Balcony",
    // "100_2395.jpg",
    "Our Cabin",
    // "100_2396.jpg",
    "Our Cabin",
    // "100_1891.jpg",
    "The Atrium",
    // "100_1892.jpg",
    "Seal of the United States",
    // "100_1893.jpg",
    "Grand Staircase",
    // "100_1894.jpg",
    "Atrium View",
    // "100_1896.jpg",
    "Grand Staircase",
    // "100_2470.jpg",
    "Cigar Area",
    // "100_2413.jpg",
    "Bob in Cigar Bar",
    // "100_2415.jpg",
    "View from Cigar Bar",
    // "100_2416.jpg",
    "Pink's Champagne Bar",
    // "100_2417.jpg",
    "Pink's Champagne Bar",
    // "100_2522.jpg",
    "Hollywood Theatre Entrance",
    // "100_1924.jpg",
    "Inside the Hollywood Theatre",
    // "100_1925.jpg",
    "Theatre View",
    // "100_1928.jpg",
    "Musician",
    // "100_1935.jpg",
    "Crush of Passengers",
    // "100_2418.jpg",
    "The Library",
    // "100_2419.jpg",
    "Library",
    // "100_2420.jpg",
    "Library",
    // "100_2421.jpg",
    "Library",
    // "100_2444.jpg",
    "Hula Dancers",
    // "100_2445.jpg",
    "Kumu Hula",
    // "100_2469.jpg",
    "Conservatory"
);

var current = 0;

var first_time = 1;

function first_pass()
{
    if (first_time === 1)
    {
      //  alert("first pass");
        load_picture(0); // load picture zero
        first_time = 0; // prevent re-invocation
    }
}

function build_selector()
{
    var selector = document.getElementById("picture_selector"); 
    
    for (i = 0 ; i < total_photos ; i++)
    {
        newtext = document.createTextNode(i + " - " + titles[i]); // text content
        newoption = document.createElement("option");
        newoption.setAttribute("value",i); // value is pic number only
        newoption.appendChild(newtext); // add text
        selector.appendChild(newoption);
    }
}

function create_selector()
{
    for (i = 0 ; i < total_photos ; i++)
    {
        document.write('<option value="' + i + '">' + 
                       i + " - " + titles[i] + '</option>');
    }
}

function get_thumb_url (position) {

    url = "http://www219.pair.com/swansonr/pics/panama2005/lthumbs/th_" + numbers[position];
    return url;
}

function get_picture_url (position) {

    url = "http://www219.pair.com/swansonr/pics/panama2005/" + numbers[position];
    return url;
}

//
// advance and load next if there is one
//
function load_next() {
    //alert(current);
    current = current + 1;
    if (current < total_photos)
    {
        load_picture(current);
    }
    else
    {
        current = current - 1;
        load_picture(total_photos - 1);
    }
}
//
// pop up window with current big photo
//
function load_current() {
    var the_picture_url = get_picture_url(current);
    window.open(the_picture_url,'panama_canal_photo','resizable=yes,scrollbars=yes');
}

function load_selected()
{
    var selector = document.getElementById("picture_selector"); 
    var cur = selector.options[selector.selectedIndex].value;
    //alert("load: " + cur);
    current = parseInt(cur);
    load_picture(current);
}

//
// decrement and load previous if there is one
//
function load_previous() {
    current = current - 1;
    if (current >= 0)
    {
        load_picture(current);
    }
    else
    {
        current = 0;
        load_picture(0);
    }
}

function load_picture(at)
{
    var ximage = document.getElementById("thumb"); // the IMG tag
    var the_thumb_url = get_thumb_url(at);
    ximage.setAttribute("src",the_thumb_url);
    var the_picture_url = get_picture_url(at);
    set_text(the_picture_url);
    set_head_narrative(at);
}

function removeAllChildren(xxx)
{
    while (xxx.hasChildNodes()) 
    {
        xxx.removeChild(xxx.firstChild);
    }
}

//
// sets the prompt just below the photo with
// an anchor that loads the full-size photo
//
function set_text(text)
{
    var prompt = document.getElementById("prompt");
    removeAllChildren(prompt); // remove all content
    //
    // add back in
    //
    newtext = document.createTextNode("View Larger Photo"); // text for anchor
    newpara = document.createElement("p"); // new wrapper for anchor
    newpara.setAttribute("class","timestamp"); // make it smaller 
    anchor = document.createElement("a"); // new anchor
    anchor.setAttribute("href",text);
    anchor.appendChild(newtext); // add text to anchor
    newpara.appendChild(anchor); // put anchor inside paragraph
    // DO NOT DO THIS FOR NOW  prompt.appendChild(newpara); // put paragraph into div
}


function set_head_narrative(position)
{
    //
    // first the heading
    //
    var subh = document.getElementById("subhead");
    removeAllChildren(subh); // remove all content
    //
    // add back in
    //
    newtext = document.createTextNode(titles[position]); // text for title
    newhead = document.createElement("h2"); 
    newhead.setAttribute("class","heading2");
    newhead.appendChild(newtext); // add text to heading
    subh.appendChild(newhead); // put heading into div
    //
    // now the narrative below
    //
    var narr = document.getElementById("narrative");
    removeAllChildren(narr); // remove all content
    //
    // add back in
    //
    newtext = document.createTextNode("[Image: " + position + "] " + narratives[position]); // text for narrative
    newpara = document.createElement("p"); // new wrapper for narrative
    newpara.setAttribute("class","body"); // make it normal
    newpara.appendChild(newtext); // add text to paragraph
    narr.appendChild(newpara); // put paragraph into div
}
