var _url;
var _font;
var _limit;
var _width;
var _titleColor;
var _titleBackgroundColor;
var _linkColor;
var _linkBackgroundColor;
var _boldtitle;
var _displaysummaries;
var code;
function get (id) {
	return document.getElementById(id);
}
function getByClass (className) {
	x = document.getElementsByTagName('*');
	ret = Array();
	y = 0;
	for (i in x) {
		if (x[i].className == className) {
			ret[y] = x[i];
			y++;
		}
	}
	return ret;
}
function updateCode () {
	wrapper = getByClass('feedSource-wrapper');
	for (i in wrapper) {
		wrapper[i].style.fontFamily = _font.value;
		wrapper[i].style.fontSize = _size.value;
		wrapper[i].style.width = _width.value;
	}
	title = getByClass('feedSource-title');
	for (i in title) {
		title[i].style.color = _titleColor.value;
		title[i].style.backgroundColor = _titleBackgroundColor.value;
                title[i].style.boldtitle = _boldtitle.value;
	}
	links = getByClass('feedSource-link');
	for (i in links) {
		links[i].color = _linkColor.value;
		links[i].backgroundColor = _linkBackgroundColor.value;
	}

code.value = '<div align="center"><center><table border="0" cellpadding="2" cellspacing="2" width="' + _width.value + '"><tr><td width="100%">' + "\n";


	code.value += '<script language="javascript" type="text/javascript">' + "\n";
        code.value += 'var syndicate = new Object;' + "\n";


	code.value += "	syndicate.title_fontface    = '" + _font.value + "';\n";
	code.value += "	syndicate.title_fontsize    = '" + _size.value + "';\n";
	code.value += "	width = '" + _width.value + "';\n";
	code.value += "	syndicate.title_fontcolor   = '" + _titleColor.value + "';\n";
code.value += "	syndicate.max_articles      = '" + _limit.value + "';\n";
code.value += "	syndicate.title_fontbold    = '" + _boldtitle.value + "';\n";
code.value += "	syndicate.display_summaries = '" + _displaysummaries.value + "';\n";
code.value += "	syndicate.summary_fontcolor = '" + _summaryfontcolor.value + "';\n";
code.value += "	syndicate.summary_fontsize  = '" + _summaryfontsize.value + "';\n";
code.value += "	syndicate.date_fontcolor    = '" + _datecolor.value + "';\n";
code.value += "	syndicate.date_fontsize     = '" + _datesize.value + "';\n";
code.value += "	syndicate.date_fontbold     = '" + _datebold.value + "';\n";
code.value += "	syndicate.summary_fontface  = '" + _summaryfont.value + "';\n";
code.value += "	syndicate.date_fontface     = '" + _datefont.value + "';\n";



	
	code.value += "	syndicate.display_date      = '" + _displaydate.value + "';\n";
	code.value += "	syndicate.bgcolor           = '" + _linkBackgroundColor.value + "';\n";
	code.value += "</script>\n";
	code.value += '<script language="javascript" type="text/javascript" src="' + _url.value + '"></script></div>' + "\n";
}
window.onload = function () {
	_url = get('feed-url');
	_font = get('font');
	_size = get('size');
	_limit = get('limit');
	_width = get('width');
        _boldtitle = get('boldtitle');
        _displaysummaries = get('displaysummaries');
        _summaryfontcolor = get('summaryfontcolor');
        _summaryfontsize = get('summaryfontsize')


	_titleColor = get('title-color');
	_titleBackgroundColor = get('title-background-color');
	_linkColor = get('link-color');
	_linkBackgroundColor = get('link-background-color');
_displaydate = get('displaydate');
_datecolor = get('datecolor');
_datesize = get('datesize');
_datebold = get('datebold');
_summaryfont = get('summaryfont');
_datefont = get('datefont');


	code = get('code');
}