/* Display the main graphical logo */
function MainLogo()
{
  var root = arguments[0];

  document.write("<div id=\"top\">");
  document.write("  <a href=\"" + root + "\"><img id=\"titlebar\" src=\"" + root + "/images/fglogosm.jpg\" alt=\"\"></a>");
  document.write("</div>");
}


/* Display the google site search form */
function SiteSearchGoogle()

{
  document.write("<form method=\"get\" action=\"http://www.br.flightgear.org/search.html\" target=\"_top\">");
  document.write("<table border=\"0\" bgcolor=\"#ffffff\">");
  document.write("<tr><td nowrap=\"nowrap\" valign=\"top\" align=\"left\" height=\"32\">");
  document.write("<a href=\"http://www.google.com.br/\">");
  document.write("<img src=\"http://www.google.com/logos/Logo_25wht.gif\"");
  document.write("border=\"0\" alt=\"Google\" align=\"middle\"></img></a>");
  document.write("<br/>");
  document.write("<input type=\"hidden\" name=\"domains\" value=\"www.br.flightgear.org\"></input>");
  document.write("<label for=\"sbi\" style=\"display: none\">Digite os termos da sua pesquisa</label>");
  document.write("<input type=\"text\" name=\"q\" size=\"15\" maxlength=\"255\" value=\"\" id=\"sbi\"></input>");
  document.write("</td></tr>");
  document.write("<tr>");
  document.write("<td nowrap=\"nowrap\">");
  document.write("<table>");
  document.write("<tr>");
  document.write("<td>");
  document.write("<input type=\"radio\" name=\"sitesearch\" value=\"\" id=\"ss0\"></input><label for=\"ss0\" title=\"Pesquisar na web\"><font size=\"-2\" color=\"#000000\">Web</font>");
  document.write("</td>");
  document.write("<td>");
  document.write("<input type=\"radio\" name=\"sitesearch\" value=\"www.br.flightgear.org\" checked id=\"ss1\"></input><label for=\"ss1\" title=\"Pesquisar em www.br.flightgear.org\"><font size=\"-2\" color=\"#000000\">FlightGear</font>");
  document.write("</td>");
  document.write("</tr>");
  document.write("</table>");
  document.write("<label for=\"sbb\" style=\"display: none\">Enviar formul&aacute;rio de pesquisa</label>");
  document.write("<input type=\"submit\" name=\"sa\" value=\"Pesquisar\" id=\"sbb\"></input>");
  document.write("<input type=\"hidden\" name=\"client\" value=\"pub-4152680871892282\"></input>");
  document.write("<input type=\"hidden\" name=\"forid\" value=\"1\"></input>");
  document.write("<input type=\"hidden\" name=\"channel\" value=\"7717283002\"></input>");
  document.write("<input type=\"hidden\" name=\"ie\" value=\"ISO-8859-1\"></input>");
  document.write("<input type=\"hidden\" name=\"oe\" value=\"ISO-8859-1\"></input>");
  document.write("<input type=\"hidden\" name=\"safe\" value=\"active\"></input>");
  document.write("<input type=\"hidden\" name=\"cof\" value=\"GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0f7a71;LC:0f7a71;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:285;L:http://www.br.flightgear.org/images/fglogosm.jpg;S:http://;FORID:11\"></input>");
  document.write("<input type=\"hidden\" name=\"hl\" value=\"pt\"></input>");
  document.write("</td></tr></table>");
  document.write("</form>");
}


