if (document.getElementById('login'))
{
	document.getElementById('login').onsubmit = function()
	{
		tn_send_form('login','login','','document.location.href="/?log=true"');
		return false;
	}
	if (document.getElementById('seml') && document.getElementById('spwd'))
	{
		if (document.getElementById('seml').value != '' && document.getElementById('spwd').value != '')
		{
			tn_send_form('login','login','','document.location.reload()');
		}
	}
}
function get_to(iid)
{
 	tn_xml2div('tores','showto','id='+iid, 'track_zv('+iid+');reageer()');
}


if (document.getElementById('tosel'))
{
	document.getElementById('tosel').onchange = function()
 	{
		get_to(this.value);
	}
	if (document.location.hash != '')
	{
		var urid = document.location.hash.substr(1, document.location.hash.length -1);
		get_to(urid);
	}
} 

function track_zv(xx)
{
	if (document.getElementById('zvin'))
	{
		var rds = document.getElementById('zvin').getElementsByTagName('input');
		for (i = 0; i < rds.length; i++)
		{
			rds[i].onclick = function()
			{
				tn_nodiv('zvin','val='+this.value+'&tag='+this.name+'&id=' + xx, 'get_to('+xx+');');
			}
		}
	}
	
	if (document.getElementById('trans'))
	{
		document.getElementById('kright').innerHTML = document.getElementById('trans').innerHTML;
		document.getElementById('trans').innerHTML = '';
	}	
	
	if (document.getElementById('netw'))
	{
		var rdsn = document.getElementById('netw').getElementsByTagName('input');
		for (j = 0; j < rdsn.length; j++)
		{
			rdsn[j].onclick = function()
			{
				tn_nodiv('netw','val='+this.value+'&tag='+this.name+'&id=' + xx, 'get_to('+xx+');');
			}
		}
	}

}

function reageer()
{
	if (document.getElementById('reageer') && document.getElementById('reageer').innerHTML.indexOf(",") != -1)
	{
			var what = new Array();
			what = document.getElementById('reageer').innerHTML.split(',');
			tn_xml2div('reageer','reageer','id='+what[0]+'&soort='+what[1],"catch_reply("+what[0]+",'"+what[1]+"')");	
	}
}

function delcom(i,fid,fsoort)
{
	tn_xml2div('reageer','reageer','id='+fid+'&soort='+fsoort+'&del='+ i,"catch_reply("+fid+",'"+fsoort+"')");
}
		

function catch_reply(fid,fsoort)
{
	if (document.getElementById('reply'))
	{
				document.getElementById('reply').onclick = function()
				{
					tn_send_form('reageer','reageer','id='+fid+'&soort='+fsoort,"catch_reply("+fid+",'"+fsoort+"')");
					return false;
				}
	}
}

if (document.getElementById('ar'))
{
	document.getElementById('ar').onclick = function()
	{
		document.location.href = '/revue';
		return false;
	}
}

reageer();
