// Form validation
function checkForm(form)
{
	if (!form.gender[0].checked&&!form.gender[1].checked)
	{
		alert('Please fill in your title.');
		return(false);
	}
	if (form.firstname.value.match(/^\s*$/))
	{
		alert('Please enter your First name.');
		form.firstname.focus();
		return(false);
	}
	if (form.firstname.value=="Firstname")
	{
		alert('Please enter your First name.');
		form.firstname.focus();
		return(false);
	}
	if (form.lastname.value.match(/^\s*$/))
	{
		alert('Please enter your Name');
		form.lastname.focus();
		return(false);
	}
	if (form.lastname.value=="Name")
	{
		alert('Please enter your Name.');
		form.lastname.focus();
		return(false);
	}
	if (form.email.value.match(/^\s*$/))
	{
		alert('Please enter your Email address.');
		form.email.focus();
		return(false);
	}
	if (form.email.value=="Email address")
	{
		alert('Please enter your Email address.');
		form.email.focus();
		return(false);
	}
	if (!form.email.value.match(/^[^\s\.]\S*@[^\s\.]\S*[^\s\.]\.[^\s\.][^\s\.]+$/))
	{
		alert('Please make sure that the email address matches the format x@xx.xx');
		form.email.focus();
		return(false);
	}
	if (!form.alreadyclient[0].checked&&!form.alreadyclient[1].checked)
	{
		alert('Please fill in the "Already a Mobistar customer" field.');
		return(false);
	}
	return(true);
}
function showMap() {
	window.open("http://corporate.mobistar.be/en/info/popup_network.html","","scrollbars=yes,width=800,height=740");
}
function checkFormOrder1(form)
{
	if (!form.gender[0].checked&&!form.gender[1].checked)
	{
		alert('Please fill in your title.');
		return(false);
	}
	if (form.firstname.value.match(/^\s*$/))
	{
		alert('Please fill in the "Surname" field.');
		form.firstname.focus();
		return(false);
	}
	if (form.firstname.value=="Surname")
	{
		alert('Please fill in the "Surname" field.');
		form.firstname.focus();
		return(false);
	}
	if (form.lastname.value.match(/^\s*$/))
	{
		alert('Please fill in the "Name" field.');
		form.lastname.focus();
		return(false);
	}
	if (form.lastname.value=="Name")
	{
		alert('Please fill in the "Name" field.');
		form.lastname.focus();
		return(false);
	}
	if (form.email.value.match(/^\s*$/))
	{
		alert('Please fill in the "Email address" field.');
		form.email.focus();
		return(false);
	}
	if (form.email.value=="Email address")
	{
		alert('Please fill in the "Email address" field.');
		form.email.focus();
		return(false);
	}
	if (!form.email.value.match(/^[^\s\.]\S*@[^\s\.]\S*[^\s\.]\.[^\s\.][^\s\.]+$/))
	{
		alert('Please make sure that the email address matches the format x@xx.xx');
		form.email.focus();
		return(false);
	}
	if (form.currentgsmnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "Phone" field.');
		form.email.focus();
		return(false);
	}
	if (form.currentgsmnumber.value=="Phone")
	{
		alert('Please fill in the "Phone" field.');
		form.currentgsmnumber.focus();
		return(false);
	}
	if (!form.iscompany[0].checked&&!form.iscompany[1].checked)
	{
		alert('Please indicate if you are a company or a particular.');
		return(false);
	}
	if (form.iscompany[0].checked&&form.companystatus.value=="")
	{
		alert('Please fill in the "Company status " field.');
		form.companystatus.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyname.value.match(/^\s*$/))
	{
		alert('Please fill in the "Company name" field.');
		form.companyname.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyname.value=="Company name")
	{
		alert('Please fill in the "Company name" field.');
		form.companyname.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyvat.value.match(/^\s*$/))
	{
		alert('Please fill in the "Company VAT number" field.');
		form.companyvat.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyvat.value=="Company VAT number")
	{
		alert('Please fill in the "Company VAT number" field.');
		form.companyvat.focus();
		return(false);
	}
	return(true);
}

