function randomString(string_length) {
	var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";
	var string_length = (string_length == null)?8:string_length;
	var randomstring = '';
	for (var i=0; i<string_length; i++) {
		var rnum = Math.floor(Math.random() * chars.length);
		randomstring += chars.substring(rnum,rnum+1);
	}
	return randomstring;
}

$(function(){
	$('#conteudo').addClass('show')
})

/* troca do Sumario agrianual2010 */
function tAgri2010(ativo){

	document.getElementById('artigos').style.display = 'none';
	document.getElementById('terras').style.display = 'none';
	document.getElementById('mecanizacao').style.display = 'none';
	document.getElementById('indicadores').style.display = 'none';
	document.getElementById('biocombustivel').style.display = 'none';
	document.getElementById('c_a').style.display = 'none';
	document.getElementById('c_b').style.display = 'none';
	document.getElementById('c_c').style.display = 'none';
	document.getElementById('c_d').style.display = 'none';
	document.getElementById('c_f').style.display = 'none';
	document.getElementById('c_g').style.display = 'none';
	document.getElementById('c_h').style.display = 'none';
	document.getElementById('c_m').style.display = 'none';
	document.getElementById('c_n').style.display = 'none';
	document.getElementById('c_p').style.display = 'none';
	document.getElementById('c_s').style.display = 'none';
	document.getElementById('c_t').style.display = 'none';
	document.getElementById('c_u').style.display = 'none';
	
	if(ativo != 'nenhum'){
		document.getElementById(ativo).style.display = 'block';
	}
	
}

function carSuss(tipo){

	if(tipo == 'credito'){

		alert('Foram debitados os cr�ditos de sua conta, clique no link ao lado para fazer o download');

	} else {
		
		alert('pedido adicionado com sucesso ao carrinho!');
		
	}
	
}

/*# Abre popup centralizada na tela. Passar largura e altura */
function wopen(page,wdt,hgt)
{
	var _x				= wdt / 2;
	var _y				= hgt / 2;
	var pos_tela_width		= (screen.width / 2) - _x;
	var pos_tela_height		= (screen.height / 2) - _y;

	window.open(page,"pre","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=2,noresize,copyhistory=no,width="+wdt+",height="+hgt+",top="+pos_tela_height+",left="+pos_tela_width);
}