
function load2(url) {
var load = window.open(url,'','scrollbars=yes,menubar=no,width=500,height=200,resizable=yes,toolbar=no,location=no,status=no');
}

function checkJS()
{
	alert("JAVASCRIPT");
	return;
}


function checkClassificadosAdd(nome, email, titulo1, texto1, titulo2, texto2, seccao) 
{

var returnValue = true;
var myRegNome = /^([a-zA-Z\ç\Ç\á\Á\à\À\ã\Ã\â\Â\ó\Ó\ò\Ò\õ\Õ\ô\Ô\é\É\è\È\ê\Ê\í\Í\ì\Ì\ú\Ú\ù\Ù\s])+$/;
var myRegEmail = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
var myRegTituloTexto = /^([\w\t\n\r\f\v\s\.\,\ç\Ç\á\Á\à\À\ã\Ã\â\Â\ó\Ó\ò\Ò\õ\Õ\ô\Ô\é\É\è\È\ê\Ê\í\Í\ì\Ì\ú\Ú\ù\Ù\(\)-])*$/;

if (nome.length==0 | email.length==0 | titulo1.length==0 | texto1.length==0 | seccao.length==0)
{
	returnValue = false;
	alert ("Nome ou email ou secção ou titulo ou texto vazios. Verifique as regras.\nInvalid name or email or section or title or text. Check rules.");
}

else
{
	// check do NOME
	returnValue = myRegNome.test(nome);
	if (returnValue)
	{
		// check do EMAIL
		returnValue = myRegEmail.test(email);
		if (returnValue)
		{
			// check dp TITULO português
			returnValue = myRegTituloTexto.test(titulo1);
			if (returnValue)
			{
				// check dp TEXTO português
				returnValue = myRegTituloTexto.test(texto1);
				if (returnValue)
				{
					// check dp TITULO inglês
					if (titulo2.lenght != 0) { returnValue = myRegTituloTexto.test(titulo2); }
					if (returnValue)
					{
						// check dp TEXTO inglês
						if (texto2.lenght != 0) { returnValue = myRegTituloTexto.test(texto2); }
						if (returnValue)
						{
							 
						}
						else
						{
							alert ("Texto não aceitável!\nUnacceptable Text!");
						}
					}
					else
					{
						alert ("Título não aceitável!\nUnacceptable Title!");
					}
				}
				else
				{
					alert ("Texto não aceitável!\nUnacceptable Text!");
				}
	
			}
			else
			{
				alert ("Título não aceitável!\nUnacceptable Title!");
			}
		}
		else
		{
			alert ("Endereço de email não aceitável!\nUnacceptable email address!");
		}
	}
	else
	{
		alert ("Nome Inválido. O Nome apenas pode ter letras e espaços!\nInvalid Name. Name field can have only letters and spaces!");
	}
}

return returnValue;

}



function checkEmailContacto(nome, email, assunto, mensagem) 
{


var returnValue = true;
var myRegNome = /^([a-zA-Z\ç\Ç\á\Á\à\À\ã\Ã\â\Â\ó\Ó\ò\Ò\õ\Õ\ô\Ô\é\É\è\È\ê\Ê\í\Í\ì\Ì\ú\Ú\ù\Ù\s])+$/;
var myRegEmail = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

if (nome.length==0 | email.length==0 | assunto.length==0 | mensagem.length==0)
{
	returnValue = false;
	alert ("Nome ou email ou assunto ou mensagem vazios. Preencha os campos.\nInvalid name or email or subject or message. Fill all fields.");
}

else
{
	// check do NOME
	returnValue = myRegNome.test(nome);
	if (returnValue)
	{
		// check do EMAIL
		returnValue = myRegEmail.test(email);
		if (returnValue)
		{
						
		}
		else
		{
			alert ("Endereço de email não aceitável!\nUnacceptable email address!");
		}
	}
	else
	{
		alert ("Nome Inválido. O Nome apenas pode ter letras e espaços!\nInvalid Name. Name field can have only letters and spaces!");
	}
}

return returnValue;

}

function checkDirectorioRegisto(empresa, aceitotermos, metodopagamento) 
{

	var returnValue = true;
	var theone;
/*	var var0;
	var var1;
	var var2;
	
	var0 = metodopagamento[0].checked;
	var1 = metodopagamento[1].checked;
	var2 = metodopagamento[2].checked;
	alert (var0);
	alert (var1);
	alert (var2);
*/
	theone = -1;
		
	//a variable that will hold the index number of the selected radio button
	
	for (i=0;i < metodopagamento.length;i++)
	{
		if (metodopagamento[i].checked==true)
		{
			theone=i
			break //exist for loop, as target acquired.
		}
	}
	
	
	
	if (empresa.length==0)
	{
		returnValue = false;
		alert ("Nome de empresa não preenchido. Preencha correctamente os campos.\nInvalid company name. Fill all fields.");
	}
	
	else if (theone == -1) 
	{
		returnValue = false;
		alert ("Escolha um método de pagamento.\nA payment method must be selected.");
	}

	else if (aceitotermos != true)
	{
			returnValue = false;
			alert ("Deve ler e selecionar a checkbox de aceitação dos termos e condições de registo!\nYou must read and check terms and conditions of registration!");
	}

	else 
	{
		
	}

	return returnValue;

}