
//<script>
//deteccao do browser e redireccionamento se incompatível
if (!document.getElementById){
	window.location='unsupported.html';
}

//funcao para expandir, minimizar as seccoes de conteudos na seccao 'alojamento web'
function expander(pre,elem){
	for (x=1; x<=document.getElementById(pre+'count').value; x++){
		if (x!=elem){
			document.getElementById(pre+x).src='http://www.yds.pt/imagens/alojamento/seta_abaixo.jpg';
			document.getElementById(pre+x+'c').style.visibility='hidden';
			document.getElementById(pre+x+'c').style.display='none';
		}
	}
	
	//imagem
	currentImg=(document.getElementById(pre+elem).src=='http://www.yds.pt/imagens/alojamento/seta_abaixo.jpg') ? 'http://www.yds.pt/imagens/alojamento/seta_acima.jpg' : 'http://www.yds.pt/imagens/alojamento/seta_abaixo.jpg';
	
	//esconde mostra conteudo
	currentStatus1=(document.getElementById(pre+elem+'c').style.visibility=='hidden') ? '' : 'hidden';
	currentStatus2=(document.getElementById(pre+elem+'c').style.display=='none') ? '' : 'none';
	
	//aplica
	document.getElementById(pre+elem).src=currentImg;
	document.getElementById(pre+elem+'c').style.visibility=currentStatus1;
	document.getElementById(pre+elem+'c').style.display=currentStatus2;	
}

//avalia se o campo esta vazio
function IsEmpty(aTextField) {
   if ((aTextField.value.length==0) ||
   (aTextField.value==null)) {
      return true;
   }
   else { return false; }
}	

//funcao para esconder o texto do status bar
function hidestatus(){
window.status=''
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus

//funcao para escrever para uma div
function writeToDiv(divId,html){
 if (document.getElementById) {
       document.getElementById(divId).innerHTML= html;
 }else{
     document.layers[divId].document.open();
     document.layers[divId].document.write(html);
     document.layers[divId].document.close();
 }
}

//funcao equivalente ao number_format do php
function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
		num = "0";
		sign = (num == (num = Math.abs(num)));
		num = Math.floor(num*100+0.50000000001);
		cents = num%100;
		num = Math.floor(num/100).toString();
	if(cents<10)
		cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		num = num.substring(0,num.length-(4*i+3))+'.'+
		num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + num + ',' + cents + '€');
}

//funcao para verificar se um email é valido
function isEmail(str){
	var filter=/^.+@.+\..{2,4}$/
	return (filter.test(str))
}
  
//funcao para validar um dominio
function isURL(urlStr){
	if (urlStr.indexOf(" ")!=-1){
		alert("Espaços não são permitídos nos URLs.");
		return false;
	}
	if(urlStr==""||urlStr==null){
		return false;
	}
	urlStr=urlStr.toLowerCase();
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	var validChars="\[^\\s" + specialChars + "\]";
	var atom=validChars + '+';
	var urlPat=/^http:\/\/(\w*)\.([\-\+a-z0-9]*)\.(\w*)/;
	var matchArray=urlStr.match(urlPat);
	if (matchArray==null){
		alert("O URL está incorrecto.");
		return false;
	}
	var user=matchArray[2];
	var domain=matchArray[3];
	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			alert("O URL contem caractéres inválidos.");
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			alert("O URL contem caractéres inválidos.");
			return false;
		}
	}
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			alert("O URL está incorrecto.");
			return false;
		}
	}
	/*var knownDomsPat=/^(pt|com|net|org|info|eu|edu|us|mobi|name|ws|biz|cc|tv|de|uk|md|cn|ca|ch)$/;
	
	if (len==1 && domArr[len-1].search(knownDomsPat)==-1) {
		alert("Terminação inválida para este domínio.");
		return false;
	}*/
	return true;
}

//funcao para restringir a caracteres alfanumericos apenas
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
//onkeypress="return letternumber(event)"
function letternumber(e)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);
keychar = keychar.toLowerCase();

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// alphas and numbers
else if ((("abcdefghijklmnopqrstuvwxyz0123456789 ").indexOf(keychar) > -1))
   return true;
else
   return false;
}

//funcao para restringir a caracteres numericos apenas
// copyright 1999 Idocs, Inc. http://www.idocs.com
// Distribute this script freely but keep this notice in place
//onkeypress="return numbersonly(this, event)"
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

else
   return false;
}

/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/

/* hover layer code */

// Copyright (C) 2005 Ilya S. Lyubinskiy. All rights reserved.
// Technical support: http://www.php-development.ru/
//
// YOU MAY NOT
// (1) Remove or modify this copyright notice.
// (2) Distribute this code, any part or any modified version of it.
//     Instead, you can link to the homepage of this code:
//     http://www.php-development.ru/javascripts/dropdown.php.
//
// YOU MAY
// (1) Use this code on your website.
// (2) Use this code as a part of another product provided that
//     this code will be a small part of this product.
//
// NO WARRANTY
// This code is provided "as is" without warranty of any kind, either
// expressed or implied, including, but not limited to, the implied warranties
// of merchantability and fitness for a particular purpose. You expressly
// acknowledge and agree that use of this code is at your own risk.


// USAGE
//
// function popup_show(id, drag_id, exit_id, position, x, y, position_id)
//
// id          - id of a popup window;
// drag_id     - id of an element within popup window intended for dragging it
// exit_id     - id of an element within popup window intended for hiding it
// position    - positioning type:
//               "screen-corner", "screen-center"
//               "mouse-corner" , "mouse-center"
//               "element-right", "element-bottom"
// x, y        - offset
// position_id - for the last two types of positioning popup window will be
//               positioned relative to this element


// ----- Variables -------------------------------------------------------------

var popup_dragging = false;
var popup_target;
var popup_mouseX;
var popup_mouseY;
var popup_mouseposX;
var popup_mouseposY;
var popup_oldfunction;

function popup_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

// ----- popup_mousedown -------------------------------------------------------

function popup_mousedown(e)
{
  var ie = navigator.appName == "Microsoft Internet Explorer";
  if ( ie && window.event.button != 1) return;
  if (!ie && e.button            != 0) return;
  popup_dragging = true;
  popup_target   = this['target'];
  popup_mouseX   = ie ? window.event.clientX : e.clientX;
  popup_mouseY   = ie ? window.event.clientY : e.clientY;
  if (ie)
       popup_oldfunction      = document.onselectstart;
  else popup_oldfunction      = document.onmousedown;
  if (ie)
       document.onselectstart = new Function("return false;");
  else document.onmousedown   = new Function("return false;");
}

// ----- popup_mousemove -------------------------------------------------------

