function max(txarea) { 
digitado = document.getElementById("digitado");
restante = document.getElementById("restante");
total = 270;   
tam = txarea.value.length;   
str=0;
str=str+tam;
digitado.innerHTML = str;
restante.innerHTML = total - str;

if (tam > total){ 
aux = txarea.value;
txarea.value = aux.substring(0,total);
digitado.innerHTML = total;
restante.innerHTML = 0;
} 
}
function checkMail(mail){
	var er = new RegExp(/^[A-Za-z0-9_\-\.]+@[A-Za-z0-9_\-\.]{2,}\.[A-Za-z0-9]{2,}(\.[A-Za-z0-9])?/);
	if(typeof(mail) == "string"){
		if(er.test(mail)){ return true; }
	}else if(typeof(mail) == "object"){
		if(er.test(mail.value)){
					return true;
		}
	}else{
		return false;
	}
}
function corS(i) {
	document.getElementById(i).style.backgroundColor="#ececec";
}
function corO(i) {
	document.getElementById(i).style.backgroundColor="#ffffff";
}

function corS2(i,j) {
	document.getElementById(i).style.backgroundColor="#ececec";
	document.getElementById(j).style.backgroundColor="#ececec";
}
function corO2(i,j) {
	document.getElementById(i).style.backgroundColor="#ffffff";
	document.getElementById(j).style.backgroundColor="#ffffff";
}
function place(i,j) {
	document.getElementById("posX").value=i;
	document.getElementById("posY").value=j;
}

function url_encode(str) { 
var hex_chars = "0123456789ABCDEF"; 
var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 
var n, strCode, hex1, hex2, strEncode = ""; 
for(n = 0; n < str.length; n++) { 
if (noEncode.test(str.charAt(n))) { 
strEncode += str.charAt(n); 
} else { 
strCode = str.charCodeAt(n); 
hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 
hex2 = hex_chars.charAt(strCode % 16); 
strEncode += "%" + (hex1 + hex2); 
} 
} 
return strEncode; 
} 

function url_decode(str) { 
var n, strCode, strDecode = ""; 
for (n = 0; n < str.length; n++) { 
if (str.charAt(n) == "%") { 
strCode = str.charAt(n + 1) + str.charAt(n + 2); 
strDecode += String.fromCharCode(parseInt(strCode, 16)); 
n += 2; 
} else { 
strDecode += str.charAt(n); 
} 
} 
return strDecode; 
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function criarObjMSXMLHttp() {
	var versoes = ["MSXML2.XMLHttp.6.0","MSXML2.XMLHttp.5.0","MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0","MSXML2.XMLHttp","Microsoft.XMLHttp"];
	for (var i=0; i<versoes.length; i++){ try{ var objetoXMLHttp=new ActiveXObject(versoes[i]); return objetoXMLHttp; } catch (ex) { } } return false; 
}