

var filhos;
var dvs;
function RenderTTF()
    {
    
    //dvs = document.getElementsByTagName("div");
		
    dvs = document.getElementsByTagName("*");
    dvs2 = dvs;
    lis = document.getElementsByTagName("li");
    	
		for(i = 0; i <dvs.length; i++){
		
		    if(dvs[i].className == 'txt_rubricas'){
				
					filhos = dvs[i].childNodes;
		    }
    }
		
    for(i = 0; i <dvs2.length; i++){
		
		    if(dvs2[i].className == 'txt_noticias'){
				
					var filhos2 = dvs2[i].childNodes;
		    }
    }
    
    for(i = 0; i < lis.length; i++){
		
		    if( lis[i].className == ''){
				
					var filhos3=  lis[i].childNodes;
		    }
    }	
    	
      // se exitirem elementos filho
			if(filhos!=null){
			   for(i = 0; i <filhos.length; i++){
					
              if(filhos[i].tagName=="H1"){
          
                if(filhos[i].className==""){
                  
                  filhos[i].className="tituloH1gest";
                }
              }
              
               if(filhos[i].tagName=="H2"){
                
                 if(filhos[i].className==""){
                  
                  filhos[i].className="tituloH2gest";
                 }
              }
              
              
              
        }
			
     }
     
     // se exitirem elementos filho
			if(filhos2!=null){
			   for(i = 0; i <filhos2.length; i++){
					
              if(filhos2[i].tagName=="H1"){
                
                if(filhos2[i].className==""){
                    filhos2[i].className="tituloH1gest";
                }
              }
              
               if(filhos2[i].tagName=="H2"){
                
                if(filhos2[i].className==""){
                  filhos2[i].className="tituloH2gest";
                }
          
              }
        }
			
     }
     
     // se exitirem elementos filho
			if(filhos3!=null){
			   for(i = 0; i <filhos3.length; i++){
					
              if(filhos3[i].tagName=="H1"){
                
                if(filhos3[i].className==""){
                    filhos3[i].className="tituloH1gest";
                }
              }
              
               if(filhos3[i].tagName=="H2"){
                
                if(filhos3[i].className==""){
                  filhos3[i].className="tituloH2gest";
                }
          
              }
        }
			
     }
    
    DATAFUNCS.RenderFonts('tituloH1',{ 
       fontSize         : '21',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });

    DATAFUNCS.RenderFonts('tituloH2',{ 
        fontSize         : '10.5',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });
    
     DATAFUNCS.RenderFonts('tituloH2_news',{ 
        fontSize         : '13.5',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });
    
   /*DATAFUNCS.RenderFonts('titulo_Ref',{ 
        fontSize         : '21',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntelMedium.ttf',
       transparent      : '1'
    });*/
    
    DATAFUNCS.RenderFonts('tituloH1gest',{ 
       fontSize         : '21',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('tituloH2gest',{ 
        fontSize         : '10.5',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });
    
  }      
     

function RenderTTFpais()
    {
    
   DATAFUNCS.RenderFonts('tituloH2pais',{ 
        fontSize         : '10.5',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });
    
  }      
     
    


function load() {
      map = new GMap2(document.getElementById("map"));
  map.setCenter(new GLatLng(39.425652,-8.97568), 13);
  map.addControl(new GSmallMapControl);
  //GEvent.addListener(map, "click", getAddress);
  geocoder = new GClientGeocoder();
  point = new GLatLng(39.425652,-8.97568);
  
  var blueIcon = new GIcon(G_DEFAULT_ICON);
  blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
  blueIcon.iconSize = new GSize(30,30);
              
  

  
  //marker = new GMarker(point,{draggable: true,icon:blueIcon});
  marker = new GMarker(point,{icon:blueIcon});
  
  //GEvent.addListener(marker, "dragstart", function() {
  //map.closeInfoWindow();
  //});

  //GEvent.addListener(map, "dragend",getAddress);

  
  map.addOverlay(marker);
    }
    
    function getAddress(overlay, latlng) {
   
    if (latlng != null) {
      address = latlng;
      geocoder.getLocations(latlng, showAddress);
    }
}

function showAddress(response) {
  map.clearOverlays();
  if (!response || response.Status.code != 200) {
    alert("Status Code:" + response.Status.code);
  } else {
    place = response.Placemark[0];
    point = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
    marker = new GMarker(point);
    map.addOverlay(marker);
    marker.openInfoWindowHtml(
        //'<b>orig latlng:</b>' + response.name + '<br/>' + 
        //'<b>latlng:</b>' + place.Point.coordinates[0] + "," + place.Point.coordinates[1] + '<br>' +
       
        '<br><b>'+msg_map+'</b>:' + place.address + '<br>'
        
        //'<b>Country code:</b> ' + place.AddressDetails.Country.CountryNameCode
        );
  }
}

    //]]>

function mn_hover(id) {
	var menu = document.getElementById(id);
	menu.className = menu.className + '_hover';
}

function mn_out(id) {
	var menu = document.getElementById(id);
	menu.className = menu.className.replace('_hover','');
}

function maisinfo_hover(id) {
	var img = document.getElementById('bullet_'+id);
	img.src = img.src.replace('.gif','_hover.gif');
}

function maisinfo_out(id) {
	var img = document.getElementById('bullet_'+id);
	img.src = img.src.replace('_hover.gif','.gif');
}

function mn_submn_mostra(id) {
	var dtn = document.getElementsByTagName('div');
	var dtn_length = dtn.length;
	for(i = 0; i < dtn_length; i++){
		if(dtn[i].className == 'submn_div_mostra'){
			dtn[i].className = 'submn_div_esconde';
		}
	}
	var menu = document.getElementById(id);
	menu.className = menu.className.replace('_esconde','_mostra');
}

function mn_submn_esconde(id) {
	var dtn = document.getElementsByTagName('div');
	var dtn_length = dtn.length;
	for(i = 0; i < dtn.length; i++){
		if(dtn[i].className == 'submn_div_mostra'){
			dtn[i].className = 'submn_div_esconde';
		}
	}
}

function produtos_numeracao_hover(id) {
	var produto = document.getElementById(id);
	var produto_div = document.getElementById(id+'_div');
	produto.className = produto.className + '_hover';
	produto_div.className = produto_div.className + '_hover';
}

function produtos_numeracao_out(id) {
	var produto = document.getElementById(id);
	var produto_div = document.getElementById(id+'_div');
	produto.className = produto.className.replace('_hover','');
	produto_div.className = produto_div.className.replace('_hover','');
}

function produtos_maisinfo_hover(id) {
	var produto = document.getElementById(id+'_cmd');
	var produto_div = document.getElementById(id+'_div');
	produto.src = produto.src.replace('.jpg','_hover.jpg');
	produto_div.className = produto_div.className + '_hover';
}

function produtos_maisinfo_out(id) {
	var produto = document.getElementById(id+'_cmd');
	var produto_div = document.getElementById(id+'_div');
	produto.src = produto.src.replace('_hover.jpg','.jpg');
	produto_div.className = produto_div.className.replace('_hover','');
}

function popup_imagem_mostra(objID,id) {
	var popup = document.getElementById(objID);
	popup.className = popup.className.replace('_esconde','_mostra');
	
	
	//puxa página para o topo
	window.scrollTo(0,0);
}

function popup_imagem_esconde(id) {
	var popup = document.getElementById(id);
	popup.style.display='none';
	popup.className = popup.className.replace('_mostra','_esconde');
}

function popup_referencia_mostra(id) {
	var popup = document.getElementById(id);
	popup.style.display='';
	popup.className = popup.className.replace('_esconde','_mostra');
}

function popup_referencia_esconde(id) {
	var popup = document.getElementById(id);
	popup.className = popup.className.replace('_mostra','_esconde');
}

function img_hover(id) {
	var img = document.getElementById(id);
	img.src = img.src.replace('.jpg','_hover.jpg');
}

function img_out(id) {
	var img = document.getElementById(id);
	img.src = img.src.replace('_hover.jpg','.jpg');
}


/*function popup_imagem_mostra(objID,id){

var obj = document.getElementById(objID);
var serverPage="imagem_detalhe.php"
var params = "id="+id;

xmlhttp.open("GET", serverPage+"?"+params);

xmlhttp.onreadystatechange = function() {

    if(xmlhttp.readyState == 1 ) {
    
    }else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        
        obj.innerHTML = xmlhttp.responseText;
        
        var popup = document.getElementById(objID);
	      popup.className = popup.className.replace('_esconde','_mostra');
        
    
      
    
    }
}
xmlhttp.send(null);
}*/


var total_pags;
var pag_size=485;
var pg;
pg=1;
var seccao;
seccao=0;


var pg_sel;

function avancar(){

var obj='wn1';

if(pg<total_pags){
dw_scrollObj.scrollTo(obj,pg*pag_size,0,0);
pg=pg+1;
seccao=seccao+1;

document.getElementById('num_pag').innerHTML=pg;
}



if(pg>1 && pg<total_pags){
	var cmd_avancar = document.getElementById('btn_avancar');
	cmd_avancar.src = 'sysimages/paginacao_avancar.jpg';

	var cmd_recuar = document.getElementById('btn_recuar');
	cmd_recuar.src = 'sysimages/paginacao_recuar.jpg';

} if(pg==total_pags){
	var cmd_avancar = document.getElementById('btn_avancar');
	cmd_avancar.src = 'sysimages/paginacao_avancar2.jpg';

  var cmd_recuar = document.getElementById('btn_recuar');
	cmd_recuar.src = 'sysimages/paginacao_recuar.jpg';
}

}

function recuar(){

if(pg>1){
dw_scrollObj.scrollTo('wn1',(seccao-1)*pag_size,0,0);
pg--;
seccao--;
document.getElementById('num_pag').innerHTML=pg;

}

if(pg>1 ){
	

	var cmd_recuar = document.getElementById('btn_recuar');
	cmd_recuar.src = 'sysimages/paginacao_recuar.jpg';
		
	var cmd_avancar = document.getElementById('btn_avancar');
	cmd_avancar.src = 'sysimages/paginacao_avancar.jpg';

}
if(pg==1 ){

	var cmd_recuar = document.getElementById('btn_recuar');
	cmd_recuar.src = 'sysimages/paginacao_recuar2.jpg';

  var cmd_avancar = document.getElementById('btn_avancar');
	cmd_avancar.src = 'sysimages/paginacao_avancar.jpg';

}


}

function mostra_sel() {

seccao=pg_sel-1;
pg=pg_sel;
dw_scrollObj.scrollTo('wn1',(seccao)*pag_size,0,-500);

if(document.getElementById('num_pag')!=null){
document.getElementById('num_pag').innerHTML=pg;
}



if(pg>1 && pg<total_pags){

		var cmd_recuar = document.getElementById('btn_recuar');
	 cmd_recuar.src = 'sysimages/paginacao_recuar.jpg';
		
	 var cmd_avancar = document.getElementById('btn_avancar');
	 cmd_avancar.src = 'sysimages/paginacao_avancar.jpg';
}

if(pg>1 && pg==total_pags){
			var cmd_recuar = document.getElementById('btn_recuar');
	 cmd_recuar.src = 'sysimages/paginacao_recuar.jpg';
		
	 var cmd_avancar = document.getElementById('btn_avancar');
	 cmd_avancar.src = 'sysimages/paginacao_avancar2.jpg';
}

}

function validateFormLogin(frmObj, jsonstr){
  
 //alert(frmObj.name);
  
  
  
  var errorcont = 0;
  
  var email = frmObj.email;
  
  if(email)
    var valem = email.value;
  
  
  
  if(email){
  
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  
    if (!filter.test(valem)){
      errorcont += 1;
      //var strerror = unescape(jsonstr[8]);
      var elementfocus = email;
      
       email.style.border="1px solid #FF0000";
      
      
  }
    
  }
  
  
  if(frmObj.pass1 && frmObj.pass2){
    
    if(frmObj.pass2.value != frmObj.pass1.value){
      errorcont += 1;
      var strerror = unescape(jsonstr[131]);
      var elementfocus = frmObj.pass2;
    }
    
  }
  
  
  var elem = new Array();
  
 elem = frmObj.elements;
 
  for(i = 0; i < elem.length; i++){
    
    var index = elem[i].selectedIndex;
    var nome = elem[i].name;
    
    if((elem[i].value == '') || (elem[i].value == unescape(jsonstr[41])) || (elem[i].value == unescape(jsonstr[61])) || (elem[i][index]=='0') || (elem[i][index]=='')  ){
    
     
    
      errorcont += 1;
      //var strerror = unescape(jsonstr[130]);
      var elementfocus = elem[i];
       
       elem[i].style.border="1px solid #FF0000";
      
      
    }
  }

  if(errorcont == 0){
    return true;
   
  } else {
  
//alert(strerror);
 elementfocus.focus();
    return false;
  }

} 


var objele;
function verifyRegFields(obj){
  
 
  
  var cont = 0;
  
  var cont2 = 0;
  
  var cont3 = 0;
  
  var cont4 = 0;
  
  objele = obj.elements;
  
  //alert(objele.length);
  
  
  for(i = 0; i < objele.length; i++){
    
    var xs = objele[i].name.substring(0,1);
    
    if((objele[i].value == '' || objele[i].value == unescape(jstr[12]))  && xs == 'R' ){
    cont++;
    
    //alert(objele[i].name);
     objele[i].style.border="1px solid #FF0000";
    
     objele[i].value=unescape(jstr[12]);
    
    //document.getElementById('email1').style.background="#f0f0f0";
   
    if(document.getElementById('email2')!=undefined){
    objele[i].style.border="1px solid #FF0000";
    
    //document.getElementById('email2').style.background="#f0f0f0";
    }
    if(document.getElementById('pass2')!=undefined){
    objele[i].style.border="1px solid #FF0000";
    //document.getElementById('pass1').style.background="#f0f0f0";
    //document.getElementById('pass2').style.background="#f0f0f0";
    }
    
    }else if(xs == 'R' && (objele[i].value != '' || objele[i].value == unescape(jstr[12]) ) ){
    
    //document.getElementById('email1').style.background="#FFFFFF";
    if(document.getElementById('email2')!=undefined){
    objele[i].style.border="1px solid #C2C7CF";
    //document.getElementById('email2').style.background="#FFFFFF";
    }
    if(document.getElementById('pass2')!=undefined){
    objele[i].style.border="1px solid #C2C7CF";
    //document.getElementById('pass1').style.background="#FFFFFF";
    
    }
    
    
    
    }
      
   if(document.getElementById('email2')!=undefined){
    if(objele[i].name == 'R[email][2]' && document.getElementById('email2').value != document.getElementById('email1').value)
      cont2++;
   }
   if(document.getElementById('pass2')!=undefined){
    if(objele[i].name == 'R[pass][2]' && document.getElementById('pass2').value != document.getElementById('pass1').value)
      cont3++;
   }
  }
  
  if(document.getElementById('email1')){
    if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email1').value))){
        //alert("Campo de e-mail incorrecto!")
        document.getElementById('email1').focus();
        document.getElementById('email1').value=unescape(jstr[63]);
        //document.getElementById('email1').style.background="#f0f0f0";
         document.getElementById('email1').style.border="1px solid #FF0000";
        return false;
    }else {
    // document.getElementById('email1').style.background="#FFFFFF";
    document.getElementById('email1').style.border="1px solid #C2C7CF";
    }
  }
  if(document.getElementById('email2')){
    if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email2').value))){
        //alert("Campo de confirmação de e-mail incorrecto!")
        document.getElementById('email2').focus();
        document.getElementById('email2').value=unescape(jstr[85]);
       // document.getElementById('email2').style.background="#f0f0f0";
        document.getElementById('email2').style.border="1px solid #FF0000";
        return false;
    }else {
    //document.getElementById('email2').style.background="#FFFFFF";
    document.getElementById('email2').style.border="1px solid #C2C7CF";;
    }
  }
  
  if(objele[12]!=undefined || objele[12]!=null){
    if(objele[12].checked==false ){
    alert(unescape(jstr[88]));
    return false;
    }
  }
  
  if(cont2 > 0){
    alert(unescape(jstr[87]));
      
    return false;
  }
  if(cont3 > 0){
    alert(unescape(jstr[66]));
      
    return false;
  }
 
  
  if(cont > 0){
    alert(unescape(jstr[86]));
    return false;
  } else {
    return true;
  }
}

