var last = '000000';
function $ (id) {
	return document.getElementById(id);
}
function download_image () {
	window.location = $('image').firstChild.src.replace('image.php', 'download.php');
}
function load_image () {
	//$('image').innerHTML = '<img src="image.php?font=' + $('font').value + '&text=' + window.encodeURI($('text').value) + '&color=' + $('cp1_Hex').value + '&size=' + $('size').value;
	$('image').firstChild.src = 'image.php?font=' + $('font').value + '&text=' + window.encodeURI($('text').value) + '&color=' + $('cp1_Hex').value + '&size=' + $('size').value;
}
function check_changed () {
	if (last != $('cp1_Hex').value) {
		last = $('cp1_Hex').value;
		load_image();
	}
}
window.onload = function () {
	load_image();
	window.setInterval(check_changed, 100);
}