function Validation(form)
{
	this.formObject = $('#'+form).get(0);

	this.getFormObjectsAsMap = function() { return this.formObject.elements; }
	
	this.getFormValuesAsMap = function()
	{
		var params = new Object();
		var inputs = this.formObject.elements;

		for (var i=0; i<inputs.length; i++)
		{
			var input = inputs[i]; 
			if (input.type == "radio" || input.type == "checkbox")
			{
				// For radios and checkboxes, include them only if checked 
				if (input.checked == true)
				{
					if (params[input.name] == null) params[input.name] = new Array(); 
					params[input.name].push(this.removeHTMLTags(input.value)); 
				}
			}
			else if (input.type == "select-multiple")
			{
				// For multi-selects we have to check each value 
				for (var j=0; j<input.options.length; j++)
				{
					if (input.options[j].selected == true)
					{ 
						if (params[input.name] == null) params[input.name] = new Array(); 
						params[input.name].push(this.removeHTMLTags(input.options[j].value)); 
					}
				}
			}
			else if (input.type == "submit" || input.type == "button" || input.type == "reset")
			{
				// Don't include button types in the submit 
			} 
			else if (input.name != undefined && input.value != undefined)
			{
				// Encode the rest as name=value 
				if (params[input.name] == null) params[input.name] = new Array(); 
				params[input.name].push(this.removeHTMLTags(input.value)); 
			}
		}
		return params;
	}

	this.getFormValuesAsQueryString = function()
	{
		var params = this.getFormValuesAsMap(this.formObject);
		var queryString = "";
		var value = '';
		for (var name in params)
		{
			var values = params[name]; 
			for (var i=0; i<values.length; i++)
			{
				value = values[i];
				queryString += "&" + name + "=" + encodeURIComponent(value); 
			}
		}
		return queryString;
	}

	this.isEmpty = function (value) { var val = value+''; if(val.length > 0) { return false; } else { return true; } }

	this.isNumeric = function (val) { if(val.match(/^[0-9]+$/)) { return false; } else { return true; } }

	this.isAlphabet = function (val) { if(val.match(/^[a-zA-Z]+$/)) { return false; } else { return true; } }

	this.isAlphanumeric = function (val) { if(val.match(/^[0-9a-zA-Z]+$/)) { return false; } else { return true; } }

	this.lengthRestriction = function (val, min_val, max_val) { if(val.length >= min_val && val.length <= max_val) { return false; } else { return true; } }

	this.emailValidator = function (val)
	{
		val = String(val);
		if(val.match(/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/)) { return false; } else { return true; }
	}

	this.removeHTMLTags = function(str)
	{
		var strInputCode = str;
		var re = /(<([^>]+)>)/gi;
		var strTagStrippedText = strInputCode.replace(re, "");
		return strTagStrippedText;
	}
}
function validationAskQuestion()
{
	var validationObject = new Validation('formAskaQuestion');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	if(validationObject.isEmpty(formObjects.question) || formObjects.question == 'Stel een vraag')
	{
		error = true;
		errorMessage += '<li>Het invullen van een vraag is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.name) || formObjects.name == 'Je naam')
	{
		error = true;
		errorMessage += '<li>Naam is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.user_type_id))
	{
		error = true;
		errorMessage += '<li>Selecteer wat je bent</li>';
	}
	if(error)
	{
		$("#close_validation_panel").click(function() { tb_remove(); });
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationCreateTopic()
{
	var validationObject = new Validation('formCreateTopic');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	if(validationObject.isEmpty(formObjects.topic) || formObjects.detail == 'vul hier je onderwerp in')
	{
		error = true;
		errorMessage += '<li>Het invullen van een onderwerp is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.detail)  || formObjects.detail == 'vul hier je reactie in')
	{
		error = true;
		errorMessage += '<li>Het invullen van een beschrijving is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.name)   || formObjects.name == 'vul hier je naam in')
	{
		error = true;
		errorMessage += '<li>Het invullen van een naam is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.user_type_id))
	{
		error = true;
		errorMessage += '<li>Selecteer wat je bent</li>';
	}
	if(!validationObject.isEmpty(formObjects.email))
	{
		if(validationObject.emailValidator(formObjects.email))
		{
			error = true;
			errorMessage += '<li>Ongeldig email-adres</li>';
		}
	}
	if(error)
	{
		// Close opened tb
		tb_remove();
		// Set click event
		$("#close_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=create_topic_panel&modal=true', null);", 1000); });
		$("#back_button_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=create_topic_panel&modal=true', null);", 1000); });
		$('#validation_errors').html(errorMessage);
		
		setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);", 1000);
	}
	return error;
}

function validationEditTopic()
{
	var validationObject = new Validation('formEditTopic');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	if(validationObject.isEmpty(formObjects.topic))
	{
		error = true;
		errorMessage += '<li>Het invullen van een onderwerp is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.detail)  || formObjects.detail == 'Stel een vraag')
	{
		error = true;
		errorMessage += '<li>Het invullen van een beschrijving is verplicht</li>';
	}
	if(error)
	{
		// Close opened tb
		tb_remove();
		// Set click event
		$("#close_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=edit_topic_panel&modal=true', null);", 1000); });
		$("#back_button_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=edit_topic_panel&modal=true', null);", 1000); });
		$('#validation_errors').html(errorMessage);
		
		setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);", 1000);
	}
	return error;
}

