function newimage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}
function changeimages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeimages.arguments.length; i+=2) {
document[changeimages.arguments[i]].src = changeimages.arguments[i+1];
}
}
}
var preloadFlag = false;
function preloadimages() {
if (document.images) {
op01_lo_esq_high = newimage("<?php bloginfo('template_directory');?>/pics/op01_lo_esq_high.gif");
op02_lo_esq_high = newimage("<?php bloginfo('template_directory');?>/pics/op02_lo_esq_high.gif");
op03_lo_esq_high = newimage("<?php bloginfo('template_directory');?>/pics/op03_lo_esq_high.gif");
btn_registo_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_registo_high.gif");
btn_login_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_login_high.gif");
sep_high = newimage("<?php bloginfo('template_directory');?>/pics/sep_high.gif");
btn_quemsomos_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_quemsomos_high.gif");
btn_jornal_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_jornal_high.gif");
btn_anunciar_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_anunciar_high.gif");
btn_news_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_news_high.gif");
btn_links_high = newimage("<?php bloginfo('template_directory');?>/pics/btn_links_high.gif");
preloadFlag = true;
}
}
function imprimir(arg) {
var url;
url = "/common/imprimir.html?artigo=" + arg
window.open(url,'imprimirartigo','toolbar=no,height=570,top=50,left=100,width=490,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no');
}
function enviarartigo(arg) {
var url;
url = "/common/enviarartigo.html?artigo=" + arg
window.open(url,'enviarartigo','toolbar=no,height=420,top=200,left=200,width=490,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}
function recomendesite() {
window.open('/common/enviarsite.html','enviarsite','toolbar=no,height=415,top=200,left=200,width=490,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}
var errGeneric = "Preencha "
var errMail = "O Email não é válido."
var errLogin = "Login não é válido."
var errPass = "Insira a Palavra-Passe."
var erro=false;
function valTxt(field){
if (field.value.length==0){
erro = true;
}else{
erro = false;
}
}
function valEmail(email){
var i,max,achou1,achou2
achou1 = false
achou2 = false
max = email.value.length
for (i=0;i<max;i++){
if (email.value.substring(i,i+1)=='@'){
achou1 = true
}
if (email.value.substring(i,i+1)=='.'){
achou2 = true
}
}
if ((!achou1) || (!achou2)){
erro = true;
}else{
erro = false;
}
}
function valLogin(form){
valEmail(form.credential_0);
if(erro){
alert(errLogin);
return 0;
}
valTxt(form.credential_1);
if (erro){
alert(errPass);
return 0;
}
}
function valRecPass(form){
valEmail(form.credential_0);
if(erro){
alert(errMail);
return 0;
}
}
// Radio Button Validation
// copyright Stephen Chapman, 15th Nov 2004
// you may copy this function but please keep the copyright notice with it
function valButton(btn) {
var cnt = -1;
for (var i=0; i < btn.length; i++) {
if (btn[i].checked) {cnt = i; i = btn.length;}
}
if (cnt > -1) return btn[cnt].value;
else return null;
}
function valRegisto(form){
	valTxt(form.txtNome);
	if (erro){
	alert(errGeneric + "o Nome.");
	return 0;
	}
	/*
	valTxt(form.txtApelido);
	if (erro){
	alert(errGeneric + "o Apelido.");
	return 0;
	}
	*/
	valTxt(form.txtEmpresa);
	if (erro){
	alert(errGeneric + "a Empresa.");
	return 0;
	}
	/*
	valTxt(form.txtNIF);
	if (erro){
	alert(errGeneric + "o Número de Contribuinte.");
	return 0;
	}
	valTxt(form.txtMorada);
	if (erro){
	alert(errGeneric + "a Morada.");
	return 0;
	}
	valTxt(form.txtLocalidade);
	if (erro){
	alert(errGeneric + "a Localidade.");
	return 0;
	}
	valTxt(form.txtCodPostal);
	valTxt(form.txtCodPostal_Pref);
	if (erro){
	alert(errGeneric + "o Código Postal.");
	return 0;
	}
	valTxt(form.txtTelefone);
	if (erro){
	alert(errGeneric + "o Número de Telefone.");
	return 0;
	}
	*/
	valTxt(form.selSector);
	if (erro){
	alert(errGeneric + "o Sector.");
	return 0;
	}
	valTxt(form.txtFuncao);
	if (erro){
	alert(errGeneric + "a Função.");
	return 0;
	}
	valEmail(form.txtEmail);
	if(erro){
	alert(errMail);
	return 0;
	}
	valEmail(form.txtEmailConf);
	if(erro){
	alert("A Confirmação do Email não é válido.");
	return 0;
	}
	if (form.txtEmail.value != form.txtEmailConf.value) {
	alert("A Confirmação do Email é diferente do Email.");
	return 0;
	}
	/*
	valTxt(form.txtPass);
	if (erro){
	alert(errGeneric + "a Palavra-Passe.");
	return 0;
	}
	valTxt(form.txtPassConf);
	if (erro){
	alert(errGeneric + "a Confirmação da Palavra-Passe.");
	return 0;
	}
	if (form.txtPass.value != form.txtPassConf.value) {
	alert("A Confirmação da Palavra-Passe é diferente da Palavra-Passe.");
	return 0;
	}
	if( form.chkAssina.checked ){
	if (valButton(form.rdModoPagamento) == 'Cheque' ){
	valTxt(form.txtNrCheque);
	if (erro){
	alert(errGeneric + "o Número de Cheque.");
	return 0;
	}
	valTxt(form.txtValorCheque);
	if (erro){
	alert(errGeneric + "o Valor do Cheque.");
	return 0;
	}
	valTxt(form.txtBancoCheque);
	if (erro){
	alert(errGeneric + "o Nome do Banco.");
	return 0;
	}
	}
	if (valButton(form.rdModoPagamento) == 'Transferência Bancária' ){
	valTxt(form.txtValorTransf);
	if (erro){
	alert(errGeneric + "o Valor da Transferência.");
	return 0;
	}
	}
	}
	*/
}

