// gallery.js
// -------------
// general gallery specific functions

// init and write the heading link line for gallery and report pages
function writeHeadLink()
{
    var curHome, curContact;

    if (GERMAN)
    {
       curHome     = "snoack taucht ab";
       curContact  = "Kontakt";
    }
    else
    {
       curHome     = "snoack underwater";
       curContact  = "Contact";
    }

    document.writeln("<div id=\"Jump1\" name=\"Jump1\">\n");
    document.writeln("<img src=\"../images/lk_water.jpg\" width=\"650\" height=\"30\" alt=\"\">\n");
    document.writeln("</div>\n\n");

    document.writeln("<div id=\"Link1\" name=\"Link1\">\n");
    document.writeln("<a class=\"blak\" href=\"http://www.snoack.de\">snoack</a>&nbsp;&nbsp;\n");
    document.writeln("<a class=\"blak\" href=\"http://www.dive.snoack.de\">" + curHome + "</a>&nbsp;&nbsp;\n");
    document.writeln("<a class=\"blak\" href=\"mailto:dive@snoack.de?subject=" + pageNAME + " " + pageTRIP + "\">" + curContact + "</a>&nbsp;&nbsp;&nbsp;&nbsp;\n");
    document.writeln("</div>\n\n");

    document.writeln("<div id=\"Ptitle\" name=\"Ptitle\">\n");
    document.writeln("<img src=\"images/title.jpg\" width=\"650\" height=\"50\" alt=\"\">\n");
    document.writeln("</div>\n\n");

    document.writeln("<div id=\"Ptype\" name=\"Ptype\">\n");
    //document.writeln("<img src=\"images/title.jpg\" width=\"650\" height=\"50\" alt=\"\">\n");
    document.writeln("<img src=\"../images/" + pageTYPE + "\" width=\"650\" height=\"50\" alt=\"\">\n");
    document.writeln("</div>\n\n");

    document.writeln("<div id=\"Bar1\" name=\"Bar1\">\n");
    document.writeln("<img src=\"../images/sm_water.jpg\" width=\"642\" height=\"10\" alt=\"\">\n");
    document.writeln("</div>\n\n");
}


// init and write the heading link line for gallery and report pages
function writePageLink()
{
    var curLang, curHint, curTrip, curDiary, curVideo, curMap, curPageNum, othLang, othText;
    var linkTrip, linkDiary, linkVideo, linkMap;

    if (GERMAN)
    {
       curLang  = "g_";
       othLang  = "e_";
       curHint  = "Siehe auch:";
       curVideo = "Videos";
       curTrip  = "Reisebericht";
       curDiary = "Reisetagebuch";
       curMap   = "Karte";
       othText  = "Show English Version";
    }
    else
    {
       curLang  = "e_";
       othLang  = "g_";
       curHint  = "See also:";
       curVideo = "Videos";
       curTrip  = "Trip Report";
       curDiary = "Itinerary (German only)";
       curMap   = "Map";
       othText  = "Deutsche Version zeigen";
    }

    curPageNum = "gallery" + pageNUM + ".html";

    if (hasVIDEO)   linkVideo = "href=\"" + curLang + "video.html\"";
    if (hasTRIP)    linkTrip  = "href=\"" + curLang + "report.html\"";
    if (hasDIARY)   linkDiary = "href=\"g_diary.html\"";
    if (hasMAP)     linkMap   = "href=\"javascript:showMap(" + mapVALUE + ")\"";


    document.writeln("<div id=\"Link2\" name=\"Link2\">\n");

    if (hasVIDEO || hasTRIP || hasDIARY || hasMAP)
        document.writeln("<span class=\"dbig\">" + curHint + "&nbsp;&nbsp;</span>\n\n");

    if (hasVIDEO)
    {
        document.writeln("<img src=\"../images/s_star.jpg\" width=\"14\" height=\"10\" alt=\"\">&nbsp;&nbsp;\n");
        document.writeln("<a class=\"dbig\" " + linkVideo + ">" + curVideo + "</a>&nbsp;&nbsp;\n");
    }

    if (hasTRIP)
    {
        document.writeln("<img src=\"../images/s_star.jpg\" width=\"14\" height=\"10\" alt=\"\">&nbsp;&nbsp;\n");
        document.writeln("<a class=\"dbig\" " + linkTrip + ">" + curTrip + "</a>&nbsp;&nbsp;\n");
    }

    if (hasDIARY)
    {
        document.writeln("<img src=\"../images/s_star.jpg\" width=\"14\" height=\"10\" alt=\"\">&nbsp;&nbsp;\n");
        document.writeln("<a class=\"dbig\" " + linkDiary + ">" + curDiary + "</a>&nbsp;&nbsp;\n");
    }

    if (hasMAP)
    {
        document.writeln("<img src=\"../images/s_star.jpg\" width=\"14\" height=\"10\" alt=\"\">&nbsp;&nbsp;\n");
        document.writeln("<a class=\"dbig\" " + linkMap + ">" + curMap + "</a>&nbsp;&nbsp;\n");
    }

    document.writeln("<img src=\"../images/s_star.jpg\" width=\"14\" height=\"10\" alt=\"\">&nbsp;&nbsp;\n");
    document.writeln("<a class=\"dbig\" href=\"" + othLang + curPageNum + "\">" + othText + "</a>\n");
    document.writeln("</div>\n\n");

    document.writeln("<div id=\"Bar2\" name=\"Bar2\">\n");
    document.writeln("<img src=\"../images/sm_water.jpg\" width=\"642\" height=\"10\" alt=\"\">\n");
    document.writeln("</div>\n\n");
}