function validationCreateAnswer()
{
	var validationObject = new Validation('formNewAnswer');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.message)  || formObjects.message == 'Type hier je reactie')
	{
		error = true;
		errorMessage += '<li>Het invullen van een reactie is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.name)   || formObjects.name == 'Jouw naam')
	{
		error = true;
		errorMessage += '<li>Het invullen van een naam is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.user_type_id))
	{
		error = true;
		errorMessage += '<li>Selecteer wat je bent</li>';
	}
	if(!validationObject.isEmpty(formObjects.email))
	{
		if(validationObject.emailValidator(formObjects.email))
		{
			error = true;
			errorMessage += '<li>Ongeldig email-adres</li>';
		}
	}
	if(error)
	{
		// Close opened tb
		tb_remove();
		// Set click event
		$("#close_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=create_message_panel&modal=true', null);", 1000); });
		$("#back_button_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=create_message_panel&modal=true', null);", 1000); });
		$('#validation_errors').html(errorMessage);
		
		setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);", 1000);
	}
	return error;
}

function validationEditAnswer()
{
	var validationObject = new Validation('formEditAnswer');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	
	if(validationObject.isEmpty(formObjects.message)  || formObjects.message == 'Type hier je reactie')
	{
		error = true;
		errorMessage += '<li>Het invullen van een reactie is verplicht</li>';
	}
	if(error)
	{
		// Close opened tb
		tb_remove();
		// Set click event
		$("#close_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=edit_message_panel&modal=true', null);", 1000); });
		$("#back_button_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=edit_message_panel&modal=true', null);", 1000); });
		$('#validation_errors').html(errorMessage);
		
		setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);", 1000);
	}
	return error;
}

function validationSendContact()
{
	var validationObject = new Validation('formSendContact');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	
	if(validationObject.isEmpty(formObjects.question)  || formObjects.question == 'Type hier een bericht')
	{
		error = true;
		errorMessage += '<li>Het invullen van een bericht is verplicht</li>';
	}
	if(validationObject.isEmpty(formObjects.name)   || formObjects.name == 'Jouw naam')
	{
		error = true;
		errorMessage += '<li>Het invullen van een naam is verplicht</li>';
	}
	if(!validationObject.isEmpty(formObjects.email))
	{
		if(validationObject.emailValidator(formObjects.email))
		{
			error = true;
			errorMessage += '<li>Ongeldig email-adres</li>';
		}
	}
	if(error)
	{
		// Close opened tb
		tb_remove();
		// Set click event
		$("#close_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=contact_panel&modal=true', null);", 1000); });
		$("#back_button_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=contact_panel&modal=true', null);", 1000); });
		$('#validation_errors').html(errorMessage);
		
		setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);", 1000);
	}
	return error;
}

function validationSendOpenDay()
{
	var validationObject = new Validation('formSendOpenDay');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	
	if(validationObject.isEmpty(formObjects.name)   || formObjects.name == 'Voor- en achternaam')
	{
		error = true;
		errorMessage += '<li>Het invullen van een naam is verplicht</li>';
	}
	if(!validationObject.isEmpty(formObjects.email))
	{
		if(validationObject.emailValidator(formObjects.email))
		{
			error = true;
			errorMessage += '<li>Ongeldig email-adres</li>';
		}
	}
	var gender = formObjects.gender+''
	gender = gender.substr(12);
	if(validationObject.isEmpty(gender))
	{
		error = true;
		errorMessage += '<li>Het kiezen van een geslacht is verplicht</li>';
	}

	var year = formObjects.selectYear+''
	year = year.substr(12);
	if(validationObject.isEmpty(year))
	{
		error = true;
		errorMessage += '<li>Het kiezen van een geboortejaar is verplicht</li>';
	}	

	if(error)
	{
		// Close opened tb
		tb_remove();
		// Set click event
		$("#close_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=openday_panel&modal=true', null);", 1000); });
		$("#back_button_validation_panel").click(function() { tb_remove(); setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=openday_panel&modal=true', null);", 1000); });
		$('#validation_errors').html(errorMessage);
		
		setTimeout("tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);", 1000);
	}
	return error;
}

