function isEmail(value) {return /[\w\.\-]+@[\w\-]+\.\w+/.test(trim(value))}
function isDate(value) {return /(0[1-9]|[12[0-9]|3[01])\/(0[1-9]|1[0-2])\/[12][0-9]{3}/.test(trim(value))}
function isEmpty(value) { return (/^[\s]*$/.test(value+'')) }
function isNumber(value) { return /^[-+]?[0-9]+(,[0-9]{3})*(\.[0-9]+)?$/.test(value) }
function isTime(value) { return /^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(value) }
function trim(strvar) { return ltrim(rtrim(strvar+'')) }
function ltrim(strvar) {return (strvar+'').replace(/^[\s]*/,'')}
function rtrim(strvar) {return (strvar+'').replace(/[\s]*$/,'')}

function info() {
   window.onerror=null;
   document.pop.navigator.value = navigator.appName;
   document.pop.version.value = navigator.appVersion;
   document.pop.platform.value = navigator.platform;
}

function openWindow(url, name) {
   popupWin = window.open(url,name,"width=555,height=377,top=0,resizable=no,scrollbars=no");
}

function habilitaBotao(){
   document.getElementById("btEntrarFidelidade").disabled=false;
}

function postNCC(){
   if (isNumber(document.pop.txtCartaoFidelidade.value)){
        document.getElementById("IdArea").value=3;
	openWindow('about:blank', 'remote');
	document.pop.action="Cliente/frm_login.asp?frmPost=1&sel=WebCallCenter+TAM";
	document.pop.submit();
	document.getElementById("btEntrarFidelidade").disabled=true;
	setTimeout("habilitaBotao()",9000)
   } else {
	alert('O Cartão Fidelidade deve ser um número válido!');
	document.pop.txtCartaoFidelidade.focus();
	return false;
   }
}

function formata_fidelidade( obj ) {	
	i = 0;
	num = obj.value;	
	while ( num.substring( 0, 1 ) == "0" ) {
    	  num = num.substring( 1, num.length ); 
	}
	obj.value = num;
	if ( num.length > 10 ) {
	  alert('Número fidelidade inválido!');
	  obj.value = '';
	  obj.focus();
	}  
}