/* Fontview 2006-12-12 */


function changeFonts(listname, fontsize) {
	changeHeadline('System Font: ' + listname)
	showFonts(listname, fontsize)
}


function changeHeadline(newHeadline) {
	var theHeadline = document.getElementById('theHeadline')
	while(theHeadline.hasChildNodes()) {
		theHeadline.removeChild(theHeadline.childNodes[0])
	}
	
	var oTextNode = document.createTextNode(newHeadline)
	theHeadline.appendChild(oTextNode)
}

function showFonts(listname, fontsize) {
	var theFontList = document.getElementById('theFontList')
	while(theFontList.hasChildNodes()) {
		theFontList.removeChild(theFontList.childNodes[0])
	}
	var ul = document.createElement("ul")
	theFontList.appendChild(ul)
	for (font in fontlist[listname]) {
		var fontname = fontlist[listname][font]
		var li = document.createElement("li")
		ul.appendChild(li)
		var span = document.createElement("span")
		li.appendChild(span)
		var oTextNode = document.createTextNode(fontname)
		span.appendChild(oTextNode)
//		span.setAttribute("class", "fontItem")
		span.style.fontFamily = fontname
		span.style.fontSize = fontsize
		if (fontname.indexOf('Bold')!=-1)
			span.style.fontWeight = 'bold'
		if (fontname.indexOf('Italic')!=-1)
			span.style.fontStyle = 'italic'
	}
}

function clearFonts() {
	var theFontList = document.getElementById('theFontList')
	while(theFontList.hasChildNodes()) {
		theFontList.removeChild(theFontList.childNodes[0])
	}
}

function start() {
//	alert('hallo')
	var startFontlist = document.getElementById('sect_fontlist').value
	var startFontsize = document.getElementById('sect_fontsize').value
	changeFonts(startFontlist, startFontsize)
}


window.onload=start

