// GLOBALE VARIABLEN
var gstrLastChanges = '22.02.12';
var gstrWochentage  = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
var gobjDatum       = new Date();
var gstrUri         = '';
var garrUri         = [];
var gintEvent, gintCat;
garrUri['all']      = 0;
garrUri['lng']      = 0;
garrUri['cat']      = 0;
garrUri['num']      = 0;
garrUri['tim']      = '';

////
// !Liest Uri-Parameter in garrUri[] ein
//
function doReadUri()
{
    var intIndex, arrUri;
    var strUri       = window.location.href;
    var intPosition  = strUri.indexOf('#');
    if(intPosition != -1)
    {
        arrUri = strUri.split('#');
        strUri = arrUri[0];
    }
    var intPosition  = strUri.indexOf('?');
    if(intPosition != -1)
    {
        strUri = strUri.substring(intPosition + 1, strUri.length);
        arrUri = strUri.split('&');
        for(intIndex = 0; intIndex < arrUri.length; intIndex++)
        {
            strUri      = arrUri[intIndex];
            intPosition = strUri.indexOf('=');
            garrUri[strUri.substr(0, intPosition).toLowerCase()] = strUri.substr(intPosition + 1, strUri.length);
        }
    }
    gstrUri = '?lng=' + garrUri['lng'] + '&all=' + garrUri['all'];
}

////
// !Liest Uri und setzt Num und Cat Parameter
//
function doGetParams()
{
    doReadUri();
    if(garrUri['tim'] != '')
    {
        for(intIndex = (garrGallery.length - 1); intIndex > 0; intIndex--)
        {
            if(garrGallery[intIndex][0][0] == garrUri['tim'])
            {
                garrUri['num'] = intIndex;
                intIndex = 0;
            }
        }
    }
    gintEvent = parseInt(garrUri['num'], 10);
    gintCat   = parseInt(garrUri['cat'], 10);
}

////
// !Ersetzt Teile eines Textes.
//
// !param   string      strText                 Der gesamte Text.
// !param   string      strVorher               Der Text der ersetzt werden soll.
// !param   string      strNachher              Der Text, durch den ersetzt werden soll.
//
// !returns string                              Den bearbeiteten Text.
//
function fnStrReplace(strText, strVorher, strNachher)
{
    var intIndex;
    while((intIndex = strText.indexOf(strVorher)) != -1)
        strText = strText.substr(0, intIndex) + strNachher + strText.substring(intIndex + strVorher.length, strText.length);
    return strText;
}

////
// !Erzeugt einen X-stelligen String aus einer Zahl
//
// !param   integer     intZahl                 Zahl
// !param   integer     intStellen              Anzahl Stellen
//
// !returns string                              x-stellige Zahl
//
function fnStellenZahl(intZahl, intStellen)
{
    var strZahl = '#' + (intZahl + 100000000);
    if(intStellen==2 && intZahl<100)
        return strZahl.substr(10 - intStellen, intStellen);
    else
        return strZahl.substr(7, 3);
}

////
// !Plottet Seiten-Kopf
//
function doPlotPageHeader(strTitel)
{
    document.write('<html><head><title>MotionPictureCars.net - The collection of famous american movie cars</title></head>');
    document.write('<body bgcolor=#606060 text=#ffffff link=#ffffff vlink=#ffffff alink=#ff0000 topmargin=0 leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0>');

    document.write('<center><table border=0 cellspacing=5 cellpadding=5 width=990 bgcolor=#000000 height=100%><tr><td valign=top>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');
    document.write('<img src=gfx/trpix.gif width=1 height=3><br>');

    document.write('<table border=0 width=100% cellspacing=0 cellpadding=0>');
    document.write('<tr><td align=center><a href="http://www.motionpicturecars.net"><img src="gfx/logos/mopica.jpg" border=0></a></td></tr>');
    document.write('</table>');

    document.write('<img src=gfx/trpix.gif width=1 height=2><br>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0>');
    document.write('<tr><td colspan=2 bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr>');
    document.write('<tr><td bgcolor=#204080><font face=arial color=#ffff80 size=2>&nbsp; ' + strTitel);
    document.write('</td><td bgcolor=#204080 align=right><font face=arial color=#ffff80 size=2>' + gstrWochentage[gobjDatum.getDay()] + ', ' + fnStellenZahl(gobjDatum.getDate(), 2) + '.' + fnStellenZahl(gobjDatum.getMonth()+1, 2) + '.' + fnStellenZahl(gobjDatum.getFullYear(), 4) + ' &nbsp;</td></tr>');
    document.write('<tr><td colspan=2 bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');
    document.write('<img src=gfx/trpix.gif width=1 height=10><br>');

    if(window.location.href.substr(0,7) != 'file://')
    {
        // Google-Analytics
        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    }
}

