function externa(){
	gE("externa").style.visibility = "visible";
	gE("interna").style.visibility = "hidden";
	gE("interna1").style.visibility = "hidden";
}

function interna(){
	gE("interna").style.visibility = "visible";
	gE("interna1").style.visibility = "visible";
	gE("externa").style.visibility = "hidden";
}

//*********************************************************
function verificaImp1(){
	if(gE("tipo").value == ""){
		alert("Selecione o tipo!");
		gE("tipo").focus();
		return false;
	}
	if(gE("tit").value == ""){
		alert("Preencha o título!");
		gE("tit").focus();
		return false;
	}
	if(gE("breve").value == ""){
		alert("Preencha o breve!");
		gE("breve").focus();
		return false;
	}
	if(gE("externa").style.visibility == "visible" && gE("link").value == ""){
		alert("Preencha o link!");
		gE("link").focus();
		return false;
	}
	return true;
}
//*********************************************************

function cursos(){
	if(gE("tit").value == ""){
		alert("Por favor, preencha o título!");
		return false;
		gE("tit").focus();
	}
	
	if(gE("arquivo").value == "" && gE("url").value == ""){
		alert("Por favor, preencha o arquivo ou a url!");
		return false;
		gE("arquivo").focus();
	}
	return true;
}


//*********************************************************


function verificaImp(){
	if(gE("tipo").value == ""){
		alert("Selecione o tipo!");
		gE("tipo").focus();
		return false;
	}
	if(gE("tit").value == ""){
		alert("Preencha o título!");
		gE("tit").focus();
		return false;
	}
	if(gE("breve").value == ""){
		alert("Preencha o breve!");
		gE("breve").focus();
		return false;
	}
	if(gE("interna").style.visibility == "visible" && gE("imagem").value == ""){
		alert("Selecione a imagem!");
		gE("imagem").focus();
		return false;
	}
	if(gE("externa").style.visibility == "visible" && gE("link").value == ""){
		alert("Preencha o link!");
		gE("link").focus();
		return false;
	}
	return true;
}
//*********************************************************
function mudaTipo(){
	tipo = gE("tipo").value;
	if(tipo == "0"){
		gE("interna").style.visibility = "visible";
		gE("externa").style.visibility = "hidden";
	}
	if(tipo == "1"){
		gE("interna").style.visibility = "hidden";
		gE("externa").style.visibility = "visible";
	}
}

//*********************************************************
function mudaTipo1(){
	tipo = gE("tipo").value;
	if(tipo == "0"){
		gE("interna").style.visibility = "visible";
		gE("interna1").style.visibility = "visible";
		gE("externa").style.visibility = "hidden";
	}
	if(tipo == "1"){
		gE("interna").style.visibility = "hidden";
		gE("interna1").style.visibility = "hidden";
		gE("externa").style.visibility = "visible";
	}
}



//*********************************************************
			function toggle(obj) { 
			var el = document.getElementById(obj); 
			if ( el.style.display != "none" ) { 
			el.style.display = 'none'; 
			} 
			else { 
			el.style.display = 'block'; 
			} 
			} 

//*********************************************************function esqueci() {
function esqueci() {
props=window.open('esqueci.asp', 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=300, height=130, left = 390, top = 341.5');
}

//*********************************************************function esqueci() {
function popup(url) {
props=window.open(url, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=300, height=130, left = 390, top = 341.5');
}

//*********************************************************
function galeria(id) {
props=window.open('galeria.asp?idMaquina=' + id, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=800, height=750, left = 390, top = 341.5');
}

//*********************************************************
function galeria_videos(id) {
props=window.open('galeria_videos.asp?idMaquina=' + id, 'poppage', 'toolbars=0, scrollbars=0, location=0, statusbars=0, menubars=0, resizable=0, width=800, height=750, left = 390, top = 341.5');
}
//*********************************************************
var el;
function gE(id)
{
	el = document.getElementById(id);
	return el;
}

//*********************************************************
function textCounter(field, countfield, maxlimit) 
		{
			if (gE(field).value.length > maxlimit) 
				gE(field).value = gE(field).value.substring(0, maxlimit);

			else 
				gE(countfield).value = maxlimit - gE(field).value.length ;
		}
//*********************************************************
function excluir(id, url)
{
	if(confirm("Deseja realmente excluir?"))
	{
		a = url + id
		// alert(a)
		window.location = url + id
	}
}

//*********************************************************

function pagina(endereco){
	window.location = endereco + ".asp"
}

//*********************************************************
function verifica()
{
var checks = document.getElementsByTagName("input");

for(j=0;j<checks.length;j++)
    {
        if(checks[j].getAttribute("obrig") == "sim")
        {
            if(checks[j].value == "")
            {
                alert("Por favor, preencha o campo " + checks[j].getAttribute("nome") + " !");
                checks[j].focus();
                return false;
            }
        }
    }
	
	
var checks1 = document.getElementsByTagName("select");

for(j=0;j<checks1.length;j++)
    {
        if(checks1[j].getAttribute("obrig") == "sim")
        {
            if(checks1[j].value == "")
            {
                alert("Por favor, preencha o campo " + checks1[j].getAttribute("nome") + " !");
                checks1[j].focus();
                return false;
            }
        }
    }	

var checks1 = document.getElementsByTagName("textarea");

for(j=0;j<checks1.length;j++)
    {
        if(checks1[j].getAttribute("obrig") == "sim")
        {
            if(checks1[j].value == "")
            {
                alert("Por favor, preencha o campo " + checks1[j].getAttribute("nome") + " !");
                checks1[j].focus();
                return false;
            }
        }
    }	


}

//*********************************************************

//*********************************************************
function verifica1()
{
var checks = document.getElementsByTagName("input");

for(j=0;j<checks.length;j++)
    {
        if(checks[j].getAttribute("alt") == "obrig")
        {
            if(checks[j].value == "")
            {
                alert("Por favor, preencha o campo " + checks[j].getAttribute("title") + " !");
                checks[j].focus();
                return false;
            }
        }
    }
	
	
var checks1 = document.getElementsByTagName("select");

for(j=0;j<checks1.length;j++)
    {
        if(checks1[j].getAttribute("alt") == "obrig")
        {
            if(checks1[j].value == "")
            {
                alert("Por favor, preencha o campo " + checks1[j].getAttribute("title") + " !");
                checks1[j].focus();
                return false;
            }
        }
    }	

var checks1 = document.getElementsByTagName("textarea");

for(j=0;j<checks1.length;j++)
    {
        if(checks1[j].getAttribute("alt") == "obrig")
        {
            if(checks1[j].value == "")
            {
                alert("Por favor, preencha o campo " + checks1[j].getAttribute("title") + " !");
                checks1[j].focus();
                return false;
            }
        }
    }	


}

//*********************************************************

var numero;
function numeros(obj)
{
var valor = document.getElementById(obj).value;
var char = valor.substr(valor.length-1);
var numeros = new Array();
numeros[0] = "1";
numeros[1] = "2";
numeros[2] = "3";
numeros[3] = "4";
numeros[4] = "5";
numeros[5] = "6";
numeros[6] = "7";
numeros[7] = "8";
numeros[8] = "9";
numeros[9] = "0";
numeros[11] = ".";
numeros[12] = "-";
numeros[13] = "/";

for (i=0;i<numeros.length;i++)
{
if(char == numeros[i])
{
numero = "sim";
break;
}
else
{
numero = "nao";
}
}

if (numero == "sim")
{
document.getElementById(obj).value = valor;
}
else
{
document.getElementById(obj).value = valor.substr(0,valor.length-1); 
}
}
//*********************************************************



//*********************************************************

