var showMenu = false;

$(document).ready(function() {
	$(".menu-vivo-div").stop().fadeTo(0, 0);
	$(".menu-vivo-div").hide();

	$(".menu-vivo").click(function(){
		if (!showMenu) {
			$(".menu-vivo-div").show();
			$(".menu-vivo").css({ "width":"405px" });
			$(".menu-vivo-div").stop().fadeTo(1000, 0.9);
			showMenu = true;
		} else {
			$(".menu-vivo-div").stop().fadeTo(1000, 0, function() {
			 	$(".menu-vivo").css({ "width":"405px" });	
				$(".menu-vivo-div").hide();
			});
			showMenu = false;
		}						   
	});
});

/* ------ Início Regionalização ---------------------*/
function mudaRegiao(uf, url)
{
	writeCookie("region", uf, 24);
	window.location = url + "?id_regional=" + uf.toLowerCase();
}

function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";

  if(document.cookie.length > 0) { 
    offset = document.cookie.indexOf(search);

    if (offset != -1) { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }

  return cookieValue;
}

function writeCookie(name, value, hours)
{
	var expire = "";

	if(hours != null) {
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}

	document.cookie = name + "=" + escape(value) + expire + ";path=/";
}

/* ------ Fim Regionalização ---------------------*/

/* Inicio - Métrica 3G */
function fnMetrica(texto){
	leArquivo('/metrica.php?WT.ac='+texto);
}
function fnOK(){ if (HttpReq.readyState == 4 ){	 return true; }}
//function fnOK(){ if (HttpReq.readyState == 4 ){	return true; }}
function leArquivo(vUrl){
	if (window.document.getElementById) { //Verifica se o Browser suporta DHTML.
        if (window.XMLHttpRequest) {
            HttpReq = new XMLHttpRequest();
            HttpReq.onreadystatechange = fnOK;
            HttpReq.open("GET", vUrl, true);
            HttpReq.send(null);
        } else if (window.ActiveXObject) {
			try {
                HttpReq = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    HttpReq = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {
				}
			}
			if (HttpReq) {
				HttpReq.onreadystatechange = fnOK;
				HttpReq.open("GET", vUrl, true);
				HttpReq.send();
			}
		}
	}
}
/* Final - Métrica do HotSite */
