<!-- MANIPULAR PROPRIEDADES CSS
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_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+"'");
  }
}
//-->


<!-- PRELOAD DE ROLLOVER
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.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 FormataData(Campo,teclapres) {
    if(navigator.userAgent.toUpperCase().indexOf("MSIE")+1) tecla=teclapres.keyCode;
    else tecla=teclapres.which;

    campo=eval("document.form1.elements['"+Campo+"']");
    vr = campo.value;
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    vr = vr.replace( "/", "" );
    tam = vr.length + 1;
    if((tecla > 46 && tecla < 58) || (tecla > 95 && tecla < 106)) {
        if( tam > 2 && tam < 5 ) campo.value = vr.substr( 0, tam - 2 ) + '/' + vr.substr( tam - 2, tam );
        if( tam >= 5 && tam <= 10 ) campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); }
}

function num(e) {
    if(navigator.userAgent.toUpperCase().indexOf("MSIE")+1) cod=e.keyCode;
    else cod=e.which;
    if(!(cod > 46 && cod < 58) && !(cod==8) && !(cod==0)) return false;
}

function FormataCep(Campo,teclapres) {
    if(navigator.userAgent.toUpperCase().indexOf("MSIE")+1) tecla=teclapres.keyCode;
    else tecla=teclapres.which;

    campo=eval("document.form1.elements['"+Campo+"']");
    vr = campo.value;
    vr = vr.replace( "-", "" );
    tam = vr.length + 1;
    if((tecla > 46 && tecla < 58) || (tecla > 95 && tecla < 106)) {
        if( tam > 5 ) campo.value = vr.substr( 0, tam - 4 ) + '-' + vr.substr( tam - 4, tam );
	}
}

function FormataTel(Campo,teclapres) {
    if(navigator.userAgent.toUpperCase().indexOf("MSIE")+1) tecla=teclapres.keyCode;
    else tecla=teclapres.which;

    campo=eval("document.form1.elements['"+Campo+"']");
    vr = campo.value;
    vr = vr.replace( "(", "" );
    vr = vr.replace( ")", "" );
    vr = vr.replace( "-", "" );
    tam = vr.length + 1;
	if((tecla > 46 && tecla < 58) || (tecla > 95 && tecla < 106) && tam<12) {
        if( tam > 1 ) campo.value = '(' + vr.substr( 0, tam );
        if( tam > 3 ) campo.value = '(' + vr.substr( 0, 2 ) + ')' + vr.substr( 2, tam );
        if( tam > 7 ) campo.value = '(' + vr.substr( 0, 2 ) + ')' + vr.substr( 2,4 ) + '-' + vr.substr(6,tam);
	}
}

function FormataCpf(campo,e) {
	tammax=11;
    if(navigator.userAgent.toUpperCase().indexOf("MSIE")+1) tecla=e.keyCode;
    else tecla=e.which;
	vr = campo.value;

	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	tam = vr.length;

	if (tam < tammax && tecla != 8){ tam = vr.length + 1; }

	if (tecla == 8 ){ tam = tam - 1; }
 
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){ campo.value = vr; }
		if ( (tam > 2) && (tam <= 5) ) { campo.value = vr.substr( 0, tam - 2 ) + '-' + vr.substr( tam - 2, tam ); }
		if ( (tam >= 6) && (tam <= 8) ){ campo.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ); }
		if ( (tam >= 9) && (tam <= 11) ){ campo.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ); }
		if ( (tam >= 12) && (tam <= 14) ){ campo.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam ); }
		if ( (tam >= 15) && (tam <= 17) ){ campo.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + '-' + vr.substr( tam - 2, tam );}
	} 
}

