// JavaScript Document
function right(e) {
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3)) {
alert("PA - Projectos e Avaliações - 2004-2007");
return false;
}
return true;
}

document.onmousedown=right;
document.onmouseup=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (document.layers) window.captureEvents(Event.MOUSEUP);
window.onmousedown=right;
window.onmouseup=right;

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function no_error()
{ return true; }
window.onerror=no_error;

function commaSplit(srcNumber) {
var txtNumber = '' + srcNumber;
if (isNaN(txtNumber) || txtNumber == "") {
fieldName.select();
fieldName.focus();
}
else {
var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
var arrNumber = txtNumber.split('.');
arrNumber[0] += '.';
do {
arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
} while (rxSplit.test(arrNumber[0]));
if (arrNumber.length > 1) {
return arrNumber.join('');
}
else {
return arrNumber[0].split('.')[0];
      }
   }
}

function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}

function getElementValues(k) {
  var element, nameValue
  var srchStr = "?"
  for (var i=0; i < document.forms[k].elements.length; i++) {
      element = document.forms[k].elements[i];
      if (element.type == "text" || element.type == "textarea") {
         nameValue = escape(element.name) + "=" + escape(element.value);
      } else if (element.type.indexOf("select") != -1) {
         nameValue = escape(element.name) + "=" +
                     escape(element.options[element.selectedIndex].value);
      } else if (element.type == "checkbox" || element.type == "radio") {
         if (element.checked) {
            nameValue = escape(element.name) + "=" + escape(element.value);
         } else continue
      } else continue
      srchStr += nameValue + "&";
  }
  return srchStr;
}

function runClock() {
theTime = window.setTimeout("runClock()", 1000);
var today = new Date();
var display = today.toLocaleString();
window.status = display;
}
runClock();

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function Form_Validator(theForm)
{
  if (theForm.nome.value == "")
  {
    alert("Por favor preencha o campo do Nome.");
    theForm.nome.focus();
    return (false);
  }
  if (theForm.telefone.value == "")
  {
    alert("Por favor preencha o campo do Telefone.");
    theForm.telefone.focus();
    return (false);
  }
  if (theForm.email.value == "")
  {
    alert("Por favor preencha o campo do E-mail");
    theForm.email.focus();
    return (false);
  }
	var checkemail = "@.";
	var checkStr = theForm.email.value;
	var emailValid = false;
	var emailAt = false;
	var emailPeriod = false;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkemail.length;  j++)
		{
			if (ch == checkemail.charAt(j) && ch == "@")
			emailAt = true;
			if (ch == checkemail.charAt(j) && ch == ".")
			emailPeriod = true;
			if (emailAt && emailPeriod)
			break;
			if (j == checkemail.length)
			break;
		}
		if (emailAt && emailPeriod)
		{
			emailValid = true
			break;
		}
	}
	if (!emailValid)
	{
		alert("Por favor preencha o campo E-mail correctamente.");
		theForm.email.focus();
		return (false);
	}  
  if (theForm.assunto.value == "")
  {
    alert("Por favor preencha o campo Assunto.");
    theForm.assunto.focus();
    return (false);
  }
  form.submit();
}
/*win=window.open("http://www.pai.pt/avaliadores/pa-projectos-e-avaliações/y:pt_2463392_5__1.html#")
win=window.open("http://www.yellowpages.pai.pt/assessors/pa-projectos-e-avaliações/y:pt_2463392_5__1.html?locale=en_PT&visitorUid=8a98819025b5b86e0125d7c47ccb5d72&passwordToken=34EE999C-6BC1-FAB3-E0E8-1323042C0551&newSearch=true&location=&location=&previousPath=detailssearchfordetailsview")*/
function open_call_pt(){
win=window.open("http://ep.estara.com/UI/gui.php?accountid=200106285525&template=408213&authorizeurl=http%3A%2F%2Fwww.pai.pt%2Fauthorizecall.ds%3FdetailsListingId%3Dy%253APT_2463392_5__1&calltype=webvoicepop&linkfile=%2FOneCC%2F200106285525%2F408213.js&referrer=Email&donotcache=1591783538&emaillink=1&upeid=mSmJKPQREd6JBQAfKQ4qpg&guiid=43f2de8a9637b&timestamp=1262046728")
//win.moveTo(screen.width/2-261,screen.height/2-300)
}

function open_call_en(){
win=window.open("http://ep.estara.com/UI/gui.php?accountid=200106285525&template=407383&authorizeurl=http%3A%2F%2Fwww.pai.pt%2Fauthorizecall.ds%3FdetailsListingId%3Dy%253APT_2463392_5__1&calltype=webvoicepop&linkfile=%2FOneCC%2F200106285525%2F407383.js&referrer=Email&donotcache=1784536856&emaillink=1&upeid=Z_XPkvQREd6qoQAfKQ4qpg&guiid=43f2de8a9637b&timestamp=1262046646")
//win.moveTo(screen.width/2-261,screen.height/2-300)
}

function open_and_center(){
win=window.open("projectos_arquitectura_execut.htm","","scrollbars=yes,width=570,height=450")
win.moveTo(screen.width/2-261,screen.height/2-300)
}

function open_and_center_en(){
win=window.open("projects_architecture_exec.htm","","scrollbars=yes,width=570,height=450")
win.moveTo(screen.width/2-261,screen.height/2-300)
}

function getParams() {
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++) {
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];   
	}
}
return params;
}
params = getParams();