/* Display the main menu */
function MainMenu()
{
  var root = arguments[0];

  document.write("<h3>Principal</h3>");
  document.write("<a href=\"" + root + "/index.shtml\">Inicial</a><br>");
  document.write("<a href=\"" + root + "/introduction.html\">Introdu&ccedil;&atilde;o</a><br>");
  document.write("<a href=\"" + root + "/features.html\">Caracter&iacute;sticas</a><br>");
  document.write("<a href=\"" + root + "/Gallery-v1.0/\">Galeria de Imagens</a><br>");
  document.write("<a href=\"" + root + "/Downloads/\">Downloads</a><br>");
  document.write("<a href=\"http://cdrom.flightgear.org\">CD e DVD do FlightGear</a><br>");
  document.write("<h3>Suporte</h3>");
  document.write("<a href=\"" + root + "/version.html\">Mudan&ccedil;as nas Vers&otilde;es</a><br>");
  document.write("<a href=\"" + root + "/hardwarereq.html\">Exig&ecirc;ncias de Hardware</a><br>");
  document.write("<a href=\"" + root + "/docs.html\">Documenta&ccedil;&atilde;o</a><br>");
  document.write("<a href=\"" + root + "/places.html\">Lugares para Voar</a><br>");
  document.write("<a href=\"" + root + "/mail.html\">Listas, F&oacute;rums, e IRC</a><br>");
  document.write("<a href=\"" + root + "/Docs/FAQ.shtml\">Dúvidas (FAQ)</a><br>");
  document.write("<h3>Links</h3>");
  document.write("<a href=\"" + root + "/links.html\">Websites Relacionados</a><br>");
  document.write("<a href=\"" + root + "/Projects/\">Projetos Relacionados</a><br>");
  document.write("<h3>Contribua</h3>");
  document.write("<a href=\"" + root + "/contributing.html\">Contribui&ccedil;&otilde;es</a><br>");
  document.write("<a href=\"" + root + "/cvs.html\">Recursos CVS</a><br>");
  document.write("<a href=\"" + root + "/goals.html\">Lista de Metas</a><br>");
  document.write("<a href=\"" + root + "/thanks.shtml\">Colaboradores</a><br>");
  document.write("<a href=\"" + root + "/design.html\">Propostas de Design</a><br>");
  document.write("<a href=\"" + root + "/events.html\">Eventos</a><br><br><br>");
  document.write("<a href=\"http://www.orkut.com/Community.aspx?cmm=5105481\" target=\"_blank\"><img border=\"0\" src=\"" + root + "/images/orkut.gif\" alt=\"Comunidade FlightGear no Orkut\"></a><br>");
}


function BottomMenu()
{
  var root = arguments[0];

  document.write("<a href=\"/\">Inicial</a> | ");
  document.write("<a href=\"" + root + "/Downloads/\">Downloads</a> | ");
  document.write("<a href=\"" + root + "/Gallery-v1.0/index.shtml\">Imagens</a> | ");
  document.write("<a href=\"" + root + "/docs.html\">Documenta&ccedil;&atilde;o</a>");
}


// Array.shuffle( deep ) - Randomly interchange elements
Array.prototype.fgshuffle = function( b ) {
 var i = this.length, j, t;
 while( i ) {
  j = Math.floor( ( i-- ) * Math.random() );
  t = b && typeof this[i].shuffle!=='undefined' ? this[i].shuffle() : this[i];
  this[i] = this[j];
  this[j] = t;
 }
 return this;
};

