function w(s) {document.writeln(s)}

function nh( name, html, highlight )
{
    if ( highlight || gCategory == name )
    {
        if ( name == 'Home' )
        {
            w('<td width=80 height=22 align=left><span class="nav2"><a href="' + html + '">&nbsp;' + name + '</a></span></td>')
        }
        else
        {
            w('<td width=80 height=22 align=center><span class="nav2"><a href="' + html + '">&nbsp;' + name + '</a></span></td>')
        }
    }
    else
    {
        if ( name == 'Home' )
        {
            w('<td width=80 height=22 align=left><a href="' + html + '">&nbsp;' + name + '</a></td>')
        }
        else
        {
            w('<td width=80 height=22 align=center><a href="' + html + '">&nbsp;' + name + '</a></td>')
        }
    }
}

function nv( name, html, highlight )
{
    w('<tr valign=middle align=left>')
    if ( highlight || gMenuItem == name || gSubCategory == name )
    {
       w('<td width=125 height=25><span class="nav2"><a href="' + html + '">&nbsp;' + name + '</a></span></td>')
    }
    else
    {
       w('<td width=125 height=25><a href="' + html + '">&nbsp;' + name + '</a></td>')
    }
    w('</tr>')
    w('<tr valign=middle align=left>')
}

function nv2( parent, name, html, highlight )
{
    if ( gSubCategory == parent || gMenuItem == parent )
    {
        w('<tr valign=middle align=left>')
        if ( highlight || gMenuItem == name )
        {
           w('<td width=125 height=17><span class="nav2"><a href="' + html + '">&nbsp;&nbsp;&nbsp;' + name + '</a></span></td>')
        }
        else
        {
           w('<td width=125 height=17><a href="' + html + '">&nbsp;&nbsp;&nbsp;' + name + '</a></td>')
        }
        w('</tr>')
        w('<tr valign=middle align=left>')
    }
}

