/**
 * Create the banner area at the top of the screen. A menu will be added to the left.
 * @param active the current active page
 * @param section if the page belongs to a section that contains submenus, the name of the section is given here
 * @param language define the language of the page ("en", "de")
 */
function writeLeadIn(active, section, language) {
	var bannerclass = "bannerdiv_"+language;
	write("<center>")
	write("<div class='pagediv'>");
	write("<div class='"+bannerclass+"'>");
	write("</div>");
	write("<table class='contenttable'>");
	write("<tr><td valign='top' colspan=2>");
	// create the navigation menu
	writeNavigationLeadIn();
	if( language=="de" ) {
		document.title = "Ingenieurbüro Janicke"
		writeNavigation_de(active, section);
	} else {
		document.title = "Janicke Consulting"
		writeNavigation_en(active, section);
	}
	writeNavigationLeadOut(active, language);
}

/**
 * The method closes all surrounding tags that were opened by the leadIn method.
 * Additionally a footer will be created.
 */
function writeLeadOut(language) {
	// the date of the last change will be displayed within the footer
	var lastChange = "2010-08-03";
	write("</td></tr></table>");
	if( language == "de" ) {
		write("<div class='footerdiv'><center><i>&copy; 1998-2010 Ing.-B&uuml;ro Janicke  - Letzte Änderung: "+lastChange+" - <a href='trademarks.html'>Verwendete Warenzeichen</a></i></center></div>")
	} else {
		write("<div class='footerdiv'><center><i>&copy; 1998-2010 Janicke Consulting - last change: "+lastChange+" - <a href='trademarks.html'>trademarks</a></i></center></div>")
	}
	write("</div>");		// pagediv
	write("</center>");	
}

/**
 * The german navigation menu.
 */
function writeNavigation_de(active, section) {
	writeNavigationButton("Hauptseite", "home.html", active);
	writeNavigationButton("Über uns", "aboutus.html", active);
	writeNavigationButton("Leistungen", "products.html", active);
	if( "products"==section ) {
		writeNavigationSubButton("LASAT", "lasat.html", active);
		writeNavigationSubButton("LASPORT", "lasport.html", active);
		writeNavigationSubButton("IBJdis", "ibjdis.html", active);
		writeNavigationSubButton("Preise", "prices.html", active);
		writeSeparator();
	}
	writeNavigationButton("Support", "support.html", active);
	if( "support"==section ) {
		writeNavigationSubButton("Fragen und Antworten zu LASAT", "lasat-faq.html", active);
		writeNavigationSubButton("Bekannte Probleme zu LASAT", "lasat-known-problems.html", active);
		writeNavigationSubButton("LASPORT", "lasport-support.html", active);
		writeSeparator();
	}
	writeNavigationButton("Downloads", "download.html", active);
	if( "download"==section ) {
		writeNavigationSubButton("Programme", "download-programs.html", active);
		writeNavigationSubButton("Texte", "download-text.html", active);
		writeNavigationSubButton("Datens&auml;tze", "download-data.html", active);
		writeSeparator();
	}
	writeNavigationButton("BZU", "bzu.html", active);
	writeNavigationButton("Gruppen", "groups.html", active);
	writeNavigationButton("AUSTAL2000", "http://www.austal2000.de", "_blank");
	/* writeNavigationButton("AUSTAL2000G", "http://www.austal2000g.de", "_blank"); */
	writeNavigationButton("Impressum", "impressum.html", active);
	writeNavigationButton("&Auml;nderungen", "changes.html", active);
}

/**
 * The english navigation menu.
 */
function writeNavigation_en(active, section) {
	writeNavigationButton("Home", "home.html", active);
	writeNavigationButton("About us", "aboutus.html", active);
	writeNavigationButton("Products", "products.html", active);
	if( "products"==section ) {
		writeNavigationSubButton("LASAT", "lasat.html", active);
		writeNavigationSubButton("LASPORT", "lasport.html", active);
		writeNavigationSubButton("IBJdis", "ibjdis.html", active);
		writeNavigationSubButton("Prices", "prices.html", active);
		writeSeparator();
	}
	writeNavigationButton("Support", "support.html", active);
	if( "support"==section ) {
		writeNavigationSubButton("Questions and Answers for LASAT", "lasat-faq.html", active);
		writeNavigationSubButton("Known problems with LASAT", "lasat-known-problems.html", active);
		writeNavigationSubButton("LASPORT", "lasport-support.html", active);
		writeSeparator();
	}
	writeNavigationButton("Downloads", "download.html", active);
	if( "download"==section ) {
		writeNavigationSubButton("Programs", "download-programs.html", active);
		writeNavigationSubButton("Text files", "download-text.html", active);
		writeNavigationSubButton("Data Sets", "download-data.html", active);
		writeSeparator();
	}
	writeNavigationButton("BZU", "bzu.html", active);
	writeNavigationButton("Groups", "groups.html", active);
	writeNavigationButton("AUSTAL2000", "http://www.austal2000.de", "_blank");
	/* writeNavigationButton("AUSTAL2000G", "http://www.austal2000g.de", "_blank"); */
	writeNavigationButton("Impressum", "impressum.html", active);
	writeNavigationButton("Changes", "changes.html", active);
}

/** The beginning of the navigation menu will be written */
function writeNavigationLeadIn() {
	write("<table  class='navtable'>");
}

/** Add the language flags to the navigation and close it */
function writeNavigationLeadOut(active) {
	write("<tr><td class='navflags'>");
	write("<a href='../de/"+active+"'><img src='../pics/de.gif' width=31 height=17 border=0 alt='de'></a>");
	write("<a href='../en/"+active+"'><img src='../pics/en.gif' width=31 height=17 border=0 alt='en'></a></td></tr>");
	//write("<tr><td class='navfiller'></td></tr>"); // fill until the end of page
	//write("<tr><td valign='top' height='100%'>&nbsp;</td></tr>"); // fill until the end of page
	write("</table>");
	//write("<table height='100%'><tr><td>&nbsp;</td></tr></table>"); // bug in mozilla: forces table to be placed at top
	write("</td><td class='contentcell'>");
}

/** Create a main menu entry */
function writeNavigationButton(text, link, active) {
	var targetClass = (link==active)?"activenavbutton":"navbutton";
	var targetLinkClass = (link==active)?"activenavlink":"navlink";
	var targetWindow = (active=="_blank")?'target="_blank"':"";
	write("<tr><td class='"+ targetClass + "'><a "+targetWindow+" class='"+targetLinkClass+"' href='"+ link + "'>" + text + "</a></td></tr>");
}

/** Create a sub menu entry */
function writeNavigationSubButton(text, link, active) {
	var targetClass = (link==active)?"activenavsubbutton":"navsubbutton";
	var targetLinkClass= (link==active)?"activenavsublink":"navsublink";
	write("<tr><td class='"+ targetClass + "'><a class='"+targetLinkClass+"' href='"+ link + "'>" + text + "</a></td></tr>");
}

function writeSeparator() {
	write("<tr height='2px'><td class='separator'><a style='font-size:1px;'>&nbsp;</a></td></tr>");
}

function write(s) {
	document.write(s);
}