
// Código para validação de formulário
//
campos_erro	= "";
erro 		= false;
function isNumero(valor){	
	var ver_numero = "1234567890";
	var cont = 0;
	
	for (i = 0;  i < valor.length;  i++){
		ch = valor.charAt(i);
		for (j = 0;  j < ver_numero.length;  j++){
			if (ch == ver_numero.charAt(j)){
				cont++;
			}
		}
	}
	if (cont == valor.length){
		return true
	}else{
		return false;
	}
}
function evita_letra(tecla) {  
     if (tecla.keyCode < 45 || tecla.keyCode > 57 || tecla.keyCode == 47 || tecla.keyCode == 45 || tecla.keyCode == 46)  
          tecla.returnValue = false;  
}
function validaData(campo){
	dia = document.form[campo].value.substring(0,2); 
	mes = document.form[campo].value.substring(3,5); 
	ano = document.form[campo].value.substring(6,10); 		

	mensagem = "Erro na data";		
	if(!isNumero(dia+mes+ano)){
		alert("No campo 'DATA' deve conter apenas número!");
		
		comando2 = "document.all."+campo+".style.backgroundColor = 'red'";
		erro = true;
		eval(comando2);
	}else if(document.form[campo].value.length != 10){
		alert("Tamanho da data inválido!");
		
		comando2 = "document.all.data.style.backgroundColor = 'red'";
		erro = true;
		eval(comando2);
	}else{
		if(dia < 1 || dia > 31){
			alert("No campo 'DATA' o dia é inválido!");
			
			comando2 = "document.all."+campo+".style.backgroundColor = 'red'";
		    erro = true;
		    eval(comando2);
		}else if(mes < 1 || mes > 12){
			alert("No campo 'DATA' o mês é inválido!");
			
			comando2 = "document.all."+campo+".style.backgroundColor = 'red'";
		    erro = true;
		    eval(comando2);	
		}else if(ano < 1900 || ano > 3000){
			alert("No campo 'DATA' o ano é inválido!");
			
			comando2 = "document.all."+campo+".style.backgroundColor = 'red'";
		    erro = true;
		    eval(comando2);
		}	
	}	
}
function valida(campo){
	comando = "document.form."+campo+".value";
	resulta = eval(comando);

	if (resulta == ""){
		comando2 = "document.all."+campo+".style.backgroundColor = 'red'";
		erro = true;
		eval(comando2);
	}
}
function submeter(arrayComCampos){
	campos 	= arrayComCampos;
	cont	= campos.length;
	
	for (i=0 ; i<cont; i++){
		
		if (campos[i] == "asd") {
		validaData(campos[i]);
		} else {
		valida(campos[i]);
		}
	}

	if(!erro){
		cmd_sub = "document.form.submit()";
		eval (cmd_sub);
		
	}else{
		alert ('Os campos marcados em vermelho sao de preenchimento obrigatório!');
		campos_erro="";
	}
}
function limpa_fundo(campo){
		comando3 = "document.all."+campo+".style.backgroundColor = 'white'";
		eval(comando3);
		erro = false;
}


// ------------------------------------------ FIM do Código para validação de formulário



function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function DisplayInfo(pagina,janela,w,h,scrolling) {
 if (!scrolling) { scrolling="auto" } resultado = window.open(pagina,janela,"width="+w+",height="+h+",scrollbars="+scrolling+",toolbar=no,location=no,status=yes,menubar=yes,resizable=yes,left=5,top=5")
}


function boldThis(from) { 
	strSelection = document.selection.createRange().text 
	if (strSelection == "") { 
	return false; 
	} 
	else document.selection.createRange().text = "<b>" + strSelection 
	+ "</b>" 
	return;
}

function italicThis(from) { 
	strSelection = document.selection.createRange().text 
	if (strSelection == "") { 
	return false; 
	} 
	else document.selection.createRange().text = "<i>" + strSelection 
	+ "</i>" 
	return;
}

function underlineThis(from) { 
	strSelection = document.selection.createRange().text 
	if (strSelection == "") { 
	return false; 
	} 
	else document.selection.createRange().text = "<u>" + strSelection 
	+ "</u>" 
	return;
}

function changecolor(t) { 
	strSelection = document.selection.createRange().text 
	if (strSelection == "") { 
	return false; 
	} 
	else document.selection.createRange().text = "<font" + " color" +"=" +t+">" + strSelection 
	+ "</font>" 
	return;
}

function changesize(t) { 
	strSelection = document.selection.createRange().text 
	if (strSelection == "") { 
	return false; 
	} 
	else document.selection.createRange().text = "<font" + " size" +"=" +t+">" + strSelection 
	+ "</font>" 
	return;
}
function changealign(t) { 
	strSelection = document.selection.createRange().text 
	if (strSelection == "") { 
	return false; 
	} 
	else document.selection.createRange().text = "<div" + " align" +"=" +t+">" + strSelection 
	+ "</div>" 
	return;
}

