function error_report(errors, field, message)
{
	//errors:
	//0 - hidden
	//1+ - visible
	
	var report_field = field;
	
	if(errors > 0)
	{
		report_field.innerHTML = message;
		show_field(report_field.id);
		return false;
	}
	else if(errors == 0)
	{
		hide_field(report_field.id);
		report_field.innerHTML = '';
		return true;
	}

}


//sidebar login panel
function validate_panel_login()
{
	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	var flag_invalid_email = true;
	var flag_invalid_password = true;
	
	val_fields["response"] = $("panel_response");
	
	val_fields["email"] = $("user_email_panel");
	val_fields["password"] = $("user_password");

	val_fields["email"].className = 'inputtext';
	val_fields["password"].className = 'inputtext';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'inputtext val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
		flag_invalid_email = true;
	}
	else
	{
		flag_invalid_email = false;
	}
	
	if(val_fields["password"].value.length == 0)
	{
		val_fields["password"].className = 'inputtext val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Password not provided" + "<br />";
		flag_invalid_password = true;
	}
	else
	{
		flag_invalid_password = false;
	}

	if(flag_invalid_email == false && flag_invalid_password == false)
	{
		val_fields["email"].className = 'inputtext inputtext_loading';
		val_fields["password"].className = 'inputtext inputtext_loading';
	}
	else
	{
		
	}

	return error_report(val_errors, val_fields["response"], val_errorlist);

	//val_fields["response"].innerHTML = val_errors > 0 ? val_errorlist : '';
	//return val_errors > 0 ? false : true;
}


