var isNN = (navigator.appName.indexOf("Netscape")!=-1); 
function autoTab(input,len, e) { 
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46]; 
if(input.value.length >= len && !containsElement(filter,keyCode)) { 
input.value = input.value.slice(0, len); 
input.form[(getIndex(input)+1) % input.form.length].focus(); 
} 
function containsElement(arr, ele) { 
var found = false, index = 0; 
while(!found && index < arr.length) 
if(arr[index] == ele) 
found = true; 
else 
index++; 
return found; 
} 
function getIndex(input) { 
var index = -1, i = 0, found = false; 
while (i < input.form.length && index == -1) 
if (input.form[i] == input)index = i; 
else i++; 
return index; 
} 
return true; 
}

function AbrirAjax()
{
	var Ajax;
	try {Ajax = new XMLHttpRequest();
	}catch(ee) { 
	try {Ajax = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e) { 
	try {Ajax = new ActiveXObject("Microsoft.XMLHTTP");
	}catch(e) {Ajax = false; 
	}
	}
	}
	return Ajax;
}

function OFF_bannerPromo(conta,quadros) {
	
	if(conta>quadros) {
		
		var bOld = document.getElementById('b'+(conta-1));
		$(bOld).fadeOut('slow');
		//bOld.style.display = 'none';
		
		conta = 1
	
	}
	
	if(conta==1) {
		
		var bNew = document.getElementById('b'+conta);
		$(bNew).fadeIn('slow');
		//bNew.style.display = 'block';
	
		var conta = conta + 1
		
		setTimeout(function() { bannerPromo(conta,quadros)	}, 8000);

	} else {
		
		//alert('conta: '+conta+' quadros: '+quadros)
		
		var bOld = document.getElementById('b'+(conta-1));
		$(bOld).fadeOut('slow');
		//bOld.style.display = 'none';
	
		var bNew = document.getElementById('b'+conta);
		$(bNew).fadeIn('slow');
		//bNew.style.display = 'block';
	
		conta = conta + 1
	
		//if(conta>quadros) { conta=1 }
		
		setTimeout(function() { bannerPromo(conta,quadros)	}, 8000);
	
	}
}

function rodape() {
	var janela = $(window).height();
	var box = $('#box').innerHeight();
	var rodape = $('#rodape').innerHeight();
	var op1 = box + rodape;
	var op2 = janela-op1;
	var op3 = op2 - 20;
	
	if(op2>0){
		var opW = box + op3
		var box = document.getElementById('box');
		box.style.height = opW+'px';
	}
}


















