﻿function checkemail(){

var str=document.validation.emailcheck.value

var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

if (filter.test(str))

testresults=true

else{

alert("Please input a valid email address!")

testresults=false

}

return (testresults)

}



function checkrequired(which,lang)

{
obj=which.name;

	var pass=true

	if (document.images)

	{

		for (i=0;i<which.length;i++)

		{

			var tempobj=which.elements[i]
			
			if (tempobj.id.substring(0,4)=="req_")

			{
				
				if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1))

				{

					pass=false

					//break

				}

			}

			else if (tempobj.id.substring(0,9)=="reqemail_")

			{	

			if (pass)

				{

					var str=tempobj.value

					var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

					if (filter.test(str))

					{

						pass=true

					}

					else

					{

						//alert("Please input a valid email address!")

						pass=false

					}

				}	

			}

		}

	}		

	if (!pass)

	{

	if (lingua=="0") 
	{	
		alert("Um ou mais elementos de preenchimento necessário não foram preenchidos, ou o email está mal formatado...")
	}
	else if (lingua=="1")	
	{	
		alert("One or more required fields were not filled or the email isn´t right...")
	}
	else if (lingua=="2")	
	{	
		alert("Un o diversi elementi non sono stati riempiti oppure la mail non sta bene...")
	}
	else if (lingua=="3")	
	{	
	alert("Un o más elementos de ou mais elementos no fueron completados u entonces el email non está bien...")
	}
	





		return false

	}

	else

	{

		return true

	}

}