function popup_mousemove(e)
{
  if (!popup_dragging) return;
  var ie      = navigator.appName == "Microsoft Internet Explorer";
  var element = document.getElementById(popup_target);
  var mouseX = ie ? window.event.clientX : e.clientX;
  var mouseY = ie ? window.event.clientY : e.clientY;
  element.style.left = (element.offsetLeft+mouseX-popup_mouseX)+'px';
  element.style.top  = (element.offsetTop +mouseY-popup_mouseY)+'px';
  popup_mouseX = ie ? window.event.clientX : e.clientX;
  popup_mouseY = ie ? window.event.clientY : e.clientY;
}

// ----- popup_mouseup ---------------------------------------------------------

function popup_mouseup(e)
{
  if (!popup_dragging) return;
  popup_dragging = false;
  var ie      = navigator.appName == "Microsoft Internet Explorer";
  var element = document.getElementById(popup_target);
  if (ie)
       document.onselectstart = popup_oldfunction;
  else document.onmousedown   = popup_oldfunction;
}

// ----- popup_exit ------------------------------------------------------------

function popup_exit(e)
{
  var ie      = navigator.appName == "Microsoft Internet Explorer";
  var element = document.getElementById(popup_target);
  popup_mouseup(e);
  element.style.visibility = 'hidden';
  element.style.display    = 'none';
  return false;
}


// ----- popup_show ------------------------------------------------------------

function popup_show(id, drag_id, exit_id, position, x, y, position_id)
{
  element      = document.getElementById(id);
  drag_element = document.getElementById(drag_id);
  exit_element = document.getElementById(exit_id);
  element.style.position   = "absolute";
  element.style.visibility = "visible";
  element.style.display    = "block";
  if (position == "screen-corner")
  {
    element.style.left = (document.documentElement.scrollLeft+x)+'px';
    element.style.top  = (document.documentElement.scrollTop +y)+'px';
  }
  if (position == "screen-center")
  {
    element.style.left = (document.documentElement.scrollLeft+(document.body.clientWidth -element.clientWidth )/2+x)+'px';
    element.style.top  = (document.documentElement.scrollTop +(document.body.clientHeight-element.clientHeight)/2+y)+'px';
  }
  if (position == "mouse-corner")
  {
    element.style.left = (document.documentElement.scrollLeft+popup_mouseposX+x)+'px';
    element.style.top  = (document.documentElement.scrollTop +popup_mouseposY+y)+'px';
  }
  if (position == "mouse-center")
  {
    element.style.left = (document.documentElement.scrollLeft+popup_mouseposX-element.clientWidth /2+x)+'px';
    element.style.top  = (document.documentElement.scrollTop +popup_mouseposY-element.clientHeight/2+y)+'px';
  }
  if (position == "element-right" || position == "element-bottom")
  {
    var position_element = document.getElementById(position_id);

    for (var p = position_element; p; p = p.offsetParent)
      if (p.style.position != 'absolute')
      {
        x += p.offsetLeft;
        y += p.offsetTop ;
      }

    if (position == "element-right" ) x += position_element.clientWidth;
    if (position == "element-bottom") y += position_element.clientHeight;

    element.style.left = x+'px';
    element.style.top  = y+'px';
  }
  drag_element['target']   = id;
  drag_element.onmousedown = popup_mousedown;
  exit_element.onclick     = popup_exit;
}

// ----- popup_mousepos --------------------------------------------------------

function popup_mousepos(e)
{
  var ie = navigator.appName == "Microsoft Internet Explorer";

  popup_mouseposX = ie ? window.event.clientX : e.clientX;
  popup_mouseposY = ie ? window.event.clientY : e.clientY;
}

// ----- Attach Events ---------------------------------------------------------

if (navigator.appName == "Microsoft Internet Explorer")
     document.attachEvent('onmousedown', popup_mousepos);
else document.addEventListener('mousedown', popup_mousepos, false);

if (navigator.appName == "Microsoft Internet Explorer")
     document.attachEvent('onmousemove', popup_mousemove);
else document.addEventListener('mousemove', popup_mousemove, false);

if (navigator.appName == "Microsoft Internet Explorer")
     document.attachEvent('onmouseup', popup_mouseup);
else document.addEventListener('mouseup', popup_mouseup, false);

/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/

/* main code */

//funcoes do dreamweaver para preload de imagens / rollover
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// Preloade Layer Hide
/* layer html code
<div id="hidepage" style="visibility: hidden; display: none; position: absolute; left:0; top:0; background-color: #FFFFFF; layer-background-color: #FFFFFF; height: 100%; width: 100%; border: 1px none #000000;"> 

<table width=100%><tr>
  <td align="center" valign="middle"><br>
    <br>
    <span class="domainListNotAvailable"><br>
    <br>
    <br>
    <br>
    <strong class="domainListNotAvailable">YDS.PT</strong></span><br>
    <span class="domainListNameNotAvailable">A carregar conte&uacute;do... </span></td>
</tr></table></div> 
*/
<!-- Original:  Gilbert Davis -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function loadImages() {
if (document.getElementById) {  // DOM3 = IE5, NS6
document.getElementById('hidepage').style.visibility = 'hidden';
}
else {
if (document.layers) {  // Netscape 4
document.hidepage.visibility = 'hidden';
}
else {  // IE 4
document.all.hidepage.style.visibility = 'hidden';
      }
   }
}
//  End -->

//funcao para mandar as opcoes do teste de dominio para o formulario antes de submeter o mesmo
function avDomainCBoxes(){
	if (document.getElementById('dotCom').checked){
		document.domainTestForm._dotCom.value='1';
	}
	if (document.getElementById('dotNet').checked){
		document.domainTestForm._dotNet.value='1';
	}
	if (document.getElementById('dotOrg').checked){
		document.domainTestForm._dotOrg.value='1';
	}
	if (document.getElementById('dotInfo').checked){
		document.domainTestForm._dotInfo.value='1';
	}
	if (document.getElementById('dotComPt').checked){
		document.domainTestForm._dotComPt.value='1';
	}
	if (document.getElementById('dotPt').checked){
		document.domainTestForm._dotPt.value='1';
	}
	if (document.getElementById('dotEu').checked){
		document.domainTestForm._dotEu.value='1';
	}	
	if (document.getElementById('dotTodos').checked){
		document.domainTestForm._dotTodos.value='1';
	}	
	document.domainTestForm._domainList.value=document.getElementById('domainList').value;
}