////
// !Plottet Menüleiste mit angewähltem Menüpunkt
//
// !param   integer     intMenupunkt            angewählter Punkt
//
function doPlotNavibar()
{
    var intIndex, strLink1, strLink2;
    var intMenupunkt = 0;

    var arrMenu = [
        [0,0,0,0],
        ['Home',              0, 'index.htm',       0],
        ['News',              1, 'news.htm',        0],
        ['About us',          0, 'about.htm',       0],
        ['X-Gallery',         3, 'xgallery.htm',    0],
        ['Forum',             0, 'forum.htm',       0],
        ['Events',            1, 'event-diary.htm', 0],
        ['Links',             0, 'links.htm',       0],
      ['K.I.T.T.',          2, 'xx',1],
        ['Overview',          0, 'kitt-start.htm',  1],
        ['Gallery',           1, 'kitt-gallery.htm',1],
        ['Diary KITT2nd',     0, 'kitt-diary.htm',  1],
        ['Diary KITT4th',     0, 'kitc-diary.htm', 1],
        ['Television series', 0, 'kitt-movie.htm',  1],
      ['DeLorean',          2, 'xx',2],
        ['Overview',          0, 'delo-start.htm',  2],
        ['Gallery',           1, 'delo-gallery.htm',2],
        ['Diary',             0, 'delo-diary.htm',  2],
        ['Film trilogy',      0, 'delo-movie.htm',  2],
      ['Christine',         2, 'xx',3],
        ['Overview',          0, 'tine-start.htm',  3],
        ['Gallery',           1, 'tine-gallery.htm',3],
        ['Diary',             0, 'tine-diary.htm',  3],
        ['Movie & Book',      0, 'tine-movie.htm',  3],
      ['Bandit',            2, 'xx',4],
        ['Overview',          0, 'bndt-start.htm',  4],
        ['Gallery',           1, 'bndt-gallery.htm',4],
        ['Restoration diary', 0, 'bndt-diary.htm',  4],
        ['Film trilogy',      0, 'bndt-movie.htm',  4],
    []];

    var arrMain = [
        ['kitt', 'Knight Rider', '1985 Pontiac Trans Am',   9],
        ['delo', 'Time machine', '1981 DeLorean DMC-12',    14],
        ['tine', 'Christine',    '1958 Plymouth Belvedere', 19],
        ['bndt', 'Bandit',       '1981 Pontiac Trans Am',   24]
    ];

    // NAVI-BAR

    document.write('<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td width=1% valign=top>');
    document.write('<table width=140 border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#000000><a href="http://www.rent-a-kitt.de/board/portal.php" target="_blank"><img border=0 src=gfx/logos/pkev140px.png></a><br><img src=gfx/trpix.gif width=1 height=17></td></tr><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr>');
    for(intIndex = 1; intIndex < (arrMenu.length - 1); intIndex++)
    {
        if(window.location.href.indexOf(arrMenu[intIndex][2]) > -1)
            intMenupunkt = intIndex;

        if(arrMenu[intIndex][2] == 'xx')
        {
            strLink1 = '';
            strLink2 = '';
        }
        else
        {
            strLink1 = '<a style="text-decoration:none" href="' + arrMenu[intIndex][2] + gstrUri + '" onmouseover="self.status=\'' + arrMenu[intIndex][0] + '\'; return true;">';
            strLink2 = '</font></a>';
        }

        if(intIndex == intMenupunkt)
            document.write('<tr><td align=right bgcolor=#ffffff><b>' + strLink1 + '<font color=#000000 face=arial size=3>' + arrMenu[intIndex][0] + '</font>' + strLink2 + '</b>');
        else
        {
            switch(arrMenu[intIndex][1])
            {
                case 0:
	                document.write('<tr><td align=right bgcolor=#204080>' + strLink1 + '<font color=#ffffff face=arial size=2>' + arrMenu[intIndex][0] + '</font>' + strLink2);
                    break;
                case 1:
                    document.write('<tr><td align=right bgcolor=#204080><b>' + strLink1 + '<font color=#ffff80 face=arial size=2>' + arrMenu[intIndex][0] + '</font>' + strLink2 + '</b>');
                    break;
                case 2:
                    document.write('<tr><td align=right bgcolor=#000000><i><b>' + strLink1 + '<font color=#ff8000 face=arial size=3>' + arrMenu[intIndex][0] + '</font>' + strLink2 + '</b></i>');
                    break;
                case 3:
                    document.write('<tr><td align=right bgcolor=#204080><b>' + strLink1 + '<font color=#ff2020 face=arial size=2>' + arrMenu[intIndex][0] + '</font>' + strLink2 + '</b>');
                    break;
            }
        }
        document.write(' &nbsp;</td></tr><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr>');
    }
    document.write('</table><br><center><a href="http://www.rent-a-kitt.de/cms/index.php?option=com_content&view=article&id=82&Itemid=47&lang=de" target="_blank"><img src="gfx/logos/vwfree.png" border=0></a></center>');

    document.write('<br></td><td width=1% >&nbsp;&nbsp;&nbsp;</td><td width=98% valign=top>');

    // MAIN-TABS

    document.write('<table border=0 cellspacing=0 cellpadding=0><tr>');

    for(intIndex = 0; intIndex < 4; intIndex++)
    {
        if((intIndex + 1) == arrMenu[intMenupunkt][3])
        {
            strCol1 = 'ffffff';
            strCol2 = '000000';
            strCol3 = '550000';
        }
        else
        {
            strCol1 = '2040ff';
            strCol2 = 'ffff44';
            strCol3 = '102080';
        }

        document.write('<td><table border=0 cellspacing=0 cellpadding=0><tr>');
        document.write('<td rowspan=2 bgcolor=' + strCol1 + ' valign=top width=78><a href="' + arrMain[intIndex][0] + '-start.htm' + gstrUri + '"><img border=0 src=gfx/tab-' + arrMain[intIndex][0] + '.gif width=78 height=30></a></td>');
        document.write('<td colspan=3><img src=gfx/trpix.gif width=124 height=6></td>');
        document.write('</tr><tr>');
        document.write('<td bgcolor=#' + strCol1 + ' width=99%><b> &nbsp; <a style="text-decoration:none" href="' + arrMain[intIndex][0] + '-start.htm' + gstrUri + '"><font face=arial size=3 color=#' + strCol2 + '>' + arrMain[intIndex][1] + '</font></a></td>');
        document.write('<td bgcolor=#' + strCol1 + ' width=6 align=right valign=top><img src=gfx/tab-rechts.gif></td>');
        document.write('<td width=4><img src=gfx/trpix.gif width=4 height=1></td>');
        document.write('</tr><tr>');
        document.write('<td colspan=3 bgcolor=#' + strCol3 + '><font face=arial size=1>&nbsp;' + arrMain[intIndex][2] + '</font></td>');
        document.write('<td width=4><img src=gfx/trpix.gif width=4 height=1></td>');
        document.write('</tr></table></td>');

    }
    document.write('</tr></table>');

    document.write('<img src=gfx/trpix.gif width=1 height=7><br>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');
    document.write('<img src=gfx/trpix.gif width=1 height=3><br>');

}

