function clear_field(field,name)
{
		if(field.value==name){
			field.value="";
		}
}

function check_register1()
{
	if (document.register.name.value=="") {
		alert("Va rugam adaugati Numele pentru a continua.");
		document.register.name.focus();
		return false;
	}

	if (document.register.email.value=="") {
		alert("Va rugam adaugati adresa de e-mail pentru a continua.");
		document.register.email.value="";
		document.register.email.focus();
		return false;
	} else {
		ast=document.register.email.value.indexOf("@");
		dot=document.register.email.value.lastIndexOf(".");
		if(!(ast>0 && dot>0 && dot>ast)){
			alert("Va rugam adaugati o adresa de e-mail valida pentru a continua.");
			document.register.email.focus();
			return false;
	}}

	if (document.register.email_again.value!=document.register.email.value) {
		alert("Atentie, adresa de e-mail este gresita la rescriere.");
		document.register.email_again.focus();
		return false;
	}
	
	if (document.register.password.value=="") {
		alert("Va rugam adaugati parola pentru a continua.");
		document.register.password.focus();
		return false;
	}

	if (document.register.password_again.value!=document.register.password.value) {
		alert("Atentie, parola este gresita la rescriere.");
		document.register.password_again.focus();
		return false;
	}

	if (document.register.code.value==""){
		alert("Va rugam adaugati codul de siguranta din imaginea de mai sus pentru a continua.");
		document.register.code.focus();
		return false;
	}

	if(!document.getElementById('supplier').checked && !document.getElementById('buyer').checked){
		alert("Va rugam alegeti Tipul de utilizator pentru a continua.");
		return false;
	}
	
	return true;
}

function check_register2()
{
	if (document.register.name.value=="") {
		alert("Please fill in your Name.");
		document.register.name.focus();
		return false;
	}

	if (document.register.email.value=="") {
		alert("Please fill in your e-mail address.");
		document.register.email.value="";
		document.register.email.focus();
		return false;
	} else {
		ast=document.register.email.value.indexOf("@");
		dot=document.register.email.value.lastIndexOf(".");
		if(!(ast>0 && dot>0 && dot>ast)){
			alert("Please enter a valid e-mail address.");
			document.register.email.focus();
			return false;
	}}

	if (document.register.email_again.value!=document.register.email.value) {
		alert("Your e-mail does not match on rewrite.");
		document.register.email_again.focus();
		return false;
	}
	
	if (document.register.password.value=="") {
		alert("Please fill in the password.");
		document.register.password.focus();
		return false;
	}

	if (document.register.password_again.value!=document.register.password.value) {
		alert("Your password does not match on rewrite.");
		document.register.password_again.focus();
		return false;
	}

	if (document.register.code.value==""){
		alert("Please enter the code from the image.");
		document.register.code.focus();
		return false;
	}

	if(!document.getElementById('supplier').checked && !document.getElementById('buyer').checked){
		alert("Please choose the type of user.");
		return false;
	}
	
	return true;
}



function check_fpassword_form1(){
	if (document.f_password.fpass_email.value=="") {
		alert("Va rugam adaugati adresa de e-mail pentru a continua.");
		document.f_password.fpass_email.focus();
		return false;
	}
	
	return true;	
}

function check_fpassword_form2(){
	if (document.f_password.fpass_email.value=="") {
		alert("Please enter your e-mail address.");
		document.f_password.fpass_email.focus();
		return false;
	}
	
	return true;	
}




function check_login1(default_email)
{	
	if (document.login.email.value=="" || document.login.email.value==default_email) {
		alert("Va rugam adaugati adresa de e-mail pentru a continua.");
		document.login.email.focus();
		return false;
	}
	
	if (document.login.password.value=="") {
		alert("Va rugam adaugati parola pentru a continua.");
		document.login.password.focus();
		return false;
	}
	return true;
}

function check_login2(default_email)
{	
	if (document.login.email.value=="" || document.login.email.value==default_email) {
		alert("Please enter your e-mail address.");
		document.login.email.focus();
		return false;
	}
	
	if (document.login.password.value=="") {
		alert("Please enter your password.");
		document.login.password.focus();
		return false;
	}
	return true;
}

function check_login_form1(default_email)
{	
	if (document.login_form.email.value=="" || document.login_form.email.value==default_email) {
		alert("Va rugam adaugati adresa de e-mail pentru a continua.");
		document.login_form.email.focus();
		return false;
	}
	
	if (document.login_form.password.value=="") {
		alert("Va rugam adaugati parola pentru a continua.");
		document.login_form.password.focus();
		return false;
	}
	return true;
}

function check_login_form2(default_email)
{	
	if (document.login_form.email.value=="" || document.login_form.email.value==default_email) {
		alert("Please enter your e-mail address.");
		document.login_form.email.focus();
		return false;
	}
	
	if (document.login_form.password.value=="") {
		alert("Please enter your password.");
		document.login_form.password.focus();
		return false;
	}
	return true;
}



function check_new_pass1()
{	
	if (document.new_pass.old_pass.value=="") {
		alert("Va rugam adaugati parola actuala pentru a continua.");
		document.new_pass.old_pass.focus();
		return false;
	}

	if (document.new_pass.password.value=="") {
		alert("Va rugam adaugati parola noua pentru a continua.");
		document.new_pass.password.focus();
		return false;
	}

	if (document.new_pass.password.value!=document.new_pass.password_again.value) {
		alert("La rescriere parola noua nu se potriveste.");
		document.new_pass.password_again.focus();
		return false;
	}
	return true;
}