function checkFormOrder2(form)
{
	if (form.street.value.match(/^\s*$/))
	{
		alert('Please fill in the "Street" field.');
		form.street.focus();
		return(false);
	}
	if (form.street.value=="Street")
	{
		alert('Please fill in the "Street" field.');
		form.street.focus();
		return(false);
	}
	if (form.streetnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "Number" field.');
		form.streetnumber.focus();
		return(false);
	}
	if (form.streetnumber.value=="Number")
	{
		alert('Please fill in the "Number" field.');
		form.streetnumber.focus();
		return(false);
	}
	if (form.zip.value.match(/^\s*$/))
	{
		alert('Please fill in the "Postal code" field.');
		form.zip.focus();
		return(false);
	}
	if (form.zip.value=="Postal code")
	{
		alert('Please fill in the "Postal code" field.');
		form.zip.focus();
		return(false);
	}
	if (isNaN(form.zip.value))
	{
		alert('Please fill the field "Postal code" with numbers only.');
		form.zip.focus();
		return(false);
	}
	if (form.zip.value.length>4||form.zip.value.length<4)
	{
		alert('Please use 4 numbers in the field "Postal code".');
		form.zip.focus();
		return(false);
	}
	if (form.city.value.match(/^\s*$/))
	{
		alert('Please fill in the "City" field.');
		form.city.focus();
		return(false);
	}
	if (form.city.value=="City")
	{
		alert('Please fill in the "City" field.');
		form.city.focus();
		return(false);
	}
	if (!form.invoiceaddress[0].checked&&!form.invoiceaddress[1].checked)
	{
		alert('Please indicate if you need a different invoicing address.');
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicestreet.value.match(/^\s*$/))
	{
		alert('Please fill in the "Street (invoice address)" field.');
		form.invoicestreet.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicestreet.value=="Street")
	{
		alert('Please fill in the "Street (invoice address)" field.');
		form.invoicestreet.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicestreetnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "Number (invoice address)" field.');
		form.invoicestreetnumber.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicestreetnumber.value=="Number")
	{
		alert('Please fill in the "Number (invoice address)" field.');
		form.invoicestreetnumber.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicezip.value.match(/^\s*$/))
	{
		alert('Please fill in the "Postal code (invoice address)" field.');
		form.invoicezip.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicezip.value=="Postal code")
	{
		alert('Please fill in the "Postal code (invoice address)" field.');
		form.invoicezip.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&isNaN(form.invoicezip.value))
	{
		alert('Please fill the field "Postal code (invoice address)" with numbers only.');
		form.invoicezip.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&(form.invoicezip.value.length>4||form.invoicezip.value.length<4))
	{
		alert('Please use 4 numbers in the field "Postal code (invoice address)".');
		form.invoicezip.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicecity.value.match(/^\s*$/))
	{
		alert('Please fill in the "City (invoice address)" field.');
		form.invoicecity.focus();
		return(false);
	}
	if (form.invoiceaddress[0].checked&&form.invoicecity.value=="City")
	{
		alert('Please fill in the "City (invoice address)" field.');
		form.invoicecity.focus();
		return(false);
	}
	return(true);
}

function checkFormOrderPlan1(form)
{
	if (!form.gender[0].checked&&!form.gender[1].checked)
	{
		alert('Please fill in your title.');
		return(false);
	}
	if (form.firstname.value.match(/^\s*$/))
	{
		alert('Please fill in the "Surname" field.');
		form.firstname.focus();
		return(false);
	}
	if (form.firstname.value=="Surname")
	{
		alert('Please fill in the "Surname" field.');
		form.firstname.focus();
		return(false);
	}
	if (form.lastname.value.match(/^\s*$/))
	{
		alert('Please fill in the "Name" field.');
		form.lastname.focus();
		return(false);
	}
	if (form.lastname.value=="Name")
	{
		alert('Please fill in the "Name" field.');
		form.lastname.focus();
		return(false);
	}
	if (form.email.value.match(/^\s*$/))
	{
		alert('Please fill in the "Email address" field.');
		form.email.focus();
		return(false);
	}
	if (form.email.value=="Email address")
	{
		alert('Please fill in the "Email address" field.');
		form.email.focus();
		return(false);
	}
	if (!form.email.value.match(/^[^\s\.]\S*@[^\s\.]\S*[^\s\.]\.[^\s\.][^\s\.]+$/))
	{
		alert('Please make sure that the email address matches the format x@xx');
		form.email.focus();
		return(false);
	}
	if (!form.nationality[0].checked&&!form.nationality[1].checked)
	{
		alert('Please indicate your nationality.');
		return(false);
	}
	if (form.idcardnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "ID card number" field.');
		form.idcardnumber.focus();
		return(false);
	}
	if (form.idcardnumber.value=="ID card number")
	{
		alert('Please fill in the "ID card number" field.');
		form.idcardnumber.focus();
		return(false);
	}
	if (form.nationality[0].checked&&isNaN(form.idcardnumber.value))
	{
		alert('Please fill the field "ID card number" with numbers only.');
		form.idcardnumber.focus();
		return(false);
	}
	if (form.nationality[0].checked&&(form.idcardnumber.value.length>12||form.idcardnumber.value.length<12))
	{
		alert('Please use 12 numbers in the field "ID card number".');
		form.idcardnumber.focus();
		return(false);
	}
	if (form.nationality[1].checked&&form.nationalnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "National number" field.');
		form.nationalnumber.focus();
		return(false);
	}
	if (form.nationality[1].checked&&form.nationalnumber.value=="National number")
	{
		alert('Please fill in the "National number" field.');
		form.nationalnumber.focus();
		return(false);
	}
	if (form.profession.value=="")
	{
		alert('Please fill in the "Profession" field.');
		form.profession.focus();
		return(false);
	}
	if (!form.iscompany[0].checked&&!form.iscompany[1].checked)
	{
		alert('Please indicate if you are a company or a particular.');
		return(false);
	}
	if (form.iscompany[0].checked&&form.companystatus.value=="")
	{
		alert('Please fill in the "Company status" field.');
		form.companystatus.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyname.value.match(/^\s*$/))
	{
		alert('Please fill in the "Company name.');
		form.companyname.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyname.value=="Company name")
	{
		alert('Please fill in the "Company name" field.');
		form.companyname.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyvat.value.match(/^\s*$/))
	{
		alert('Please fill in the "Company VAT number" field.');
		form.companyvat.focus();
		return(false);
	}
	if (form.iscompany[0].checked&&form.companyvat.value=="Company VAT number")
	{
		alert('Please fill in the "Company VAT number" field.');
		form.companyvat.focus();
		return(false);
	}
	return(true);
}

