function sendToFriend(title, perex, link) {
	if ($('#overlay-video').attr('id') == undefined) {
		$('body')
				.append(
						'<div id="overlay-video"><div class="video"><div id="overlay-video-object"></div><div class="description" id="overlay-video-description"></div><div class="close"><a href="#" style="margin-right: 10px; position: relative; top: 10px;"><img src="/images/pressinfo/lightbox-btn-close.gif" alt="zavřít" /></a></div></div><div class="background">&nbsp;</div></div>');
	}

	var url = $(this).attr('href');

	scroll(0, 0);
	$("#overlay-video").css(
			'height',
			($('body').height() > $("#overlay-video").height() ? $('body')
					.height() : $("#overlay-video").height()) + 'px');
	if ($(this).parent(".video-teaser").attr("class") == undefined)
		var description = $(this).parent().parent(".video-teaser").find(
				".description").html();
	else
		var description = $(this).parent(".video-teaser").find(".description")
				.html();

	$("#overlay-video-description").html(description);
	$("#overlay-video .background").css("opacity", 0.5);

	var url = jQuery(this).attr("href");
	var y = jQuery(this).find(".videoUrl").text();
	
	jQuery.post('/content/sendToMailForm',{
		title: title.html(),
		text: perex.html(),
		link: link
	},function(data){
		jQuery("#overlay-video-object").html(data);	
	});

	setTimeout(function() {
		$('#overlay-video .close a').click(function() {
			$('#overlay-video').fadeOut();
			setTimeout(function() {
				$('#overlay-video').remove();
			}, 1000);
		})
	}, 500);

	return false;
}

function sendToFriendForm() {
	jQuery.post('/content/sendToFriend',{
		recipient: jQuery("#send_recipient").val(),
		text: jQuery("#send_text").val(),
		author: jQuery("#send_author").val(),
		sender: jQuery("#send_sender").val(),
		link: jQuery("#send_link").val(),
		title: jQuery("#send_title").val(),
		content: jQuery("#send_content").val(),
		_csrf_token: jQuery("#send__csrf_token").val()
	},function(data){
		jQuery("#overlay-video-object").html(data);
	});
	
	return false;
}

function validateMail(address) {
	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if(reg.test(address) == false) {
		return false;
	}
	return true;
}