function DisplayInfo(pagina,janela,w,h,scrolling) {
 if (!scrolling) { scrolling="auto" } resultado = window.open(pagina,janela,"width="+w+",height="+h+",scrollbars="+scrolling+",toolbar=no,location=no,status=yes,menubar=yes,resizable=yes,left=5,top=5")
}

function FormataData(campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = document.form[campo].value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			document.form[campo].value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
		if ( tam >= 5 && tam <= 10 )
			document.form[campo].value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); 
	}
}
function FormataHora(campo,teclapres) {
	var tecla = teclapres.keyCode;
	vr = document.form[campo].value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( ":", "" );
	vr = vr.replace( ":", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			document.form[campo].value = vr.substr( 0, tam - 2  ) + ':' + vr.substr( tam - 2, tam );
	}
}
function imprimir(id) {
 DisplayInfo("imprimir.php?id="+id,"imprimir",600,500,"yes","no");
}

function opened(url,frame,param)
{
window.open(url,frame,param);
}
function home_sub(url)
{
top.opener.top.location.href=url;
window.self.close();
}
function openPopUp(URL, NAME, OPTIONS) 
{
window.open(URL,NAME,OPTIONS);
}

function clearall (form) {
	form.reset();
}

function jczOpenWindow(theURL,winName) {
	window.open(theURL,winName,'status=yes,scrollbars=no,width=300,height=300');

}
function DisplayInfo(pagina,janela,w,h,scrolling) {
 if (!scrolling) { scrolling="auto" } resultado = window.open(pagina,janela,"width="+w+",height="+h+",scrollbars="+scrolling+",toolbar=no,location=no,status=yes,menubar=yes,resizable=yes,left=5,top=5")
}

function submit_login() {
	if (document.implogin.imapuser.value == "") {
		alert('Por favor, informe seu nome de usuário e sua senha');
		return false;
	} else if (document.implogin.pass.value == "") {
		alert('Por favor, informe seu nome de usuário e sua senha');
		return false;
	} else {
		document.implogin.submit();
	}
}

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_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_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_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 popup(menuName,mostra) {
			if (mostra) {
			document.getElementById(menuName).style.visibility = "visible";
			} else {
			document.getElementById(menuName).style.visibility = "hidden";
		}
	}


//CORREÇÃO DO FLASH PARA IE

//v1.0
//Copyright 2006 Adobe Systems, Inc. All rights reserved.
function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '<object ';
  for (var i in objAttrs)
    str += i + '="' + objAttrs[i] + '" ';
  str += '>';
  for (var i in params)
    str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  str += '<embed ';
  for (var i in embedAttrs)
    str += i + '="' + embedAttrs[i] + '" ';
  str += ' ></embed></object>';

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "id":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}

// FINAL DA CORREÇÃO IE



<!-- // INÍCIO ANIMAÇÃO DO CABEÇALHO

function imgCycle(dir) { with (this)
{
 // Stop any exiting play function if this is called manually.
 stop();

 // Increment and mod by the image array length.
 currImg += dir;
 currImg = currImg % data.length;
 if (currImg < 0) currImg += data.length;

 // The image in question -- perhaps nested within its parent layer for NS4.
 var imgRef = parLyr.document.images[myName + 'Img'];

 // IE filters active?
 var f = imgRef.filters;
 if (f&&f.length&&f[0]) f[0].Apply();
 // Swap the image, and play the filter if applicable.
 imgRef.src = data[currImg].src;
 if (f&&f.length&&f[0]) f[0].Play();
}}

function imgPlay() { with (this)
{
 // Cycle one image forwards -- cycle() will stop an existing timeout if applied.
 cycle(1);
 timer = setTimeout(myName + '.play()', delay);
}}

function imgStop()
{
 // Clear the play timer to stop autocycling.
 clearTimeout(this.timer);
 this.timer = null;
}

function ImageCycle(myName, delay, parLyr)
{
 this.myName = myName;
 this.delay = delay;
 this.timer = 0;
 this.parLyr = (document.layers && parLyr ? eval(parLyr) : window);
 this.currImg = 0;

 this.data = new Array();
 for (var i = 3; i < arguments.length; i++)
 {
  // Preload images into an array before swapping.
  this.data[i - 3] = new Image();
  this.data[i - 3].src = arguments[i];
 }
 
 this.cycle = imgCycle;
 this.play = imgPlay;
 this.stop = imgStop;
}

// *** START EDITING HERE ***

// Create a new image object, and pass its own name and delay between cycles in milliseconds.
// The third parameter is optional -- if you're positioning the image within an NS4 layer make
// it a string that when evaluated returns a reference to the layer, or just leave it null as is. 
// The fourth parameter onwards is a list of image filenames, replace with your own images of course.


// And stop cycling in 20 seconds.
//setTimeout('picRotate.stop()', 30000);

// FIM ANIMAÇÃO CABEÇALHO -->