//funcao para mandar os dominios seleccionados para o formulario do carrinho antes de submeter o mesmo
function adicionaCarrinho(){
	var total=document.getElementById('_domainListCount').value;
	if (total>0){
		var checkado=false;
		var cc=0;
		for (cc=0; cc<total; cc++){
			if (document.getElementById('c'+cc).checked){
				checkado=true;	
			}
		}
		if (checkado){
			document._domainListPreview.submit();
		}else{
			alert('Nenhum domínio escolhido!');
		}
	}else{
		alert('Nenhum domínio escolhido!');
	}
}

//funcao para enviar o formulario de esvaziar o carrinho
function esvaziarEncomenda(){
	var esvazia=confirm('Deseja eliminar o conteúdo da encomenda actual?\nEste acção é irreversível.');
	if (esvazia){
		document.esvaziarEncomendaForm.submit();
	}
}

//funcao para alertar as condições de domínios .pt
function confirmaPT(){
	var confirma=confirm('ATENÇÃO: INFORMAÇÃO IMPORTANTE RELATIVA À TITULARIDADE DE DOMÍNIOS .PT\n\nCaro cliente,\n\nVerificamos que possui na sua encomenda domínios .pt\n\nSegundo as REGRAS DO REGISTO DE DOMÍNIOS .PT da FCCN (Artigo 11):\n\n- No caso das pessoas colectivas, o nome do domínio deverá coincidir com o nome, a firma ou denominação da mesma, devidamente registados;\n\n- No caso das entidades públicas, o nome do domínio deverá coincidir com o constante da publicação no Diário da República (DR);\n\n- No caso dos empresários em nome individual, o nome do domínio deverá coincidir com o nome, a firma ou denominação do mesmo, devidamente registados;\n\n- No caso de profissionais liberais, o nome do domínio deverá coincidir integralmente com o respectivo nome profissional constante de documento comprovativo da referida qualidade. Quando não haja uma pré definição do nome profissional, designadamente junto de uma Ordem profissional, ele terá que ser constituído, no mínimo, por dois nomes;\n\n- No caso dos titulares de marcas registadas pela via do registo nacional, comunitário ou internacional ou de requerentes de pedidos de registo de marcas através de qualquer daquelas vias de protecção, o nome de domínio deverá ser tal como consta do respectivo título de registo nacional, comunitário ou internacional desde que, nestes últimos casos, as marcas sejam extensivas a Portugal.\n\nReceberá ainda, um e-mail dos nossos serviços com um formulário que deverá ser preenchido relativo aos dados do titular do domínio. Sugerimos que até recepção da nossa parte destes dados, e avaliação dos mesmos não efectue o pagamento da encomenda, para o caso de surgir algum erro no registo do domínio.');
	if (!confirma){
		return false;
	}else{
		mostraCondicoes();
	}
}

//funcao para alternar os separadores do custom
function alternaConteudosLYDC(){
	var cv=document.getElementById('ydc_c').style.visibility;
	var cd=document.getElementById('ydc_c').style.display;
	var fv=document.getElementById('ydc_f').style.visibility;
	var fd=document.getElementById('ydc_f').style.display;
	var ncv=(cv=="visible") ? "hidden" : "visible";
	var ncd=(cd=="none") ? "block" : "none";
	var nfv=(fv=="visible") ? "hidden" : "visible";
	var nfd=(fd=="none") ? "block" : "none";
	document.getElementById('ydc_c').style.visibility=ncv;
	document.getElementById('ydc_c').style.display=ncd;
	document.getElementById('ydc_f').style.visibility=nfv;
	document.getElementById('ydc_f').style.display=nfd;
}

//funcao para esconder a layer do standard
function hideLYDS(){
	document.getElementById('popupS').style.visibility="hidden";
	document.getElementById('popupS').style.display="none";
}

//funcao para esconder a leyer do custom
function hideLYDC(){
	document.getElementById('popupC').style.visibility="hidden";
	document.getElementById('popupC').style.display="none";
}

//mostra  layer YDC
function showYDC(){
	hideLYDS(); 
	popup_show('popupC', 'popup_drag2', '', 'screen-center', 10, 10);
	return false;
}

//mostra layer YDS
function showYDS(){
	hideLYDC(); 
	popup_show('popupS', 'popup_drag', '', 'screen-center', 10, 10);
	return false;
}

//funcoes especificas para o simulador (custom)
//espaco extra (custom)
function hd(val){
	newval=parseInt(document.getElementById('hdValor').value);
	newval=newval+val;
	if (newval>=0){
		document.getElementById('hdValor').value=newval;
		writeToDiv('hdc2', parseInt(document.getElementById('hdValor').value));	
		writeToDiv('hdc', parseInt(document.getElementById('hdValor').value)+400);			
	}
	updateResultado();
}

//emails extras (custom)
function email(val){
	if (val==-1 && document.getElementById('emailValor').value=='Ilimitados'){
		document.getElementById('emailValor').value=11;
		email(-1);
	}else{
		newval=parseInt(document.getElementById('emailValor').value);
		newval=newval+val;
		if (newval>10){
			document.getElementById('emailValor').value='Ilimitados';		
			writeToDiv('ec', 'Ilimitados');
			writeToDiv('ec2', 'Ilimitados');
		}else if (newval>=0){
			document.getElementById('emailValor').value=newval;
			writeToDiv('ec2', parseInt(document.getElementById('emailValor').value));
			writeToDiv('ec', parseInt(document.getElementById('emailValor').value)+10);
		}
	}
	updateResultado();
}	

//funcao para escolher todas as terminacoes na pesquisa de dominios
function checkTodos(){
	if (document.getElementById('dotTodos').checked){
		document.getElementById('dotCom').checked=true;
		document.getElementById('dotOrg').checked=true;
		document.getElementById('dotNet').checked=true;
		document.getElementById('dotPt').checked=true;
		document.getElementById('dotComPt').checked=true;
		document.getElementById('dotEu').checked=true;
		document.getElementById('dotInfo').checked=true;
	}else{
		document.getElementById('dotCom').checked=false;
		document.getElementById('dotOrg').checked=false;
		document.getElementById('dotNet').checked=false;
		document.getElementById('dotPt').checked=false;
		document.getElementById('dotComPt').checked=false;
		document.getElementById('dotEu').checked=false;
		document.getElementById('dotInfo').checked=false;
	}
}
//bases de dados extra (custom)
function bd(val){
	newval=parseInt(document.getElementById('bdValor').value);
	newval=newval+val;
	if (newval>=0){
		document.getElementById('bdValor').value=newval;
		writeToDiv('bdc2', parseInt(document.getElementById('bdValor').value));
		writeToDiv('bdc', parseInt(document.getElementById('bdValor').value)+1);
	}
	updateResultado();
}	