function header( mainArea, category, subCategory, title, menuItem, draft, pictures )
{
    gMainArea = mainArea
    gCategory = category
    gSubCategory = subCategory
    gTitle = title
    gMenuItem = menuItem

    if ( draft == 'Yes' )
    {
        if ( pictures == 'Yes' )
        {
            w('<body onLoad="preloadImages()" background="./draft.gif" text="#000000" link="#0000ff" vlink="#800080" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>')
        }
        else
        {
            w('<body background="./draft.gif" text="#000000" link="#0000ff" vlink="#800080" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>')
        }
    }
    else
    {
        if ( pictures == 'Yes' )
        {
            w('<body onLoad="preloadImages()" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>')
        }
        else
        {
            w('<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>')
        }
    }
    w('<table border=0 cellspacing=0 cellpadding=0 width=800 summary=banner>')
    w('<tr valign=top align=left>')
    w('<td height=100 width=150 bgcolor="#693742"><img id="banner1" src="./fishcorner.jpg" alt="fish" border=0></td>')
    if ( mainArea == 'Home' )
    {
        w('<td height=100 width=500 bgcolor="#693742" align=center valign=middle><span class="banner">ATJ\'s Marine Aquarium Site</span></td>')
    }
    else
    {
        w('<td height=100 width=500 bgcolor="#693742" align=center valign=middle><span class="banner">' + mainArea + '</span></td>')
    }
    w('<td height=100 width=150 bgcolor="#693742">&nbsp;</td>')
    w('</tr>')
    w('</table>')
    w('<div class="nav">')
    w('<table border=0 cellspacing=0 cellpadding=0 width=800 summary=navigator>')
    w('<tr valign=top align=left>')
    w('<td height=22 width=800>')
    w('<table id="navigationbar2" border=0 cellspacing=0 cellpadding=0 width=800 summary=navigator>')
    w('<tr valign=middle align=left>')

    switch (mainArea)
    {
        case 'Home':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html', true )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case '404: Document Not Found':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case 'Tanks':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html', true )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case 'Reference':
            if ( category == '' || category == 'Societies' )
            {
                nh( 'Home',  './default.html' )
                nh( 'Tanks', './tanks.html' )
                nh( 'Blog',  './blog.html' )
                nh( 'DIY',   './diy.html' )
                nh( 'Reference', './reference.html', true )
                nh( 'The Lab', './the_lab.html')
                nh( 'About', './aboutme.html')
                nh( 'Site Info', './site_info.html')
            }
            else
            {
                nh( 'Home',  './default.html' )
//                nh( 'Acclimation', './acclimation.html')
                nh( 'Books', './recommendedbooks.html')
                nh( 'Fish Diseases', './fishdiseases.html')
//                nh( 'Hitchhikers', './hitchhikers.html')
//                nh( 'Links', './links.html')
//                nh( 'Mantis', './mantis.html')
//                nh( 'Organisms to Avoid', './organismstoavoid.html')
                nh( 'Organisms', './organisms.html')
//                nh( 'Photoacclimation', './photoacclimation.html')
//                nh( 'Photography', './photography.html' )
                nh( 'Societies', './societies.html')
                nh( 'Tank Planning', './tankplan.html')
                nh( 'Tank Setup', './tanksetup.html')
                nh( 'Water Quality', './waterquality.html')
            }
            break;
        case 'DIY':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html', true )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case 'The Lab':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html', true )
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case 'News':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case 'Blog':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html', true )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html')
            break;
        case 'About':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html', true)
            nh( 'Site Info', './site_info.html')
            break;
        case 'Site Info':
            nh( 'Home',  './default.html' )
            nh( 'Tanks', './tanks.html' )
            nh( 'Blog',  './blog.html' )
            nh( 'DIY',   './diy.html' )
            nh( 'Reference', './reference.html' )
            nh( 'The Lab', './the_lab.html')
            nh( 'About', './aboutme.html')
            nh( 'Site Info', './site_info.html, true')
            break;
    }

    w('</tr>')
    w('</table>')
    w('</td>')
    w('</tr>')
    w('</table>')
    w('</div>')
    w('<table cellpadding=0 cellspacing=0 border=0 width=800 summary=navigator>')
    w('<tr valign=top align=left>')
    w('<td>')
    w('<div class="nav">')
    if ( mainArea == 'Home' )
    {
        w('<table border=0 cellspacing=0 cellpadding=0 width=10 summary=navigator>')
    }
    else
    {
        w('<table border=0 cellspacing=0 cellpadding=0 width=127 summary=navigator>')
    }
    w('<tr valign=top align=left>')
    w('<td height=3></td>')
    w('</tr>')
    w('<tr valign=top align=left>')
    w('<td height=150 width=127>')
    if ( mainArea == 'Home' )
    {
        w('<table id="verticalnavigationbar1" border=0 cellspacing=1 cellpadding=0 width=10 summary=navigator>')
    }
    else
    {
        w('<table id="verticalnavigationbar1" border=0 cellspacing=1 cellpadding=0 width=127 summary=navigator>')
    }
    switch (mainArea)
    {
        case 'About':
            nv(  'Other Pets', './otherpets.html' )
            nv2( 'Other Pets', 'Angus', 'angus.html' )
            nv2( 'Other Pets', 'Bippy', 'bippy.html' )
            nv2( 'Other Pets', 'Lucy',  'lucy.html' )
            nv2( 'Other Pets', 'Harry', 'harry.html' )
            nv2( 'Other Pets', 'Oscar', 'oscar.html' )
            nv2( 'Other Pets', 'Sally', 'sally.html' )
//            nv( 'Photography', './myphotography.html' )
            break;

        case 'The Lab':
            nv( 'Coral Feeding', './coralfeeding.html' )
            nv( 'Coral Feeding II', './coral_feeding_ii.html' )
            nv( 'Coral Feeding III', './coralfeedingiii.html' )
//            nv2( 'Coral Feeding III', 'Faviid', './coralfeedingiiifaviid.html' )
//            nv2( 'Coral Feeding III', '<i>Lobophyllia</i>', './coralfeedingiiilobo.html' )
//            nv2( 'Coral Feeding III', '<i>Fungia</i>', './coralfeedingiiifungia.html' )
//            nv2( 'Coral Feeding III', '<i>Trachyphyllia</i>', './coralfeedingiiitrachy.html' )
//            nv2( 'Coral Feeding III', 'Outtake', './coralfeedingout.html' )
            nv( 'Coral Growth', './coral_growth.html' )
            nv( '"Kalkwasser"', './_kalkwasser_.html' )
            nv( 'Light Intensity', './light_intensity.html' )
            nv( 'Light Readings', './lightreading.html' )
            nv( 'Light Transmission', './lighttransmission.html' )
            break;

        case 'Reference':
            switch (category)
            {
                case 'Organisms':
                    nv( 'Acclimation', './acclimation.html')
//                case 'Hitchhikers':
                    nv( 'Hitchhikers', './hitchhikers.html')
                    nv2( 'Hitchhikers', 'Algae', './hitchhikeralgae.html' )
                    nv2( 'Hitchhikers', 'Cnidarians', './hitchhikercnidarians.html' )
                    nv2( 'Hitchhikers', 'Worms', './hitchhikerworms.html' )
                    nv2( 'Hitchhikers', 'Molluscs', './hitchhikermolluscs.html' )
                    nv2( 'Hitchhikers', 'Crustaceans', './hitchhikercrustaceans.html' )
                    nv2( 'Hitchhikers', 'Echinoderms', './hitchhikerechinoderms.html' )
                    nv2( 'Hitchhikers', 'Chordates', './hitchhikerchordates.html' )
                    nv( 'Organisms to Avoid', './organismstoavoid.html')
                    nv( 'Photoacclimation', './photoacclimation.html')
                    break;

                case 'Water Quality':
                    nv( 'Temperature', './temperature.html')
                    nv( 'Specific Gravity', './specificgravity.html')
                    nv( 'pH', './ph.html')
                    nv( 'Alkalinity', './alkalinity.html')
                    nv( 'Calcium', './calcium.html')
                    nv( 'Nitrate', './nitrate.html')
                    nv( 'Phosphate', './phosphate.html')
                    nv( 'Silica', './silica.html')
                    nv( 'Test Kits', './testkits.html')
                    nv( 'Additives', './additivesref.html')
                    nv2( 'Additives', 'Kalkwasser', './kalkwasser.html' )
//                    nv2( 'Additives', 'CaCO<sub>3</sub> Reactor', './caco3reactor.html' )
//                    nv2( 'Additives', 'Single Element', './singleelement.html' )
//                    nv2( 'Additives', '"Bal." Two-Part', './balanced2.html' )
                    nv2( 'Additives', 'Tuning CaCO<sub>3</sub>', './tuningcaco3reactor.html' )
                    break;

                case 'Fish Diseases':
                    nv( 'Amyloodiniosis', './amyloodinium.html' )
                    nv2( 'Amyloodiniosis', 'oama&rsquo;s FW Dip', './oamasfwdiptest.html' )
                    nv( 'Black "Ich"', './blackich.html' )
                    nv( 'Brooklynellosis', './brooklynella.html' )
                    nv( 'Internal Infections', './internalinfections.html' )
                    nv( 'Marine "Ich"', './marineich.html' )
                    nv( 'Treatments', './treatments.html' )
                    nv2( 'Treatments', 'Cupramine&trade;', './cupramine.html' )
                    nv2( 'Treatments', 'Formalin Baths', './formalinbaths.html' )
                    nv2( 'Treatments', 'Freshwater Dips', './freshwaterdips.html' )
                    nv2( 'Treatments', 'Hyposalinity', './hyposalinity.html')
                    nv2( 'Treatments', 'Hyposalinity Effects', './hyposalinityeffects.html')
                    nv2( 'Treatments', 'Quarantine Tanks', './quarantinetanks.html' )
                    nv2( 'Treatments', '3 Day Transfer', './3daytransfer.html' )
                    break;

                case 'Tank Planning':
                    nv( 'Circulation', './circulation.html' )
                    nv( 'Filtration', './filtration.html' )
                    nv2( 'Filtration', 'Nitrogen Cycle', './nitrogencycle.html' )
                    nv2( 'Filtration', 'Undergravel', './undergravel.html' )
                    nv( 'Sump', './sump.html' )
                    nv( 'Lighting', './lighting.html' )
                    nv2( 'Lighting', 'Colour v Depth', './colourvdepth.html')
                    nv2( 'Lighting', 'Photosynthesis', './photosynthesis.html')
                    nv2( 'Lighting', 'Fluoro Lamps', './fluoro_lamps.html')
                    nv( 'Heating', './heating.html' )
                    nv( 'Cooling', './cooling.html' )
//                    nv( 'Equipment', './equipment.html' )
//                    nv2( 'Equipment', 'Circulation', './circulation.html' )
//                    nv2( 'Equipment', 'Filtration', './filtration.html' )
//                    nv2( 'Equipment', 'Sump', './sump.html' )
//                    nv2( 'Equipment', 'Lighting', './lighting.html' )
//                    nv2( 'Equipment', 'Heating', './heating.html' )
//                    nv2( 'Equipment', 'Cooling', './cooling.html' )
                    break;

                case '':
                case 'Societies':
//                    nv( 'Acclimation', './acclimation.html')
                    nv( 'Books', './recommendedbooks.html')
                    nv2( 'Books', 'My Books', './books.html')
                    nv( 'Fish Diseases', './fishdiseases.html')
                    nv( 'Fluoro Lamps', './fluoro_lamps.html')
//                    nv( 'Hitchhikers', './hitchhikers.html')
//                    nv( 'Hyposalinity', './hyposalinity.html')
//                    nv( 'Links', './links.html')
//                    nv( 'Mantis', './mantis.html')
//                    nv( 'Organisms to Avoid', './organismstoavoid.html')
                    nv( 'Organisms', './organisms.html')
//                    nv( 'Photoacclimation', './photoacclimation.html')
//                    nv( 'Photography', './photography.html' )
                    nv( 'Societies', './societies.html')
//                    nv2('Societies', 'MASA', './masa.html')
//                    nv2('Societies', 'MASA DNS Prob.', './masadnsproblems.html')
                    nv2('Societies', 'MASS', './mass.html')
                    nv( 'Tank Planning', './tankplan.html')
                    nv( 'Tank Setup', './tanksetup.html')
                    nv( 'Water Quality', './waterquality.html')
                    break;
//                case 'Photography':
//                    nv( 'Macro', './macrophotography.html')
            }
            break;
        case 'DIY':
                    nv( '150W MH', './150wmh.html')
                    nv( 'Auto Top-off II', './autotopoff2.html')
                    nv( 'Backup Power', './backup_power.html')
                    nv( 'BH-100 Mods', './bh-100mods.html')
                    nv( 'Brine Shrimp', './artemia.html')
                    nv2( 'Brine Shrimp', 'Hatching', './hatchingartemia.html' )
                    nv2( 'Brine Shrimp', 'Raising', './raisingartemia.html' )
                    nv( 'Bulk Kalkwasser', './bulkkalkwasser.html')
                    nv( 'Bulkhead', './bulkhead_modifications.html')
                    nv( 'Collecting', './collecting.html')
                    nv2( 'Collecting', 'Species', './species.html')
                    nv( 'Collecting Seawater', './collectingseawater.html')
                    nv( 'Cooling Fans', './cooling_fans.html')
                    nv( 'Crushed Marble', './crushed_marble.html')
                    nv( 'Dripping Kalkwasser', './kalkwasserdripping.html')
                    nv( 'Fluoro in Hood', './fluoro_in_hood.html')
                    nv( 'Hood for 40G2', './diyhood40G2.html')
                    nv( 'Power Outages', './poweroutages.html')
                    nv( 'Pump Housing', './peripumphousing.html')
                    nv( 'Scraper', './scraper.html')
                    nv( 'Simple Filter', './simplebiofilter.html')
                    nv( 'Single Fluoro', './single_fluoro.html')
                    nv( 'Surge Device', './surge_device.html')
                    nv( 'T5 Refit for 20G', './T5refit20ghood.html')
                    nv( 'Water Pump', './watercollectionpump.html')
            break;
        case 'Tanks':
              nv( '6\'',  './6__fowlr.html' )
              nv( '180G',  './180g_fowlr.html')
              nv( '60G',  './60g_fowlr.html' )
              nv( '50G1',  './50g_reef1.html' )
              nv( '50G2',  './50g_reef_2.html' )
              nv( '40G2',  './40g_fowlr2.html' )
              nv( '20G',  './20g_fowlr.html' )
              nv( 'Quarantine2',  './quarantine2.html' )
              nv( 'Upkeep',  './upkeep.html' )
              nv( 'All Inhabitants', './allinhabitants.html')
              nv( 'Longevity', './longevity.html')

            break;
    }
    if ( mainArea != 'Home' )
    {

    w('<tr valign=middle align=left>')
    w('<td width=80 height=22 align=left><br>')
//    w('<form action=./donate.html method="post">')
//    w('<input type=image src=https://www.paypal.com/en_US/i/btn/x-click-but04.gif border=0 name=submit>')
    w('<a href=./donate.html><img alt="" border="0" src=https://www.paypal.com/en_US/i/btn/x-click-but04.gif></a>')
//    w('</form>')
    w('</td>')
    w('</tr>')
    }

    w('</table>')
    w('</td>')
    w('</tr>')
    w('</table>')
    w('</div>')
    w('</td>')
    w('<td>')
    if ( mainArea == 'Home' )
    {
        w('<table border=0 cellspacing=0 cellpadding=0 width=780 summary=content>')
    }
    else
    {
        w('<table border=0 cellspacing=0 cellpadding=0 width=673 summary=content>')
    }

    w('<tr valign=top align=left>')
    w('<td height=3></td>')
    w('</tr>')
    w('<tr valign=top align=left>')
    w('<td height=366 width=673><div id="externalhtml1color">')
    if ( mainArea == 'Home' )
    {
        w('<table width=780 summary=content>')
    }
    else
    {
        w('<table width=673 summary=content>')
//        w('<br>' + mainArea + '->' + category + '->' + subCategory + '->' + menuItem + '<br><br>' )
    }
    w('<tr align=left valign=top>')
    w('<td>')
    if ( mainArea != 'Tanks' )
    {
       w('<span class="head"><p align=center><b>' + title + '</b></p></span>')
    }