// write links and content description of gallery parts
function writePartLink()
{
    document.writeln("<div id=\"Link3\" name=\"Link3\">\n");
    document.writeln(getPartLinks());
    document.writeln("</div>\n\n");

    document.writeln("<div id=\"Bar3\" name=\"Bar3\">\n");
    document.writeln("<img src=\"../images/sm_water.jpg\" width=\"642\" height=\"10\" alt=\"\">\n");
    document.writeln("</div>\n\n");
}


// write general gallery information
function writeInfo()
{
    document.writeln("<div id=\"Info\" name=\"Info\">\n");
    document.writeln("<table width=\"650\" cellspacing=\"2\" cellpadding=\"0\">\n");
    document.writeln(getLocationAndTime());
    document.writeln(getUWEquipment());
    document.writeln("</table>\n");
    document.writeln("</div>\n\n");


    document.writeln("<div id=\"Bar4\" name=\"Bar4\">\n");
    document.writeln("<img src=\"../images/sm_water.jpg\" width=\"642\" height=\"10\" alt=\"\">\n");
    document.writeln("</div>\n\n");
}


// write links and content description of gallery parts
function writeContinueLink()
{
    document.writeln("<div id=\"Link4\" name=\"Link4\">\n");
    document.writeln(getContinueLinks());
    document.writeln("</div>\n\n");
}


// write copyright div
function writeCopyRight(copyDate)
{
    document.writeln("<div id=\"CManta\" name=\"CManta\">\n");
    document.writeln("<table>\n");
    document.writeln("<tr><td valign=\"bottom\" width=\"140\"><img src=\"../images/c_manta.jpg\" width=\"140\" height=\"40\" alt=\"\"></td>\n");
    document.writeln("<td><br><span class=\"foot\">&copy; Sabine Noack, " + copyDate + "</span></td></tr>\n");
    document.writeln("</table>\n");
    document.writeln("</div>\n\n");
}





// Constructor for the picture object
function Picture(picId, picSer, picNum, gTitle, eTitle, gText, eText, Layout)
{
    this.picId = picId;
    this.bName = "images/" + picNum + "B_" + picSer + ".jpg";
    this.tName = "images/" + picNum + "T_" + picSer + ".jpg";

    if (Layout == 0)  // Portrait
    {
        this.bWidth  = 300;
        this.bHeight = 400;
        this.sHeight = 410;
        this.tWidth  = 75;
        this.tHeight = 100;
    }
    else              // Landscape
    {
        this.bWidth  = 400;
        this.bHeight = 300;
        this.sHeight = 310;
        this.tWidth  = 100;
        this.tHeight = 75;
    }

    if (GERMAN)
    {
        this.bAlt  = "Bild in 400 x 300 anzeigen.";
        this.Title = gTitle;
        this.Text  = gText;
        this.cWin  = "Fenster schlie&szlig;en";
    }
    else
    {
        this.bAlt  = "Show picture in 400 x 300.";
        this.Title = eTitle;
        this.Text  = eText;
        this.cWin  = "Close Window";
    }
}


function writeThumbRow5(myPic1, myPic2, myPic3, myPic4, myPic5)
{
    document.writeln("<table cellspacing=\"5\" cellpadding=\"0\"><tr>\n");
    writeThumbCell(myPic1); writeThumbCell(myPic2); writeThumbCell(myPic3); writeThumbCell(myPic4); writeThumbCell(myPic5);
    document.writeln("</tr></table>\n");
}


function writeThumbCell(myPic)
{
    var tdStart = "<td valign=\"bottom\" align=\"center\" width=\"102\" height=\"102\">";

    document.writeln(tdStart + "<a href=\"javascript:showPicture(" + myPic.picId + ")\"><img src=\"" + myPic.tName + "\" alt=\"" + myPic.bAlt + "\" title=\"" + myPic.bAlt + "\" width=\"" + myPic.tWidth + "\" height=\"" + myPic.tHeight + "\"></a></td>\n");
}


function showPicture(bigPic)
{
    curPicture = bigPic;

    picWindow=window.open("picture.html","PictureWindow","width=420,height=550,screenX=570,left=570,screenY=50,top=50,scrollbars=no");
    picWindow.focus();
}



function showMap(mWidth, mHeight, mLeft, mTop)
{
    picWindow=window.open("map.html","Map","width=" + mWidth + ",height=" + mHeight + ",screenX=" + mLeft + ",left=" + mLeft + ",screenY=" + mTop + ",top=" + mTop + ",scrollbars=no, resizable=yes");
    picWindow.focus();
}