////
// !Plottet Ordner-Position
//
function doPlotLocation(arrFolders)
{
    var intIndex;
    document.write('<br><font face=arial size=3><b>');
    for(intIndex = 0; intIndex < (arrFolders.length - 1); intIndex+=2)
        document.write('<a href="' + arrFolders[intIndex+1] + gstrUri + '">' + arrFolders[intIndex+0] + '</a> &gt;&gt; ');
    document.write(arrFolders[intIndex] + '</b></font><br>');
}

////
// !Plottet Titelbar
//
function doPlotTitle(strText)
{
    document.write('<br><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');
    document.write('<table border=0 width=100% cellspacing=0 cellpadding=0><tr>');
    document.write('<td bgcolor=#000080><font face=arial size=5 color=#ffff80><b>&nbsp;' + strText + '</font></b></td></tr></table>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table><br><font face=arial size=2>');
}

////
// !Plottet anstehenden Event
//
function doPlotEventline(strDate, strTitle, strUrl)
{
    document.write('<big><b><font color="#ff4000">' + strDate + '<font color="#0080ff"> &nbsp;=> &nbsp; <a href="' + strUrl + '" target="_blank"><font color="#ffffc0">' + strTitle + '</a></b></big><br>');
}

////
// !Plottet anstehenden Event
//
function doPlotEventline0(strDate, strTitle, strUrl)
{
    document.write(strDate + '<font color="#0080ff"> => <a href="' + strUrl + '" target="_blank"><font color="#ffffff">' + strTitle + '</a>');
}

