function Clearmsg_cxusername()
{
	if (document.getElementById('login').value == 'Inserir o Username')
	{
		document.getElementById('login').value = '';
	}
}
 
function Clearmsg_cxpw()
{
	if (document.getElementById('password').value == 'Password')
	{
		document.getElementById('password').value = '';
	}
}
 

function Clearnome()
{
	if (document.getElementById('nome').value == 'Insira o seu nome')
	{
		document.getElementById('nome').value = '';
	}
}
 
 
function Clearemail()
{
	if (document.getElementById('e-mail').value == 'Insira o seu e-mail')
	{
		document.getElementById('e-mail').value = '';
	}
}
 

/**
* Verificação de Preenchimento
*
* Função JavaScript que verifica se os
* campos do login foram preenchidos (login e password).
*
* @author Fernando Mateus      24 Novembro 2007
*/
function login_val()
{
	var login = document.f_log.login.value;
	var password = document.f_log.password.value;
	if ((login=="" && password=="") || (login=="Inserir o Username" && password=="Password"))
	{
		alert("Os campos LOGIN e PASSWORD são de preenchimento obrigatório...");
		return false;
	}else if((login=="") || (login=="Inserir o Username"))
	{
		alert("O campo LOGIN é de preenchimento obrigatório...");
		return false;
	}else if((password=="") || (password=="Password"))
	{
		alert("O campo PASSWORD é de preenchimento obrigatório...");
		return false;
	}
}


/**
* Verificação de Preenchimento Newsletter
*
* Função JavaScript que verifica se o
* campo e-mail foi preenchido.
*
* @author Fernando Mateus      24 Junho 2008
*/
/*
function newsletter_val()
{
	var email = document.getElementById('e-mail').value;
	
	if ((email=="") || (email=="Insira o seu e-mail") || (email.match("@")==null))
	{
		alert("Preencha corretamente o campo de e-mail...");
		return false;
	}
}
*/


/**
* Pergunta Logout
*
* Função JavaScript que pergunta ao utilizador
* se realmente pretende sair da aplicacao.
*
* @author Fernando Mateus      24 Novembro 2007
*/
function logout()
{
	var response=confirm("Tem a certeza que pretende sair?");
	return (response);

}


function showdiv(activar,id1,id2)
{ 
	var A=document.getElementById(id1);
	var B=document.getElementById(id2);
	if(activar=='sim')
	{
		B.style.display = 'block';
		A.style.display= 'none'; 
	}
	else
	{
		A.style.display = 'block';
		B.style.display= 'none';
	}
}


/**
* Verificação de tecla premida
*
* Função JavaScript que verifica se a tecla premida
* é um número, se não o for devolve 'false'.
*
* @author Fernando Mateus      06 Maio 2008
*/
function so_num()
{
	if (event.keyCode < 48 || event.keyCode > 57) 
		event.returnValue = false;
}


function OpenWindow(SITE,TITLE,SUBTITLE)
{
  var NewWindow=window.open('','name','height=660,width=500,status=1');

  NewWindow.document.write('<html><head><title>' + SITE + '</title>');
  NewWindow.document.write('</head><body bgcolor="#FFFFFF">');
  NewWindow.document.write('<table width="474" border="0" align="center" cellpadding="0" cellspacing="0">');
  NewWindow.document.write('<tr>');
  NewWindow.document.write('<td align="right">');
  NewWindow.document.write('<a href="javascript:self.close()"><FONT COLOR="#067D95" SIZE="2" FACE="VERDANA">FECHAR JANELA </FONT><img src="img/close.png" width="24" height="24" border="0" align="absmiddle" /></a>');
  NewWindow.document.write('</td>');
  NewWindow.document.write('</tr>');
  NewWindow.document.write('<tr height="5"><td></td></tr>');
  NewWindow.document.write('</table>');
  NewWindow.document.write('<div align="center">');
  NewWindow.document.write('<a href=' + SITE + ' title="Freguesia de Orvalho"><img src="img/templates/topo.jpg" border="0"></a><br />');
  NewWindow.document.write('</div>');
  NewWindow.document.write('<br />');
  NewWindow.document.write('<table width="474" border="0" align="center" cellpadding="0" cellspacing="0">');
  NewWindow.document.write('<tr>');
  NewWindow.document.write('<td align="left">');
  NewWindow.document.write('<FONT COLOR="#067D95" SIZE="2" FACE="VERDANA"><B>' + TITLE + '</B></FONT>');
  NewWindow.document.write('</td>');
  NewWindow.document.write('</tr>');
  NewWindow.document.write('<tr height="5"><td></td></tr>');
  NewWindow.document.write('<tr>');
  NewWindow.document.write('<td>');
  NewWindow.document.write('<div align="justify">');
  NewWindow.document.write('<FONT COLOR="#000000" SIZE="1" FACE="VERDANA"><B>' + SUBTITLE + '</B></FONT>');
  NewWindow.document.write('</div>');
  NewWindow.document.write('</td>');
  NewWindow.document.write('</tr>');
  NewWindow.document.write('<tr height="25"><td></td></tr>');
  NewWindow.document.write('<tr>');
  NewWindow.document.write('<td align="right">');
  NewWindow.document.write('<a href="javascript:window.print()"><img src="images/icons_filetypes/print.gif" border="0" /></a>');
  NewWindow.document.write('</td>');
  NewWindow.document.write('</tr>');
  NewWindow.document.write('</table>');
  NewWindow.document.write('</body></html>');
  NewWindow.document.close();
}

function getStyle(el,styleProp) {
	var x = document.getElementById(el);
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}
function aumentarFonte() {
	var increment = 1;
	var el = "Body";
	var styleProp = "font-size";
	if (navigator.appName == "Microsoft Internet Explorer" && styleProp == "font-size") {
		styleProp = "fontSize";
	}
	var result = getStyle(el,styleProp);
	var sizeOfBaseFont = result.substring(0,result.length-2);
	sizeOfBaseFont = (parseInt(sizeOfBaseFont) + parseInt(increment));
	document.getElementById(el).style.fontSize = sizeOfBaseFont+"px";
}
function diminuirFonte() {
	var increment = 1;
	var el = "Body";
	var styleProp = "font-size";
	if (navigator.appName == "Microsoft Internet Explorer" && styleProp == "font-size") {
		styleProp = "fontSize";
	}
	var result = getStyle(el,styleProp);
	var sizeOfBaseFont = result.substring(0,result.length-2);
	sizeOfBaseFont = (parseInt(sizeOfBaseFont) - parseInt(increment));
	document.getElementById(el).style.fontSize = sizeOfBaseFont+"px";
}
function tamanhoPadrao() {
	var el = "Body";
	document.getElementById(el).style.fontSize = "10px";
}

/*
function loadworddoc(){
	var doc = new ActiveXObject("Word.Application"); // creates the word object
	
	doc.Visible=false; // doesn't display Word window
	
	doc.Documents.Open("tst.doc"); // specify path to document
	
	
	//copy the content from my word document and throw it into my variable
	
	var txt;
	
	txt = doc.Documents("tst1.doc").Content;
	
	document.all.myarea.value = txt;
	
	doc.quit(0); // quit word (very important or you'll quickly chew up memory!)
}
*/
