  	function checkRegForm() {
	var sFields = "";
	
	
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	if(document.forms.regForm.Name.value == "" ){
			sFields = sFields + " - First name\n";
	}
	if(document.forms.regForm.Lastname.value == "" ){
			sFields = sFields + " - Last name\n";
	}
	if(document.forms.regForm.Title.value == "" ){
			sFields = sFields + " - Job title\n";
	}
	if(document.forms.regForm.Company.value == "" ){
			sFields = sFields + " - Company\n";
	}
	if(document.forms.regForm.Country.value == "" ){
			sFields = sFields + " - Country\n";
	}
	if(!re.test(document.forms.regForm.Email.value)) {
		sFields = sFields + " - Email address\n";
	}
	if(document.forms.regForm.Phone.value == "" ){
			sFields = sFields + " - Phone\n";
	}

	if(sFields != "") {
		alert("Following fields were empty or not correct: \n" + sFields);
		return;
	} else {
		document.forms.regForm.submit();
	}
}

function checkCmpgnRegForm() {
	var sFields = "";
	
	
	var re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	if(document.forms.cmpgn_regForm.Name.value == "" ){
			sFields = sFields + " - First name\n";
	}
	if(document.forms.cmpgn_regForm.Lastname.value == "" ){
			sFields = sFields + " - Last name\n";
	}
	if(document.forms.cmpgn_regForm.Title.value == "" ){
			sFields = sFields + " - Job title\n";
	}
	if(document.forms.cmpgn_regForm.Company.value == "" ){
			sFields = sFields + " - Company\n";
	}
	if(document.forms.cmpgn_regForm.Country.value == "" ){
			sFields = sFields + " - Country\n";
	}
	if(!re.test(document.forms.cmpgn_regForm.Email.value)) {
		sFields = sFields + " - Email address\n";
	}
	if(document.forms.cmpgn_regForm.Phone.value == "" ){
			sFields = sFields + " - Phone\n";
	}

	if(sFields != "") {
		alert("Following fields were empty or not correct: \n" + sFields);
		return;
	} else {
		document.forms.cmpgn_regForm.submit();
	}
}


// ---- Till kontaktformuläret ------
    var fieldnames = new Array();
	fieldnames[0] = "Name";
	fieldnames[1] = "Title";
	fieldnames[3] = "E-mail";
	
	function isValidEmail(sEmail)
	{
		//Return true if sEmail is in valid e-mail format.
		var re = /^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i;
		var bMatch = sEmail.match(re);
		
		if(bMatch != null)
		{
			return true;
		}
		else
		{
			alert("Du har angivit en felaktig e-postadress.\nVar god ange en korrekt adress.");
			return false;
		}
	}
	
	function verifyer()
	{
		var d = document.SendForm;
		
		d.Title.optional	= true;
		d.Company.optional	= true;
		d.Address.optional	= true;
		d.Zip.optional		= true;
		d.Country.optional	= true;
		d.Phone.optional	= true;
		d.Message.optional	= true;
		
		if(verify(d))
		{
			return isValidEmail(d.Email.value);
		}
		else
		{
			return false;
		}
	}
// A utility function that returns true if a string contains only 
// whitespace characters.
function isblank(s)
{
    for(var i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
    }
    return true;
}

// This is the function that performs form verification. It will be invoked
// from the onSubmit() event handler. The handler should return whatever
// value this function returns.
function verify(f)
{
    var msg;
    var empty_fields = "";
    var errors = "";
	

    // Loop through the elements of the form, looking for all 
    // text and textarea elements that don't have an "optional" property
    // defined. Then, check for fields that are empty and make a list of them.
    // Also, if any of these elements have a "min" or a "max" property defined,
    // then verify that they are numbers and that they are in the right range.
    // Put together error messages for fields that are wrong.
    for(var i = 0; i < f.length; i++) {
        var e = f.elements[i];

        if (((e.type == "text") || (e.type == "textarea")) && !e.optional) {
            // first check if the field is empty
            if ((e.value == null) || (e.value == "") || isblank(e.value)) {
                empty_fields += "\n          " + fieldnames[i];
                continue;
            }

            // Now check for fields that are supposed to be numeric.
            if (e.numeric || (e.min != null) || (e.max != null)) { 
                var v = parseFloat(e.value);
                if (isNaN(v) || 
                    ((e.min != null) && (v < e.min)) || 
                    ((e.max != null) && (v > e.max))) {
                    errors += "- Fältet " + fieldnames[i] + " kan bara innehålla tal";
                    if (e.min != null) 
                        errors += " som är större än " + e.min;
                    if (e.max != null && e.min != null) 
                        errors += " och mindre än " + e.max;
                    else if (e.max != null)
                        errors += " som är mindre än " + e.max;
                    errors += ".\n";
                }
            }
        }
    }

	
    // Now, if there were any errors, display the messages, and
    // return false to prevent the form from being submitted. 
    // Otherwise return true.
    if (!empty_fields) return true;

    msg  = "______________________________________________________\n\n"
    msg += "The form was not sent due to the following errors.\n";
    msg += "Please correct the errors and resend the form.\n";
    msg += "______________________________________________________\n\n"

    if (empty_fields) {
        msg += "- The following mandatory fields was empty:" 
                + empty_fields + "\n";
        if (errors) msg += "\n";
    }
    alert(msg);
    return false;
}	
