/**
 * 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 colspan=2>");
	// create the navigation menu
	writeNavigationLeadIn();
	if( language=="de" ) {
		document.title = "AUSTAL2000"
		writeNavigation_de(active, section);
	} else {
		document.title = "AUSTAL2000"
		writeNavigation_en(active, section);
	}
	writeNavigationLeadOut(active, language);
	write("</td><tr><td><div class='contentcell'>");
}

/**
 * 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("</div></td></tr></table>");
	if( language == "de" ) {
		write("<div class='footerdiv'><center><i>&copy; 2002-2010 UBA, Ing.-B&uuml;ro Janicke  - Letzte Änderung: "+lastChange+"</i></center></div>")
	} else {
		write("<div class='footerdiv'><center><i>&copy; 2002-2010 UBA, Janicke Consulting - last change: "+lastChange+"</i></center></div>")
	}
	write("</div>");		// pagediv
	write("</center>");	
}

/**
 * The german navigation menu.
 */
function writeNavigation_de(active, section) {
	writeNavigationButton("AUSTAL2000", "home.html", active);
	writeNavigationButton("Geschichte", "history.html", active);
	writeNavigationButton("Downloads", "downloads.html", active);
	writeNavigationButton("FAQ", "faq.html", active);
	writeNavigationButton("Bekannte Probleme", "problems.html", active);
	writeNavigationButton("Alte Dateien", "past.html", active);
	writeNavigationButton("&Auml;nderungen", "changes.html", active);
	writeNavigationButton("Impressum", "impressum.html", active);
}

/**
 * The english navigation menu.
 */
function writeNavigation_en(active, section) {
	writeNavigationButton("AUSTAL2000", "home.html", active);
	writeNavigationButton("History", "history.html", active);
	writeNavigationButton("Downloads", "downloads.html", active);
	writeNavigationButton("FAQ", "faq.html", active);
	writeNavigationButton("Known Problems", "problems.html", active);
	writeNavigationButton("Old Data", "past.html", active);
	writeNavigationButton("Changes", "changes.html", active);
	writeNavigationButton("Impressum", "impressum.html", active);
}

/** The beginning of the navigation menu will be written */
function writeNavigationLeadIn() {
	write("<ul id='nav'>");
}

/** Add the language flags to the navigation and close it */
function writeNavigationLeadOut(active) {
	write("<li >");
	write("<a href='../de/"+active+"'><img src='../pics/de.gif' width=27 height=14 border=0 alt='de'></a>");
	write("<a href='../en/"+active+"'><img src='../pics/en.gif' width=27 height=14 border=0 alt='en'></a></li>");
	write("</ul>");
	write("</table>");
}

/** 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("<li><a href='"+ link + "'>" + text + "</a></li>");
}

/** 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);
}