function limpaformulario(id,valor){
	if (document.getElementById(id).value == valor) {
		document.getElementById(id).value = '';
	}
	
	if(id=="password"){
	document.getElementById(id).setAttribute("type", "password");
  //document.getElementById(id).type="password";
  }
}

function verificaformulario(id,valor){


	if (document.getElementById(id).value == '') {
	
	    if(id=="password"){
	
        document.getElementById(id).setAttribute("type", "text");
       // document.getElementById(id).type="text";
      }
      
	document.getElementById(id).value = valor;
	
	}
	
}

var jpesq;

function verifica_pesq(form) {

//alert(document.getElementById("valor_pesq").value);

  if((document.getElementById("valor_pesq").value=="") || (document.getElementById("valor_pesq").value==unescape(jpesq[279]))){
      alert(unescape(jpesq[169]));
      //document.getElementById(form).action="#";

  }

  if((document.getElementById("valor_pesq").value!="") && (document.getElementById("valor_pesq").value!=unescape(jpesq[279] ))){
      //document.getElementById(form).action="index.php?id=13";
      document.getElementById(form).submit();

  }
}

var numbr=1;
var tipo="Appear";
var teste;
var cats=new Array();
function random_dest(){


teste = self.setInterval(function (){

if(numbr!=cats.length-1){
  numbr++;
}else{
  numbr=1;
}
//alert(numbr);


//Effect.BlindDown("not_dest", { duration: 1.0,from:0,to:1,afterFinishInternal:function (){Effect.Appear("not_dest", { duration: 14.0,from:1,to:1});}});
Effect.Appear("dest_cat", { duration: 7.0,from:0.5,to:1,afterFinishInternal:function (){Effect.Fade("dest_cat", { duration: 17.0,from:1,to:0.5});}});




mostra_img_dest(cats[numbr]);
},"25000");
}

function mostra_img_dest(id_cat){


var obj = document.getElementById("dest_cat");

var serverPage ="cat_dest.php";
var params = "id_cat="+id_cat;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
	if(xmlhttp.readyState == 1 ) {

//obj.innerHTML="<img src='./sysimages/loader2.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {



obj.innerHTML = xmlhttp.responseText;


}


}
xmlhttp.send(null);


}


function mostra_pais(id){


var obj = document.getElementById("detalhe_pais");

var serverPage ="detalhe_pais.php";
var params = "id="+id;


xmlhttp.open("GET",serverPage+"?"+params);
xmlhttp.onreadystatechange = function() {
	if(xmlhttp.readyState == 1 ) {

//obj.innerHTML="<img src='./sysimages/loader2.gif' border='0' class='border_img'>";
}else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {



obj.innerHTML = xmlhttp.responseText;

DATAFUNCS.RenderFonts('tituloH2pais',{ 
        fontSize         : '10.5',
       backgroundColor  : 'FFFFFF',
       color            : '333333',
       fontFile         : 'fonts/NeoSansIntel.ttf',
       transparent      : '1'
    });

}


}
xmlhttp.send(null);


}