// Admin.....
function validationUpdateContent()
{
	var validationObject = new Validation('formUpdateContent');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';
	
	var content_id = $('#content_id').val();
	if(parseInt(content_id) < 3) { 
		if($("#picture").length > 0 )
		{
			if(validationObject.isEmpty(formObjects.picture))
			{
				error = true;
				errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
			}
		}
		else
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
		}
	}

	if(validationObject.isEmpty(formObjects.content))
	{
		error = true;
		errorMessage += '<li>Er dient content aanwezig te zijn op de pagina</li>';
	}
	if(error)
	{
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationInsertCoolstuff()
{
	var validationObject = new Validation('formInsertCoolStuff');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.title))
	{
		error = true;
		errorMessage += '<li>Er dient een titel ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.country))
	{
		error = true;
		errorMessage += '<li>Er dient een land ingevuld te worden.</li>';
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationUpdateCoolstuff()
{
	var validationObject = new Validation('formUpdateCoolStuff');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.title))
	{
		error = true;
		errorMessage += '<li>Er dient een titel ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.picture))
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.country))
	{
		error = true;
		errorMessage += '<li>Er dient een land ingevuld te worden.</li>';
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationInsertEducation()
{
	var validationObject = new Validation('formInsertEducation');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.name))
	{
		error = true;
		errorMessage += '<li>Er dient een naam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.openday_description))
	{
		error = true;
		errorMessage += '<li>Er dient een kleine beschrijving ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.country))
	{
		error = true;
		errorMessage += '<li>Er dient een land ingevuld te worden.</li>';
	}

	if(!$('#education_types').val())
	{
		error = true;
		errorMessage += '<li>Er dient een onderwijs niveau(s) ingevuld te worden.</li>';
	}
	
	if($('#openday').get(0).checked)
	{
		if(validationObject.isEmpty(formObjects.time))
		{
			error = true;
			errorMessage += '<li>Er dient een tijd ingevuld te worden.</li>';
		}
		if(validationObject.isEmpty(formObjects.email_address))
		{
			error = true;
			errorMessage += '<li>Er dient een email adres ingevuld te worden.</li>';
		}
	}

	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationUpdateEducation()
{
	var validationObject = new Validation('formUpdateEducation');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.name))
	{
		error = true;
		errorMessage += '<li>Er dient een naam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.openday_description))
	{
		error = true;
		errorMessage += '<li>Er dient een kleine beschrijving ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.country))
	{
		error = true;
		errorMessage += '<li>Er dient een land ingevuld te worden.</li>';
	}

	if(!$('#education_types').val())
	{
		error = true;
		errorMessage += '<li>Er dient een onderwijs niveau(s) ingevuld te worden.</li>';
	}
	
	if($('#openday').get(0).checked)
	{
		if(validationObject.isEmpty(formObjects.time))
		{
			error = true;
			errorMessage += '<li>Er dient een tijd ingevuld te worden.</li>';
		}
		if(validationObject.isEmpty(formObjects.email_address))
		{
			error = true;
			errorMessage += '<li>Er dient een email adres ingevuld te worden.</li>';
		}
	}

	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationInsertCompany()
{
	var validationObject = new Validation('formInsertCompany');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.name))
	{
		error = true;
		errorMessage += '<li>Er dient een naam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if(!$('#company_types').val())
	{
		error = true;
		errorMessage += '<li>Er dient een onderwijs niveau(s) ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.country))
	{
		error = true;
		errorMessage += '<li>Er dient een land ingevuld te worden.</li>';
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationUpdateCompany()
{
	var validationObject = new Validation('formUpdateCompany');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.name))
	{
		error = true;
		errorMessage += '<li>Er dient een naam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if(!$('#company_types').val())
	{
		error = true;
		errorMessage += '<li>Er dient een onderwijs niveau(s) ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.country))
	{
		error = true;
		errorMessage += '<li>Er dient een land ingevuld te worden.</li>';
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationInsertPartner()
{
	var validationObject = new Validation('formInsertPartner');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.name))
	{
		error = true;
		errorMessage += '<li>Er dient een naam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationUpdatePartner()
{
	var validationObject = new Validation('formUpdatePartner');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.name))
	{
		error = true;
		errorMessage += '<li>Er dient een naam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.description))
	{
		error = true;
		errorMessage += '<li>Er dient een beschrijving ingevuld te worden.</li>';
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationInsertUser()
{
	var validationObject = new Validation('formInsertUser');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.first_name))
	{
		error = true;
		errorMessage += '<li>Er dient een voornaam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.last_name))
	{
		error = true;
		errorMessage += '<li>Er dient een achternaam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.email_address))
	{
		error = true;
		errorMessage += '<li>Er dient een email-adres ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.user_name))
	{
		error = true;
		errorMessage += '<li>Er dient een gebruikersnaam ingevuld te worden.</li>';
	}

	if(validationObject.isEmpty(formObjects.user_password))
	{
		error = true;
		errorMessage += '<li>Er dient een wachtwoord ingevuld te worden.</li>';
	}
	else
	{
		if(validationObject.isEmpty(formObjects.user_password_confirm))
		{
			error = true;
			errorMessage += '<li>Er dient een bevestiging wachtwoord ingevuld te worden.</li>';
		}
		else
		{
			if(formObjects.user_password_confirm+'' != formObjects.user_password+'')
			{
				error = true;
				errorMessage += '<li>Het wachtwoord en bevestiging wachtwoord veld dienen dezelfde waarde te bevatten.</li>';
			}
		}
	}
	
	if($('#topic_speaker').get(0).checked)
	{
		if(validationObject.isEmpty(formObjects.profession))
		{
			error = true;
			errorMessage += '<li>Er dient een beroep ingevuld te worden.</li>';
		}
		if(validationObject.isEmpty(formObjects.knowledge))
		{
			error = true;
			errorMessage += '<li>Er dient een kennisveld ingevuld te worden.</li>';
		}
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}

function validationUpdateUser()
{
	var validationObject = new Validation('formUpdateUser');
	var formObjects = validationObject.getFormValuesAsMap();
	var error = false;
	var errorMessage = '';

	if(validationObject.isEmpty(formObjects.first_name))
	{
		error = true;
		errorMessage += '<li>Er dient een voornaam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.last_name))
	{
		error = true;
		errorMessage += '<li>Er dient een achternaam ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.email_address))
	{
		error = true;
		errorMessage += '<li>Er dient een email-adres ingevuld te worden.</li>';
	}
	if(validationObject.isEmpty(formObjects.user_name))
	{
		error = true;
		errorMessage += '<li>Er dient een gebruikersnaam ingevuld te worden.</li>';
	}

	if(validationObject.isEmpty(formObjects.user_password))
	{
		error = true;
		errorMessage += '<li>Er dient een wachtwoord ingevuld te worden.</li>';
	}
	else
	{
		if(validationObject.isEmpty(formObjects.user_password_confirm))
		{
			error = true;
			errorMessage += '<li>Er dient een bevestiging wachtwoord ingevuld te worden.</li>';
		}
		else
		{
			if(formObjects.user_password_confirm+'' != formObjects.user_password+'')
			{
				error = true;
				errorMessage += '<li>Het wachtwoord en bevestiging wachtwoord veld dienen dezelfde waarde te bevatten.</li>';
			}
		}
	}

	if($('#topic_speaker').get(0).checked)
	{
		if(validationObject.isEmpty(formObjects.profession))
		{
			error = true;
			errorMessage += '<li>Er dient een beroep ingevuld te worden.</li>';
		}
		if(validationObject.isEmpty(formObjects.knowledge))
		{
			error = true;
			errorMessage += '<li>Er dient een kennisveld ingevuld te worden.</li>';
		}
	}
	if ( $("#picture").length > 0 )
	{
		if(validationObject.isEmpty(formObjects.picture))
		{
			error = true;
			errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';
		}
	}
	else
	{
		error = true;
		errorMessage += '<li>Er dient een afbeelding ingevuld te worden.</li>';	
	}
	if(validationObject.isEmpty(formObjects.city))
	{
		error = true;
		errorMessage += '<li>Er dient een stad ingevuld te worden.</li>';
	}
	if(error)
	{
		// Set click event
		$('#validation_errors').html(errorMessage);
		tb_show('', '?keepThis=true&TB_inline?height=450&width=550&inlineId=validation_panel&modal=true', null);
	}
	return error;
}