//------ trecho de codigo para aumentar ou diminuir a fonte ------
var tgs = new Array( 'div','td','tr','a','p','font');

//Specify spectrum of different font sizes:
var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz;

if(getCookie("fontSize")){
	startSz = parseFloat(getCookie("fontSize"));
}else{
	startSz = 10;
}

function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;

	if(inc==0) sz = 10;
	sz += inc;
	if ( sz < 8 ) sz = 8;
	if ( sz > 18 ) sz = 18;
	startSz = sz;

	if(!(cEl = d.getElementById(trgt))) cEl = d.getElementsByTagName( trgt )[ 0 ];

	//cEl.style.fontSize = szs[ sz ];
	cEl.style.fontSize = sz+'px';

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		//for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = sz+'px';
	}

	//alert(sz);
	deleteCookie("fontSize","/");
	setCookie( "fontSize", sz, 180, "/" );
    //return false;
}

// 

function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}


//-----------------------------------------------------------------------

function FormataValor(objeto,tammax,teclapres) {
	caracteres = '01234567890';
	campo = eval (objeto)
	var tecla = teclapres.keyCode;
	vr = campo.value;
	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 Mascara (formato, keypress, objeto){
		campo = eval (objeto);
		// CEP
		if (formato=='DATA')	{
			caracteres = '01234567890';
			separacoes = 2;
			separacao1 = '/';
			if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (10)) {
				if (campo.value.length == 2) 
				campo.value = campo.value + separacao1;
				if (campo.value.length == 5) 
				campo.value = campo.value + separacao1;
			} else {
				event.returnValue = false;
			}
		}
		if (formato=='NUMERO'){
			caracteres = ',.01234567890';
			if(caracteres.search(String.fromCharCode(keypress))==-1) {
				event.returnValue = false;
			}
		}
		if (formato=='CEP'){
			separador = '-'; 
			conjunto1 = 5;
			caracteres = '01234567890';
			separacao1 = '-';
			if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (9)) {
				if (campo.value.length == 5) 
				campo.value = campo.value + separacao1;
			} else {
				event.returnValue = false;
			}


		}
		if (formato=='TEL')	{
			caracteres = '01234567890';
			separacoes = 2;
			separacao1 = '(';
			separacao2 = ')';
			separacao3 = ' ';
			separacao4 = '-';
			if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (14)) {
				if (campo.value.length == 0) 
				campo.value = campo.value + separacao1;
				if (campo.value.length == 3) 
				campo.value = campo.value + separacao2;
				if (campo.value.length == 4) 
				campo.value = campo.value + separacao3;
				if (campo.value.length == 9) 
				campo.value = campo.value + separacao4;
			} else {
				event.returnValue = false;
			}
		}

		//
		if (formato=='CIC'){
			caracteres = '01234567890';
			val = campo.value.substring(2,3);
			if(val == "."){
				if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (18)) {
					separador = '.'; 
					separador1 = '/'; 
					separador2 = '-'; 
					conjunto1 = 2;
					conjunto2 = 6;
					conjunto3 = 10;
					conjunto4 = 15;
					if (campo.value.length == conjunto1){
						campo.value = campo.value + separador;
					}
					if (campo.value.length == conjunto2){
						campo.value = campo.value + separador;
					}
					if (campo.value.length == conjunto3){
						campo.value = campo.value + separador1;
					}
					if (campo.value.length == conjunto4){
						campo.value = campo.value + separador2;
					}
				}else{
					event.returnValue = false;
				}
			}
			else{
				if ((caracteres.search(String.fromCharCode (keypress))!=-1) && campo.value.length < (14)) {
					separador = '.'; 
					separador2 = '-'; 
					conjunto1 = 3;
					conjunto2 = 7;
					conjunto3 = 11;
					if (campo.value.length == conjunto1){
						campo.value = campo.value + separador;
					}
					if (campo.value.length == conjunto2){
						campo.value = campo.value + separador;
					}
					if (campo.value.length == conjunto3){
						campo.value = campo.value + separador2;
					}
				}else{
					event.returnValue = false;
				}
			}
	}
}