// JavaScript Document
// BY FRiZBee.be
// FOR beologic.com

function make_link_meel(user, host, text)
{
    document.write ('<a href="mailto:' + user + '@' + host +'?subject='+text+'">' + user + '@' + host + '</a>');
}

function contact_formcheck(){
	if (document.formname.ab.value=="" || document.formname.ab.value=="Type here your first name and last name."){
	  alert("Please fill in your first name and last name.");
	  document.formname.ab.focus();
	  return false
	}
	if (!checkMail(document.formname.bem.value)){
	  alert("Please fill in a valid email address.");
	  document.formname.bem.focus();
	  return false
	}
	if (document.formname.message.value=="" || document.formname.message.value=="Type here your message."){
	  alert("Please fill in a message.");
	  document.formname.message.focus();
	  return false
	}
	if (document.formname.validator.value=="" || document.formname.validator.value=="Retype the code from the left."){
	  alert("Please fill in the code you see on the left.");
	  document.formname.validator.focus();
	  return false
	}
}

function checkMail(s)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(s)) return true;
	else return false;
}



// CMS FUNCTIONS -----------------------------------------------------------------------------------------------------------
function formchecklogin()
{
	if (document.formname.username.value=="")
	{
		alert("Gelieve uw gebruikersnaam in te vullen!");
		document.formname.username.focus();
		return false
	}
	if (document.formname.password.value=="")
	{
		alert("Gelieve je paswoord in te vullen!");
		document.formname.password.focus();
		return false
	}
}

function cms_changepwd_formcheck(){
	if (document.frm.oldpwd.value==""){
		alert("Vul je oude paswoord in.");
		document.frm.oldpwd.focus();
		return false
	}
	if (document.frm.newpwd.value==""){
		alert("Vul een nieuw paswoord in.");
		document.frm.newpwd.focus();
		return false
	}
	if (document.frm.newpwd2.value==""){
		alert("Herhaal je nieuwe paswoord.");
		document.frm.newpwd2.focus();
		return false
	}
}

function formcheck_itemaddnewthumb(){
	if (document.frm.nithumb.value==""){
		alert("Gelieve een thumbnail te selecteren.");
		document.frm.nithumb.focus();
		return false
	}
}

function formcheck_additem(){
	if (document.frm.itemnaam.value=="")
	{
		alert("Gelieve een naam in te vullen voor het item dat je wil toevoegen!");
		document.frm.itemnaam.focus();
		return false
	}
	if (document.frm.nithumb.value==""){
		alert("Gelieve een thumbnail te selecteren voor het item dat je wil toevoegen.");
		document.frm.nithumb.focus();
		return false
	}
}

function formcheck_addextrapic(){
	if (document.frm.nithumb.value==""){
		alert("Gelieve een afbeelding te selecteren voor het item dat je wil toevoegen.");
		document.frm.nithumb.focus();
		return false
	}
}