function RenderTTF()

{

  DATAFUNCS.RenderFonts('h1_c',{ 

   fontSize         : '15',

   backgroundColor  : 'FFFFFF',

   color            : 'D8141E',

   fontFile         : 'fonts/myriadMM700600.TTF',

   transparent      : '1'

  });

  

  DATAFUNCS.RenderFonts('h3_c',{ 

   fontSize         : '10.5',

   backgroundColor  : 'FFFFFF',

   color            : '333333',

   fontFile         : 'fonts/MYRIM400700.TTF',

   transparent      : '1'

  });

  

  DATAFUNCS.RenderFonts('h2_c',{ 

   fontSize         : '12',

   backgroundColor  : 'FFFFFF',

   color            : '333333',

   fontFile         : 'fonts/myriadMM700600.TTF',

   transparent      : '1'

  });

}



function show(id,color, btid) {


  var bt = document.getElementById('bt_1');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_2');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_3');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_4');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_5');
  bt.style.backgroundPosition = '0px 0px';
  
  

  var el = document.getElementById(id);
  var bt = document.getElementById(btid);
  bt.style.zIndex = 999;
  bt.style.backgroundPosition = '0px -30px';
  
  el.style.borderColor = color;


  var xclose = document.getElementsByTagName("div");

  

  for (var i=0; i<xclose.length; i++) {

    if (xclose[i].className == "submenu"){

      xclose[i].style.display = "none";

    }

  }

  

  var trans = document.getElementById("transparencias");

  iHeight = window.document.body.scrollHeight;

  trans.style.height = iHeight;

  trans.style.display = "block";

  

  

  el.style.display = "block";

}



function hide(id) {

  var el = document.getElementById(id);
  
  

  var bt = document.getElementById('bt_1');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_2');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_3');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_4');
  bt.style.backgroundPosition = '0px 0px';

  var bt = document.getElementById('bt_5');
  bt.style.backgroundPosition = '0px 0px';



  el.style.display = (el.style.display=="") ? "none" : "";

  var trans = document.getElementById("transparencias");

  trans.style.display = "none";

  

  var fechaall = document.getElementsByTagName("div")

  for (var i=0; i<fechaall.length; i++) {

    if (fechaall[i].className == "submenu"){

        fechaall[i].style.display = "none";

    }

  }

}







/* Validação de newsletter */

function echeck(str) {

	var at="@"

	var dot="."

	var lat=str.indexOf(at)

	var lstr=str.length

	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1){

	   //alert("Invalid E-mail ID")

	   return false

	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

	   //alert("Invalid E-mail ID")

	   return false

	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

	    //alert("Invalid E-mail ID")

	    return false

	}

	 if (str.indexOf(at,(lat+1))!=-1){

	    //alert("Invalid E-mail ID")

	    return false

	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

	    //alert("Invalid E-mail ID")

	    return false

	 }

	 if (str.indexOf(dot,(lat+2))==-1){

	    //alert("Invalid E-mail ID")

	    return false

	 }

	 if (str.indexOf(" ")!=-1){

	    //alert("Invalid E-mail ID")

	    return false

	 }

	 return true					

}



function getXmlHttpRequest() {

	if (window.XMLHttpRequest) {

		return new XMLHttpRequest();

	} else if (window.ActiveXObject) {

		return new ActiveXObject("Microsoft.XMLHTTP");

	}

}



function newsletter(lang)