gstrPicCopyright = '';

////
// !Plottet Bildergallerie
//
function doPlotPictures(arrScreens, arrDescriptions, strFolder)
{
    var intIndex, intCount, strUrlBase, strUrl, strTitle;

    var C_COLNUM   = 4;
    var C_COLWIDTH = 160;

    strUrlBase = 'photos/' + strFolder + '/' + strFolder + '-';

    if((gbolClickHint == true) || (gbolClickHint == 2))
    {
        gintSubGallery = 0;
        document.write('<big><b><i><font color="#ffc000">(click to enlarge)</font></i></big>');
        if((garrUri['all'] == '0') && (gbolClickHint != 2))
            document.write(' &nbsp; [ <a href="' + fnStrReplace(window.location.href, 'all=' + garrUri['all'], 'all=' + (1-garrUri['all'])) + '#all">Show all pictures</a> ]');
        document.write('</b><br> <br>');
        gbolClickHint = false;
    }
    gintSubGallery++;

    document.write('<table border=0 cellspacing=0 cellpadding=0><tr><td><img src=gfx/trpix.gif width=20></td><td bgcolor=#0000a0><table border=0 cellspacing=4 cellpadding=2>');
    intCount = 0;
    do
    {
        document.write('<tr>');
        for(intIndex = intCount; intIndex < (intCount + C_COLNUM); intIndex++)
        {
            if(intIndex < arrScreens.length)
            {
                if(arrDescriptions != 0)
                {
                    if(arrDescriptions[intIndex] == 0)
                        arrDescriptions[intIndex] = arrDescriptions[intIndex - 1];
                    strTitle = arrDescriptions[intIndex];
                }
                else
                    strTitle = '';
                document.write('<td bgcolor=#000000 align=center><a href="' + strUrlBase + fnStellenZahl(arrScreens[intIndex], 2) + '.jpg" rel="lytebox[gallery' + gintSubGallery + ']" title="' + strTitle + gstrPicCopyright + '" target="_blank"><img src="' + strUrlBase + fnStellenZahl(arrScreens[intIndex], 2) + 's.jpg" height="120" border="0"></a><br><img src=gfx/trpix.gif width=' + C_COLWIDTH + ' height=1></td>');
            }
            else if(arrScreens.length > C_COLNUM)
                document.write('<td bgcolor=#000000><img src=gfx/trpix.gif width=' + C_COLWIDTH + ' height=1></td>');
        }
        document.write('</tr>');

        if(arrDescriptions != 0)
        {
            document.write('<tr>');
            for(intIndex = intCount; intIndex < (intCount + C_COLNUM); intIndex++)
            {
                document.write('');
                if(intIndex < arrScreens.length)
                    document.write('<td bgcolor=#000050 align=center><font face=arial size=1>' + arrDescriptions[intIndex] + '</td>');
                else if(arrScreens.length > C_COLNUM)
                    document.write('<td bgcolor=#000050 align=center><font face=arial size=1>&nbsp;</td>');
            }
            document.write('</tr>');
        }
        intCount += 4;
    }
    while (intCount < arrScreens.length);
    document.write('</table></td></tr></table><br>');
}