//normal login
function validate_login()
{
	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["email"] = $("user_email");
	val_fields["password"] = $("user_password_1");
	
	val_fields["email"].className = '';
	val_fields["password"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	if(val_fields["password"].value.length == 0)
	{
		val_fields["password"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Password not provided" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//confirmation
function validate_confirmation()
{
	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response_1");
	
	val_fields["code"] = $("user_confirmation_code");
	
	val_fields["code"].className = '';
	
	if(trim(val_fields["code"].value).length == 0 || check_confirmation_validity(trim(val_fields["code"].value)) == false)
	{
		val_fields["code"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid confirmation code format" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons_confirm');
		show_field('loader_confirm');
		return true;
	}
	else
	{
		return false;
	}
}

//request confirmation
function validate_request()
{
	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response_2");
	
	val_fields["email"] = $("user_email");
	
	val_fields["email"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons_request');
		show_field('loader_request');
		return true;
	}
	else
	{
		return false;
	}
}

//retrieve password
function validate_retrieve()
{
	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["email"] = $("user_email");
	
	val_fields["email"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//contact
function validate_contact()
{

	var val_fields = new Array(7);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["email"] = $("contact_email");
	val_fields["name"] = $("contact_name");
	val_fields["topic"] = $("contact_topic");
	val_fields["subject"] = $("contact_subject");
	val_fields["message"] = $("contact_message");
	val_fields["captcha"] = $("contact_captcha");
	
	val_fields["email"].className = '';
	val_fields["name"].className = '';
	val_fields["topic"].className = '';
	val_fields["subject"].className = '';
	val_fields["message"].className = '';
	val_fields["captcha"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Name not provided" + "<br />";
	}

	if(trim(val_fields["topic"].value).length == 0 || val_fields["topic"].value == 0)
	{
		val_fields["topic"].className = 'val_error';		
		val_errors++;
		val_errorlist = val_errorlist + "Topic not provided" + "<br />";
	}
	
	if(trim(val_fields["subject"].value).length == 0)
	{
		val_fields["subject"].className = 'val_error';		
		val_errors++;
		val_errorlist = val_errorlist + "Subject not provided" + "<br />";
	}
	
	if(trim(val_fields["message"].value).length == 0)
	{
		val_fields["message"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Message not provided" + "<br />";
	}
	
	if(trim(val_fields["captcha"].value).length == 0)
	{
		val_fields["captcha"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Please insert the code as displayed on the picture" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//search
function validate_search()
{

	var val_fields = new Array(4);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");

	val_fields["search_keywords"] = $("search_keywords");
	val_fields["search_software"] = $("search_software");
	val_fields["search_language"] = $("search_language");
	
	val_fields["search_keywords"].className = '';
	val_fields["search_software"].className = '';
	val_fields["search_language"].className = '';
	
	if(trim(val_fields["search_keywords"].value).length < 3 && (trim(val_fields["search_software"].value).length == 0 && trim(val_fields["search_language"].value).length == 0))
	{
		val_fields["search_keywords"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Search string too short, please input at least 3 characters or select language or software from the list" + "<br />";
	}
	
	/*
	if(trim(val_fields["search_software"].value).length == 0 || val_fields["search_software"].value == 0)
	{
		val_fields["search_software"].className = 'val_error';		
		val_errors++;
		val_errorlist = val_errorlist + "Software not provided" + "<br />";
	}

	if(trim(val_fields["search_language"].value).length == 0 || val_fields["search_language"].value == 0)
	{
		val_fields["search_language"].className = 'val_error';		
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}	
	*/
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		track_search('search_keywords');
		return true;
	}
	else
	{
		return false;
	}
}

//search
function validate_search_panel()
{

	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("panel_response_search");

	val_fields["search_keywords_panel"] = $("search_keywords_panel");
	
	val_fields["search_keywords_panel"].className = 'inputtext inputtext_loading';

	if(trim(val_fields["search_keywords_panel"].value).length < 3)
	{
		val_fields["search_keywords_panel"].className = 'inputtext val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Search string too short, please input at least 3 characters" + "<br />";
	}
		
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		//hide_field('buttons_panel_search');
		//show_field('loader_panel_search');
		track_search('search_keywords_panel');
		return true;
	}
	else
	{
		return false;
	}
}


//tell
function validate_tell()
{

	var val_fields = new Array(6);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["email"] = $("tell_email");
	val_fields["name"] = $("tell_name");
	val_fields["message"] = $("tell_message");
	val_fields["email_friend"] = $("tell_friend_email");
	val_fields["name_friend"] = $("tell_friend_name");
	
	val_fields["email"].className = '';
	val_fields["name"].className = '';
	val_fields["message"].className = '';
	val_fields["email_friend"].className = '';
	val_fields["name_friend"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Name not provided" + "<br />";
	}
	
	if(trim(val_fields["message"].value).length == 0)
	{
		val_fields["message"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Message not provided" + "<br />";
	}
	
	if(trim(val_fields["email_friend"].value).length == 0 || check_email_validity(trim(val_fields["email_friend"].value)) == false)
	{
		val_fields["email_friend"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid friend's e-mail format" + "<br />";
	}
	
	if(trim(val_fields["name_friend"].value).length == 0)
	{
		val_fields["name_friend"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Friend's name not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//create profile
function validate_create_profile()
{

	var val_fields = new Array(9);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["type_translator"] = $("radio_user_type_translator");
	val_fields["type_developer"] = $("radio_user_type_developer");	
	
	val_fields["nick"] = $("user_nick");
	val_fields["email"] = $("user_email");
	val_fields["password1"] = $("user_password_1");
	val_fields["password2"] = $("user_password_2");
	val_fields["terms"] = $("user_terms");
	val_fields["checked_nick"] = $("checked_nick");	
	val_fields["checked_status"] = $("checked_status");	
	
	val_fields["nick"].className = '';
	val_fields["email"].className = '';
	val_fields["password1"].className = '';
	val_fields["password2"].className = '';
	val_fields["terms"].className = 'checkbox';
	val_fields["checked_nick"].className = '';
	val_fields["checked_status"].className = '';
	
	if(val_fields["type_developer"].checked == true)
	{
		var developer_confirmation = confirm("Please select the developer account type only if you are a multilingual software developer.\nSelecting this account type will allow you to manage your software but you will not be able to modify localizations (translate).");
		
		if(developer_confirmation == false)
		{
			val_fields["type_translator"].checked = true;
			return false;
		}
	}
	
	if(trim(val_fields["nick"].value).length == 0)
	{
		val_fields["nick"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid screen name format" + "<br />";
	}
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	if(val_fields["password1"].value.length == 0 || val_fields["password1"].value.length < 8)
	{
		val_fields["password1"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Password not provided or too short" + "<br />";
	}
	
	if(val_fields["password2"].value.length == 0 || val_fields["password2"].value.length < 8)
	{
		val_fields["password2"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Repeated password not provided or too short" + "<br />";
	}
	
	if((val_fields["password1"].value.length > 0 && val_fields["password2"].value.length > 0) && (val_fields["password1"].value != val_fields["password2"].value))
	{
		val_fields["password1"].className = 'val_error';
		val_fields["password2"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Provided passwords do not match" + "<br />";
	}
	
	if(val_fields["terms"].checked == false)
	{
		val_fields["terms"].className = 'checkbox val_error';
		val_errors++;
		val_errorlist = val_errorlist + "You have to accept Terms of Use" + "<br />";
	}	

	if(trim(val_fields["nick"].value).length > 0 && ((trim(val_fields["checked_nick"].value) != trim(val_fields["nick"].value)) || trim(val_fields["checked_status"].value) == 0))
	{
		val_fields["nick"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Please validate your screen name before proceeding (use check icon)" + "<br />";
	}	
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}


//update profile
function validate_update_profile()
{

	var val_fields = new Array(4);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["email"] = $("user_email");
	val_fields["password1"] = $("user_password_1");
	val_fields["password2"] = $("user_password_2");
	
	val_fields["email"].className = '';
	val_fields["password1"].className = '';
	val_fields["password2"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	//check if the user wants to change the password
	if(val_fields["password1"].value.length > 0 || val_fields["password2"].value.length > 0)
	{
	
		if(val_fields["password1"].value != val_fields["password2"].value)
		{
			val_fields["password1"].className = 'val_error';
			val_fields["password2"].className = 'val_error';
			val_errors++;
			val_errorlist = val_errorlist + "Provided passwords do not match" + "<br />";
		}

	}
	else
	{
			val_fields["password1"].className = 'disabled';
			val_fields["password2"].className = 'disabled';
			val_fields["password1"].disabled = 'disabled';
			val_fields["password2"].disabled = 'disabled';
	}

	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//submit bug
function validate_bug()
{

	var val_fields = new Array(9);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["email"] = $("bug_submit_email");
	val_fields["name"] = $("bug_submit_name");
	val_fields["software"] = $("bug_submit_software");
	val_fields["language"] = $("bug_submit_language");
	val_fields["section"] = $("bug_submit_section");
	val_fields["key"] = $("bug_submit_key");
	val_fields["description"] = $("bug_submit_description");
	val_fields["captcha"] = $("bug_submit_captcha");
	
	val_fields["email"].className = '';
	val_fields["name"].className = '';
	val_fields["software"].className = '';
	val_fields["language"].className = '';
	val_fields["section"].className = '';
	val_fields["key"].className = '';
	val_fields["description"].className = '';
	val_fields["captcha"].className = '';
	
	if(trim(val_fields["email"].value).length == 0 || check_email_validity(trim(val_fields["email"].value)) == false)
	{
		val_fields["email"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid e-mail format" + "<br />";
	}
	
	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Name not provided" + "<br />";
	}
	
	if(trim(val_fields["software"].value).length == 0)
	{
		val_fields["software"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Software not provided" + "<br />";
	}
	
	if(trim(val_fields["language"].value).length == 0)
	{
		val_fields["language"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}	
	
	if(trim(val_fields["section"].value).length == 0  || check_inisection_validity(trim(val_fields["section"].value)) == false)
	{
		val_fields["section"].className = 'val_error';		
		val_errors++;
		val_errorlist = val_errorlist + "Invalid localization section format" + "<br />";
	}
	
	if(trim(val_fields["key"].value).length == 0  || check_inikey_validity(trim(val_fields["key"].value)) == false)
	{
		val_fields["key"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid localization key format" + "<br />";
	}
	
	if(trim(val_fields["description"].value).length == 0)
	{
		val_fields["description"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Description not provided" + "<br />";
	}
	
	if(trim(val_fields["captcha"].value).length == 0)
	{
		val_fields["captcha"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Please insert the code as displayed on the picture" + "<br />";
	}
		
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
	
	
}

//create category
function validate_category_create()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["name"] = $("category_name");
	val_fields["parent"] = $("category_parent");
	
	val_fields["name"].className = '';
	val_fields["parent"].className = '';
	
	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Category name not provided" + "<br />";
	}
	
	if(trim(val_fields["parent"].value).length == 0)
	{
		val_fields["parent"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Parent category not provided" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//edit category
function validate_category_edit()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["name"] = $("category_name");
	val_fields["parent"] = $("category_parent");
	
	val_fields["name"].className = '';
	val_fields["parent"].className = '';
	
	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Category name not provided" + "<br />";
	}
	
	if(trim(val_fields["parent"].value).length == 0)
	{
		val_fields["parent"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Parent category not provided" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//create comment
function validate_comment_create()
{

	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["comment"] = $("comment_content");
	
	val_fields["comment"].className = '';
	
	if(trim(val_fields["comment"].value).length == 0)
	{
		val_fields["comment"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Comment not provided" + "<br />";
	}

	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//add external developer
function validate_developer_create()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["company"] = $("developer_company");
	val_fields["url"] = $("developer_url");
	
	val_fields["company"].className = '';
	val_fields["url"].className = '';
	
	if(trim(val_fields["company"].value).length == 0)
	{
		val_fields["company"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Company name not provided" + "<br />";
	}
	
	if(trim(val_fields["url"].value).length == 0)
	{
		val_fields["url"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Company website address not provided" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//edit external developer
function validate_developer_edit()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["company"] = $("developer_company");
	val_fields["url"] = $("developer_url");
	
	val_fields["company"].className = '';
	val_fields["url"].className = '';
	
	if(trim(val_fields["company"].value).length == 0)
	{
		val_fields["company"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Company name not provided" + "<br />";
	}
	
	if(trim(val_fields["url"].value).length == 0)
	{
		val_fields["url"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Company website address not provided" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//create language
function validate_language_create()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["language"] = $("language_language_to");
	val_fields["charset"] = $("language_charset");
	
	val_fields["language"].className = '';
	val_fields["charset"].className = '';
	
	if(trim(val_fields["language"].value).length == 0)
	{
		val_fields["language"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}
	
	if(trim(val_fields["charset"].value).length == 0)
	{
		val_fields["charset"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Character set not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//update language
function validate_language_update()
{

	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["charset"] = $("language_charset");
	
	val_fields["charset"].className = '';
		
	if(trim(val_fields["charset"].value).length == 0)
	{
		val_fields["charset"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Character set not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//create message
function validate_message_create()
{

	var val_fields = new Array(4);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["receiver"] = $("message_receiver");
	val_fields["title"] = $("message_title");
	val_fields["message"] = $("message_content");
	
	val_fields["receiver"].className = '';
	val_fields["title"].className = '';
	val_fields["message"].className = '';
	
	if(trim(val_fields["receiver"].value).length == 0)
	{
		val_fields["receiver"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Receiver not provided" + "<br />";
	}

	if(trim(val_fields["title"].value).length == 0)
	{
		val_fields["title"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Title not provided" + "<br />";
	}
	
	if(trim(val_fields["message"].value).length == 0)
	{
		val_fields["message"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Message not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//reply to message
function validate_message_reply()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");		
	
	val_fields["title"] = $("message_title");
	val_fields["message"] = $("message_content");
	
	val_fields["title"].className = '';
	val_fields["message"].className = '';
	
	if(trim(val_fields["title"].value).length == 0)
	{
		val_fields["title"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Title not provided" + "<br />";
	}
	
	if(trim(val_fields["message"].value).length == 0)
	{
		val_fields["message"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Message not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}
}

//create news article
function validate_news_create()
{

	var val_fields = new Array(6);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["title"] = $("news_title");
	val_fields["introduction"] = $("news_introduction");
	val_fields["date"] = $("news_publication_date");
	val_fields["hour"] = $("news_publication_time_hour");
	val_fields["minute"] = $("news_publication_time_minute");
	
	val_fields["title"].className = '';
	val_fields["introduction"].className = '';
	val_fields["date"].className = '';
	val_fields["hour"].className = '';
	val_fields["minute"].className = '';
	
	if(trim(val_fields["title"].value).length == 0)
	{
		val_fields["title"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Title not provided" + "<br />";
	}
	
	if(trim(val_fields["introduction"].value).length == 0)
	{
		val_fields["introduction"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Introduction not provided" + "<br />";
	}
	
	if(trim(val_fields["date"].value).length == 0 || check_date_validity(trim(val_fields["date"].value)) == false)
	{
		val_fields["date"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid date format" + "<br />";
	}

	if(trim(val_fields["hour"].value).length == 0)
	{
		val_fields["hour"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Hour not provided" + "<br />";
	}

	if(trim(val_fields["minute"].value).length == 0)
	{
		val_fields["minute"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Minute not provided" + "<br />";
	}

	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//edit news article
function validate_news_edit()
{

	var val_fields = new Array(6);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["title"] = $("news_title");
	val_fields["introduction"] = $("news_introduction");
	val_fields["date"] = $("news_publication_date");
	val_fields["hour"] = $("news_publication_time_hour");
	val_fields["minute"] = $("news_publication_time_minute");
	
	val_fields["title"].className = '';
	val_fields["introduction"].className = '';
	val_fields["date"].className = '';
	val_fields["hour"].className = '';
	val_fields["minute"].className = '';
	
	if(trim(val_fields["title"].value).length == 0)
	{
		val_fields["title"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Title not provided" + "<br />";
	}
	
	if(trim(val_fields["introduction"].value).length == 0)
	{
		val_fields["introduction"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Introduction not provided" + "<br />";
	}
	
	if(trim(val_fields["date"].value).length == 0 || check_date_validity(trim(val_fields["date"].value)) == false)
	{
		val_fields["date"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid date format" + "<br />";
	}

	if(trim(val_fields["hour"].value).length == 0)
	{
		val_fields["hour"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Hour not provided" + "<br />";
	}

	if(trim(val_fields["minute"].value).length == 0)
	{
		val_fields["minute"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Minute not provided" + "<br />";
	}

	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//create software
function validate_software_create()
{

	var val_fields = new Array(11);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["name"] = $("software_name");
	val_fields["category"] = $("software_category");
	val_fields["license"] = $("software_license");
	val_fields["language"] = $("software_language");
	val_fields["platform"] = $("software_platform");
	val_fields["version"] = $("software_version");
	val_fields["description"] = $("software_description");
	val_fields["price"] = $("software_price");
	val_fields["screenshot"] = $("software_screenshot");
	val_fields["url"] = $("software_url");
	
	val_fields["name"].className = '';
	val_fields["category"].className = '';
	val_fields["license"].className = '';
	val_fields["language"].className = '';
	val_fields["platform"].className = '';
	val_fields["version"].className = '';
	val_fields["description"].className = '';
	val_fields["price"].className = '';
	val_fields["screenshot"].className = '';
	val_fields["url"].className = '';
	
	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Name not provided" + "<br />";
	}
	
	if(trim(val_fields["category"].value).length == 0)
	{
		val_fields["category"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Category not provided" + "<br />";
	}

	if(trim(val_fields["license"].value).length == 0)
	{
		val_fields["license"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "License not provided" + "<br />";
	}
	
	if(trim(val_fields["language"].value).length == 0)
	{
		val_fields["language"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}

	if(trim(val_fields["platform"].value).length == 0)
	{
		val_fields["platform"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Platform not provided" + "<br />";
	}

	if(trim(val_fields["version"].value).length == 0 || check_version_validity(trim(val_fields["version"].value)) == false)
	{
		val_fields["version"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid version format" + "<br />";
	}

	if(trim(val_fields["description"].value).length == 0)
	{
		val_fields["description"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Description not provided" + "<br />";
	}

	if(trim(val_fields["price"].value).length == 0 || check_float_validity(trim(val_fields["price"].value)) == false)
	{
		val_fields["price"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid price format" + "<br />";
	}

	if(trim(val_fields["screenshot"].value).length == 0 || check_image_file_validity(trim(val_fields["screenshot"].value)) == false)
	{
		val_fields["screenshot"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Screenshot not provided" + "<br />";
	}	
	
	if(trim(val_fields["url"].value).length == 0)
	{
		val_fields["url"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Website address not provided" + "<br />";
	}

	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}	

}

//update software
function validate_software_update()
{

	var val_fields = new Array(9);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["category"] = $("software_category");
	val_fields["license"] = $("software_license");
	val_fields["language"] = $("software_language");
	val_fields["platform"] = $("software_platform");
	val_fields["version"] = $("software_version");
	val_fields["description"] = $("software_description");
	val_fields["price"] = $("software_price");
	val_fields["url"] = $("software_url");
	
	val_fields["category"].className = '';
	val_fields["license"].className = '';
	val_fields["language"].className = '';
	val_fields["platform"].className = '';
	val_fields["version"].className = '';
	val_fields["description"].className = '';
	val_fields["price"].className = '';
	val_fields["url"].className = '';

	if(trim(val_fields["category"].value).length == 0)
	{
		val_fields["category"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Category not provided" + "<br />";
	}

	if(trim(val_fields["license"].value).length == 0)
	{
		val_fields["license"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "License not provided" + "<br />";
	}
	
	if(trim(val_fields["language"].value).length == 0)
	{
		val_fields["language"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}

	if(trim(val_fields["platform"].value).length == 0)
	{
		val_fields["platform"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Platform not provided" + "<br />";
	}

	if(trim(val_fields["version"].value).length == 0 || check_version_validity(trim(val_fields["version"].value)) == false)
	{
		val_fields["version"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid version format" + "<br />";
	}

	if(trim(val_fields["description"].value).length == 0)
	{
		val_fields["description"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Description not provided" + "<br />";
	}

	if(trim(val_fields["price"].value).length == 0 || check_float_validity(trim(val_fields["price"].value)) == false)
	{
		val_fields["price"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Invalid price format" + "<br />";
	}
	
	if(trim(val_fields["url"].value).length == 0)
	{
		val_fields["url"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Website address not provided" + "<br />";
	}

	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}	

}

//submit software
function validate_software_submit()
{

	var val_fields = new Array(9);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["name"] = $("software_name");
	val_fields["category"] = $("software_category");
	val_fields["license"] = $("software_license");
	val_fields["language"] = $("software_language");
	val_fields["platform"] = $("software_platform");
	val_fields["url"] = $("software_url");
	val_fields["multilingual"] = $("software_multilingual");
	val_fields["captcha"] = $("software_captcha");

	val_fields["name"].className = '';
	val_fields["category"].className = '';
	val_fields["license"].className = '';
	val_fields["language"].className = '';
	val_fields["platform"].className = '';
	val_fields["url"].className = '';
	val_fields["multilingual"].className = 'checkbox';
	val_fields["captcha"].className = '';

	if(trim(val_fields["name"].value).length == 0)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Name not provided" + "<br />";
	}
	
	if(trim(val_fields["category"].value).length == 0)
	{
		val_fields["category"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Category not provided" + "<br />";
	}

	if(trim(val_fields["license"].value).length == 0)
	{
		val_fields["license"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "License not provided" + "<br />";
	}
	
	if(trim(val_fields["language"].value).length == 0)
	{
		val_fields["language"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}

	if(trim(val_fields["platform"].value).length == 0)
	{
		val_fields["platform"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Platform not provided" + "<br />";
	}
	
	if(trim(val_fields["url"].value).length == 0)
	{
		val_fields["url"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Website address not provided" + "<br />";
	}
	
	if(val_fields["multilingual"].checked == false)
	{
		val_fields["multilingual"].className = 'checkbox val_error';
		val_errors++;
		val_errorlist = val_errorlist + "You have to confirm that the software is multilingual" + "<br />";
	}
	
	if(trim(val_fields["captcha"].value).length == 0)
	{
		val_fields["captcha"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Please insert the code as displayed on the picture" + "<br />";
	}	
		
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}	
	

}


//upload software localization file
function validate_software_upload()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["language"] = $("software_upload_language");
	val_fields["file"] = $("software_upload_file");
	
	val_fields["language"].className = '';
	val_fields["file"].className = '';

	if(trim(val_fields["language"].value).length == 0)
	{
		val_fields["language"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Language not provided" + "<br />";
	}

	if(trim(val_fields["file"].value).length == 0 || check_text_file_validity(trim(val_fields["file"].value)) == false)
	{
		val_fields["file"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Localization file not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}	

}

//create translation profile
function validate_translate_create()
{

	var val_fields = new Array(5);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["software"] = $("translation_software");
	val_fields["file"] = $("translation_file");
	val_fields["filename"] = $("translation_filename");
	val_fields["charset"] = $("translation_charset");
	
	val_fields["software"].className = '';
	val_fields["file"].className = '';
	val_fields["filename"].className = '';
	val_fields["charset"].className = '';

	if(trim(val_fields["software"].value).length == 0)
	{
		val_fields["software"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Software not provided" + "<br />";
	}
	
	if(trim(val_fields["file"].value).length == 0 || check_text_file_validity(trim(val_fields["file"].value)) == false)
	{
		val_fields["file"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Base localization file not provided" + "<br />";
	}

	if(trim(val_fields["filename"].value).length == 0 || check_language_filename_validity(trim(val_fields["filename"].value)) == false)
	{
		val_fields["filename"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "File name pattern not provided" + "<br />";
	}
	
	if(trim(val_fields["charset"].value).length == 0)
	{
		val_fields["charset"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Character set not provided" + "<br />";
	}
	
	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}

}


//update translation profile
function validate_translate_update()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");	
	
	val_fields["filename"] = $("translation_filename");
	val_fields["charset"] = $("translation_charset");
	
	val_fields["filename"].className = '';
	val_fields["charset"].className = '';
	
	if(trim(val_fields["filename"].value).length == 0 || check_language_filename_validity(trim(val_fields["filename"].value)) == false)
	{
		val_fields["filename"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "File name pattern not provided" + "<br />";
	}
	
	if(trim(val_fields["charset"].value).length == 0)
	{
		val_fields["charset"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Character set not provided" + "<br />";
	}

	if(error_report(val_errors, val_fields["response"], val_errorlist) == true)
	{
		hide_field('buttons');
		show_field('loader');
		return true;
	}
	else
	{
		return false;
	}

}


//create tag
function validate_tag_create()
{

	var val_fields = new Array(2);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");
	
	val_fields["name"] = $("tag_name");
	
	val_fields["name"].className = '';
	
	if(check_tag_name_validity(trim(val_fields["name"].value)) == false)
	{
		val_fields["name"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Tag name is invalid" + "<br />";
	}
		
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//assign tag
function validate_tag_assign()
{
	
	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";
	
	val_fields["response"] = $("form_response");

	val_fields["software"] = $("tag_software");
	val_fields["tag"] = $("tag_name");
	
	val_fields["software"].className = '';
	val_fields["tag"].className = '';

	if(trim(val_fields["software"].value).length == 0)
	{
		val_fields["software"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Software not selected" + "<br />";
	}

	if(trim(val_fields["tag"].value).length == 0)
	{
		val_fields["tag"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Tag no selected" + "<br />";
	}

	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}

//assign multiple tags
function validate_tag_assign_multiple()
{

	var val_fields = new Array(3);
	var val_errors = 0;
	var val_errorlist = "";

	val_fields["response"] = $("form_response");
	val_fields["software"] = $("tag_software_multiple");
	val_fields["tags"] = $("tag_software_multiple_count");
		
	val_fields["software"].className = '';
	//val_fields["tags"].className = '';	

	if(trim(val_fields["software"].value).length == 0)
	{
		val_fields["software"].className = 'val_error';
		val_errors++;
		val_errorlist = val_errorlist + "Software not selected" + "<br />";
	}
	
	var sum_tags = val_fields["tags"].value;
	var sum_tags_checked = 0;

	for(var i = 0; i < sum_tags; i++)
	{
		if($("tag_name_multiple["+ i +"]").checked == true)
		{
			sum_tags_checked++;
		}
	}

	if(sum_tags_checked == 0)
	{
		val_errors++;
		val_errorlist = val_errorlist + "No tags selected" + "<br />";
	}
	
	return error_report(val_errors, val_fields["response"], val_errorlist);
	
}