	Cufon.replace('h1', {hover: true});
	Cufon.replace('h2', {hover: true});
	Cufon.replace('h3', {hover: true});
	Cufon.replace('h4', {hover: true});
	Cufon.replace('h5', {hover: true});
	Cufon.replace('h6', {hover: true});
	Cufon.replace('#topo_cont ul li a', {hover: true});
	Cufon.replace('.info p', {hover: true});
	Cufon.replace('.horario', {hover: true});
	Cufon.replace('.atendimento', {hover: true});
	Cufon.replace('p.mais', {hover: true});

function getElementsByClassName(classname, node) {
 if(!node) node = document.getElementsByTagName("body")[0];
 var a = [];
 var re = new RegExp('\\b' + classname + '\\b');

 var els = node.getElementsByTagName("*");
 for(var i=0,j=els.length; i<j; i++)
 if(re.test(els[i].className))a.push(els[i]);
 return a;
}

function getWindowSizes(){
  /*Pega altura e largura da janela do browser */
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return {h: myHeight, w: myWidth};
}

function titulo(){
  var list = document.getElementById("conteudo");
  var listItems = getElementsByClassName("titulo", list);
  for(var i = 0; i < (listItems.length); i++) {
	var twidth = listItems[i].offsetWidth;
	var slabel = getElementsByClassName("label", listItems[i]);
	var spanlabel = slabel[0].offsetWidth;
	var spanlinha = getElementsByClassName("linha", listItems[i]);
	for(var b = 0; b < (spanlinha.length); b++) {
		spanlinha[b].style.width = ((twidth - spanlabel - 1)/2) + "px";
	}
  }
}

function lateral_banners(){
  if(document.getElementById("centro_container")){
    var medidas = getWindowSizes();
    var largJanela = medidas.w;
    var cc = document.getElementById("centro_container").offsetWidth;
    var areaRestante = (largJanela - cc - 15)/2;
    if ( $.browser.msie ) {
      document.getElementById("bg_branco_left").style.width = (areaRestante+10)+"px";
      document.getElementById("bg_branco_right").style.width = (areaRestante+10)+"px";
    } else {
      document.getElementById("bg_branco_left").style.width = areaRestante+"px";
      document.getElementById("bg_branco_right").style.width = areaRestante+"px";
    }
  }
}

function footer(){
  var topo = document.getElementById("topo").offsetHeight;
  var vitrine = 0;
  if(document.getElementById("vitrine")){
    vitrine = document.getElementById("vitrine").offsetHeight;
  }
  var conteudo = document.getElementById("conteudo").offsetHeight;
  var rodape = document.getElementById("rodape").offsetHeight;
  var medidas = getWindowSizes();
  var altJanela = medidas.h;
  var altSite = topo+vitrine+conteudo+rodape;
  var dif = altJanela - altSite;
  if(dif > 0){
    document.getElementById("conteudo").style.paddingBottom = dif+"px";
  }
}

function baloes(){
  $(".info a").each(function(){
    $(this).find("span").css({opacity: 0.0, top: "35px"});
    $(this).hover(function(){
      $(this).find("span").stop().animate({opacity: 1.0, top: "25px"});
    },function(){
      $(this).find("span").stop().animate({opacity: 0.0, top: "35px"});
    });
  });
}

function produtos_abre(){
    jQuery.noConflict();
    jQuery(document).ready(function($) {
            $(document).ready(function(){
                  $(".produto").each(function(index){
                    var to_opensa = $(this).find(".descricao ul");
                    var openersa = $(this).find("p.mostrar a");
                    var orig_hsa = parseFloat(to_opensa.outerHeight());
                    //alert(orig_h);
                    var curr_hsa = 200;
                    var opensa = false;
                    to_opensa.css({height: curr_hsa});
                    openersa.click(function(){
                        if(!opensa){
                          to_opensa.animate({height: orig_hsa});
                          opensa = true;
                          var html = openersa.html();
                          openersa.html("Encolher lista",html);
                        } else {
                          to_opensa.animate({height: curr_hsa});
                          opensa = false;
                          var html = openersa.html();
                          openersa.html("Mostrar lista toda",html);
                        }
                    });
                  });
          });
      });

}

window.onload = function(){
  titulo();
  lateral_banners();
  footer();
}
window.onresize = function(){
  lateral_banners();
  footer();
}