//actualiza o resultado (custom)
function updateResultado(){
	var valorBase=96.00;
	var custoHd=1.00;
	var custoEmail=0.20;
	var custoBd=5.00;
	var valorHd=(document.getElementById('hdValor').value*custoHd)/100;
	if(document.getElementById('emailValor').value=='Ilimitados'){
		var valorEmail=3.00;
	}else{
		var valorEmail=document.getElementById('emailValor').value*custoEmail;
	}
	var valorBd=document.getElementById('bdValor').value*custoBd;
	var valorTotal=valorBase+(valorHd*12)+(valorEmail*12)+(valorBd*12);
	document.getElementById('valorTotal').value=valorTotal;
	var valorMensal=valorTotal/12;
	var id='resultado';
	var text='<table width=100% cellpadding=0 cellspacing=0><tr><td width=120>&nbsp;</td>'
	+'<td width=80 class=conf_3 height=20 align=center><b>'
	+formatCurrency(valorTotal)+'</b></td><td width=130>&nbsp;</td><td class=conf_3 align=center><b>'
	+formatCurrency(valorMensal)+'</b></td></tr></table>';
	
	text+='<table width=100% cellpadding=0 cellspacing=0>';
	if (valorTotal>=600){
		text+='<tr><td width=20% align=center height=60><span class=conf_3>Mensal</span><br><span class=conf_4>'
		+formatCurrency(valorTotal/12)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Mensal /></td>';
		text+='<td width=20% align=center><span class=conf_3>Trimestral</span><br><span class=conf_4>'
		+formatCurrency(valorTotal/4)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Trimestral /></td>';
		text+='<td width=20% align=center><span class=conf_3>Semestral</span><br><span class=conf_4>'
		+formatCurrency(valorTotal/2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Semestral /></td>';
		text+='<td width=20% align=center><span class=conf_3>Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Anual checked /></td>';
		text+='<td width=20% align=center><span class=conf_3>Bi-Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal*2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Bi-Anual /></td></tr>';
	}else if (valorTotal>=200){
		text+='<tr><td width=25% align=center height=60><span class=conf_3>Trimestral</span><br><span class=conf_4>'
		+formatCurrency(valorTotal/4)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Trimestral /></td>';
		text+='<td width=25% align=center><span class=conf_3>Semestral</span><br><span class=conf_4>'
		+formatCurrency(valorTotal/2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Semestral /></td>';
		text+='<td width=25% align=center><span class=conf_3>Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Anual checked /></td>';
		text+='<td width=25% align=center><span class=conf_3>Bi-Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal*2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Bi-Anual /></td></tr>';
	}else if (valorTotal>=100){
		text+='<tr><td width=33% align=center height=60><span class=conf_3>Semestral</span><br><span class=conf_4>'
		+formatCurrency(valorTotal/2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Semestral /></td>';
		text+='<td width=33% align=center><span class=conf_3>Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Anual checked /></td>';
		text+='<td width=33% align=center><span class=conf_3>Bi-Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal*2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Bi-Anual /></td></tr>';
	}else if (valorTotal>=50){
		text+='<tr><td width=50% align=center height=60><span class=conf_3>Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Anual checked /></td>';
		text+='<td width=50% align=center><span class=conf_3>Bi-Anual</span><br><span class=conf_4>'
		+formatCurrency(valorTotal*2)+'</span><br><input onclick=document.getElementById(\'valor_periodicidade_c\').value=this.value; type=radio name=periodicidade value=Bi-Anual /></td></tr>';
	}
	text+='</table>';
	writeToDiv(id, text);
	
	writeToDiv('bdc', parseInt(document.getElementById('bdValor').value)+1);
	writeToDiv('bdc2', parseInt(document.getElementById('bdValor').value));
	document.getElementById('bdValorT').value=parseInt(document.getElementById('bdValor').value)+1;
	
	if (document.getElementById('emailValor').value=='Ilimitados'){
		writeToDiv('ec', 'Ilimitados');
		writeToDiv('ec2', 'Ilimitados');
		document.getElementById('emailValorT').value='Ilimitados';
	}else{
		writeToDiv('ec', parseInt(document.getElementById('emailValor').value)+10);
		writeToDiv('ec2', parseInt(document.getElementById('emailValor').value));
		document.getElementById('emailValorT').value=parseInt(document.getElementById('emailValor').value)+10;
	}
	writeToDiv('hdc', parseInt(document.getElementById('hdValor').value)+400);			
	writeToDiv('hdc2', parseInt(document.getElementById('hdValor').value));			
	document.getElementById('hdValorT').value=parseInt(document.getElementById('hdValor').value)+400;
}

//funcao para escrever o conteudo relativo a cada opcao do "tem dominio registado" (custom)
function checkTemDominioCustom(){
	td=document.getElementById('temDominioCustom');
	if (td.options[td.options.selectedIndex].value==0){
		writeToDiv('YDC_dominio', 'Deve proceder ao registo de um domínio antes continuar com o processo de registo do alojamento. Para esse efeito, sirva-se do <b>formulário de pesquisa de domínios livres</b> na página inicial do site do YDS.PT.');
	}else if (td.options[td.options.selectedIndex].value==1){
		writeToDiv('YDC_dominio', '<span class=conf_3>Escolha um dos domínios da encomenda actual:</span><br>'+cart_c);
	}else if (td.options[td.options.selectedIndex].value==2){
		writeToDiv('YDC_dominio', '<span class=conf_3>Introduza o nome de domínio para este alojamento:</span><br><span class=conf_4>http://www.&nbsp;</span><input type=text size=40 name=dominio_url_C id=dominio_url_C>');
	}else if (td.options[td.options.selectedIndex].value==''){
		writeToDiv('YDC_dominio', '');
	}else{
	}
}

//funcao para escrever o conteudo relativo a cada opcao do "tem dominio registado" (standard)
function checkTemDominioStandard(){
	td=document.getElementById('temDominioStandard');
	if (td.options[td.options.selectedIndex].value==0){
		writeToDiv('YDS_dominio', 'Deve proceder ao registo de um domínio antes continuar com o processo de registo do alojamento. Para esse efeito, sirva-se do <b>formulário de pesquisa de domínios livres</b> na página inicial do site do YDS.PT.');
	}else if (td.options[td.options.selectedIndex].value==1){
		writeToDiv('YDS_dominio', '<span class=conf_6>Escolha um dos domínios da encomenda actual:</span><br>'+cart_s);
	}else if (td.options[td.options.selectedIndex].value==2){
		writeToDiv('YDS_dominio', '<span class=conf_6>Introduza o nome de domínio para este alojamento:</span><br><span class=conf_4>http://www.&nbsp;</span><input type=text size=40 name=dominio_url_S id=dominio_url_S>');
	}else{
	}
}

//funcao para validar o YDC
function validateYDC(){
	var errors=false;
	var ts=document.getElementById('temDominioCustom');
	if (ts.options[ts.options.selectedIndex].value==0 || ts.options[ts.options.selectedIndex].value==''){
		errors=true;
	}else{
		if (ts.options[ts.options.selectedIndex].value==1){
			var ds=document.getElementById('dominio_url_c');
			if (ds){
				if (ds.options[ds.options.selectedIndex].value==''){
					errors=true;
				}
			}else{
				errors=true;
			}
		}else if (ts.options[ts.options.selectedIndex].value==2){
			if (!isURL("http://www."+document.getElementById('dominio_url_C').value)){
				errors=true;
			}
		}
	}
	if (errors==false){
		addYDC();
	}else{
		alert('Foram encontrados erros ao adicionar YDCustom.');
	}	
}

//funcao para validar o YDS
function validateYDS(){
	var errors=false;
	var ts=document.getElementById('temDominioStandard');
	if (ts.options[ts.options.selectedIndex].value==0 || ts.options[ts.options.selectedIndex].value==''){
		errors=true;
	}else{
		if (ts.options[ts.options.selectedIndex].value==1){
			var ds=document.getElementById('dominio_url_s');
			if (ds){
				if (ds.options[ds.options.selectedIndex].value==''){
					errors=true;
				}
			}else{
				errors=true;
			}
		}else if (ts.options[ts.options.selectedIndex].value==2){
			if (!isURL("http://www."+document.getElementById('dominio_url_S').value)){
				errors=true;
			}
		}
	}
	if (errors==false){
		addYDS();
	}else{
		alert('Foram encontrados erros ao adicionar YDStandard.');
	}
}

//funcao para adicionar YDcustom (dados) ao formulario de submissão de alojamento (para adicionar ao carrinho)
function addYDC(){
	//definicoes de standard
	vMensal=document.getElementById('valorTotal').value/12;
	vTrimestral=document.getElementById('valorTotal').value/4;
	vSemestral=document.getElementById('valorTotal').value/2;
	vAnual=document.getElementById('valorTotal').value;
	vBiAnual=document.getElementById('valorTotal').value*2;
	//tipo de alojamento (standard)
	document.adicionarAlojamentoForm._vTipo.value='YDC';
	//tipo de registo
	var tr=document.getElementById('tipoRegistoC');
	document.adicionarAlojamentoForm._vTipoRegisto.value=tr.options[tr.options.selectedIndex].value;
	//dominio
	var td=document.getElementById('temDominioCustom');
	if (td.options[td.options.selectedIndex].value==1){
		ds=document.getElementById('dominio_url_c');
		document.adicionarAlojamentoForm._urlDominio.value=ds.options[ds.options.selectedIndex].text;
	}else if (td.options[td.options.selectedIndex].value==2){
		document.adicionarAlojamentoForm._urlDominio.value=document.getElementById('dominio_url_C').value;
	}
	//tem dominio?
	document.adicionarAlojamentoForm._vTemDominio.value=td.options[td.options.selectedIndex].value;
	//extras
	//hd
	document.adicionarAlojamentoForm._hd.value=document.getElementById('hdValorT').value;
	//email
	document.adicionarAlojamentoForm._email.value=document.getElementById('emailValorT').value;
	//bd
	document.adicionarAlojamentoForm._bd.value=document.getElementById('bdValorT').value;
	//periodicidades
	document.adicionarAlojamentoForm._periodicidade.value=document.getElementById('valor_periodicidade_c').value;
	//mensal
	document.adicionarAlojamentoForm._vMensal.value=vMensal;
	//trimestral
	document.adicionarAlojamentoForm._vTrimestral.value=vTrimestral;
	//semestral
	document.adicionarAlojamentoForm._vSemestral.value=vSemestral;
	//anual
	document.adicionarAlojamentoForm._vAnual.value=vAnual;
	//bianual
	document.adicionarAlojamentoForm._vBiAnual.value=vBiAnual;
	document.adicionarAlojamentoForm.submit();
}

//funcao para adicionar YDstandard (dados) ao formulario de submissão de alojamento (para adicionar ao carrinho)
function addYDS(){
	//definicoes de standard
	vMensal=5;
	vTrimestral=15;
	vSemestral=30;
	vAnual=60;
	vBiAnual=120;
	//tipo de alojamento (standard)
	document.adicionarAlojamentoForm._vTipo.value='YDS';
	//tipo de registo
	var tr=document.getElementById('tipoRegistoS');
	document.adicionarAlojamentoForm._vTipoRegisto.value=tr.options[tr.options.selectedIndex].value;
	//dominio
	var td=document.getElementById('temDominioStandard');
	if (td.options[td.options.selectedIndex].value==1){
		ds=document.getElementById('dominio_url_s');
		document.adicionarAlojamentoForm._urlDominio.value=ds.options[ds.options.selectedIndex].text;
	}else if (td.options[td.options.selectedIndex].value==2){
		document.adicionarAlojamentoForm._urlDominio.value=document.getElementById('dominio_url_S').value;
	}
	//tem dominio?
	document.adicionarAlojamentoForm._vTemDominio.value=td.options[td.options.selectedIndex].value;
	//extras
	//hd
	document.adicionarAlojamentoForm._hd.value=200;
	//email
	document.adicionarAlojamentoForm._email.value=10;
	//bd
	document.adicionarAlojamentoForm._bd.value=1;
	//periodicidades
	document.adicionarAlojamentoForm._periodicidade.value=document.getElementById('valor_periodicidade_s').value;
	//mensal
	document.adicionarAlojamentoForm._vMensal.value=vMensal;
	//trimestral
	document.adicionarAlojamentoForm._vTrimestral.value=vTrimestral;
	//semestral
	document.adicionarAlojamentoForm._vSemestral.value=vSemestral;
	//anual
	document.adicionarAlojamentoForm._vAnual.value=vAnual;
	//bianual
	document.adicionarAlojamentoForm._vBiAnual.value=vBiAnual;
	document.adicionarAlojamentoForm.submit();
}

//actualiza a duracao de renovacao de um dominio
function updateDuracao(domain){
	duracao=domain.options[domain.options.selectedIndex].value;
	id=domain.name;
	document.actualizarDuracaoDominioForm._idDominio.value=id;
	document.actualizarDuracaoDominioForm._duracaoDominio.value=duracao;	
	document.actualizarDuracaoDominioForm.submit();	
}

//actualiza o form que envia os id's dos elementos do cart a remover
function updateActualizaEncomendaForm(){
	var total=document.getElementById('_domainListCount').value;
	//alert(total);
	var string='';
	for (c=0; c<total; c++){
		if (document.getElementById('item_'+c).checked){
			string+=document.getElementById('item_'+c).value+',';
		}
	}
	document.getElementById('_listaDominiosRemover').value=string;
	//alert(document.getElementById('_listaDominiosRemover').value);
	if (document.getElementById('_listaDominiosRemover').value!=''){
		document.actualizarEncomendaForm.submit();
	}
}

//funcao para a caixa de login superior
function loginTop(){
	document.loginForm1._email.value=document.getElementById('topEmail').value;
	document.loginForm1._password.value=document.getElementById('topPassword').value;
	document.loginForm1.submit();
}

//funcao para a caixa de login central
function loginBox(){
	document.loginForm1._email.value=document.getElementById('boxEmail').value;
	document.loginForm1._password.value=document.getElementById('boxPassword').value;
	document.loginForm1.submit();
}

//funcao para o logout
function logout(){
	document.logoutForm.submit();
}

//funcao para o registo
function registarUser(){
	var regErrors=false;
	if (document.getElementById('regPassword').value!=document.getElementById('regPasswordC').value || IsEmpty(document.getElementById('regPassword'))){
		regErrors=true;
		alert('Password inválida ou as passwords introduzidas não coincidem!');
	}
	if (!regErrors){
		var regForm=document.registarUtilizadorForm;
		regForm._regEmail.value=document.getElementById('regEmail').value;
		regForm._regPassword.value=document.getElementById('regPassword').value;
		regForm._regNome.value=document.getElementById('regNome').value;
		regForm._regMorada.value=document.getElementById('regMorada').value;
		regForm._regCpostal.value=document.getElementById('regCp1').value+'-'+document.getElementById('regCp2').value;
		regForm._regLocalidade.value=document.getElementById('regLocalidade').value;
		var regConcelho=document.getElementById('regConcelho');
		regForm._regConcelho.value=regConcelho.options[regConcelho.options.selectedIndex].value;		
		regForm._regNif.value=document.getElementById('regNif').value;
		regForm._regTelefone.value=document.getElementById('regTelefone').value;
		regForm._regFax.value=document.getElementById('regFax').value;
		regForm._regTelemovel.value=document.getElementById('regTelemovel').value;
		regForm._regEmpresa.value=document.getElementById('regEmpresa').value;
		var regTipo=document.getElementById('regTipo');
		regForm._regTipo.value=regTipo.options[regTipo.options.selectedIndex].value;
		//alert('Cliente registado com sucesso. Receberá dentro de instantes uma confirmação do registo por e-mail.\nSerá agora redireccionado para a página inicial, já logado no site, de forma a poder continuar a sua encomenda.');		
		document.registarUtilizadorForm.submit();
		//alert('ok');
	}
}

//funcao para limpar os dados das caixas do formulario de registo de user
function limparUser(){
	document.getElementById('regEmail').value='';
	document.getElementById('regPassword').value='';
	document.getElementById('regPasswordC').value='';
	document.getElementById('regNome').value='';
	document.getElementById('regMorada').value='';
	document.getElementById('regCp1').value='';
	document.getElementById('regCp2').value='';
	document.getElementById('regLocalidade').value='';
	var regConcelho=document.getElementById('regConcelho');
	regConcelho.options.selectedIndex=0;
	document.getElementById('regNif').value='';
	document.getElementById('regTelefone').value='';
	document.getElementById('regFax').value='';
	document.getElementById('regTelemovel').value='';
	document.getElementById('regEmpresa').value='';
	var regTipo=document.getElementById('regTipo');
	regTipo.options.selectedIndex=0;		
}

//funcao para alterar os dados do utilizador (area reservada)
function alterarUser(){
	var regErrors=false;
	if (document.getElementById('resPassword').value!=document.getElementById('resPasswordC').value){
		regErrors=true;
		alert('Password inválida ou as passwords introduzidas não coincidem!');
	}
	if (!regErrors){
		var resForm=document.alterarUtilizadorForm;
		resForm._resEmail.value=document.getElementById('resEmail').value;
		resForm._resPassword.value=document.getElementById('resPassword').value;
		resForm._resNome.value=document.getElementById('resNome').value;
		resForm._resMorada.value=document.getElementById('resMorada').value;
		resForm._resCpostal.value=document.getElementById('resCp1').value+'-'+document.getElementById('resCp2').value;
		resForm._resLocalidade.value=document.getElementById('resLocalidade').value;
		var resConcelho=document.getElementById('resConcelho');
		resForm._resConcelho.value=resConcelho.options[resConcelho.options.selectedIndex].value;		
		resForm._resNif.value=document.getElementById('resNif').value;
		resForm._resTelefone.value=document.getElementById('resTelefone').value;
		resForm._resFax.value=document.getElementById('resFax').value;
		resForm._resTelemovel.value=document.getElementById('resTelemovel').value;
		resForm._resEmpresa.value=document.getElementById('resEmpresa').value;
		var resTipo=document.getElementById('resTipo');
		resForm._resTipo.value=resTipo.options[resTipo.options.selectedIndex].value;
		//alert('Cliente registado com sucesso. Receberá dentro de instantes uma confirmação do registo por e-mail.\nSerá agora redireccionado para a página inicial, já logado no site, de forma a poder continuar a sua encomenda.');		
		document.alterarUtilizadorForm.submit();
		//alert('ok');
	}
}

//funcao para carregar o formulario de recuperar a pass e submeter o mesmo
function recuperarPassword(){
	document.recuperarPasswordForm._email.value=document.getElementById('recuperarEmail').value;
	document.recuperarPasswordForm.submit();
}

//funcao para detectar o enter na caixa de login do topo
function handleEnterLoginTop(event) {
 var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
 if (keyCode == 13) {
	 loginTop();
 }
}

//funcao para detectar o enter na caixa de login da pagina
function handleEnterLoginBox(event) {
 var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
 if (keyCode == 13) {
	 loginBox();
 }
}

//funcao para finalizar definitivamente a encomenda
function finalizarEncomenda(){
	document.finalizarEncomendaForm._passo.value=3;
	document.finalizarEncomendaForm.submit();
}

//toggleVis - funcao para laternar a visibilidade de um id
function toggleVis(id){
	var cv=document.getElementById(id).style.visibility;
	var cd=document.getElementById(id).style.display;
	var ncv=(cv=="visible") ? "hidden" : "visible";
	var ncd=(cd=="none") ? "block" : "none";
	document.getElementById(id).style.visibility=ncv;
	document.getElementById(id).style.display=ncd;
}

//mostra a layer das condicoes
function mostraCondicoes(){
	hideLYDS();
	hideLYDC();
	popup_show('condi', 'popup_drag3', '', 'screen-center', 10, 10);
	//document.condi.style.visibility='visible';
	//document.condi.style.display='block';	
}

//esconde a layer das condicoes
function esconderCondicoes(){
	document.getElementById('condi').style.visibility='hidden';
	document.getElementById('condi').style.display='none';	
}

//funcao para preencher o formulario de pagar a encomenda
function pagarEncomenda(numero, total, data){
	document.pagarEncomendaForm._numeroEncomenda.value=numero;
	document.pagarEncomendaForm._totalEncomenda.value=total;
	document.pagarEncomendaForm._dataEncomenda.value=data;
	document.pagarEncomendaForm.submit();			
}

//funcao para preencher o formulario de anular a encomenda
function anularEncomenda(numero){
	document.anularEncomendaForm._numeroEncomenda.value=numero;
	document.anularEncomendaForm.submit();			
}

//inicializacao de cenas para o onload do body da main page
function ydInit(){
	//inicializamos o motor do simulador
	updateResultado();
	//ocultamos ambas as layers do YDC e YDS
	hideLYDS();
	hideLYDC();
	document.getElementById('ydClickS').onclick=showYDS;
	document.getElementById('ydClickC').onclick=showYDC;
	document.getElementById('ydClickSim').onclick=showYDC;
	//loadImages();
	//consoante as variaveis atribuidas no topo da pagina $_GET mostramos ou nao as layers do YDS e YDC
}

//funcoes relativas ao formulario de transferencia de dominios / alojamentos
//limpar o formulario
function limparEncTransf(){
	document.formEncomendarTransf.reset()
}

//funcao para enviar o formulario de transferencias de dominio / alojamento
function enviarEncTransf(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var dominio=document.getElementById('dominio');
	var gestor=document.getElementById('gestor');
	var responsavel=document.getElementById('responsavel');
	var morada=document.getElementById('morada');
	var cp1=document.getElementById('cp1');
	var cp2=document.getElementById('cp2');
	var localidade=document.getElementById('localidade');
	var nif=document.getElementById('nif');
	var email=document.getElementById('email');
	var telefone=document.getElementById('telefone');
	var fax=document.getElementById('fax');
	var observacoes=document.getElementById('observacoes');

	if (IsEmpty(dominio)){
		errorsText+="- Domínio com falta;\n";
		errors=true;
	}	

	if (IsEmpty(gestor)){
		errorsText+="- Entidade gestora em falta;\n";
		errors=true;
	}	

	if (IsEmpty(responsavel)){
		errorsText+="- Nome do responsável em falta;\n";
		errors=true;
	}	

	if (IsEmpty(morada)){
		errorsText+="- Morada em falta;\n";
		errors=true;
	}	

	if (IsEmpty(cp1) || IsEmpty(cp2)){
		errorsText+="- Código postal inválido ou em falta;\n";
		errors=true;
	}	

	if (IsEmpty(localidade)){
		errorsText+="- Localidade em falta;\n";
		errors=true;
	}	

	if (IsEmpty(nif)){
		errorsText+="- Número de contribuinte em falta;\n";
		errors=true;
	}	

	if (IsEmpty(telefone)){
		errorsText+="- Telefone em falta;\n";
		errors=true;
	}	
	
	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}
	
	if (!errors){
		document.formEncomendarTransf.send.value=1;
		document.formEncomendarTransf.submit();
	}else{
		alert(errorsText);
	}	
}

//contactos related
//limpar o formulario da provedoria do cliente
function limparProvedoria(){
	document.provedoriaForm.reset();
}

//limpar o formulario dos parceiros
function limparParceiros(){
	document.parceirosForm.reset();
}

//limpar o formulario do recrutamento
function limparRecrutamento(){
	document.recrutamentoForm.reset();
}

//limpar o formulario da informacao geral
function limparInfoGeral(){
	document.infoGeralForm.reset();
}

//enviar o formulario da provedoria do cliente
function enviarProvedoria(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var nome=document.getElementById('nome');
	var email=document.getElementById('email');
	var mensagem=document.getElementById('mensagem');
	var telefone=document.getElementById('telefone');
	var hentre=document.getElementById('hentre');
	var hentre2=document.getElementById('hentre2');
	var rec_produto=document.getElementById('rec_produto');
	var rec_quando=document.getElementById('rec_quando');

	if (IsEmpty(rec_quando)){
		errorsText+="- Data da ocorrência em falta;\n";
		errors=true;
	}

	if (IsEmpty(rec_produto)){
		errorsText+="- Nome do produto/serviço em falta;\n";
		errors=true;
	}

	if (IsEmpty(hentre) || IsEmpty(hentre2)){
		errorsText+="- Horário preferencial para contacto em falta;\n";
		errors=true;
	}

	if (IsEmpty(telefone)){
		errorsText+="- Número de telefone em falta;\n";
		errors=true;
	}

	if (IsEmpty(mensagem)){
		errorsText+="- Mensagem em falta;\n";
		errors=true;		
	}

	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}
	
	if (IsEmpty(nome)){
		errorsText+="- Nome em falta;\n";
		errors=true;
	}

	if (!errors){
		document.provedoriaForm.submit();
	}else{
		alert(errorsText);
	}
}

//enviar o formulario dos parceiros
function enviarParceiros(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var nome=document.getElementById('nome');
	var empresa=document.getElementById('empresa');
	var contribuinte=document.getElementById('contribuinte');
	var email=document.getElementById('email');
	var telefone=document.getElementById('telefone');
	var fax=document.getElementById('fax');
	var morada=document.getElementById('morada');
	var cp1=document.getElementById('cp1');
	var localidade=document.getElementById('localidade');
	var criacao_dia=document.getElementById('criacao_dia');
	var criacao_mes=document.getElementById('criacao_mes');
	var criacao_ano=document.getElementById('criacao_ano');
	var site_comercial=document.getElementById('site_comercial');
	var dominios_comercial=document.getElementById('dominios_comercial');
	var sites_comercial=document.getElementById('sites_comercial');
	var fornecedores_comercial=document.getElementById('fornecedores_comercial');
	var nome_tecnico=document.getElementById('nome_tecnico');
	var telefone_tecnico=document.getElementById('telefone_tecnico');
	var email_tecnico=document.getElementById('email_tecnico');

	if (!isEmail(email_tecnico.value)){
		errorsText+="- Email técnico inválido ou em falta;\n";
		errors=true;
	}

	if (IsEmpty(telefone_tecnico)){
		errorsText+="- Contacto telefónico do técnico em falta;\n";
		errors=true;
	}

	if (IsEmpty(nome_tecnico)){
		errorsText+="- Nome do técnico em falta;\n";
		errors=true;
	}

	if (IsEmpty(fornecedores_comercial)){
		errorsText+="- Lista de fornecedores em falta;\n";
		errors=true;
	}

	if (IsEmpty(sites_comercial)){
		errorsText+="- Número de sites em falta;\n";
		errors=true;
	}

	if (IsEmpty(dominios_comercial)){
		errorsText+="- Número de domínios em falta;\n";
		errors=true;
	}

	if (IsEmpty(site_comercial)){
		errorsText+="- Endereço do Site da empresa em falta;\n";
		errors=true;
	}

	if (IsEmpty(criacao_dia) || IsEmpty(criacao_mes) || IsEmpty(criacao_ano)){
		errorsText+="- Data de criação da empresa em falta;\n";
		errors=true;
	}

	if (IsEmpty(localidade)){
		errorsText+="- Localidade em falta;\n";
		errors=true;
	}

	if (IsEmpty(cp1)){
		errorsText+="- Código Postal em falta;\n";
		errors=true;
	}

	if (IsEmpty(morada)){
		errorsText+="- Morada em falta;\n";
		errors=true;
	}

	if (IsEmpty(fax)){
		errorsText+="- Número de fax em falta;\n";
		errors=true;
	}

	if (IsEmpty(telefone)){
		errorsText+="- Número de telefone em falta;\n";
		errors=true;
	}
	
	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}

	if (IsEmpty(contribuinte)){
		errorsText+="- Número de contribuinte em falta;\n";
		errors=true;
	}

	if (IsEmpty(empresa)){
		errorsText+="- Empresa em falta;\n";
		errors=true;
	}

	if (IsEmpty(nome)){
		errorsText+="- Nome em falta;\n";
		errors=true;
	}

	if (!errors){
		document.parceirosForm.submit();
	}else{
		alert(errorsText);
	}
}

