// JavaScript Document
function sendValue(url){
	if(url==null)
	{
		window.opener.focus();
		window.opener.location.reload();
		window.close();
	}
	else
	{
		window.opener.focus();
		window.opener.location.href=url;
		window.close();
	}
}

function abrirJanela(URL,nome,width,height,left,top,rolagem) {
	if((''+rolagem)=='undefined')
		var sublinhar = false;
   window.open(URL,nome, 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars='+rolagem+', status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function formatar(src, mask) 
{
	var i = src.value.length;
	var saida = mask.substring(0,1);
	var texto = mask.substring(i)
	if (texto.substring(0,1) != saida) 
	{
		src.value += texto.substring(0,1);
	}
}

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 Numericos(e)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if (tecla > 47 && tecla < 58 || tecla==46) // numeros de 0 a 9 e ponto
			return true;
		else
			{
				if (tecla != 8) // backspace
					event.keyCode = 0;
					//return false;
				else
					return true;
			}
}

function parseelement(thisone){
	
	var wd;
	wd="w";

	var tempnum=thisone.value;
	for (i=0;i<tempnum.length;i++){
		if (tempnum.charAt(i)==".")
		{
			wd="d";
			break;
		}
	}
	if (wd=="w" && thisone.value!="" && thisone.value>0)
		thisone.value=tempnum+".00";
	else{
		if (tempnum.charAt(tempnum.length-2)=="."){
			if(tempnum!=0)
				thisone.value=tempnum+"0";
			else
				thisone.value="";
		}
		else{
			tempnum=Math.round(tempnum*100)/100;
			if(tempnum!=0)
				thisone.value=tempnum;
			else
				thisone.value="";
		}
	}
}
function Maximo(txarea,total,displayRestante) 
{ 
	tam = txarea.value.length; 
	str=""; 
	str=str+tam; 
	//  Digitado.innerHTML = str; 
	displayRestante.innerHTML = total;
	displayRestante.innerHTML = total - str;  
	if (tam > total)
	{ 
		aux = txarea.value; 
		txarea.value = aux.substring(0,total); 
		//	  	Digitado.innerHTML = total 
		displayRestante.innerHTML = 0 
	} 
} 

function posicionaCamada(camada){
	if(navigator.appName=="Netscape" && screen.width==800 && screen.height==600){//410x29
		document.getElementById(camada).style.top=29;
		document.getElementById(camada).style.left=410;
	}
	else 
		if(navigator.appName=="Netscape" && screen.width==1024 && screen.height==768){//528x119
			document.getElementById(camada).style.top=119;
			document.getElementById(camada).style.left=528;
		}
		else
			if(navigator.appName=="Microsoft Internet Explorer" && screen.width==800 && screen.height==600){//404x29
				document.getElementById(camada).style.top=29;
				document.getElementById(camada).style.left=404;
			}
			else
				if(navigator.appName=="Microsoft Internet Explorer" && screen.width==1024 && screen.height==768){//519x119
					document.getElementById(camada).style.top=119;
					document.getElementById(camada).style.left=519;
				}
}

//FUNÇÕES DO DREAMWEAVER
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
  var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//FIM FUNÇÕES DO DREAMWEAVER
