// ----------------------------------------------------------------------------
// DSA - generators.js
// ----------------------------------------------------------------------------

function GenerateLastUpdated()
{
   document.writeln( "Document updated ", UTCAsString( new Date( document.lastModified ) ), " UTC" );
}

function ScrollToPageAnchor( anchorId )
{
   if ( document.all ) // if IE
      var obj = document.anchors( anchorId, 0 );
   else
      var obj = document.anchors[anchorId];
   var pos = findPos( obj );
   self.scrollTo( 0, pos[1] - 80 - 14 ); // assuming: height of title header = 80
}

function GenerateTOCItem( index, href, currentIndex )
{
   var bkgColor = (index == currentIndex) ? "#432200" : "transparent";

   document.write( "<ul style=\"margin: 0; padding: 0; display: block; background-color: ", bkgColor, "\" ",
         "onmouseover=\"this.style.backgroundColor = '#35444f';\" ",
         "onmouseout=\"this.style.backgroundColor = '", bkgColor, "';\" ",
         "onclick=\"document.location = '", href, "'\">",
         "<li><img src=\"", BaseURL() , "__toc/item", ZeroPad( index, 2 ), ".png\" /></li></ul>" );
}

function GenerateStandardPageTOC( currentIndex )
{
   var base = BaseURL();
   document.writeln( "<div id=\"tableOfContents\">" );
   document.writeln( "<div style=\"margin-top: 14px;\">" );
   GenerateTOCItem( 0, base, currentIndex );
   GenerateTOCItem( 1, base + "dsa/", currentIndex );
   GenerateTOCItem( 2, base + "members/", currentIndex );
   GenerateTOCItem( 3, base + "gallery/", currentIndex );
   GenerateTOCItem( 4, base + "blog/", currentIndex );
   GenerateTOCItem( 5, base + "supporters/", currentIndex );
   GenerateTOCItem( 6, base + "contact/", currentIndex );

   document.writeln( "<p class=\"small\" style=\"text-align: right; margin-top: 80px; margin-right: 20px; color: white;\">",
                     "Copyright &copy; 2009 DSA</p>" );

   document.writeln( "</div>" );
   document.writeln( "</div>" );
}

function GenerateStandardPageLogo()
{
   document.writeln( "<div id=\"logoHeader\" onclick=\"document.location = '", BaseURL(), "'\">" );
   document.writeln( "<img src=\"", BaseURL(), "__logos/DSA-logo-orange-180x100.png", "\" />" );
   document.writeln( "</div>" );
}

function GenerateStandardPageTitle()
{
   document.writeln( "<div id=\"titleHeader\">" );
   document.writeln( "<img src=\"", BaseURL(), "__titles/DSA-title.png", "\" />" );
   document.writeln( "</div>" );
}

function GenerateStandardPageFooter()
{
   document.writeln( "<hr style=\"margin-top: 2em;\" />" );
   document.writeln( "Copyright &copy; 2009 DSA<br />" );
   document.writeln( "<br />" );
   document.writeln( "<div class=\"small\">" );
   document.writeln( "<script type=\"text/javascript\">" );
   document.writeln( "GenerateLastUpdated();" );
   document.writeln( "</script><br />" );
   document.writeln( "<br />" );
   document.writeln( "</div>" );
}

function GenerateIE6Warning()
{
   document.writeln( "<div id=\"IE6Warning\">" );
   document.writeln( "<h2>Obsolete IE Version</h2>" );
   document.writeln( "<p>You are using an obsolete version of MS Internet Explorer (IE 6 or older)" );
   document.writeln( "that we no longer support in our website.</p>" );
   document.writeln( "<p>In order to explore our website correctly, you should upgrade to Internet" );
   document.writeln( "Explorer 7 or, much better, use a standards-compliant, free web browser such as" );
   document.writeln( "<a href=\"http://www.mozilla.com/\">Mozilla Firefox</a>.</p>" );
   document.writeln( "<p>If you are interested in our reasons to discontinue support for IE6, we" );
   document.writeln( "strongly recommend you to read the" );
   document.writeln( "<a href=\"http://www.webdesignerwall.com/general/trash-all-ie-hacks/\">IE bug</a>" );
   document.writeln( "articles on <a href=\"http://www.positioniseverything.net/\">positioniseverything.net</a>." );
   document.writeln( "Also take a look at <a href=\"http://www.webdesignerwall.com/general/trash-all-ie-hacks/\">this page</a>" );
   document.writeln( "on <a href=\"http://www.webdesignerwall.com/\">WebDesignerWall</a>.</p>" );
   document.writeln( "<p><a href=\"javascript:void( 0 );\"" );
   document.writeln( "onclick=\"document.getElementById('IE6Warning').style.visibility='hidden'\"><u>Close this Message</u></a></p>" );
   document.writeln( "</div>" );
}

// ----------------------------------------------------------------------------