//enviar o formulario do recrutamento
function enviarRecrutamento(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var nome=document.getElementById('nome');
	var email=document.getElementById('email');
	var mensagem=document.getElementById('mensagem');
	var cv=document.getElementById('cv');
	
	if (IsEmpty(nome)){
		errorsText+="- Nome em falta;\n";
		errors=true;
	}

	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}

	if (IsEmpty(mensagem)){
		errorsText+="- Mensagem em falta;\n";
		errors=true;		
	}

	if (IsEmpty(cv)){
		errorsText+="- CV em falta;\n";
		errors=true;		
	}

	if (!errors){
		document.recrutamentoForm.submit();
	}else{
		alert(errorsText);
	}
}

//enviar o formulario da informacao geral
function enviarInfoGeral(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var nome=document.getElementById('nome');
	var email=document.getElementById('email');
	var mensagem=document.getElementById('mensagem');
	
	if (IsEmpty(nome)){
		errorsText+="- Nome em falta;\n";
		errors=true;
	}

	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}

	if (IsEmpty(mensagem)){
		errorsText+="- Mensagem em falta;\n";
		errors=true;		
	}

	if (!errors){
		document.infoGeralForm.submit();
	}else{
		alert(errorsText);
	}
}

//funcao para limpar o forumlario de orcamento de developing..
function limpaFormOrcDev(){
	document.orc_dev.reset();
}

