function janela(url){
	window.open(url,'janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=450,height=290,top=187,left=147')
}
function janela1(url){
	window.open(url,'janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=400,height=270,top=187,left=200')
}
function janela1024(url){
	window.open(url,'janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=1024,height=768,top=0,left=0')
}
function janela800(url){
	window.open(url,'janela','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=800,height=600,top=0,left=0')
}

function fDocDig(){
var sURL;
//sURL = "../lecca_docs.asp?cpf=<%=trim(pCPF)%>";
//padrao-rj5/leccasite/Lecca_docs.asp

//sURL = "http://padrao-rj5/leccasite/Lecca_docs.asp"
// mudar este caminho
//sURL = "../upload/Lecca_docs.asp"
sURL = "../Lecca_docs.asp"
//alert(sURL);

//sURL = "lecca_docs.asp"
//sURL = "http://localhost/lecca_upload/leccasite/lecca_docs.asp";
window.open(sURL, "Documentos", "width=785, height=530, status=yes, toolbar=no, scrollbars=yes, menubar=no, location=no");
}


function openBlank(url){window.open(url)}

function checkBrowser(){
	T=this
	b=navigator.appName
	v=navigator.appVersion
	u=navigator.userAgent
	if(b=='Netscape')T.b='ns'
	else if(b=='Microsoft Internet Explorer')T.b='ie'
	else T.b=b
	T.v=parseInt(v)
	T.ns=(T.b=='ns'&&T.v>=4)
	T.ns4=(T.b=='ns'&&T.v==4)
	T.ns5=(T.b=='ns'&&T.v==5)
	T.ns6=(T.b=='ns'&&T.v==5)
	T.ie=(T.b=='ie'&&T.v>=4)
	T.ie4=(u.indexOf('MSIE 4')>0)
	T.ie5=(u.indexOf('MSIE 5.0')>0)
	T.ie55=(u.indexOf('MSIE 5.5')>0)
	T.ie6=(u.indexOf('MSIE 6.0')>0)
	if(T.ie5)T.v=5
	if(T.ie55)T.v=5.5
	if(T.ie6)T.v=6
	T.min=(T.ns||T.ie)
	T.dom=(T.v>=5)
	T.win=(u.indexOf('Win')>0)
	T.mac=(u.indexOf('Mac')>0)
}
is=new checkBrowser()


// Page Dimensions

function docW(){return(is.ie?(d.body.scrollWidth):(d.width))}
function docH(){return(is.ie?(d.body.scrollHeight):(d.height))}
function winW(){return(is.ie?(d.body.clientWidth):(window.innerWidth))}
function winH(){return(is.ie?(d.body.clientHeight):(window.innerHeight))}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function MM_popupMsg(msg) { //v1.0
  alert(msg);
}
function swapFlyInLayer() {
	if (flyInLayer == "nn_1") {
		flyInLayer = "nn_2";
	}
	else {
		flyInLayer = "nn_1";
	}
}

function errorsuppressor(){
return true;
}
window.onerror=errorsuppressor;

function dotransition(transition_id) {
	// IE supports CSS filters. //
    if (document.all) {
		content.filters[0].transition = transition_id;
        content.filters[0].apply();
        content.innerHTML = image_lineup[i_current_image];
        content.filters[0].play();
	}

	//
	// Netscape does not. Fake it a' la DHTML
	//    
    if (document.layers) {
		swapFlyInLayer();
		var start_pos = 0;
		if (transition_id==7)
			start_pos = 580;
		else
			start_pos = -580;
		if ( flyInLayer == "nn_1" )
		{
			// move it off screen & to the front zIndex
			document.nn_1.left = start_pos;
			document.nn_1.zIndex = document.nn_2.zIndex + 1;
			document.nn_1.document.write(image_lineup[i_current_image]);
			document.close();
		}
		else
		{
			// move it off screen & to the front zIndex
			document.nn_2.left = start_pos;
			document.nn_2.zIndex = document.nn_1.zIndex + 1;
			document.nn_2.document.write(image_lineup[i_current_image]);
			document.close();
		}
		nn_transition_id = transition_id;
		document.close();
		doFlyIn();
    }
}

