var numbr=1;
var tipo="Appear";
var randDest;
var Dest=new Array();
function random_dest(){


randDest = self.setInterval(function (){

if(numbr!=Dest.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("img_home", { duration: 5.0,from:1,to:1,afterFinishInternal:function (){Effect.Fade("img_home", { duration: 5.0,from:1,to:1});}});




muda_img(Dest[numbr]);
},"10000");
}

function muda_img(id){


var obj = document.getElementById("img_home");

var serverPage ="imagem_home.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;
  
  var nr = document.getElementById("nr_" + id);
  var seta = document.getElementById("seta" + id);
  var td = document.getElementsByTagName("td");
  
  for(i = 0; i <td.length; i++){
    	
        	if(td[i].className=="nr_sel"){
    				  
              td[i].className="nr";
      				
          }
          if(td[i].className=="seta_sel"){
    				  
              td[i].className="seta";
      				
          }
    	}
  
  if(nr!=null){
    nr.className='nr_sel';
  }
  if(seta!=null){
    seta.className='seta_sel';
  }
  
}
}
xmlhttp.send(null);
}

function RenderTTF()
    {
 
    
      var blcs = document.getElementsByTagName("td");
    
    	for(i = 0; i <blcs.length; i++){
    	
    	if(blcs[i].className=="textoGeralRubricas"){
				
  					var filhos = blcs[i].childNodes;
  					
  					for(f = 0; f <filhos.length; f++){
  					
  					 if(filhos[f].tagName == 'H1'){
  					
    					   if(filhos[f].className==""){
                    filhos[f].className="H1rub"
                 }
  					 }
  					
  						if(filhos[f].tagName == 'H2'){
  					
    					   if(filhos[f].className==""){
                    filhos[f].className="H2rub"
                 }
  					 }
            
           }
        }
    	
    	}
    
   
    
   DATAFUNCS.RenderFonts('H1rub',{ 
        fontSize         : '13.5',
       backgroundColor  : 'D5D5D5',
       color            : '0075EA',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
     DATAFUNCS.RenderFonts('tituloDelH1',{ 
        fontSize         : '13.5',
       backgroundColor  : 'D5D5D5',
       color            : '0075EA',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
     DATAFUNCS.RenderFonts('tituloLoja',{ 
        fontSize         : '18.75',
       backgroundColor  : 'D5D5D5',
       color            : '0F4986',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
     DATAFUNCS.RenderFonts('subtituloLoja',{ 
        fontSize         : '13.5',
       backgroundColor  : 'D5D5D5',
       color            : '0075EA',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
     DATAFUNCS.RenderFonts('tituloDestaque',{ 
        fontSize         : '10.5',
       backgroundColor  : '1A599A',
       color            : 'FFFFFF',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('tituloDestaqueLaranja',{ 
        fontSize         : '10.5',
       backgroundColor  : 'F8A10F',
       color            : 'FFFFFF',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
    DATAFUNCS.RenderFonts('tituloMNL',{ 
        fontSize         : '9',
       backgroundColor  : '1A599A',
       color            : 'FFFFFF',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
   
}    

function RenderTTFH()
    {

   DATAFUNCS.RenderFonts('tituloH1',{ 
        fontSize         : '18.75',
       backgroundColor  : 'D5D5D5',
       color            : '0F4986',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    }); 
    
   DATAFUNCS.RenderFonts('tituloH2',{ 
        fontSize         : '13.5',
       backgroundColor  : 'FFFFFF',
       color            : '0075EA',
       fontFile         : 'fonts/arial.ttf',
       transparent      : '1'
    });
    
    
    
} 

function cmd_hover(id) {
	var cmd = document.getElementById(id);
	cmd.src = cmd.src.replace('.png','_hover.png');
}

function cmd_out(id) {
	var cmd = document.getElementById(id);
	cmd.src = cmd.src.replace('_hover.png','.png');
}

function faq_hover(id) {
	var faq = document.getElementById(id);
	faq.className = faq.className + '_hover';
}

function faq_out(id) {
	var faq = document.getElementById(id);
	faq.className = faq.className.replace('_hover','');
}

function faq_show(key){

  var trf = document.getElementsByTagName("tr");
    
    	for(i = 0; i <trf.length; i++){
    	
        	if(trf[i].className=="trf1_hide"){
    				  
              trf[i].className="trf1_show"
      				
          }
        	if(trf[i].className=="trf2_show"){
    				  
              trf[i].className="trf2_hide"
      				
          }
    	}
    	
    	var tbl = document.getElementsByTagName("table");
    
    	for(i = 0; i <tbl.length; i++){
    	
        	if(tbl[i].className=="trline2"){
    				  
              tbl[i].className="trline1"
      				
          }
        
    	}

  var tr_faq1 = document.getElementById("trf1_" + key);
  tr_faq1.className = tr_faq1.className.replace('_show','_hide');
	//tr_faq1.style.display="none";
	
	var tr_faq2 = document.getElementById("trf2_" + key);
	tr_faq2.className = tr_faq2.className.replace('_hide','_show');
	
	var previous_key = key-1;
	//alert(previous_key);
	if(previous_key>0 && previous_key<total_faqs){
  var trl0 = document.getElementById("trl" + previous_key);
	trl0.className = trl0.className.replace('1','2');
  }
	
	var trl = document.getElementById("trl" + key);
	
	if(trl!=null){
	   trl.className = trl.className.replace('1','2');
	}
}

function show_marco(key){

  var trf = document.getElementsByTagName("tr");
    
    	for(i = 0; i <trf.length; i++){
    	
        	if(trf[i].className=="marco_show"){
    				  
              trf[i].className="marco_hide"
      				
          }
        	
    	}
    	
     var tds = document.getElementsByTagName("td");
    
    	for(i = 0; i <tds.length; i++){
    	
        	if(tds[i].className=="marcos_ano_sel"){
    				  
              tds[i].className="marcos_ano"
      				
          }
        
    	}
    	
    	var dvs = document.getElementsByTagName("div");
    
    	for(i = 0; i <dvs.length; i++){
    	
        	if(dvs[i].className=="titulo_marco1_hide"){
    				  
              dvs[i].className="titulo_marco1_show"
      				
          }
          
          if(dvs[i].className=="titulo_marco2_show"){
    				  
              dvs[i].className="titulo_marco2_hide"
      				
          }
        
    	}

  /*var tr_faq1 = document.getElementById("trf1_" + key);
  tr_faq1.className = tr_faq1.className.replace('_show','_hide');
	//tr_faq1.style.display="none";
	
	var tr_faq2 = document.getElementById("trf2_" + key);
	tr_faq2.className = tr_faq2.className.replace('_hide','_show');*/
	
  var trd = document.getElementById("marco_desc" + key);
  var ano_marco = document.getElementById("marco_ano" + key);
  var tit1 = document.getElementById("tit_marco1" + key);
  var tit2 = document.getElementById("tit_marco2" + key);
	
	if(tit1!=null){
	   tit1.className = tit1.className.replace('_show','_hide');
	}
	if(tit2!=null){
	   tit2.className = tit2.className.replace('_hide','_show');
	}
	
	if(trd!=null){
	   trd.className = trd.className.replace('_hide','_show');
	}
	if(ano_marco!=null){
	   ano_marco.className = ano_marco.className.replace('_ano','_ano_sel');
	}
	
}

//<![CDATA[
var map;
var geocoder;
var address;
var point;
var directions;
var coordenadas = new Array();
var txt_localizacao;
    function load() {
  
  
  map = new GMap2(document.getElementById("map"));
  map.setCenter(new GLatLng(coordenadas[0],coordenadas[1]), 13);
  //directionsPanel = document.getElementById("my_textual_div");

  
  //map.addControl(new GSmallMapControl);
  GEvent.addListener(map, "click", getAddress);
  geocoder = new GClientGeocoder();
  point = new GLatLng(coordenadas[0],coordenadas[1]);
  
  //definições do icone do marcador
  var Icon = new GIcon(G_DEFAULT_ICON);
  Icon.image = "sysimages/gposition.png";
  Icon.iconSize = new GSize(75, 28);
  Icon.shadow = "sysimages/gshadow.png";
  Icon.shadowSize = new GSize(75, 30);
  
  markerOptions = { icon:Icon };

  
  marker = new GMarker(point,markerOptions);
  map.addOverlay(marker);
  /*var mapControl = new GMapTypeControl();
  map.addControl(mapControl);
  map.addControl(new GLargeMapControl());*/
  
  
  }
                         
    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];
    var point2 = new GLatLng(place.Point.coordinates[1],place.Point.coordinates[0]);
    
    var marker2 = new GMarker(point2);
    map.addOverlay(marker2);
    marker2.openInfoWindowHtml(
        '<br><div class="localizacaoMap"><b>'+ txt_localizacao +'</b><br>' + place.address + '</div><br>'
    );
  }
}

    //]]>


var jpesq;

function verifica_pesq(form) {

var txt=document.getElementById("valor_pesq");
var texto = txt.value;
var error;

  if((txt.value=="") || (txt.value==unescape(jpesq[122]))){
      alert(unescape(jpesq[123]));
      error=1;
  }else if(txt.value!="" &&  texto.length<3){
      alert(unescape(jpesq[124]));
      error=2;
      //return false;
  }

  if((txt.value!=unescape(jpesq[122])) && (texto.value!="") && (texto.length>=3)){
     error=0;
     //document.getElementById(form).submit();
      
  }
  
  if(error>0){
    return false;
  }else {
    return document.getElementById(form).submit();
  }
  
  
}

function validateFormLogin(frmObj, jsonstr){
  
 //alert(frmObj.name);
  
  
  
  var errorcont = 0;
  
  var email = frmObj.email;
  var email2 = frmObj.email2;
  
  if(email)
    var valem = email.value;
  
  if(email2)
    var valem2 = email2.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[130]);
      var elementfocus = email;
     
       email.style.border="1px solid #FF0000";
       email.style.color="#000000";
      //email.value=strerror;
      
  }else {
    
    email.style.borderColor="#6486A1 #6486A1 #6486A1 #6486A1";
    email.style.color="#000000";
    }
    
  }
  
  if(email2){
  
    var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
  
    if (!filter.test(valem2)){
      errorcont += 1;
      var strerror = unescape(jsonstr[130]);
      var elementfocus = email2;
     
       email2.style.border="1px solid #FF0000";
       email2.style.color="#000000";
       //email2.value=strerror;
      
  }else {
    
    email2.style.borderColor="#6486A1 #6486A1 #6486A1 #6486A1";
    email2.style.color="#000000";
    }
    
  }
  
  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][index]=='0') || (elem[i].value==unescape(jsonstr[130])) || (elem[i].value==unescape(jsonstr[172])) || (elem[i][index]==''))   && elem[i].type!="submit"  ){
    
     
    
      errorcont += 1;
      var strerror = unescape(jsonstr[172]);
      var elementfocus = elem[i];
       
       elem[i].style.border="1px solid #FF0000";
       elem[i].style.color="#000000";
       //alert(unescape(jsonstr[130]));
       //elem[i].value=strerror;
      
    }else {
    
    elem[i].style.borderColor="#6486A1 #6486A1 #6486A1 #6486A1";
    elem[i].style.color="#000000";
    }
  }

  if(errorcont == 0){
    return true;
   
  } else {
  
  
  document.getElementById("msg_erro2").style.color="#FF0000";
  document.getElementById("msg_erro2").innerHTML=strerror;
  //alert(strerror);
 //elementfocus.focus();
    return false;
  }

} 
