function isdefined( variable)
{
return (typeof(variable) == "undefined")?  false: true;
}

function valButton(btn) {
var cnt = -1;
for (var i=btn.length-1; i > -1; i--) {
if (btn[i].checked) {cnt = i; i = -1;}
}
if (cnt > -1) return btn[cnt].value;
else return null;
}




function validateContactForm()
{
var error="";
var btn = valButton(document.contactform.contact_by);

if(document.contactform.last_name.value=="Mandatory" || document.contactform.last_name.value=="" ) error+="Please enter your last name!\n";
if(document.contactform.company_name.value=="Mandatory" || document.contactform.company_name.value=="" ) error+="Please enter your company's name!\n";
if( (document.contactform.e_mail.value.indexOf("@")==-1) || document.contactform.e_mail.value == "" || document.contactform.e_mail.value == "Mandatory" )  error+="The e-mail address is incorrect!\n";
if(document.contactform.telephone.value=="" || document.contactform.telephone.value=="Mandatory") error+="Your phone number is incorect!\n";
if (btn == null) error+="You have to add your contact form!\n";
if( document.contactform.message.value=="" ) error+="You have to add a message!\n";

if (error!="") alert(error);
return error=="";
}