function next() {
	if ( i_current_image >= image_lineup.length-1 ) {
		i_current_image = 0;
	}
	else {
		i_current_image++;
	}
	dotransition(forward_trans);
}

function back() {
	if ( i_current_image == 0 ) {
		i_current_image = image_lineup.length-1;
	}
	else {
		i_current_image--;
	}
	dotransition(back_trans);
}

function doFlyIn() {
	var adder = 0;
	if (nn_transition_id == forward_trans)
		adder = -10;
	else
		adder = 10;
	if (document.layers[flyInLayer].left != 300 )
		document.layers[flyInLayer].left += adder;
	else
		return;
	// use the windows method setTimeOut
	setTimeout("doFlyIn()", 10);
	return;
}
function openBlank(url){window.open(url)}

function checkBrowser(){
	T=this
	b=navigator.appName
	v=navigator.appVersion
	u=navigator.userAgent
	if(b=='Netscape')T.b='ns'
	else if(b=='Microsoft Internet Explorer')T.b='ie'
	else T.b=b
	T.v=parseInt(v)
	T.ns=(T.b=='ns'&&T.v>=4)
	T.ns4=(T.b=='ns'&&T.v==4)
	T.ns5=(T.b=='ns'&&T.v==5)
	T.ns6=(T.b=='ns'&&T.v==5)
	T.ie=(T.b=='ie'&&T.v>=4)
	T.ie4=(u.indexOf('MSIE 4')>0)
	T.ie5=(u.indexOf('MSIE 5.0')>0)
	T.ie55=(u.indexOf('MSIE 5.5')>0)
	T.ie6=(u.indexOf('MSIE 6.0')>0)
	if(T.ie5)T.v=5
	if(T.ie55)T.v=5.5
	if(T.ie6)T.v=6
	T.min=(T.ns||T.ie)
	T.dom=(T.v>=5)
	T.win=(u.indexOf('Win')>0)
	T.mac=(u.indexOf('Mac')>0)
}
is=new checkBrowser()


// Page Dimensions

function docW(){return(is.ie?(d.body.scrollWidth):(d.width))}
function docH(){return(is.ie?(d.body.scrollHeight):(d.height))}
function winW(){return(is.ie?(d.body.clientWidth):(window.innerWidth))}
function winH(){return(is.ie?(d.body.clientHeight):(window.innerHeight))}

// --------------------- Bloqueia entrada de aspas e plics 

function ValidaString(campo) { 
//--- VEFIFICA SE EXISTEM OS CARACTERES '," 
//--- NA STRING strTexto RETORNANDO TRUE. 
var achou;

	while((campo.value.indexOf('\'') != -1)||(campo.value.indexOf('\"') != -1)) {
		achou = true;
		if ((campo.value.match('\'')=='\'')||(campo.value.match('\"')=='\"'))
			//campo.value = campo.value.substr(0,campo.value.length-1);
			if(campo.value.match('\'') == '\'')
				campo.value = campo.value.substr(0, campo.value.indexOf('\'')) + campo.value.substr(campo.value.indexOf('\'')+1, campo.value.length-1);
			else
				campo.value = campo.value.substr(0, campo.value.indexOf('\"')) + campo.value.substr(campo.value.indexOf('\"')+1, campo.value.length-1);
		else
			return true;
	}

	return false;
}

//----------------------- Limpa Campo de login e senha

function LimpaCampo(campo){

//alert("CNPJ Incorreto !")
campo.value = '';

}


// -------------------- Valida email

