	$(document).ready(function(){
		$(".btn-slide").click(function(){
		$("#mycarousel").toggle("slow");
		$(this).toggleClass("active"); return false;
		});
	});

	$(document).ready(function(){
		$(".btn-slide2").click(function(){
		$("#lista-sites").toggle("slow");
		$(this).toggleClass("active"); return false;
		});		
	});

function alterarSelect(target, valor) {
	for(var i = 0; i < target.length; i++) {
		if(target[i].value == valor){
			target[i].selected = true;
			break;
		}
	}
}

function abrirPagina(url){
	if(url.length > 0)
		window.open(url, '_blank');
}

function alterarConcessionaria(pais, url){
	document.location.href = url + "?pais="+pais;
}

function alterarPais(valor) {
	document.getElementById("pais").value = valor;
	document.selecionarPais.submit();
}

function alterarIdioma(valor) {
	document.alterarIdioma.idioma.value = valor;
	document.alterarIdioma.submit();
}

function contador(campo, valor, tamanho){
	campo.innerHTML = tamanho - valor.length;
}

function limitarCampo(tamanho, campo, e){
	var code = recuperaCode(e);
	
	if(campo.value.length >= tamanho){
		if(code == 8 || code == 9 || code == 46 || (code >= 33 && code <= 46))
			return true;
		else
			return false;
	} else
		return true;
}

function somenteNumero(e){
	var code = recuperaCode(e);
	if(code == 8 || code == 9 || code == 46 || (code >= 33 && code <= 46) || (code >= 48 && code <= 57) || (code >= 96 && code <= 105))
		return true;
	else
		return false;
}

function mascarar(campo, mascara, e){
	var posicao = campo.value.length;
	var usarMascara = true;
	var code = recuperaCode(e);
	if(code == 8 || code == 9 || code == 46 || (code >= 33 && code <= 46))
		usarMascara = false;
	if(usarMascara){
		if(mascara.substring(posicao, posicao + 1) != "#"){
			campo.value += mascara.substring(posicao, posicao + 1);
		}
	}
}

function recuperaCode(e){
	if (e.keyCode) return e.keyCode;
	else if (e.which) return e.which; // Netscape 4.?
	else if (e.charCode) return e.charCode; // Mozilla
}

function aba(abaAtiva, quantidadeAbas) {
	for(var i = 1; i <= quantidadeAbas; i++) {
		document.getElementById("table" + i).style.display = "none";
	}
	document.getElementById(abaAtiva).style.display = "block";
}

function mudarCor(campo, cor, quantidadeElemento){
	for(var i = 1; i <= quantidadeElemento; i++) {
		document.getElementById("ano" + i).style.color = "";
	}
	campo.style.color = cor;
}

function swfobject(largura, altura, arquivo){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="teste" align="middle" valign="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain"/><param name="wmode" value="transparent"/>');
	document.write('<param name="movie" value="'+arquivo+'"/><param name="quality" value="best"/><param name="bgcolor" value="#ffffff"/><embed src="'+arquivo+'" wmode="transparent" quality="best" width="'+largura+'" height="'+altura+'" name="teste" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>');
	document.write('</object>');
}

// JavaScript Document
function retorna_dimensoes(){
	var xScroll, yScroll;
//	xScroll = document.documentElement["scrollWidth"];
//	yScroll = document.documentElement["scrollHeight"];

//	xScroll = document.body.scrollWidth;
//	yScroll = document.body.scrollHeight;

	try{
		xScrollb = document.documentElement["scrollWidth"];
		yScrollb = document.documentElement["scrollHeight"];

		xScroll = document.documentElement["offsetWidth"];
		yScroll = document.documentElement["offsetHeight"];

//	debug("xscroll="+xScroll+" yscroll="+yScroll+" xscrollb="+xScrollb+" yscrollb="+yScrollb)

		if(xScrollb>xScroll) xScroll=xScrollb;
		if(yScrollb>yScroll) yScroll=yScrollb;

//	debug(yScroll);

	} catch (e) { debug(e); }

	return Array(xScroll,yScroll);
}

function iniciotIntervencao(arquivo)
{
		//var w = document.documentElement["offsetWidth"] - 10;
		valores=retorna_dimensoes();
		var ie=(document.all || window.opera) && document.getElementById
		
		var flash = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='100%' height='100%' id='teste' align='middle' valign='middle'>";
			flash += "<param name='allowScriptAccess' value='sameDomain'/><param name='wmode' value='transparent'/>";
			flash += "<param name='movie' value='"+arquivo+"'/><param name='quality' value='best'/><param name='bgcolor' value='#ffffff'/><embed src='"+arquivo+"' wmode='transparent' quality='best' width='100%' height='100%' name='teste' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'/>";
			flash += "</object>'";
	
		var flutuanteDiv = document.createElement("div");	
			flutuanteDiv.id = "flutuante";
			
				
				flutuanteDiv.style.height = '100%';
				flutuanteDiv.style.width = '100%';
			if (!ie){
			    document.body.style.overflow = "hidden";
			}else{
				document.documentElement.style.overflow ="hidden";			
			}
			flutuanteDiv.innerHTML   = flash;
			
			document.body.insertBefore(flutuanteDiv, document.body.firstChild);
			//aqui pegamos uma array com todos os drops 
				divsAtributo=document.getElementsByTagName("select");
			//loop para esconder todos os drops	
				for(i=0; i<divsAtributo.length; i++) 
				{
				divsAtributo.item(i).style.visibility = "hidden";
			    }
			document.location.href = "#";
			
}
function fecharDiv()
{
			var ie=(document.all || window.opera) && document.getElementById
				if (!ie){
				 document.body.style.overflow = "visible";
				}else{
				 document.documentElement.style.overflow = "scroll";
				}
			document.body.style.overflow = "visible";
			document.getElementById('flutuante').style.display='none';
			//aqui pegamos uma array com todos os drops 
				divsAtributo=document.getElementsByTagName("select");
			//loop para mostrar todos os drops	
				for(i=0; i<divsAtributo.length; i++) 
				{
				divsAtributo.item(i).style.visibility = "visible";
			    }
}

function alterarBorda(campo, valor){
	campo.style.background = valor;
}

function alterarBordaCima(campo, valor){
	campo.style.background = valor;
}

var BORDA_INPUT = "#FFFFFF";
var BORDA_ERRO = "#a02628";

function analytics(secao, acao, dado){
	pageTracker._trackEvent(secao, acao, dado);
}

function fbs_click() {
	u=location.href;
	t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),' sharer', 'toolbar=0, status=0, width=626, height=436');
	return false;
}

function url_twitter(titulo, link) {
	window.open("http://twitter.com/home?status="+encodeURIComponent(titulo)+":+"+link);
}