//	Print #nFile%,   "<TABLE ID=""Page Heading"" BORDER=0 CELLSPACING=3 CELLPADDING=1 WIDTH=" & nTableWidth% & ">"
//	Print #nFile%, "    <TR>"
//	Print #nFile%,   "<TD WIDTH=""40%""><P><FONT SIZE=""-1"" FACE=""Arial,Helvetica,Univers,Zurich BT"">"  & "</FONT></TD>"
//	Print #nFile%,   "<TD WIDTH=""30%""><P><B><FONT SIZE=""+1"" FACE=""Arial,Helvetica,Univers,Zurich BT"">BOOKS</FONT></TD>"
//	Print #nFile%,   "<TD WIDTH=""30%""><P><FONT SIZE=""-1"" FACE=""Arial,Helvetica,Univers,Zurich BT"">"  & "</FONT></TD>"
//	Print #nFile%, "</TR>"
//	Print #nFile%, "</TABLE>"

}

function footer( )
{
    w('</td>')
    w('</tr>')
    w('</table>')
    w('</div></td>')
    w('</tr>')
    w('</table>')
//    w('<form action=./donate.html method="post">')
//    w('<input type=image src=https://www.paypal.com/en_US/i/btn/x-click-but04.gif border=0 name=submit>')
//    w('<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1">')
//    w('</form>')
//    w('<a href=./donate.html><img src=https://www.paypal.com/en_US/i/btn/x-click-but04.gif></a>')
    w('<table border=0 cellspacing=0 cellpadding=0 summary=navigator>')
    w('<tr valign=top align=left>')
    w('<td nowrap>')
    w('<p>[<a href="./default.html">Home</a>]&nbsp;[<a href="./tanks.html">Tanks</a>]&nbsp;[<a href="./blog.html">Blog</a>]&nbsp;[<a href="./diy.html">DIY</a>]&nbsp;[<a href="./reference.html">Reference</a>]&nbsp;[<a href="./the_lab.html">The Lab</a>]&nbsp;[<a href="./aboutme.html">About Me</a>]&nbsp;[<a href="./site_info.html">Site Info</a>]</p>')
    w('</td>')
    w('</tr>')
    w('</table>')
    w('</td>')
    w('</tr>')
    w('</table>')
    w('<table border=0 cellspacing=0 cellpadding=0 width=744 summary=formatting>')
    w('<tr valign=top align=left>')
    w('<td width=744 height=8><img src="./clearpixel.gif" alt="space" width=744 height=1 border=0></td>')
    w('</tr>')
    w('<tr valign=top align=left>')
    w('<td width=744>')
    w('<p align=center><font size="-1" face="arial,helvetica,univers,zurich bt,sans-serif">&#169; Copyright 1999-2008, ATJ</font></p>')
    w('</td>')
    w('</tr>')
    w('</table>')
    w('</body>')

}

