// JavaScript Document

	function startList () {
		if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
		node.onmouseover=function() {
		this.className+=" over";
		  }
		  node.onmouseout=function() {
		  this.className=this.className.replace
			(" over", "");
		   }
		   }
		  }
		 }
		 if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav2");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
		node.onmouseover=function() {
		this.className+=" over";
		  }
		  node.onmouseout=function() {
		  this.className=this.className.replace
			(" over", "");
		   }
		   }
		  }
		 }
		  if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav3");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
		node.onmouseover=function() {
		this.className+=" over";
		  }
		  node.onmouseout=function() {
		  this.className=this.className.replace
			(" over", "");
		   }
		   }
		  }
		 }
		 if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav4");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
		node.onmouseover=function() {
		this.className+=" over";
		  }
		  node.onmouseout=function() {
		  this.className=this.className.replace
			(" over", "");
		   }
		   }
		  }
		 }
		 if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav5");
		for (i=0; i<navRoot.childNodes.length; i++) {
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
		node.onmouseover=function() {
		this.className+=" over";
		  }
		  node.onmouseout=function() {
		  this.className=this.className.replace
			(" over", "");
		   }
		   }
		  }
		 }
		}




//flash
function flash(arquivo, largura, altura)
{
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='" + largura + "' height='" + altura + "' ID=flashad>")
    document.write("<param name='allowScriptAccess' value='sameDomain' /><param name='movie' value='" + arquivo + "'>")
    document.write("<param name='quality' value='high'><param name='wmode' value='transparent' />")
    document.write("<embed src='" + arquivo + "' quality='best' wmode='transparent'  bgcolor='#ffffff' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + largura + "' height='" + altura + "'></embed>")
    document.write("</object>")
}



function Mascara(tipo, campo, teclaPress) {
	if (window.event) {
		var tecla = teclaPress.keyCode;
	} else {
		tecla = teclaPress.which;
	}

	var s = new String(campo.value);
	// Remove todos os caracteres à seguir: ( ) / - . e espaço, para tratar a string denovo.
	s = s.replace(/(\.|\(|\)|\/|\-| )+/g, '');

	tam = s.length + 1;

	if (tecla != 9 && tecla != 8) {
		switch (tipo) {
			case 'CPF':
				if (tam > 3 && tam < 7)
					campo.value = s.substr(0, 3) + '.' + s.substr(3, tam);
				if (tam >= 7 && tam < 10)
					campo.value = s.substr(0, 3) + '.' + s.substr(3, 3) + '.' + s.substr(6, tam - 6);
				if (tam >= 10 && tam < 12)
					campo.value = s.substr(0, 3) + '.' + s.substr(3, 3) + '.' + s.substr(6, 3) + '-' + s.substr(9, tam - 9);
				break;

			case 'CNPJ':

				if (!(tecla >= 48 && tecla <= 57)) {
					if (tecla != 0) {
						return false
					}
				} else {

					if (tam > 2 && tam < 6)
						campo.value = s.substr(0, 2) + '.' + s.substr(2, tam);
					if (tam >= 6 && tam < 9)
						campo.value = s.substr(0, 2) + '.' + s.substr(2, 3) + '.' + s.substr(5, tam - 5);
					if (tam >= 9 && tam < 13)
						campo.value = s.substr(0, 2) + '.' + s.substr(2, 3) + '.' + s.substr(5, 3) + '/' + s.substr(8, tam - 8);
					if (tam >= 13 && tam < 15)
						campo.value = s.substr(0, 2) + '.' + s.substr(2, 3) + '.' + s.substr(5, 3) + '/' + s.substr(8, 4) + '-' + s.substr(12, tam - 12);
				}

				break;

			case 'TEL':

				if (!(tecla >= 48 && tecla <= 57)) {
					if (tecla != 0) {
						return false
					}
				} else {
					if (tam > 2 && tam < 4)
						campo.value = s.substr(0, 2) + ' ' + s.substr(2, tam);
					if (tam >= 7 && tam < 11)
						campo.value = s.substr(0, 2) + ' ' + s.substr(2, 4) + '-' + s.substr(6, tam - 6);
				}

				break;

			case 'CEP':

				if (!(tecla >= 48 && tecla <= 57)) {
					if (tecla != 0) {
						return false
					}
				} else {
					if (tam >= 6 && tam < 8)
						campo.value = s.substr(0, 5) + '-' + s.substr(5, tam - 5);
				}

				break;

			case 'DATA':
				if (!(tecla >= 48 && tecla <= 57)) {
					if (tecla != 0) {
						return false
					}
				} else {
					if (tam > 2 && tam < 4)
						campo.value = s.substr(0, 2) + '/' + s.substr(2, tam);
					if (tam > 4 && tam < 11)
						campo.value = s.substr(0, 2) + '/' + s.substr(2, 2) + '/' + s.substr(4, tam - 4);
				}
				break;
		}
	}
}

