// Java Document

// esta função mostra o div (id=ab) e esconde todos os demais de classe 'aba' 
function mostraAba(ab) {
divs = document.getElementsByTagName("div");
topAb = 'topAba' + ab;
ld = divs.length;
	for(n=0;n<ld;n++) {
		if(ab==divs[n].id) {
			divs[n].style.position='relative';
			divs[n].style.visibility='visible';
			divs[n].style.width='100%';
		} 
		else 
		{
			if(divs[n].className=='aba')
			{
				divs[n].style.position='absolute';
				divs[n].style.left='0px';
				divs[n].style.visibility='hidden';
				divs[n].style.width='0px';
			}
		}
		if(topAb==divs[n].id)
		{
			divs[n].className='';
		}
		else
		{
			tmp = divs[n].id.substr(0,6);
			if(tmp=='topAba')
			{
				divs[n].className='abaFechada';
			}
			
		}
	}
	trocaAba(ab);
}

// esta função mostra ou esconde o div (id=ab) clicado 
function abreAba(ab) {
divs = document.getElementsByTagName("div");
divAB = document.getElementById('botAB');
ld = divs.length;
	for(n=0;n<ld;n++) 
	{
		if(ab==divs[n].id) 
		{
			if(divs[n].style.visibility=='hidden')
			{
				divAB.className='footerFechar';
				divs[n].style.position='relative';
				divs[n].style.visibility='visible';
				divs[n].style.width='100%';
			} 
			else 
			{
				divAB.className='footerAbrir';
				divs[n].style.position='absolute';
				divs[n].style.left='0px';
				divs[n].style.visibility='hidden';
				divs[n].style.width='0px';
			}
		}
	}
}

function trocaAba(ab) {
ab = ab + 'Aba';
divs = document.getElementsByTagName("div");
ld = divs.length;
	for(n=0;n<ld;n++) {
		if(ab==divs[n].id) 
		{
			divs[n].className=='abaAberta';
		} 
		else 
		{
			if(divs[n].className=='abaAberta')
			{
				
				divs[n].className=='abaFechada';
			}
		}
	}
}

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 confirmNavigate(message, URL)
{
	input_box=confirm(message);
	if (input_box==true)
	{ 
		// Output when OK is clicked
		window.location.href = URL;
	}
}

function confirmPost(message, myForm, fAction)
{
	input_box=confirm(message);
	if (input_box==true)
	{ 
		// Output when OK is clicked
		document[myForm].myAction.value = fAction;
		document[myForm].submit();
	}
}

function SetAllCheckBoxes(CheckName, CheckValue)
{
	chks = document.getElementsByTagName('input');
	ld = chks.length;
	for(n=0;n<ld;n++) 
	{
		nomered = chks[n].name.substr(0,8);
		if(nomered==CheckName)
		{	
			chks[n].checked=CheckValue;
		}
	}
}

var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbar=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function mOver(id)
{
	obj = document.getElementById(id);
	obj.style.color='#000000'
}

function mOut(id)
{
	obj = document.getElementById(id);
	obj.style.color='#FFFFFF'
	
}