function email(obj)
{
	
	if (obj.value.indexOf("@")<3)
	{
		alert("O endereço Preenchido parece não estar correto. Por favor, verifique se foi digitado o '@' ");
	 obj.focus();
	 return false;
	}
	if ((obj.value.indexOf(".com")<5)&&(obj.value.indexOf(".org")<5)
	&&(obj.value.indexOf(".gov")<5)&&(obj.value.indexOf(".net")<5)
	&&(obj.value.indexOf(".mil")<5)&&(obj.value.indexOf(".edu")<5)&&(obj.value.indexOf(".br")<5))
	{
		alert("O endereço Preenchido parece não estar correto. Por favor, "
		+" verifique o sufixo. (Deve ser um "
		+".br, .com, .edu, .net, .org, .gov ou .mil)");
	 obj.focus();
	 return false;
   	}
  if (obj.value.indexOf("@")==-1){
     alert("Campo de Email Inválido!");
	 obj.focus();
	 return false;
  }else
    return true;
}

//---------------------------Pulo do Campo

var keyPress ;

function moveNext(objAtual, objProx) {
    if ((objAtual.value.length == objAtual.maxLength) && (keyPress)) {
		objProx.focus() ;
		objProx.select() ;
		keyPress = false ;
	}

    return true ;
}

function checkKeyPress() {
	keyPress = true ;
	return true ;
}


//--------------------------- Entrada de somente numeros

function CaracteresValidos(CharsValidos,objeto)
{
// Retorna TRUE se o string str for composto somente
// por caracteres contidos no string CharsValidos.
// onchange="javascript :CaracteresValidos('0123456789',this)

	var fc_i;
	var fc_char1;
	var flag;
	var fc_a=objeto.value.length - 1;
	for (fc_i=0; fc_i<=fc_a; fc_i++)
	{
		fc_char1 = objeto.value.substring(fc_i, fc_i+1)
		flag=CharsValidos.indexOf(fc_char1)
		if (flag==-1)
		{
			alert('O campo poderá ser preenchido com números.');
			objeto.value = '';
			objeto.focus();
			return(false);
		}
	}
	
	return(true);

}

function checaData(elDia, elMes, elAno)

/* - - - - - - - - - - - - - - - - - - -
checaData
onblur="checaData(txDia, txMes, txAno)"
 - - - - - - - - - - - - - - - - - - -*/
{
  //inicia 
  var valida = true
  
  //alert(elDia.value + '\n' + elMes.value + '\n' + elAno.value)
  //checa os meses
  
  if(elMes.value >= 13) valida = false;
	
  if(elMes.value == 2)                          //se fevereiro 
  {
    if((elAno.value % 4) == 0)                  //checa quando ano for bissexto 
    {
      if(elDia.value > 29) valida = false;      //fevereiro possui 29 dias
    }
    else                                        //senao
    {
      if(elDia.value > 28) valida = false;      //fevereiro possui 28 dias
    }
  }  
  else if((elMes.value == 4) || (elMes.value == 6) || (elMes.value == 9) || (elMes.value == 11))
  {                                             //os meses abril, junho, setembro, novembro
    if(elDia.value > 30) valida = false;        //possuem 30 dias
  }
  else
  {                                             //os outros meses 
    if(elDia.value > 31) valida = false;        //possuem 31 dias
  }
	
	
  //Se foi detectado data inválida retorna com mensagem de erro e focaliza o campo.
  if(!(valida))
  {
	
    alert('Data Inválida!');
    elAno.value = '';
    elMes.value = '';
    elDia.value = '';
    elDia.focus();
    //el.select();
    return false;
  }
  return true;
}
//-------------------------------------------------
function BloqueiaData(elAno, elMes)
{	
// OnChange = "BloqueiaData(mes_ini, ano_ini);"

	var valida     	   = true;
	var objData		   = new Date();
		
	if (elAno.value >= objData.getFullYear())
	{
		if ((elMes.value-1) > objData.getMonth())
		{
			alert('A data não pode ser posteriro a data atual');
			elMes.value = '';
			elAno.value = '';
			elMes.focus();
			//el.select();
			return false;
		}
	}
	
  return true;
}
//--------------------------------------------------------
function vdVazio(el)
{
  if (el.value == '')
  {
    alert("O Campo não pode ser vazio!");
    el.focus();
    return false;
  }
  return true;
}