function checkFormOrderPlan4(form)
{
	if (form.bankaccountnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "Bank account number" field.');
		form.bankaccountnumber.focus();
		return(false);
	}
	if (form.bankaccountnumber.value=="Bank account number")
	{
		alert('Please fill in the "Bank account number" field.');
		form.bankaccountnumber.focus();
		return(false);
	}
	if (!form.bankaccountnumber.value.match(/^\d\d\d[- ]\d\d\d\d\d\d\d[- ]\d\d$/))
	{
		alert('Please make sure that the "Bank account number" matches the format xxx-xxxxxxx-xx');
		form.bankaccountnumber.focus();
		return(false);
	}
	if (!form.usecurrentmobilenumber[0].checked&&!form.usecurrentmobilenumber[1].checked)
	{
		alert('Please indicate if you want the abonnement to be activated on your current gsm number.');
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentgsmnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "Current gsm number" field.');
		form.currentgsmnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentgsmnumber.value=="Current gsm number")
	{
		alert('Please fill in the "Current gsm number" field.');
		form.currentgsmnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&isNaN(parseInt(form.currentgsmnumber.value)))
	{
		alert('Please fill in only numbers in the field "Current gsm number".');
		form.currentgsmnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentgsmnumber.value.toString().length != 10)
	{
		alert('Please fill in the "Current gsm number" field with 10 numbers.');
		form.currentgsmnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentgsmnumber.value.substr(0,2) != 04)
	{
		alert('The field "Current gsm number" must start with "04".');
		form.currentgsmnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentoperator.value!="Mobistar"&&form.currentsimcardnumber.value.match(/^\s*$/))
	{
		alert('Please fill in the "Current SIM card number" field.');
		form.currentsimcardnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentoperator.value!="Mobistar"&&form.currentsimcardnumber.value=="Current SIM card number")
	{
		alert('Please fill in the "Current SIM card number" field.');
		form.currentsimcardnumber.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentoperator.value!="Mobistar"&&!form.currentplan[0].checked&&!form.currentplan[1].checked)
	{
		alert('Please indicate your current plan.');
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentoperator.value!="Mobistar"&&form.currentplan[1].checked&&form.currentcustomercode.value.match(/^\s*$/))
	{
		alert('Please fill in the "Current customer code" field.');
		form.currentcustomercode.focus();
		return(false);
	}
	if (form.usecurrentmobilenumber[0].checked&&form.currentoperator.value!="Mobistar"&&form.currentplan[1].checked&&form.currentcustomercode.value=="Current customer code")
	{
		alert('Please fill in the "Current customer code" field.');
		form.currentcustomercode.focus();
		return(false);
	}
	return(true);
}

function checkFormOrderPlan5(form)
{
	if (form.confirmBox.checked == false) {
		alert('You have to certify that you accept the general conditions.');
		return(false);
	}
	return(true);
}