/* 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 = [
		'picture-0001',
		'picture-0002',
		'picture-0003',
		'picture-0004',
		'picture-0005',
		'picture-0006',
		'picture-0007',
		'picture-0008',
		'picture-0009',
		'picture-0010',
		'picture-0011',
		'picture-0012',
		'picture-0013',
		'picture-0014',
		'picture-0015',
		'picture-0016',
		'picture-0017',
		'picture-0018',
		'picture-0019',
		'picture-0020',
		'picture-0021',
		'picture-0022',
		'picture-0026',
		'picture-0027',
		'picture-0028',
		'picture-0029',
		'picture-0032',
		'picture-0033',
		'picture-0034',
		'slide_fgfs-screen-002',
		'slide_fgfs-screen-008',
		'slide_fgfs-screen-017',
		'slide_fgfs-screen-036',
		'slide_fgfs-screen-047',
		'slide_fgfs-screen-062',
		'slide_fgfs-screen-065',
		'slide_fgfs-screen-096',
		'slide_fgfs-screen-101',
		'slide_fgfs-screen-114',
		'slide_fgfs-screen-136',
		'slide_fgfs-screen-137',
		'slide_fgfs-screen-144',
		'slide_fgfs-screen-155',
		'slide_fgfs-screen-163',
		'slide_fgfs-screen-166',
		'slide_fgfs-screen-169',
		'slide_fgfs-screen-215',
		'slide_fgfs-screen-217'
              ];

  picts.fgshuffle();

  document.write("<A HREF=\"http://www.flightgear.org/Gallery-v1.9/Link/" + picts[0] + ".html\" target=\"_blank\"><IMG CLASS=\"mainscreen\" WIDTH=\"240\" SRC=\"/Gallery-v1.9/Small/" + picts[0] + ".jpg\" ALT=\"" + picts[0] + "\"></A>");
  document.write("<A HREF=\"http://www.flightgear.org/Gallery-v1.9/Link/" + picts[1] + ".html\" target=\"_blank\"><IMG CLASS=\"mainscreen\" WIDTH=\"240\" SRC=\"/Gallery-v1.9/Small/" + picts[1] + ".jpg\" ALT=\"" + picts[1] + "\"></A>");
  document.write("<A HREF=\"http://www.flightgear.org/Gallery-v1.9/Link/" + picts[2] + ".html\" target=\"_blank\"><IMG CLASS=\"mainscreen\" WIDTH=\"240\" SRC=\"/Gallery-v1.9/Small/" + picts[2] + ".jpg\" 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://ftp.flightgear.org/pub/fgfs/',
                'ftp://ftp.kingmont.com/flightsims/flightgear/',
                'http://mirrors.ibiblio.org/pub/mirrors/flightgear/ftp/',
                'ftp://ftp.planetmirror.com/pub/fgfs/',
                'ftp://ftp.de.flightgear.org/pub/fgfs/',
                'http://flight.frozenwebhost.com/',
		'http://mirror.fslutd.org/flightgear/',
		'http://flightgear.mxchange.org/pub/fgfs/',
		'ftp://ftp.linux.kiev.ua/pub/mirrors/ftp.flightgear.org/flightgear/',
		'http://ftp3.linux.kiev.ua/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>");
}
