// Browser Detection Javascript
// copyright 1 February 2003, by Stephen Chapman, Felgall Pty Ltd

// You have permission to copy and use this javascript provided that
// the content of the script is not changed in any way.

//criando a variável resultado
var resultado;
//testando se encontrou Firefox/x.x ou Firefox x.x;
if (!(/MSIE (\d+\.\d+);/.test(navigator.userAgent))){
   // capture a parcela de x.x e armazene-a como um número
   var ieversao=new Number(RegExp.$1);
   //atribua o resultado a variável resultado
   resultado=("Você não está usando o navegador Internet Explorer. Para assistir as transmissões, é necessário utilizá-lo.");
}
else
{
   resultado="IE";
}
//detectando a resolução de tela a concatenando a variável resultado
//resultado+="Sua resolução de tela é: <b>"+screen.width+"x"+screen.height+"</b><br />";
//resultado+="Seu Sistema operacional é: <b>"+so+"</b>";

//Exibindo resultado

function verificaformulario()
{
  if (document.formulario.nome.value == "" || document.formulario.email.value == "" || document.formulario.data.value == "")
  {
     alert ("Preencha os campos obrigatórios\nNome, e-mail e data!");
  }
  else
  {
     document.formulario.submit();
  }
}


function validaDat(campo,valor) {
	var date=valor;
	var ardt=new Array;
	var ExpReg=new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/[12][0-9]{3}");
	ardt=date.split("/");
	erro=false;
	if ( date.search(ExpReg)==-1){
		erro = true;
		}
	else if (((ardt[1]==4)||(ardt[1]==6)||(ardt[1]==9)||(ardt[1]==11))&&(ardt[0]>30))
		erro = true;
	else if ( ardt[1]==2) {
		if ((ardt[0]>28)&&((ardt[2]%4)!=0))
			erro = true;
		if ((ardt[0]>29)&&((ardt[2]%4)==0))
			erro = true;
	}
	if (erro) {
		alert("\"" + valor + "\" não é uma data válida!!!");
		campo.focus();
		campo.value = "";
		return false;
	}
	return true;
}


function dataConta(c){
  if(c.value.length ==2 || c.value.length ==5 ){
        c.value += '/';
  }
}

function ValidaEmail()
{
  var obj = eval("document.formulario.email");
  var txt = obj.value;
  if ((txt.length != 0) && ((txt.indexOf("@") < 1) || (txt.indexOf('.') < 7)))
  {
    alert('Email incorreto');
	obj.focus();
  }
}

function imprime(target)
{
         window.open('impresso.php', 'Relatorio', 'height = 300, width = 400, scrollbars=yes, status=yes, location=no, toolbar=no, menubar=no, resizable=yes');
         //alert("Target:" + target + " - " + document.getElementById(target).innerHTML);
}

function Transmitir(pp)
{
	if (confirm("Deseja 'transmitir/não transmitir' "+pp))
	{
		window.location ="index.php?c=listapp&acao=trans&pp="+pp;
	}
	else
	{
		alert("Transmissão cancelada!");
	}
}

function Publicar(pp)
{
	if (confirm("Deseja 'publicar/despublicar' "+pp))
	{
		window.location ="index.php?c=listapp&acao=publicar&pp="+pp;
	}
	else
	{
		alert("Publicação cancelada!");
	}
}