//---------------------------------------------------

function FmascTempoRealDt(ConteudoCampo)
{
if (((event.keyCode) > 47) && ((event.keyCode) < 58))
  {
   NumDig = ConteudoCampo.value;
   TamDig = NumDig.length;
   if (TamDig == 2)
      ConteudoCampo.value = NumDig.substr(0,2)+"/";
   else if (TamDig == 5)	  
      ConteudoCampo.value = NumDig.substr(0,5)+"/";
   else if (TamDig == 9)
       ConteudoCampo.value = NumDig.substr(0,10);

   return(true);}
else return(false)
}
//-------------------------------------------------------
function FtrataBackSpace(dado)
{
   NumDig = dado.value;
   TamDig = NumDig.length;
   TamDig--;
   Contador = 0;
   if ((TamDig >= 0) && (event.keyCode == 8))
    { numer = "";
      for (i = TamDig; (i >= 0); i--){
          if ((parseInt(NumDig.substr(i,1))>=0) && (parseInt(NumDig.substr(i, 1))<=9))
            {
             Contador++;
			 /*alert(NumDig.substr(i, 1) + " Contador " + Contador+ " numer "+ numer+ " TamDig " +TamDig + " i " + i );*/
             if ((Contador == 4) && ((TamDig -i) < 5))
              {numer = ","+numer;
               Contador = 0;
               }
             else if ((Contador == 3) && ((numer.length) > 4))  
              {numer = "."+numer;
               Contador = 0;
              }
			  
             numer = NumDig.substr(i, 1)+numer;
			
            }
			}
			if (numer == "001") 
			    numer="";		
			if ((numer.length) == 3 )
			    numer= "0," + numer;

		dado.value = numer;
      };
}

//--------------------------------------------------------------------
function FmascTempoReal(ConteudoCampo)
{
if (((event.keyCode) > 47) && ((event.keyCode) < 58))
{
   NumDig = ConteudoCampo.value;
   TamDig = NumDig.length;
   Contador = 0;
   if (TamDig > 1)
      {numer = "";
      for (i = TamDig; (i >= 0); i--){
          if ((parseInt(NumDig.substr(i,1))>=0) && (parseInt(NumDig.substr(i, 1))<=9))
            {
             Contador++;
             if ((Contador == 2) && ((TamDig -i) < 4))
              {numer = ","+numer;
               Contador = 0;
               }
             else if (Contador == 3)
              {numer = "."+numer;
               Contador = 0;
              }
             numer = NumDig.substr(i, 1)+numer;
            }
           }
      ConteudoCampo.value = numer;
      };
   return(true)}
   else return(false)
}

//*********************************************************
//   Verifica Campos Nulos
//*********************************************************
function ValidacaoCampo(form1)
{

	alert(cheguei);
	var sMensagemErro = '';

	if ( isNull( document.form1.Titulo) == true  )
	{
		sMensagemErro += 'O campo <b>Nome da Categoria</b> é de preenchimento obrigatório.<br>';
		setColor( document.form1.Titulo, '#d1d9e0' );
	}
	else
	{
		setColor( document.form1.Titulo, 'white' );
	}
	
	
	if ( isNull( document.form1.Texto) == true  )
	{
		sMensagemErro += 'O campo <b>Texto introdutório</b> é de preenchimento obrigatório.<br>';
		setColor( document.form1.Texto, '#d1d9e0' );
	}
	else
	{
		setColor( document.form1.Texto, 'white' );
	}
	
	if ( sMensagemErro == '' )
	{
		return true;
	}
	else
	{
		writeError( sMensagemErro );
		return false;					
	}
}