////
// !Plottet Seiten-Fuß
//
function doPlotPageFooter()
{
    document.write('</td></tr></table>');
    document.write('<img src=gfx/trpix.gif width=1 height=10><br>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0>');
    document.write('<tr><td colspan=3 bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr>');
    document.write('<tr><td colspan=2 bgcolor=#204080><font face=arial color=#ffff80 size=2>&nbsp; Last Changes: ' + gstrLastChanges);
    document.write('</td><td bgcolor=#204080 align=right><font face=arial color=#ffff80 size=2>A <a href="http://www.prodatron.net" target="_blank"><b>Prodatron</b></a> Production in 2012 &nbsp; <b>[ <a href="impressum.htm' +  gstrUri+ '">Impressum</a> ]</b> &nbsp; </td></tr>');
    document.write('<tr><td colspan=3 bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');

    document.write('</td></tr></table>');

    // Google-Analytics
    try {
        var pageTracker = _gat._getTracker("UA-1411887-4");
        pageTracker._trackPageview();
    } catch(err) {}
}

////
// !Ereignis anzeigen
//
function doPlotEvent(arrData)
{
    var intIndex, intIndex2, strUrlBase, arrScreens, strTemp;

    var C_COLNUM   = 4;
    var C_COLWIDTH = 160;

    if(garrUri['f'] != null)
    {
        document.write('<textarea cols="100" rows="20">');
        for(intIndex = 1; intIndex < (arrData.length - 1); intIndex++)
        {
            strTemp = arrData[intIndex][0];
            strTemp = fnStrReplace(strTemp, '<br>',   '\n');
            strTemp = fnStrReplace(strTemp, '<b>',    '[b]');
            strTemp = fnStrReplace(strTemp, '</b>',   '[/b]');
            strTemp = fnStrReplace(strTemp, '<i>',    '[i]');
            strTemp = fnStrReplace(strTemp, '</i>',   '[/i]');
            strTemp = fnStrReplace(strTemp, '<u>',    '[u]');
            strTemp = fnStrReplace(strTemp, '</u>',   '[/u]');
            strTemp = fnStrReplace(strTemp, '<big>',  '[size=18]');
            strTemp = fnStrReplace(strTemp, '</big>', '[/size]');
            strTemp = fnStrReplace(strTemp, '<a href="','[url=');
            strTemp = fnStrReplace(strTemp, '</a>',   '[/url]');
            strTemp = fnStrReplace(strTemp, '<ul>',   '\n\n');
            strTemp = fnStrReplace(strTemp, '</ul>',  '\n');
            strTemp = fnStrReplace(strTemp, '<li>',   '- ');
            strTemp = fnStrReplace(strTemp, '</li>',  '\n');
            document.write(strTemp + '\n\n');
            if(arrData[intIndex][1] != '')
            {
                if(intIndex == 1)
                    document.write('[b][i](klicken zum Vergrößern)[/b][/i]\n\n');
                for(intIndex2 = 0; intIndex2 < arrData[intIndex][2].length; intIndex2++)
                    document.write('[url=http://www.motionpicturecars.net/photos/' + arrData[intIndex][1] + '/' + arrData[intIndex][1] + '-' + fnStellenZahl(arrData[intIndex][2][intIndex2], 2) + '.jpg][img]http://www.motionpicturecars.net/photos/' + arrData[intIndex][1] + '/' + arrData[intIndex][1] + '-' + fnStellenZahl(arrData[intIndex][2][intIndex2], 2) + 's.jpg[/img][/url] ');
                document.write('\n\n');
            }
        }
        strTemp = window.location.href;
        strTemp = fnStrReplace(strTemp, '&f=1', '');
        strTemp = fnStrReplace(strTemp, 'file:///C:/archive/projekte/web_', 'http://www.');
        document.write('CU,\nProdatron\n\nDer Artikel mit Bildkommentaren und weiteren Fotos auf meiner Homepage:\n[url]' + strTemp + '[/url]</textarea>');
    }

    document.write('<br><table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');
    document.write('<table border=0 width=100% cellspacing=0 cellpadding=0><tr>');
    document.write('<td width=1% align=right bgcolor=#000080><font face=arial size=5 color=#ff6000><b>' + arrData[0][0] + '&nbsp;&nbsp;&nbsp;</font></td>');
    document.write('<td width=98% bgcolor=#000080><b><font face=arial size=5 color=#ffff80>' + arrData[0][2] + '</font></b></td>');
    document.write('<td width=1% align=right bgcolor=#000080><font face=arial size=2>&nbsp;&nbsp;&nbsp;<b>Category:&nbsp;' + garrCat[arrData[0][1]] + '</font></td>');
    document.write('</tr></table>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table><br>');

    for(intIndex = 1; intIndex < (arrData.length - 1); intIndex++)
    {
        document.write('<font face=arial size=2>' + arrData[intIndex][0] + '<br> <br>');

        if(arrData[intIndex][1] != '')
        {
            arrScreens = arrData[intIndex][2];
            if((arrScreens.length == 2) && (arrScreens[0] < 0) && (arrScreens[1] < 0))
            {
                arrScreens = [];
                intCount   = 0;
                for(intIndex2 = (0 - arrData[intIndex][2][0]); intIndex2 <= (0 - arrData[intIndex][2][1]); intIndex2++)
                    arrScreens[intCount++] = intIndex2;
            }
            doPlotPictures(arrScreens, arrData[intIndex][3], arrData[intIndex][1]);
        }
    }

    document.write('<br> <br> <br><a name="all"></a>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table>');
    document.write('<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td bgcolor=#000080 align=center><font face=arial size=3 color=#ffffff>');
    document.write('<b>[ <a href="');
    strUrl = window.location.href;
    strUrl = fnStrReplace(strUrl, 'all=' + garrUri['all'], 'all=' + (1-garrUri['all']));
    if(garrUri['all'] == '0')
        document.write(strUrl + '#all">Show all pictures</a> ]</b>');
    else
        document.write(fnStrReplace(strUrl, '#all', '') + '">Hide all pictures</a> ]</b>');
    document.write('</font></td></tr></table>');
    document.write('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td bgcolor=#40c0ff><img src=gfx/trpix.gif width=1 height=1></td></tr></table><br>');
    if(garrUri['all'] != '0')
    {
        for(intIndex = 0; intIndex < (arrData[arrData.length - 1].length / 2); intIndex++)
        {
            arrScreens = [];
            for(intIndex2 = 0; intIndex2 < (arrData[arrData.length - 1][intIndex * 2 + 1]); intIndex2++)
                arrScreens[intIndex2] = intIndex2 + 1;
            doPlotPictures(arrScreens, 0, arrData[arrData.length - 1][intIndex * 2]);
        }
    }
}