function writeDuration( start, end )
{

    startDate = new Date( start )
    if ( end == '' )
    {
        endDate = new Date()
    }
    else
    {
        endDate = new Date( end )
    }

    years = 0
    months = 0
    days = 0

    years = endDate.getFullYear() - startDate.getFullYear()
    months = endDate.getMonth() - startDate.getMonth()
    days = endDate.getDate() - startDate.getDate()

    if (days < 0 )
    {
        monthLength = 30

        switch ( endDate.getMonth() )
        {
            case 0:
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
                monthLength = 31
                break;
            case 4:
            case 6:
            case 9:
            case 11:
                monthLength = 30
                break;
            case 2:
                endYear = endDate.getFullYear();
                if ( (endYear % 4) == 0 )
                {
                    monthLength = 29
                }
                else
                {
                    monthLength = 28
                }
                break;
        }
        days = days + monthLength;
        months = months - 1;
    }

    if (months < 0 )
    {
        months = months + 12
        years = years - 1
    }

    if (years > 0 )
    {
        if (years == 1 )
        {
            document.write( years + ' year ' );
        }
        else
        {
            document.write( years + ' years ' );
        }
    }

    if (months > 0 )
    {
        if (months == 1 )
        {
            document.write( months + ' month ' );
        }
        else
        {
            document.write( months + ' months ' );
        }
    }

    if (days > 0 )
    {
        if (days == 1 )
        {
            document.write( days + ' day ' );
        }
        else
        {
            document.write( days + ' days ' );
        }
    }

}
function preloadImages()
{
   for (var i=0; i <= picture.length; i++)
   {
       image[i] = new Image;
       image[i].src = picture[i];
   }
}
function firstPicture()
{
   picNumber = numberofPics
   document.myPicture.src = image[picNumber-1].src;
   element = document.getElementById("caption");
   element.innerHTML = caption[picNumber-1];
}
function previousPicture()
{
   if(picNumber < numberofPics)
   {
     picNumber++
   }
   else
   {
     picNumber = 1;
   }
   document.myPicture.src = image[picNumber-1].src;
   element = document.getElementById("caption");
   element.innerHTML = caption[picNumber-1];
}
function previousPictureNoLoop()
{
   if(picNumber < numberofPics)
   {
     picNumber++
     document.myPicture.src = image[picNumber-1].src;
     element = document.getElementById("caption");
     element.innerHTML = caption[picNumber-1];
   }
}
function nextPicture()
{
   if(picNumber > 1)
   {
     picNumber--
   }
   else
   {
     picNumber = numberofPics;
   }
   document.myPicture.src=image[picNumber-1].src
   element = document.getElementById("caption");
   element.innerHTML = caption[picNumber-1];
}
function nextPictureNoLoop()
{
   if(picNumber > 1)
   {
     picNumber--
     document.myPicture.src=image[picNumber-1].src
     element = document.getElementById("caption");
     element.innerHTML = caption[picNumber-1];
   }
}
function LastPicture()
{
   picNumber = 1
   document.myPicture.src = image[picNumber-1].src;
   element = document.getElementById("caption");
   element.innerHTML = caption[picNumber-1];
}
function Play( b )
{
    bContinue = b
    if ( bContinue )
    {
       nextPicture();
       window.setTimeout("Play(bContinue)", 2000);
    }
}
function PlayNoLoop( f )
{
    fContinue = f
    if ( fContinue == 1 )
    {
        picNumber = numberofPics
        fContinue = 2
    }

    if (picNumber == 1 )
    {
        fContinue = 0
    }

    if ( fContinue > 0 )
    {
       nextPictureNoLoop();
       window.setTimeout("PlayNoLoop(fContinue)", 2000);
    }
}

function DiveMap ( location, displayedLocation, latitude, longitude, zoom, type )
{
    if (type != 'h' && type != 's' & type != 'm' )
    {
       type = 'h'
    }
    urlSite = 'http://maps.google.com/maps?f=q&hl=en&q=' + latitude + ',' + longitude + '+(' + displayedLocation + ')&ie=UTF8&om=1&z=' + zoom + '&t=' + type + '&iwloc=addr'
    w( '<a href=' + urlSite + ' target=GoogleMaps>' + location + '</a>' )
}