//funcao para limpar o formulario de orcamento de design
function limpaFormOrcDesign(){
	document.orc_design.reset();
}

//funcao para enviar o orcamento de developing
function enviarFormOrcDev(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var nome=document.getElementById('nome');
	var morada=document.getElementById('morada');
	var cp1=document.getElementById('cp1');
	var cp2=document.getElementById('cp2');
	var localidade=document.getElementById('localidade');
	var telefone=document.getElementById('telefone');
	var fax=document.getElementById('fax');
	var email=document.getElementById('email');
	var observacoes=document.getElementById('descricao');
	
	if (IsEmpty(nome)){
		errorsText+="- Nome em falta;\n";
		errors=true;
	}

	if (IsEmpty(morada)){
		errorsText+="- Morada em falta;\n";
		errors=true;
	}

	if (IsEmpty(cp1) || IsEmpty(cp2)){
		errorsText+="- Código postal incompleto;\n";
		errors=true;
	}

	if (IsEmpty(localidade)){
		errorsText+="- Localidade em falta;\n";
		errors=true;
	}

	if (IsEmpty(telefone)){
		errorsText+="- Telefone em falta;\n";
		errors=true;
	}

	if (IsEmpty(fax)){
		errorsText+="- Fax em falta;\n";
		errors=true;
	}

	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}

	if (IsEmpty(observacoes)){
		errorsText+="- Dados para orçamento em falta;\n";
		errors=true;		
	}

	if (!errors){
		document.orc_dev.submit();
	}else{
		alert(errorsText);
	}
}