function fnHighlight(intActual, intGlobal)
{
    if(intActual == intGlobal)
        return strHtml = '<font color="#ffc040"><a name';
    else
        return strHtml = '<font><a href';
}

var garrCat      = [0, 'Base',    'Exterieur', 'Interieur', 'Electronics', 'Meetings', 'Headquarter', 'Props',   'Cross',   'KITT',    'DeLorean', 'Christine', 'Events',  'Events',  'Bandit',  'Convertible'];
var garrCatCol   = [0, '#ff0000', '#40c0ff',   '#ffff00',   '#ff6000',     '#00ff00',  '#806060',     '#0080ff', '#00ff00', '#ffc000', '#40c0ff',  '#ff0000',   '#00ff00', '#00ff00', '#ff80ff', '#80ff80'];

////
// !Tagebuch-Auswahl plotten
//
function doPlotDiarySelection(intCat, strName, intNum)
{
    var intIndex, strLink, intCount;

    if(intCat > -1)
    {
        document.write('<center><font size=3><b>[ ' + fnHighlight(0, intCat) + '="' + strName + '-diary.htm' + gstrUri + '&cat=0">All</a></font>');
        for(intIndex = 1; intIndex < intNum; intIndex++)
        {
            document.write(' | ' + fnHighlight(intIndex, intCat) + '="' + strName + '-diary.htm' + gstrUri + '&cat=' + intIndex + '">' + garrCat[intIndex] + '</a></font>');
        }
        document.write(' ]</b></center><br>');
    }

    document.write('<br><table border=0 cellspacing=0 width=100% cellpadding=0><tr><td bgcolor=#0000a0><table border=0 cellspacing=4 width=100% cellpadding=4><tr>');
    document.write('<td width=1% bgcolor=#0000ff><font face=arial size=3><b>Preview</td>');
    document.write('<td width=1% bgcolor=#0000ff><font face=arial size=3><b>Date</td>');
    document.write('<td width=1% bgcolor=#0000ff><font face=arial size=3><b>Category</td>');
    document.write('<td width=97% bgcolor=#0000ff><font face=arial size=3><b>Event</td></tr>');

    intCount = 0;
    for(intIndex = (garrGallery.length - 1); intIndex > 0; intIndex--)
    {
        if((intCat < 1) || (garrGallery[intIndex][0][1] == intCat))
        {
            intCount++;
            strLink = '<a href="' + strName + '-diary.htm?&lng=' + garrUri['lng'] + '&all=' + garrUri['all'] + '&cat=' + intCat + '&num=' + intIndex + '">';
            document.write('<tr>');
            document.write('<td bgcolor=#000000 align=center>' + strLink + '<img border=0 src="photos/' + garrGallery[intIndex][garrGallery[intIndex].length - 1][0] + '/' + garrGallery[intIndex][garrGallery[intIndex].length - 1][0] + '-' + fnStellenZahl(garrGallery[intIndex][0][3], 2) + 's.jpg" height=60></a></td>');
            document.write('<td bgcolor=#000000 nowrap align=center><font face=arial size=3 color=#ffffc0>' + garrGallery[intIndex][0][0] + '</td>');
            document.write('<td bgcolor=#000000 nowrap align=center><font face=arial size=3 color=' + garrCatCol[garrGallery[intIndex][0][1]] + '>' + garrCat[garrGallery[intIndex][0][1]] + '</td>');
            document.write('<td bgcolor=#000000>' + strLink + '<font face=arial>' + garrGallery[intIndex][0][2] + '</a></td>');
            document.write('</tr>');
        }
    }
    document.write('</table></td></tr></table><font size=1 color=#ffff80><div align=right>[' + intCount + ' Entries]</div><br>');
}