function verificarCPF(c){
	var i; 
	c = c.replace( "/", "" );
	c = c.replace( "/", "" );
	c = c.replace( ",", "" );
	c = c.replace( ".", "" );
	c = c.replace( ".", "" );
	c = c.replace( ".", "" );
	c = c.replace( ".", "" );
	c = c.replace( "-", "" );
	c = c.replace( "-", "" );
	c = c.replace( "-", "" );
	c = c.replace( "-", "" );
	c = c.replace( "-", "" );
	s = c;

	var c = s.substr(0,9); 
	var dv = s.substr(9,2); 
	var d1 = 0; 
	var v = false;
	for (i = 0; i < 9; i++) d1 += c.charAt(i)*(10-i); 
	if (d1 == 0) return false; 
	d1 = 11 - (d1 % 11); 
	if (d1 > 9) d1 = 0; 
	if (dv.charAt(0) != d1) return false; 

	d1 *= 2; 
	for (i = 0; i < 9; i++) d1 += c.charAt(i)*(11-i); 
	d1 = 11 - (d1 % 11); 
	if (d1 > 9) d1 = 0; 
	if (dv.charAt(1) != d1) return false; 

	return true;
}



function Formata(campo,tammax,teclapres,decimal) {
	var tecla = teclapres.keyCode;
	vr = Limpar(campo.value,"0123456789");
	tam = vr.length;
	dec=decimal;
	
	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }
	if (tecla == 8 ) { tam = tam - 1 ; }	
		if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 )
		{
			if ( tam <= dec )
			{ 
				campo.value = vr ; 
			}
				if ( (tam > dec) && (tam <= 5) )
				{
					campo.value = vr.substr( 0, tam - 2 ) + "." + vr.substr( tam - dec, tam ) ; 
				}
					if ( (tam >= 6) && (tam <= 8) )
					{
						campo.value = vr.substr( 0, tam - 5 ) + "" + vr.substr( tam - 5, 3 ) + "." + vr.substr( tam - dec, tam ) ; 
					}
					if ( (tam >= 9) && (tam <= 11) )
					{
			campo.value = vr.substr( 0, tam - 8 ) + "" + vr.substr( tam - 8, 3 ) + "" + vr.substr( tam - 5, 3 ) + "." + vr.substr( tam - dec, tam ) ; 
					}
					if ( (tam >= 12) && (tam <= 14) )
					{
					campo.value = vr.substr( 0, tam - 11 ) + "" + vr.substr( tam - 11, 3 ) + "" + vr.substr( tam - 8, 3 ) + "" + vr.substr( tam - 5, 3 ) + "." + vr.substr( tam - dec, tam ) ; 
					} 
		if ( (tam >= 15) && (tam <= 17) ) {
			campo.value = vr.substr( 0, tam - 14 ) + "" + vr.substr( tam - 14, 3 ) + "" + vr.substr( tam - 11, 3 ) + "" + vr.substr( tam - 8, 3 ) + "" + vr.substr( tam - 5, 3 ) + "." + vr.substr( tam - 2, tam ) ;
		}
	} 
}

function Limpar(valor, validos) {
// retira caracteres invalidos da string
var result = "";
var aux;
for (var i=0; i < valor.length; i++) {
aux = validos.indexOf(valor.substring(i, i+1));
if (aux>=0) {
result += aux;
}
}
return result;
}


//-->

// SWAP AND PRELOAD IMAGES

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 swap(s) {
	MM_swapImage(s.id,'','imgs/menu_'+s.id+'_over.gif',1)
}

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; }
}

// SCROLL 
			tira_balao=false;

function lib_bwcheck(){ 
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5 || this.ie7)
	return this
}
var bw=new lib_bwcheck()

var numScrollPages = 1;
var transitionOut = 1;
var transitionIn = 2;
var slideAcceleration = 10.0;
var transitionOnload = 1 

var px = bw.ns4||window.opera?"":"px";

if(document.layers){ 
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}

function scrollerobj(obj,nest){
	nest = (!nest)?"":'document.'+nest+'.'
	this.elm = bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):document.getElementById(obj)
	this.css = bw.ns4?this.elm:this.elm.style
	this.doc = bw.ns4?this.elm.document:document
	this.obj = obj+'scrollerobj'; eval(this.obj+'=this')
	this.x = (bw.ns4||bw.opera5)?this.css.left:this.elm.offsetLeft
	this.y = (bw.ns4||bw.opera5)?this.css.top:this.elm.offsetTop
	this.w = (bw.ie4||bw.ie5||bw.ie6||bw.ie7||bw.ns6)?this.elm.offsetWidth:bw.ns4?this.elm.clip.width:bw.opera5?this.css.pixelWidth:0
	this.h = (bw.ie4||bw.ie5||bw.ie6||bw.ie7||bw.ns6)?this.elm.offsetHeight:bw.ns4?this.elm.clip.height:bw.opera5?this.css.pixelHeight:0
