// JavaScript Document 
$(document).ready(function() {
	$('#tellfriend').hide();
	centerIt();
	$('a.email_af').click(function() {
		if($("#tellfriend").is(":visible")) {
			$("#tellfriend").hide("fast");
		} else {
			$("#tellfriend").show("fast");	
		}
	});
	$('#tellfriend a.close').click(function() {
		$("#tellfriend").hide('fast');
	});
});

$(window).resize(function() {
	centerIt();
});

function centerIt() {
	$('#tellfriend').css("top", ($(window).height())/2+$(window).scrollTop() - ($('#tellfriend').height()/2) + "px");
	$('#tellfriend').css("left", ($(window).width())/2+$(window).scrollLeft() - ($('#tellfriend').width()/2) + "px");
}

formnaam = document.forms["tellafriend_form"];

function submit_form() {
	if (formnaam.elements["clt_sendname"].value == "" || isString(formnaam.elements["clt_sendname"].value) == false) {
		alert("Geef uw naam op.");
		return formnaam.elements["clt_sendname"].select();
	} else if (isEmail(formnaam.elements["clt_sendmail"].value) == false)	{
		alert("Geef uw e-mail adres op");
		return formnaam.elements["clt_sendmail"].select();
	} else if (formnaam.elements["clt_toname"].value == "" || isString(formnaam.elements["clt_toname"].value) == false) {
		alert("Geef een naam op.");
		return formnaam.elements["clt_toname"].select();
	} else if (isEmail(formnaam.elements["clt_tomail"].value) == false)	{
		alert("Geef een geldig e-mail adres op");
		return formnaam.elements["clt_tomail"].select();
	} else {
		formnaam.submit();
	}
}