////
// !Fahrzeug-Daten plotten
//
function doPlotData(arrDataTab)
{
    document.write('<table border=0 cellspacing=0 width=100% cellpadding=0><tr><td bgcolor=#0000a0><table border=0 cellspacing=4 width=100% cellpadding=4>');

    for(intIndex = 0; intIndex<arrDataTab.length; intIndex++)
    {
        switch(arrDataTab[intIndex].length)
        {
            case 1:
                document.write('<tr><td colspan=4 bgcolor=#000060 align=center><font color=#ff0000 face=arial size=4><b>' + arrDataTab[intIndex][0] + '</td></tr>');
                break;
            case 2:
                document.write('<tr><td colspan=2 bgcolor=#000060 align=center><font color=#ff0000 face=arial size=4><b>' + arrDataTab[intIndex][0] + '</td>');
                document.write(    '<td colspan=2 bgcolor=#000060 align=center><font color=#ff0000 face=arial size=4><b>' + arrDataTab[intIndex][1] + '</td></tr>');
                break;
            case 4:
                document.write('<tr><td width=20% bgcolor=#000000 valign=top align=right nowrap><font face=arial size=3 color=#ffc000>' + arrDataTab[intIndex][0] + '</font></td>');
                document.write(    '<td width=30% valign=top bgcolor=#000000><font face=arial size=3><b>' + fnStrReplace(fnStrReplace(arrDataTab[intIndex][1],'#-','<font color=#ff0000>'),'#+','<font color=#00ff00>') + '</td>');
                document.write(    '<td width=20% bgcolor=#000000 valign=top align=right nowrap><font face=arial size=3 color=#ffc000>' + arrDataTab[intIndex][2] + '</font></td>');
                strText = arrDataTab[intIndex][3];
                if(strText.indexOf('|') > -1)
                {
                    arrText = strText.split('|');
                    strText = '<a href="' + arrText[1] + '" target="_blank">' + arrText[0] + '</a>';
                }
                document.write(    '<td width=30% valign=top bgcolor=#000000><font face=arial size=3><b>' + fnStrReplace(fnStrReplace(strText,'#-','<font color=#ff0000>'),'#+','<font color=#00ff00>') + '</td></tr>');
                break;
        }
    }
    document.write('</table></td></tr></table><br>');
}

