// JavaScript Document
String.prototype.isEmail = function(){
								var er= RegExp('^[a-z0-9_\-]+(\.[_a-z0-9\-]+)*@([_a-z0-9\-]+\.)+([a-z]{2}|aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel)$');
								if(er.test(this) == false || this == ""){
									return false;		
								}else{
									return true;
								}
							}
							
String.prototype.isDate = function(){
	var date = this;
	var array_data = new Array;
	var ExpReg = new RegExp("(0[1-9]|[12][0-9]|3[01])/(0[1-9]|1[012])/[12][0-9]{3}");
	array_data = date.split("/");
	erro = false;
	if(date.search(ExpReg) == -1)
		erro = true;
	else if(((array_data[1] == 4) || (array_data[1] == 6) ||( array_data[1] == 9) ||( array_data[1] == 11)) && (array_data[0] > 30))
		erro = true;
	else if(array_data[1] == 2){
		if((array_data[0] > 28)&&((array_data[2] % 4) != 0 ))
			erro = true;
		if((array_data[0] > 29 ) && ((array_data[2] % 4) == 0))
			erro = true;
	}
	if(erro){
		return false;
	}else{
		return true;
	}	
}

String.prototype.isCPF = function(){
	aux = this.replace(".","");
	aux = aux.replace(".","");
	aux = aux.replace("/","");
	aux = aux.replace("-","");
	CPF = aux;	  
	var posicao, i, soma, dv, dv_informado;
	var digito = new Array(10);
	dv_informado = CPF.substr(9, 2);
	for (i=0; i<=8; i++) {
		digito[i] = CPF.substr( i, 1);
	}
	posicao = 10;
	soma = 0;
	for (i=0; i<=8; i++) {
		soma = soma + digito[i] * posicao;
		posicao = posicao - 1;
	}
	digito[9] = soma % 11;
	if (digito[9] < 2) {
		digito[9] = 0;
	}else{
		digito[9] = 11 - digito[9];
	}
	posicao = 11;
	soma = 0;
	for (i=0; i<=9; i++) {
		soma = soma + digito[i] * posicao;
		posicao = posicao - 1;
	}
	digito[10] = soma % 11;
	if (digito[10] < 2) {
		digito[10] = 0;
	}else {
		digito[10] = 11 - digito[10];
	}
	dv = digito[9] * 10 + digito[10];
	if (dv != dv_informado || CPF == 00000000000 || CPF == 11111111111 || CPF == 22222222222 || CPF == 33333333333 || CPF == 44444444444 || CPF == 55555555555 || CPF == 66666666666 || CPF == 77777777777 || CPF == 88888888888 || CPF == 99999999999) {
		return false;
	}else{
		return true;
	}
	return false;
}

String.prototype.isCNPJ = function(){
	var cnpj = this;
	var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
	digitos_iguais = 1;
	if (cnpj.length < 14 && cnpj.length < 15)
		return false;
	for (i = 0; i < cnpj.length - 1; i++)
		if (cnpj.charAt(i) != cnpj.charAt(i + 1))
			  {
			  digitos_iguais = 0;
			  break;
			  }
	if (!digitos_iguais)
		{
		tamanho = cnpj.length - 2
		numeros = cnpj.substring(0,tamanho);
		digitos = cnpj.substring(tamanho);
		soma = 0;
		pos = tamanho - 7;
		for (i = tamanho; i >= 1; i--)
			  {
			  soma += numeros.charAt(tamanho - i) * pos--;
			  if (pos < 2)
					pos = 9;
			  }
		resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
		if (resultado != digitos.charAt(0))
			  return false;
		tamanho = tamanho + 1;
		numeros = cnpj.substring(0,tamanho);
		soma = 0;
		pos = tamanho - 7;
		for (i = tamanho; i >= 1; i--)
			  {
			  soma += numeros.charAt(tamanho - i) * pos--;
			  if (pos < 2)
					pos = 9;
			  }
		resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
		if (resultado != digitos.charAt(1))
			  return false;
		return true;
		}
	else
		return false;	
}

String.prototype.isFone = function(){
	var er = RegExp(/^([(]+[0-9]+[)])?(\s)?[0-9]{4}-[0-9]{4}$/);
	if(er.test(this)){
		return true;
	}else{
		return false;	
	}
}

String.prototype.isCEP = function(){
	var er = RegExp(/^[0-9]{5}-[0-9]{3}$/);
	if(er.test(this)){
		return true;
	}else{
		return false;
	}
}