{ 

  document.getElementById('nome_erro').style.display='none';

  document.getElementById('email_erro').style.display='none';

  var nome = document.getElementById('news_nome').value;

  var email = document.getElementById('news_email').value;

  var language = lang; 



  if (nome==""){

    document.getElementById('nome_erro').style.display='block';

    document.getElementById('news_nome').focus();

  } else if (email==""){

    document.getElementById('email_erro').style.display='block';

    document.getElementById('news_email').focus();

  } else if (echeck(email)==false){

    document.getElementById('email_erro').style.display='block';

    document.getElementById('news_email').focus();

  } else {

    /*alert ("N->"+nome+" E->"+email);*/

    var url ="gest/add_newsletter.php"; 	

    var post_data="nome="+nome+"&email="+email+"&lang="+language;

    var cmsajaxhttp = getXmlHttpRequest();

   	cmsajaxhttp.open("POST", url+'?'+post_data, true);

    cmsajaxhttp.onreadystatechange = function(){

  		if (cmsajaxhttp.readyState==4){

  			var resultado = cmsajaxhttp.responseText;

        document.getElementById("div_frm_newsl_suc2").innerHTML=resultado;

        document.getElementById('div_frm_newsl').style.display='none';

        document.getElementById('div_frm_newsl_suc').style.display='block';

  		}

  	}

   	cmsajaxhttp.send(null);

 	}

}

/* Validação de newsletter */



function checkform(frm) {

  if (frm==1){

    if(document.getElementById('nome_cartao').value == "") { 

      alert("Preencha o nome!");

      document.getElementById('nome_cartao').focus();

      return  false;

    } else if(document.getElementById('nif_cartao').value == "") { 

      alert("Preencha o NIF!");

      document.getElementById('nif_cartao').focus();

      return  false;

    } else if(document.getElementById('nomec_cartao').value == "") { 

      alert("Preencha o nome para o cartão!");

      document.getElementById('nomec_cartao').focus();

      return  false;

    } else if(document.getElementById('telem_cartao').value == "") { 

      alert("Preencha o telemóvel!");

      document.getElementById('telem_cartao').focus();

      return  false;

    } else if(document.getElementById('email_cartao').value == "") { 

      alert("Preencha o email!");

      document.getElementById('email_cartao').focus();

      return  false;

    } else if (echeck(document.getElementById('email_cartao').value)==false){

      alert("Email inválido!");

      document.getElementById('email_cartao').focus();

      return  false;

    } else if(document.getElementById('bi_cartao').value == "") { 

      alert("Preencha o Nº de BI!");

      document.getElementById('bi_cartao').focus();

      return  false;

    } else if(document.getElementById('telef_cartao').value == "") { 

      alert("Preencha o telefone fixo!");

      document.getElementById('telef_cartao').focus();

      return  false;

    } else {

      return true;

    }

  } else if (frm==2){

    if(document.getElementById('morada_cartao').value == "") { 

      alert("Preencha a morada!");

      document.getElementById('morada_cartao').focus();

      return  false;

    } else if(document.getElementById('cp1_cartao').value == "") { 

      alert("Preencha o código postal correctamente!");

      document.getElementById('cp1_cartao').focus();

      return  false;

    } else if(document.getElementById('cp2_cartao').value == "") { 

      alert("Preencha o código postal correctamente!");

      document.getElementById('cp2_cartao').focus();

      return  false;

    } else if(document.getElementById('localidade_cartao').value == "") { 

      alert("Preencha a localidade!");

      document.getElementById('localidade_cartao').focus();

      return  false;

    } else if(document.getElementById('telef2_cartao').value == "") { 

      alert("Preencha o telefone!");

      document.getElementById('telef2_cartao').focus();

      return  false;  

    } else {

      return true;

    }

  } else if (frm==3){

    if(document.getElementById('banco_cartao').value == "") { 

      alert("Preencha o banco!");

      document.getElementById('banco_cartao').focus();

      return  false;

    } else if(document.getElementById('agencia_cartao').value == "") { 

      alert("Preencha a agência!");

      document.getElementById('agencia_cartao').focus();

      return  false;

    } else if(document.getElementById('ncont_cartao').value == "") { 

      alert("Preencha o número de conta!");

      document.getElementById('ncont_cartao').focus();

      return  false;

    } else if(document.getElementById('nib_cartao').value == "") { 

      alert("Preencha o NIB!");

      document.getElementById('nib_cartao').focus();

      return  false;

    } else {

      return true;

    }

  }

}