//	alert("aqui! "+this.elm.offsetHeight);
}

scrollerobj.prototype.moveTo = function(x,y){
	if(x!=null){this.x=x; this.css.left=x+px}
	if(y!=null){this.y=y; this.css.top=y+px}
}
scrollerobj.prototype.moveBy = function(x,y){this.moveTo(this.x+x,this.y+y)}
scrollerobj.prototype.hideIt = function(){this.css.visibility='hidden'}
scrollerobj.prototype.showIt = function(){this.css.visibility='visible'}

var scrollTimer = null;

function scroll(step){
	clearTimeout(scrollTimer);
	if (!busy && (step<0&&activePage.y+activePage.h>scroller1.h || step>0&&activePage.y<0)){
		activePage.moveBy(0,step);
		scrollTimer = setTimeout('scroll('+step+')',40);
	}
}
function stopScroll(){
	clearTimeout(scrollTimer);
}

var activePage = null;
var busy = 0;
function activate(num){
	if (activePage!=pages[num] && !busy){
		busy = 1;
		if (transitionOut==0 || !bw.opacity){ activePage.hideIt(); activateContinue(num); }
		else if (transitionOut==1) activePage.blend('hidden', 'activateContinue('+num+')');
	}
}
function activateContinue(num){
	busy = 1;
	activePage = pages[num];
	activePage.moveTo(0,0);
	if (transitionIn==0 || !bw.opacity){ activePage.showIt(); busy=0; }
	else if (transitionIn==1) activePage.blend('visible', 'busy=0');
	else if (transitionIn==2) activePage.slide(0, slideAcceleration, 40, 'busy=0');
}

scrollerobj.prototype.slide = function(target, acceleration, time, fn){
	this.slideFn= fn?fn:null;
	this.moveTo(0,scroller1.h);
	if (bw.ie4&&!bw.mac) this.css.filter = 'alpha(opacity=100)';
	if (bw.ns6) this.css.MozOpacity = 1;
	this.showIt();
	this.doSlide(target, acceleration, time);
}
scrollerobj.prototype.doSlide = function(target, acceleration, time){
	this.step = Math.round(this.y*acceleration);
	if (this.step<1) this.step = 1;
	if (this.step>this.y) this.step = this.y;
	this.moveBy(0, -this.step);
	if (this.y>0) this.slideTim = setTimeout(this.obj+'.doSlide('+target+','+acceleration+','+time+')', time);
	else {	
		eval(this.slideFn);
		this.slideFn = null;
	}
}

scrollerobj.prototype.blend= function(vis, fn){
	if (bw.ie5||bw.ie6||bw.ie7 && !bw.mac) {
		if (vis=='visible') this.css.filter= 'blendTrans(duration=0.9)';
		else this.css.filter= 'blendTrans(duration=0.6)';
		this.elm.onfilterchange = function(){ eval(fn); };
		this.elm.filters.blendTrans.apply();
		this.css.visibility= vis;
		this.elm.filters.blendTrans.play();
	}
	else if (bw.ns6 || bw.ie&&!bw.mac){
		this.css.visibility= 'visible';
		vis=='visible' ? this.fadeTo(100, 7, 40, fn) : this.fadeTo(0, 9, 40, fn);
	}
	else {
		this.css.visibility= vis;
		eval(fn);
	}
}

scrollerobj.prototype.op= 100;
scrollerobj.prototype.opacityTim= null;
scrollerobj.prototype.setOpacity= function(num){
	this.css.filter= 'alpha(opacity='+num+')';
	this.css.MozOpacity= num/100;
	this.op= num;
}

scrollerobj.prototype.fadeTo= function(target, step, time, fn){
	clearTimeout(this.opacityTim);
	this.opacityFn= fn?fn:null;
	this.op = target==100 ? 0 : 100;
	this.fade(target, step, time);
}

