function pinheiroNeto(){
	
	this.changeLanguage = function (l) {
		
		// Hide others div's
		document.getElementById("P").style.visibility = "hidden";
		document.getElementById("P").style.display = "none";
		document.getElementById("I").style.visibility = "hidden";
		document.getElementById("I").style.display = "none";
		document.getElementById("E").style.visibility = "hidden";
		document.getElementById("E").style.display = "none";
		
		// Change buttons color
		document.getElementById("bP").style.backgroundColor = "#CCCCCC";
		document.getElementById("bI").style.backgroundColor = "#CCCCCC";
		document.getElementById("bE").style.backgroundColor = "#CCCCCC";
	
		// Activate selected button
		document.getElementById("b" + l).style.backgroundColor = "#AAAAAA";	
		
		// Show selected div
		obj = document.getElementById(l);
		obj.style.visibility = "visible";
		obj.style.display = "block";
		
	};
	
	
	
	
	this.uploadWindow = function (table, field, formField, permitedExtensions) {
  	
		window.open("php/funcoes/adm_upload.php?currentTable=" + table + "&currentField=" + field + "&formField=" + formField + "&permitedExtensions=" + permitedExtensions, "UploadWindow", "width=450, height=320");
	
	}
	
	
	
	
	this.printVersion = function () { 

		window.print();
	
		/* DEPRECATED
		printContent = document.getElementById("middleContent").innerHTML;
		a = window.open("htm/print.htm", "printVersion", "width=998, height=450");
		a.document.write("<html><head><link rel='stylesheet' href='css/style.css' /></head>");
		a.document.write("<body onload='window.print()'>" + printContent + "</body");
		*/
 	};
	
	
	
	this.changeAll = function (currentState){
	
		//alert (currentState);
		
		aElements = document.getElementsByName("chkDelete[]");
		for (i=0; i<aElements.length; i++)
			aElements[i].checked = currentState;

	}
	
	
	
	
	this.chargeSelect = function (txt, id, slt) {
		
		if(id != ""){
			var opt = new Option(txt.value, id);
			slt.add(opt);			
		}
		
	}
	
	
	
	
	this.deleteSelect = function (slt){
		
		slt.removeChild(slt[slt.selectedIndex]);
		
	}
	
	
	
	
	this.selectAll = function (slt){
		
		for (i=0; i<slt.length; i++)
			slt[i].selected = true;
		
	}
	
	
	
	this.clearBox = function (txt, text){
		
		if (txt.value == text)
			txt.value = "";
		
	}
	
	
	
	this.refillBox = function (txt, val){
		
		if (txt.value == "")
			txt.value = val;
		
	}
	
	
	
	this.replaceValues = function(frm){
		
		frm.area.value = frm.area.title.substr(1);
		
	}
	
	
	
	this.formatDataBox = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		//alert(pressedKey); 
		
		if (this.isControlKey(pressedKey))
			return true;
		if ((pressedKey > 47 && pressedKey < 59) || (pressedKey > 94 && pressedKey < 106))
			if (textValue.length == 2)
				txt.value = textValue + "/";
			else if (textValue.length == 5)
				txt.value = textValue + "/";
			else
				return true;
		else 
			return false;
					
				
	}
	
	
	
	this.formatCPFBox = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		// alert(pressedKey); 
		
		if (this.isControlKey(pressedKey))
			return true;
		if ((pressedKey > 47 && pressedKey < 59) || (pressedKey > 94 && pressedKey < 106))
			if (textValue.length == 3)
				txt.value = textValue + ".";
			else if (textValue.length == 7)
				txt.value = textValue + ".";
			else if (textValue.length == 11)
				txt.value = textValue + "-";
			else
				return true;
		else 
			return false;
					
				
	}
	
	
	this.formatCEPBox = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		// alert(pressedKey); 
		
		if (this.isControlKey(pressedKey))
			return true;
			
		if (this.isNumberKey(pressedKey)){
			if (textValue.length == 5)
				txt.value = textValue + "-";
		} else 
			return false;
					
				
	}
	
	
	
	this.formatNumBox = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		// alert(pressedKey); 
		
		if (this.isControlKey(pressedKey))
			return true;
			
		if (this.isNumberKey(pressedKey))
			return true;
		else 
			return false;
		
	}
	
	
	
	this.formatSlashes = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		//alert(pressedKey);
		
		if (this.isControlKey(pressedKey))
			return true;
		else
			return false;
			//txt.value = txt.value.replace(/"\/"/gi, "");
				
					
				
	}
	
	
	this.formatTimeBox = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		if (pressedKey > 47 && pressedKey < 59)
			if (textValue.length == 2)
				txt.value = textValue + ":";
			else if (textValue.length == 5)
				txt.value = textValue + ":";
			else
				return true;
		else 
			return false;
					
				
	}
	
	
	
	this.formatDots = function(txt, key){
		
		var pressedKey = key.keyCode;
		var textValue  = txt.value;
		
		
		if (pressedKey == 8)
			if (pressedKey == 9)
				return true;
			else
				txt.value = txt.value.replace("", "");			
				
	}
	
	
	
	this.moneyFormat = function (textBox,tammax,teclapres) {
    
        if(window.event) { // Internet Explorer
         var tecla = teclapres.keyCode; }
        else if(teclapres.which) { // Nestcape / firefox
         var tecla = teclapres.which;
        }
    

		vr = textBox.value;
		vr = vr.toString().replace( "/", "" );
		vr = vr.toString().replace( "/", "" );
		vr = vr.toString().replace( ",", "" );
		vr = vr.toString().replace( ".", "" );
		vr = vr.toString().replace( ".", "" );
		vr = vr.toString().replace( ".", "" );
		vr = vr.toString().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 ){
		textBox.value = vr; }
		if ( (tam > 2) && (tam <= 5) ){
		textBox.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ); }
		if ( (tam >= 6) && (tam <= 8) ){
		textBox.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ); }
		if ( (tam >= 9) && (tam <= 11) ){
		textBox.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) ){
		textBox.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) ){
		textBox.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 );}
		}
		
	}
	
	
	
	this.isNumberKey = function (pressedKey) {
		
		if ( pressedKey >= 48 && pressedKey <= 57 || pressedKey >= 96 && pressedKey <= 105 )
			return true;
		else
			return false;
		
	}
	
	
	this.isControlKey = function (pressedKey){
		
		if (pressedKey == 35 || pressedKey == 36 || pressedKey == 46 || pressedKey == 13 || pressedKey == 8 ||  pressedKey == 9 || pressedKey == 8)
			return true;
		else
			return false;
		
	}
	
	
	this.sendMail = function (frm) {
		
		if (frm.txtEmailLogin.value != ""){
			frm.sendMail.value = true;
			frm.submit();
		} else
			alert("Digite seu Email");
		
	}


	/**
 	* 
 	* @param {String} str
 	*/	
	this.removeAccents = function (str){
 
		str = str.toLowerCase();
		 
		var w = "áéíóúàèìòùâêîôûäëïöüãõ@#$%^&*()_+=-~` ç";
		var c = "aeiouaeiouaeiouaeiouao________________c";
		var r = "";
	 
		for (i = 0; i < str.length; i++){
			if (w.indexOf(str.charAt(i)) != -1)
				r += c.charAt(w.indexOf(str.charAt(i)));
			else
				r += str.charAt(i);
		}	 
		
		return r;
 
	}
	
	
}
