function CheckSendArticle()
{
	if($('infopanel')) { $('infopanel').remove(); };

	var Error = '<div id="infopanel" class="infopanel error"><p>Nesprávně vyplněná položka.</p></div>';

	var FilterEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

	if (!FilterEmail.test(Form.Element.getValue('recipient')))
	{
		Form.Element.focus('recipient');
		new Insertion.After('recipient', Error);
		return false;
	}
	else
	if (!FilterEmail.test(Form.Element.getValue('sender')))
	{
		Form.Element.focus('sender');
		new Insertion.After('sender', Error);
		return false;
	}
	else
	return true;
}

function SendArticle(clanek_id)
{
	var content = '<div class="form">';
	content += '<fieldset>';
	content += '<legend>Poslat článek na email</legend>';
	content += '<form action="/form/form-clanek-detail.php" method="post" onsubmit="return CheckSendArticle();">';
	content += '<input type="hidden" name="clanek_id" value="' + clanek_id + '" />';
	content += '<label for="recipient" class="bold">Email přijemce: </label>';
	content += '<input type="text" name="recipient" id="recipient" class="text" />';
	content += '<br />';
	content += '<label for="sender" class="bold">Váš email: </label>';
	content += '<input type="text" name="sender" id="sender" class="text" />';
	content += '<br />';
	content += '<label for="odeslat">&nbsp;</label>';
	content += '<input type="submit" name="odeslat" id="odeslat" value="Odeslat" class="button" />';
	content += '<br />';
	content += '<p><strong>Tučné</strong> položky jsou povinné.</p>';
	content += '</form>';
	content += '</fieldset>';
	content += '</div>';

	$('artsend').update(content);
	
	return false;
}

function SetRate(clanekId)
{
	if($('artrate'))
	{		
		var content = '<div class="form">';
		content += '<fieldset>';
		content += '<legend>Ohodnotit článek</legend>';
		content += '<p>';
		content += '<span><img src="/img/thumb_down.gif" alt="" /></span>';
		for(var i = 1; i < 11; i++)
		{
			content += '<a href="/form/form-clanek-detail.php?clanek_id=' + clanekId + '&body=' + i + '">' + i + '</a>';
		}
		content += '<span><img src="/img/thumb_up.gif" alt="" /></span>';
		content += '</p>';
		content += '</fieldset>';
		
		$('artrate').innerHTML = content;
	}
}