scrollerobj.prototype.fade= function(target, step, time){
	if (Math.abs(target-this.op)>step){
		target>this.op? this.setOpacity(this.op+step):this.setOpacity(this.op-step);
		this.opacityTim= setTimeout(this.obj+'.fade('+target+','+step+','+time+')', time);
	}
	else {
		this.setOpacity(target);
		eval(this.opacityFn);
		this.opacityFn= null;
	}
}

var pageslidefadeLoaded = 0;
function initPageSlideFade(num){
	scroller1 = new scrollerobj('divScroller'+num);
	pages = new Array();
	for (var i=0; i<numScrollPages; i++){
		pages[i] = new scrollerobj('dynPage'+i, 'divScroller'+num);
		pages[i].moveTo(0,0);
	}
//	bw.opacity = ( bw.ie && !bw.ie4 && navigator.userAgent.indexOf('Windows')>-1 ) || bw.ns6
//	if (bw.ie5||bw.ie6 && !bw.mac) pages[0].css.filter= 'blendTrans(duration=0.6)'; // Preloads the windows filters.
	if (transitionOnload) activateContinue(0);
	else{
		activePage = pages[0];
		activePage.showIt();
	}
	if (bw.ie) for(var i=0;i<document.links.length;i++) document.links[i].onfocus=document.links[i].blur;
	pageslidefadeLoaded = 1;
}

function getY( oElement ) {
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX( oElement ) {
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}


// BANCO DE IMAGENS

//início controle da tela de travamento
function cont_aguarde(i) {
	if(document.getElementById("aguarded").display!="none") { ; }
	else time="";
}

function retorna_dimensoes(){
	var xScroll, yScroll;
//	xScroll = document.documentElement["scrollWidth"];
//	yScroll = document.documentElement["scrollHeight"];

	yScroll=document.documentElement["clientHeight"];
	xScroll=document.documentElement["clientWidth"];

	return Array(xScroll,yScroll);
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	)
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}


faztimet=false;
time="";
function adt(){
	if(faztimet) {
		texto1=document.getElementById("aguarded");

		posY=f_scrollTop();
		texto1.style.top=(posY+topm)+"px";

		time=setTimeout("adt()",200);
	}
}

topm="";

chamou_aguarde=0;

function aguarde(img,legenda,w,h,lin) {
	travatela=document.getElementById("trava")
	imgtravatela=document.getElementById("aguarded")
	
	imgtravatela.style.width=w+"px";
	document.getElementById("legenda").innerHTML=legenda;
	
//	document.getElementById("recebe_imagem").src="imgs/banco_imagens/"+img;
//	alert(img);
	
	/*document.getElementById("recebe_imagem").src=img;
	aux=img;*/
	document.getElementById("recebe_imagem").src=img;
	//document.getElementById("recebe_imagem").src=aux+"&muda="+Math.random()*5000;
	
//	alert(lin);
	document.getElementById("links").href=lin;
	
	//imgtravatela.innerHTML="";
	valores1=retorna_dimensoes();	
	imgtravatela.style.display="";		
	travatela.style.display="";

//	travatela.style.width="100%";
//	travatela.style.height="100%";

	travatela.style.width=valores1[0]+"px";
	travatela.style.height=valores1[1]+"px";

	topo1=document.documentElement["clientHeight"];
	
	IpopTop=(topo1-(h+70))/2;
	IpopLeft=(valores1[0]-(w+20))/2;

	topm=IpopTop;
	
	imgtravatela.style.left=IpopLeft+document.body.scrollLeft+"px";
	imgtravatela.style.top=IpopTop+document.body.scrollTop+"px"
	faztimet=true;
	

	adt();

	cont_aguarde(0);
	chamou_aguarde=1;
}

function fecha_aguarde(forca) {
	document.getElementById("recebe_imagem").src="imgs/sp.gif";
	
	if(forca) chamou_aguarde=0;
		
	if(!chamou_aguarde) {
		faztimet=false;
		document.getElementById("trava").style.display="none";
		document.getElementById("aguarded").style.display="none";
		
		time="";
	}
}

function trava_tela() {
	valores1=retorna_dimensoes();	
	travatela=document.getElementById("trava");	
	travatela.style.display="";	
	
	travatela.style.width=valores1[0]+"px";
	travatela.style.height=valores1[1]+"px";	
}

//fim controle da tela de travamento