function RandomFrontImages()
{
  var base = arguments[0];

var picts = [
                'fgfs-screen-001b.jpg',
                'fgfs-screen-001.jpg',
                'fgfs-screen-002b.jpg',
                'fgfs-screen-002.jpg',
                'fgfs-screen-006.jpg',
                'fgfs-screen-007b.jpg',
                'fgfs-screen-007.jpg',
                'fgfs-screen-009b.jpg',
                'fgfs-screen-009.jpg',
                'fgfs-screen-014.jpg',
                'fgfs-screen-015b.jpg',
                'fgfs-screen-015.jpg',
                'fgfs-screen-018b.jpg',
                'fgfs-screen-018c.jpg',
                'fgfs-screen-018.jpg',
                'fgfs-screen-020b.jpg',
                'fgfs-screen-020c.jpg',
                'fgfs-screen-020.jpg',
                'fgfs-screen-024.jpg',
                'fgfs-screen-027.jpg',
                'fgfs-screen-029.jpg',
                'fgfs-screen-032.jpg',
                'fgfs-screen-036.jpg',
                'fgfs-screen-039b.jpg',
                'fgfs-screen-039.jpg',
                'fgfs-screen-042.jpg',
                'fgfs-screen-043.jpg',
                'fgfs-screen-044.jpg',
                'fgfs-screen-047.jpg',
                'fgfs-screen-049.jpg',
                'fgfs-screen-058.jpg',
                'fgfs-screen-063.jpg',
                'fgfs-screen-069.jpg',
                'fgfs-screen-077.jpg',
                'fgfs-screen-079.jpg',
                'fgfs-screen-084.jpg',
                'fgfs-screen-086.jpg',
                'fgfs-screen-090.jpg',
                'fgfs-screen-096.jpg',
                'fgfs-screen-103b.jpg',
                'fgfs-screen-103.jpg',
                'fgfs-screen-106.jpg',
                'fgfs-screen-108.jpg',
                'fgfs-screen-115.jpg',
                'fgfs-screen-123.jpg',
                'fgfs-screen-136.jpg',
                'fgfs-screen-141.jpg',
                'fgfs-screen-143.jpg',
                'fgfs-screen-146b.jpg',
                'fgfs-screen-146.jpg',
                'fgfs-screen-147b.jpg',
                'fgfs-screen-147.jpg',
                'fgfs-screen-150.jpg',
                'fgfs-screen-151.jpg',
                'fgfs-screen-161.jpg',
                'fgfs-screen-164.jpg',
                'fgfs-screen-165.jpg',
                'fgfs-screen-169.jpg',
                'fgfs-screen-172.jpg',
                'fgfs-screen-177.jpg',
                'fgfs-screen-192.jpg',
                'fgfs-screen-196.jpg',
                'fgfs-screen-199.jpg',
                'fgfs-screen-211.jpg',
                'fgfs-screen-216.jpg',
                'fgfs-screen-233.jpg',
                'fgfs-screen-241.jpg'
              ];


 picts.fgshuffle();

  document.write("<A HREF=\"http://www.flightgear.org/Gallery-v2.0/Original/" + picts[0] + "\"><IMG CLASS=\"mainscreen\" WIDTH=\"240\" SRC=\"http://www.flightgear.org/Gallery-v2.0/Original/" + picts[0] + "\" ALT=\"" + picts[0] + "\"></A>");
  document.write("<A HREF=\"http://www.flightgear.org/Gallery-v2.0/Original/" + picts[1] + "\"><IMG CLASS=\"mainscreen\" WIDTH=\"240\" SRC=\"http://www.flightgear.org/Gallery-v2.0/Original/" + picts[1] + "\" ALT=\"" + picts[1] + "\"></A>");
  document.write("<A HREF=\"http://www.flightgear.org/Gallery-v2.0/Original/" + picts[2] + "\"><IMG CLASS=\"mainscreen\" WIDTH=\"240\" SRC=\"http://www.flightgear.org/Gallery-v2.0/Original/" + picts[2] + "\" ALT=\"" + picts[2] + "\"></A>");
}



function RandomURLS()
{
  // Contacts
  // ftp://ftp.kingmont.com/flightsims/flightgear/ - Jim Brennan jjb
  //   at kingmont dt com
  // http://flight.frozenwebhost.com/ - Steve support at
  //   frozenwebhost dt com

  var base = arguments[0];

  var sites = [	
				'ftp://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/',
				'http://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/',
				'ftp://ftp.ibiblio.org/pub/mirrors/flightgear/ftp/',
				'ftp://ftp.kingmont.com/flightsims/flightgear/',
				'ftp://ftp.de.flightgear.org/pub/fgfs/',
				'ftp://ftp.linux.kiev.ua/pub/mirrors/ftp.flightgear.org/flightgear/',
				'http://ftp.linux.kiev.ua/pub/fgfs/',
				'ftp://ftp.flightgear.org/pub/fgfs/'
              ];

  // requested not to be in the round robin, but is a full mirror
  // 'ftp://ftp.is.co.za/pub/games/flightgear/'

  sites.fgshuffle();

  document.write("<a href=\"" + sites[0] + base + "\">[Link 1]</a> ");
  document.write("<a href=\"" + sites[1] + base + "\">[Link 2]</a> ");
  document.write("<a href=\"" + sites[2] + base + "\">[Link 3]</a>");
}