//funcao para enviar o orcamento de design
function enviarFormOrcDesign(){
	var errors=false;
	var errorsText="Foram detectados os seguintes erros:\n";
	
	var nome=document.getElementById('nome');
	var morada=document.getElementById('morada');
	var cp1=document.getElementById('cp1');
	var cp2=document.getElementById('cp2');
	var localidade=document.getElementById('localidade');
	var telefone=document.getElementById('telefone');
	var fax=document.getElementById('fax');
	var email=document.getElementById('email');
	var observacoes=document.getElementById('observacoes');
	
	if (IsEmpty(nome)){
		errorsText+="- Nome em falta;\n";
		errors=true;
	}

	if (IsEmpty(morada)){
		errorsText+="- Morada em falta;\n";
		errors=true;
	}

	if (IsEmpty(cp1) || IsEmpty(cp2)){
		errorsText+="- Código postal incompleto;\n";
		errors=true;
	}

	if (IsEmpty(localidade)){
		errorsText+="- Localidade em falta;\n";
		errors=true;
	}

	if (IsEmpty(telefone)){
		errorsText+="- Telefone em falta;\n";
		errors=true;
	}

	if (IsEmpty(fax)){
		errorsText+="- Fax em falta;\n";
		errors=true;
	}

	if (!isEmail(email.value)){
		errorsText+="- Email inválido ou em falta;\n";
		errors=true;		
	}

	if (IsEmpty(observacoes)){
		errorsText+="- Dados para orçamento em falta;\n";
		errors=true;		
	}

	if (!errors){
		document.orc_design.submit();
	}else{
		alert(errorsText);
	}
}

<!-- This script generated free online at -->
<!-- Wilson Information http://www.wilsoninfo.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=640,height=520');");
}
// End -->

/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/
/****************************************************************************************************************/

  