function check_new_pass2()
{	
	if (document.new_pass.old_pass.value=="") {
		alert("Please enter your current password.");
		document.new_pass.old_pass.focus();
		return false;
	}

	if (document.new_pass.password.value=="") {
		alert("Please enter your new password.");
		document.new_pass.password.focus();
		return false;
	}

	if (document.new_pass.password.value!=document.new_pass.password_again.value) {
		alert("New password does match on rewrite.");
		document.new_pass.password_again.focus();
		return false;
	}
	return true;
}


function check_update1()
{	
	if (document.profile.company_name.value=="") {
		alert("Va rugam adaugati numele companiei pentru a continua.");
		document.profile.company_name.focus();
		return false;
	}

	if (document.profile.contact1.value=="") {
		alert("Va rugam adaugati numele persoanei de contact pentru a continua.");
		document.profile.contact1.focus();
		return false;
	}

	if (document.profile.position1.value=="") {
		alert("Va rugam adaugati functia persoanei de contact pentru a continua.");
		document.profile.position1.focus();
		return false;
	}

	if (document.profile.city.value=="") {
		alert("Va rugam adaugati localitatea pentru a continua.");
		document.profile.city.focus();
		return false;
	}

	if (document.profile.address.value=="") {
		alert("Va rugam adaugati adresa pentru a continua.");
		document.profile.address.focus();
		return false;
	}

	if (document.profile.county.value=="") {
		alert("Va rugam adaugati judetul pentru a continua.");
		document.profile.county.focus();
		return false;
	}

	if (document.profile.phone.value=="") {
		alert("Va rugam adaugati telefonul pentru a continua.");
		document.profile.phone.focus();
		return false;
	}

	if (document.profile.company_email.value=="") {
		alert("Va rugam adaugati adresa de e-mail pentru a continua.");
		document.profile.company_email.focus();
		return false;
	}

	if (document.profile.languages_spoken.value=="" && !document.profile.lang_ro.checked && !document.profile.lang_en.checked && !document.profile.lang_de.checked) {
		alert("Va rugam adaugati limbile vorbite pentru a continua.");
		document.profile.languages_spoken.focus();
		return false;
	}

	if (document.profile.employees.value=="" || document.profile.employees.value=="0") {
		alert("Va rugam adaugati numarul de angajati pentru a continua.");
		document.profile.employees.focus();
		return false;
	}

	return true;
}

function check_update2()
{	
	if (document.profile.company_name.value=="") {
		alert("Please enter your company's name.");
		document.profile.company_name.focus();
		return false;
	}

	if (document.profile.contact1.value=="") {
		alert("Please fill in the name of the contact person.");
		document.profile.contact1.focus();
		return false;
	}

	if (document.profile.position1.value=="") {
		alert("Please fill in the position of the contact person.");
		document.profile.position1.focus();
		return false;
	}

	if (document.profile.city.value=="") {
		alert("Please fill in the city.");
		document.profile.city.focus();
		return false;
	}

	if (document.profile.address.value=="") {
		alert("Please fill in the address.");
		document.profile.address.focus();
		return false;
	}

	if (document.profile.county.value=="") {
		alert("Please fill in the county.");
		document.profile.county.focus();
		return false;
	}

	if (document.profile.phone.value=="") {
		alert("Please fill in the phone number.");
		document.profile.phone.focus();
		return false;
	}

	if (document.profile.company_email.value=="") {
		alert("Please fill in the e-mail address.");
		document.profile.company_email.focus();
		return false;
	}

	if (document.profile.languages_spoken.value=="" && !document.profile.lang_ro.checked && !document.profile.lang_en.checked && !document.profile.lang_de.checked) {
		alert("Please fill in the spoken languages.");
		document.profile.languages_spoken.focus();
		return false;
	}

	if (document.profile.employees.value=="" || document.profile.employees.value=="0") {
		alert("Please fill in the number of employees.");
		document.profile.employees.focus();
		return false;
	}

	return true;
}



function check_newsletter1()
{
	if (document.newsletter.email_one.value=="") {
		alert("Va rugam adaugati adresa de e-mail pentru a continua.");
		document.newsletter.email_one.focus();
		return false;
	} else {
		ast=document.newsletter.email_one.value.indexOf("@");
		dot=document.newsletter.email_one.value.lastIndexOf(".");
		if(!(ast>0 && dot>0 && dot>ast)){
			alert("Va rugam adaugati o adresa de e-mail valida pentru a continua.");
			document.newsletter.email_one.focus();
			return false;
	}}

	if (document.newsletter.email_two.value!=document.newsletter.email_one.value) {
		alert("Atentie, adresa de e-mail este gresita la rescriere.");
		document.newsletter.email_two.focus();
		return false;
	}
	
	return true;
}

function check_newsletter2()
{
	if (document.newsletter.email_one.value=="") {
		alert("Please fill in your e-mail address.");
		document.newsletter.email_one.focus();
		return false;
	} else {
		ast=document.newsletter.email_one.value.indexOf("@");
		dot=document.newsletter.email_one.value.lastIndexOf(".");
		if(!(ast>0 && dot>0 && dot>ast)){
			alert("Please enter a valid e-mail address.");
			document.newsletter.email_one.focus();
			return false;
	}}

	if (document.newsletter.email_two.value!=document.newsletter.email_one.value) {
		alert("Your e-mail does not match on rewrite.");
		document.newsletter.email_two.focus();
		return false;
	}
	
	return true;
}

