//cores TR
	function Move(obj, cor){
		//obj.style.backgroundColor = '#1a743b';
		obj.style.backgroundColor = cor;
	}
	function Mout(obj, cor){
		obj.style.backgroundColor = cor;
	}
// -------------------------------------------------------------------

//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;
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.

{

   var arVersion = navigator.appVersion.split("MSIE")

   var version = parseFloat(arVersion[1])

   if ((version >= 5.5) && (document.body.filters)) 

   {

      for(var i=0; i<document.images.length; i++)

      {

         var img = document.images[i]

         var imgName = img.src.toUpperCase()

         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")

         {

            var imgID = (img.id) ? "id='" + img.id + "' " : ""

            var imgClass = (img.className) ? "class='" + img.className + "' " : ""

            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "

            var imgStyle = "display:inline-block;" + img.style.cssText 

            if (img.align == "left") imgStyle = "float:left;" + imgStyle

            if (img.align == "right") imgStyle = "float:right;" + imgStyle

            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle

            var strNewHTML = "<span " + imgID + imgClass + imgTitle

            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"

            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"

            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 

            img.outerHTML = strNewHTML

            i = i-1

         }

      }

   }    

}

window.attachEvent("onload", correctPNG);


// writeObj : embed,object ±â¼ú
function writeObj(code) {
    document.write(code);
}
//-------------------------------------------------------------------------------------------------------------
function MoveVerde(obj){
	obj.style.backgroundColor = '#00BD7B';
}
function MoveAmarelo(obj){
	obj.style.backgroundColor = '#FFD947';
}
function Mout(obj, cor){
	obj.style.backgroundColor = cor;
}
function mostraL(nome) {
	if(document.all[nome].style.display=="none"){
	document.all[nome].style.display = "";
	}else{
	document.all[nome].style.display = "none";}
}

//abre pop up
	function MM_openBrWindow(theURL,winName,features) { //v2.0
	  window.open(theURL,winName,features);
	}

//sem letras
	function SemLetras(){
		if ((window.event.keyCode < 48) | (window.event.keyCode > 57)){
			window.event.keyCode = 0
		}
	}

//pula de campo
	function Pula(f){
		if(f.value.length==f.maxLength){
		for(var i=0;i<f.form.length;i++){
			if(f.form[i]==f){f.form[i+1].focus();break}
			}
		}
	}

//**************************************************************************************************************************************
//validacao CPF
function validaCPF() {
		 cpf = document.form.cpf.value;
		 erro = new String;
		 if (cpf.length == null)erro += "São necessários 11 digitos para verificação do CPF! "; 
		 if (cpf.length < 11)erro += "São necessários 11 digitos para verificação do CPF! "; 
		 var nonNumbers = /\D/;
		 if (nonNumbers.test(cpf)) erro += "A verificação de CPF suporta apenas números! "; 
		 if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999"){
				 erro += "Número de CPF inválido!"
	   }
	   var a = [];
	   var b = new Number;
	   var c = 11;
	   for (i=0; i<11; i++){
			   a[i] = cpf.charAt(i);
			   if (i < 9) b += (a[i] * --c);
	   }
	   if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
	   b = 0;
	   c = 11;
	   for (y=0; y<10; y++) b += (a[y] * c--); 
	   if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
	   if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])){
				 erro += "Número de CPF inválido!"
	   }
	   if (erro.length > 0){
			   alert(erro);
			   document.form.cpf.value="";
			   document.form.cpf.focus();
			   return false;
	   }

	   return true;
	   

}
//**************************************************************************************************************************************
//validacao CNPJ
 function validaCNPJ() {
		 CNPJ = document.form.cnpj.value;
		 erro = new String;
		 if (CNPJ.length < 14) erro += "CNPJ incorreto! "; 
		 //if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-")){
		 //if (erro.length == 0) erro += "É necessário preencher corretamente o número do CNPJ! ";
		 //}
		 //substituir os caracteres que não são números
	   if(document.layers && parseInt(navigator.appVersion) == 4){
			   x = CNPJ.substring(0,2);
			   x += CNPJ. substring (3,6);
			   x += CNPJ. substring (7,10);
			   x += CNPJ. substring (11,15);
			   x += CNPJ. substring (16,18);
			   CNPJ = x; 
	   } else {
			   CNPJ = CNPJ. replace (".","");
			   CNPJ = CNPJ. replace (".","");
			   CNPJ = CNPJ. replace ("-","");
			   CNPJ = CNPJ. replace ("/","");
	   }
	   var nonNumbers = /\D/;
	   if (nonNumbers.test(CNPJ)) erro += "A verificação de CNPJ suporta apenas números! "; 
	   var a = [];
	   var b = new Number;
	   var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
	   for (i=0; i<12; i++){
			   a[i] = CNPJ.charAt(i);
			   b += a[i] * c[i+1];
}
	   if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
	   b = 0;
	   for (y=0; y<13; y++) {
			   b += (a[y] * c[y]); 
	   }
	   if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
	   if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13])){
			   erro +="CNPJ inválido!";
	   }
	   if (erro.length > 0){
			   alert(erro);
			   document.form.cnpj.value="";
			   document.form.cnpj.focus();
			   return false;
	   //} else {
		//	   alert("CNPJ valido!");
	   }
	   return 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_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_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}
