var Class = {
	create: function() {
		return function() {
			this.initialize.apply(this, arguments);
		}
	}
}

function getValue(s){return document.getElementById(s).value}

var Validate = Class.create();
Validate.prototype = {
	
	initialize:function(){
		this.error_array = []
		this.rules_array = [];
		this.e = true;
	},
	
	isEqual:function(string1, string2){
		if(string1 == string2) return true;
		else return false;
	},
	
	hasValidChars:function(s, characters, caseSensitive){
		function escapeSpecials(s){
			return s.replace(new RegExp("([\\\\-])", "g"), "\\$1");
		}
		return new RegExp("^[" + escapeSpecials(characters) + "]+$",(!caseSensitive ? "i" : "")).test(s);
	},
	
	isSimpleIP:function(ip){
		ipRegExp = /^(([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+)\.([0-2]*[0-9]+[0-9]+))$/
		return ipRegExp.test(ip);
	},
	
	isAlphaLatin:function(string){
		alphaRegExp = /^[0-9a-z]+$/i
		return alphaRegExp.test(string);
	},
	
	isNotEmpty:function (string){
		return /\S/.test(string);
	},
	
	isEmpty:function(s){
		return !/\S/.test(s);
	},
	
	isIntegerInRange:function(n,Nmin,Nmax){
		var num = Number(n);
		if(isNaN(num)){
			return false;
		}
		if(num != Math.round(num)){
			return false;
		}
		return (num >= Nmin && num <= Nmax);
	},
	
	isNum:function(number){
		numRegExp = /^[0-9]+$/
		return numRegExp.test(number);
	},
	
	isEMailAddr:function(string){
		emailRegExp = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.([a-z]){2,4})$/
		return emailRegExp.test(string);
	},
	
	isZipCode:function(zipcode,country){
		if(!zipcode) return false;
		if(!country) format = 'US';
		switch(country){
			case'US': zpcRegExp = /^\d{5}$|^\d{5}-\d{4}$/; break;
			case'MA': zpcRegExp = /^\d{5}$/; break;
			case'CA': zpcRegExp = /^[A-Z]\d[A-Z] \d[A-Z]\d$/; break;
			case'DU': zpcRegExp = /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/; break;
			case'FR': zpcRegExp = /^\d{5}$/; break;
			case'Monaco':zpcRegExp = /^(MC-)\d{5}$/; break;
		}
		return zpcRegExp.test(zipcode);
	},
	
	isDate:function(date,format){
		if(!date) return false;
		if(!format) format = 'FR';
		
		switch(format){
			case'FR': RegExpformat = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/([2][0]|[1][9])\d{2})$/; break;
			case'US': RegExpformat = /^([2][0]|[1][9])\d{2}\-([0]\d|[1][0-2])\-([0-2]\d|[3][0-1])$/; break;
			case'SHORTFR': RegExpformat = /^([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/\d{2}$/; break;
			case'SHORTUS': RegExpformat = /^\d{2}\-([0]\d|[1][0-2])\-([0-2]\d|[3][0-1])$/; break;
			case'dd MMM yyyy':RegExpformat = /^([0-2]\d|[3][0-1])\s(Jan(vier)?|F√©v(rier)?|Mars|Avr(il)?|Mai|Juin|Juil(let)?|Aout|Sep(tembre)?|Oct(obre)?|Nov(ember)?|Dec(embre)?)\s([2][0]|[1][19])\d{2}$/; break;
			case'MMM dd, yyyy':RegExpformat = /^(J(anuary|u(ne|ly))|February|Ma(rch|y)|A(pril|ugust)|(((Sept|Nov|Dec)em)|Octo)ber)\s([0-2]\d|[3][0-1])\,\s([2][0]|[1][9])\d{2}$/; break;
		}
		
		return RegExpformat.test(date);
	},
	
	isMD5:function(string){
		if(!string) return false;
		md5RegExp = /^[a-f0-9]{32}$/;
		return md5RegExp.test(string);
	},
	
	isURL:function(string){
		if(!string) return false;
		string = string.toLowerCase();
		urlRegExp = /^(((ht|f)tp(s?))\:\/\/)([0-9a-zA-Z\-]+\.)+[a-zA-Z]{2,6}(\:[0-9]+)?(\/\S*)?$/
		return urlRegExp.test(string);
	},
	
	isGuid:function(guid){
		if(!guid) return false;
		GuidRegExp = /^[{|\(]?[0-9a-fA-F]{8}[-]?([0-9a-fA-F]{4}[-]?){3}[0-9a-fA-F]{12}[\)|}]?$/
		return GuidRegExp.test(guid);
	},
	
	isISBN:function(number){
		if(!number) return false;
		ISBNRegExp = /ISBN\x20(?=.{13}$)\d{1,5}([- ])\d{1,7}\1\d{1,6}\1(\d|X)$/
		return ISBNRegExp.test(number);
	},
	
	isSSN:function(number){
		if(!number) return false;
		ssnRegExp = /^\d{3}-\d{2}-\d{4}$/
		return ssnRegExp.test(number);
	},
	
	isDecimal:function(number){
		decimalRegExp = /^-?(0|[1-9]{1}\d{0,})(\.(\d{1}\d{0,}))?$/
		return decimalRegExp.test(number);
	},
	
	isplatform:function(platform){
		if(!platform) return false;
		var os;
		winRegExp = /\win/i
		if(winRegExp.test(window.navigator.platform)) os = 'win';
		
		macRegExp = /\mac/i
		if(macRegExp.test(window.navigator.platform)) os = 'mac';
		
		nixRegExp = /\unix|\linux|\sun/i
		if(nixRegExp.test(window.navigator.platform)) os = 'nix';
		
		if(platform == os) return true;
		else return false;
	},
	
	getValue:function(id){
		document.getElementById(id).value;
	},
	
	addRules:function(rules){
		this.rules_array.push(rules);
	},
	
	check:function(){
		this.error_array = [];
		this.e = true;
		for(var i=0;i<this.rules_array.length;i++){
			switch(this.rules_array[i].option){
				
				case'ValidChars':
					if(!this.hasValidChars(getValue(this.rules_array[i].id),this.rules_array[i].chars,false)){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'AlphaLatin':
					if (this.isAlphaLatin(getValue(this.rules_array[i].id))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'required':
					if (this.isEmpty(getValue(this.rules_array[i].id))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'integerRange':
					if (!this.isIntegerInRange(getValue(this.rules_array[i].id),this.rules_array[i].Min,this.rules_array[i].Max)){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'Number':
					if (!this.isNum(getValue(this.rules_array[i].id))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'email':
					if (!this.isEMailAddr(getValue(this.rules_array[i].id))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'zipCode':
					if (!this.isZipCode(getValue(this.rules_array[i].id),this.rules_array[i].country)){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'date':
					if(!this.isDate(getValue(this.rules_array[i].id),this.rules_array[i].format)){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'url':
					if(!this.isURL(getValue(this.rules_array[i].id))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'Decimal':
					if(!this.isDecimal(getValue(this.rules_array[i].id))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
				case'isEqual':
					if(!this.isEqual(getValue(this.rules_array[i].id),getValue(this.rules_array[i].to))){
						this.error_array.push(this.rules_array[i].error);
						this.e = false;
					}
				break;
				
			}
		}
	},
	
	Apply:function(el){
		this.check();
		if(this.e){
			return true;
		}else{
			var endMsg = this.error_array;
			if(!el){
				alert(this.error_array.toString().replace(/\,/gi,"\n"));
			}else{
				document.getElementById(el).innerHTML = this.error_array.toString().replace(/\,/gi,"<br/>");
			}
			return false;
		}
	}
	
}

function eDigitoNuN(pStr){
	var reDigits = /^\d+$/;

	if (reDigits.test(pStr)) {

		   return true; // e digito

	} else if (pStr != null && pStr != "") {

		   return false; // nao e digito

	}
}

function valida_cpf(cpf){
	var numeros, digitos, soma, i, resultado, digitos_iguais;
	digitos_iguais = 1;
	if (cpf.length < 11)
		return false;
	for (i = 0; i < cpf.length - 1; i++)
		if (cpf.charAt(i) != cpf.charAt(i + 1)){
			digitos_iguais = 0;
			break;
	  }
	if (!digitos_iguais)
		{
		numeros = cpf.substring(0,9);
		digitos = cpf.substring(9);
		soma = 0;
		for (i = 10; i > 1; i--)
			  soma += numeros.charAt(10 - i) * i;
		resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
		if (resultado != digitos.charAt(0))
			  return false;
		numeros = cpf.substring(0,10);
		soma = 0;
		for (i = 11; i > 1; i--)
			  soma += numeros.charAt(11 - i) * i;
		resultado = soma % 11 < 2 ? 0 : 11 - soma % 11;
		if (resultado != digitos.charAt(1))
			  return false;
		return true;
		}
	else
		return false;
}

function valida_cnpj(cnpj){
	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;
} 


function SoNumeros(e) {
	if(window.event) {
	  key = e.keyCode;
	}
	else if(e.which) {
	  key = e.which;
	}
	if (key!=8 || key < 48 || key > 57)
		return (((key > 47) && (key < 58)) || (key==8))
	return true;
}

function MascaraTel(objeto, tecla){

        separador="-";
        
        tecla=tecla.keyCode;
        
        valor=objeto.value.split('');
        formatado="";
		
        i=0;
        while(i<valor.length){
            caractere=valor[i];
            numeros=/^\d+$/;
			
            if(numeros.test(caractere) || caractere==separador)
				formatado+=String(caractere);
			
			if((formatado.length==2 || formatado.length==7) && tecla!=8){
				formatado += separador;
				i++;
			}
			i++;
		}
        
        objeto.value=formatado; 
}
function MascaraData(objeto, tecla){

        separador="/"; 
        
        tecla=tecla.keyCode;
        
        valor=objeto.value.split('');
        formatado="";
		
        i=0;
        while(i<valor.length){
            caractere=valor[i];
            numeros=/^\d+$/;

            if(numeros.test(caractere) || caractere==separador)
				formatado+=String(caractere);
			
			if((formatado.length==2 || formatado.length==5) && tecla!=8){
				formatado += separador;
				i++;
			}
			i++;
        }
        
        objeto.value=formatado;
}
function DigitaApenasDominio(obj, evt) {
   	 var key = (evt.which) ? evt.which : event.keyCode	
	  if ( key == 46 || key == 32) {
			alert("Não digite a extensão do domínio neste campo ou caracteres genéricos.\nSelecione a extensão na caixa ao lado.\n\nEm caso de subdomínios, digite apenas a parte principal.\n\nExemplo 1 - Domínio desejado - www.personalwd.com\nDigite apenas 'personalwd' no campo.\n\nExemplo 2 - Domínio desejado (com subdomínio) - www.suporte.personalwd.com\nDigite apenas 'personalwd' no campo.");
			obj.focus();
			return false; 
	 }
	 return true;
}

function EnviarDados(QualEnviar){
	
	var f = new Validate();
	
	if(QualEnviar == "Briefing"){
	
		var ValoresForm = document.PaginaBriefing;
	
		if(ValoresForm.setorAtuacao.value=="")	{
			alert("Por favor, escolha o \"Setor de atuação\"." );
			ValoresForm.setorAtuacao.className = "ClassErroForm";
			ValoresForm.setorAtuacao.focus();
			return false;
		}
	
		if(ValoresForm.areaAtuacao.value=="")	{
			alert("Por favor, escolha o \"Ramo de atividade\"." );
			ValoresForm.areaAtuacao.className = "ClassErroForm";
			ValoresForm.areaAtuacao.focus();
			return false;
		}
	
		if(!ValoresForm.RadioDominio[0].checked && !ValoresForm.RadioDominio[1].checked){
			alert("Pro favor, informe se deseja registrar um domínio para utilização ou se já possui um domínio devidamente registrado.");
			ValoresForm.RadioDominio[0].focus();
			return false;
		}
		else {
			if(ValoresForm.RadioDominio[0].checked){
				if(ValoresForm.domain.value == ""){
					alert("Por favor, preencha o endereço do seu site corretamente.");
					ValoresForm.domain.className = "ClassErroForm";
					ValoresForm.domain.focus();
					return false;
				}
				else 
					if(ValoresForm.dominio_encontrado.value != 0){
						alert("Por favor, preencha o endereço do seu site corretamente.\n\nEste domínio não está disponível!");
						ValoresForm.domain.className = "ClassErroForm";
						ValoresForm.domain.focus();
						return false;
					}
			}
			else
				if(ValoresForm.RadioDominio[1].checked){
					if(ValoresForm.JaTenhoDominio.value == "" || ValoresForm.JaTenhoDominio.value == "http://" || (!f.isURL(document.PaginaBriefing.JaTenhoDominio.value))){
						alert("Por favor, preencha o endereço do seu site corretamente.");
						ValoresForm.JaTenhoDominio.className = "ClassErroForm";
						ValoresForm.JaTenhoDominio.focus();
						return false;
					}
				}
		}
		var Radiomarcado = -1
		for (var i=0; i < ValoresForm.FisicaJuridica.length; i++) {
			if (ValoresForm.FisicaJuridica[i].checked) {
				Radiomarcado = i;
				resposta = ValoresForm.FisicaJuridica[i].value;
			}
		}
		
		if (Radiomarcado == -1) {
			alert("Você está atuando como \"Pessoa física ou Juridica\"?");
			ValoresForm.FisicaJuridica[0].focus();
			return false;
		}
		else
			if(Radiomarcado == 1){
				if(ValoresForm.RazaoSocial.value==""){
					alert("Por favor, preencha sua \"Razão Social\" corretamente!");
					ValoresForm.RazaoSocial.className = "ClassErroForm";
					ValoresForm.RazaoSocial.focus();
					return false;
				}
				if(ValoresForm.cnpj.value==""){
					alert("Por favor, preencha o campo \"CNPJ\" corretamente!");
					ValoresForm.cnpj.className = "ClassErroForm";
					ValoresForm.cnpj.focus();
					return false;
				}
				if(!valida_cnpj(ValoresForm.cnpj.value)){
					alert("Por favor, preencha o campo \"CNPJ\" corretamente!");
					ValoresForm.cnpj.className = "ClassErroForm";
					ValoresForm.cnpj.focus();
					return false;
				}
				if(ValoresForm.nomeFantasia.value==""){
					alert("Por favor, preencha o campo \"Nome fantasia\" corretamente!");
					ValoresForm.nomeFantasia.className = "ClassErroForm";
					ValoresForm.nomeFantasia.focus();
					return false;
				}
				if(ValoresForm.cargo.value==""){
					alert("Por favor, preencha o campo \"Cargo\" corretamente!");
					ValoresForm.cargo.className = "ClassErroForm";
					ValoresForm.cargo.focus();
					return false;
				}
				if(ValoresForm.porte.value==""){
					alert("Por favor, preencha o campo \"Porte da empresa\" corretamente!");
					ValoresForm.porte.className = "ClassErroForm";
					ValoresForm.porte.focus();
					return false;
				}
				if(ValoresForm.funcionarios.value==""){
					alert("Por favor, preencha o campo \"Quantidade de funcionários\" corretamente!");
					ValoresForm.funcionarios.className = "ClassErroForm";
					ValoresForm.funcionarios.focus();
					return false;
				}
			}
	
		if(ValoresForm.nome.value=="")	{
			alert("Por favor, preencha o campo \"Nome\" corretamente." );
			ValoresForm.nome.className = "ClassErroForm";
			ValoresForm.nome.focus();
			return false;
		}
	
		if(ValoresForm.cpf.value=="")	{
			alert("Por favor, preencha o campo \"CPF\" corretamente." );
			ValoresForm.cpf.className = "ClassErroForm";
			ValoresForm.cpf.focus();
			return false;
		}
		else
			if(!valida_cpf(ValoresForm.cpf.value)){
				alert("Por favor, preencha o campo \"CPF\" corretamente." );
				ValoresForm.cpf.className = "ClassErroForm";
				ValoresForm.cpf.focus();
				return false;
			}
		if(ValoresForm.titular_cpf.value==""){
			alert("Por favor, preencha o campo \"Titular do CPF\" corretamente." );
			ValoresForm.titular_cpf.className = "ClassErroForm";
			ValoresForm.titular_cpf.focus();
			return false;
		}

		if(ValoresForm.cep.value=="" || ValoresForm.cep.value.length < 8) {
			alert("Por favor, preencha o campo \"CEP\" corretamente." );
			ValoresForm.cep.className = "ClassErroForm";
			ValoresForm.cep.focus();
			return false;
		}
		if(ValoresForm.idcepvalido.value=="false"){
			alert("Por favor, preencha o campo \"CEP\" corretamente.\n- O CEP digitado não é aceito no sistema dos Correios." );
			ValoresForm.cep.className = "ClassErroForm";
			ValoresForm.cep.focus();
			return false;
		}
	
		if(ValoresForm.numeroEndereco.value=="")	{
			alert("Por favor, preencha o campo \"Número\" corretamente." );
			ValoresForm.numeroEndereco.className = "ClassErroForm";
			ValoresForm.numeroEndereco.focus();
			return false;
		}
	
		if(ValoresForm.endereco.value=="")	{
			alert("Por favor, preencha o campo \"Endereço para contato\" corretamente." );
			ValoresForm.endereco.className = "ClassErroForm";
			ValoresForm.endereco.focus();
			return false;
		}
	
		if(ValoresForm.bairro.value=="")	{
			alert("Por favor, preencha o campo \"Bairro\" corretamente." );
			ValoresForm.bairro.className = "ClassErroForm";
			ValoresForm.bairro.focus();
			return false;
		}
	
		if(ValoresForm.cidade.value=="")	{
			alert("Por favor, preencha o campo \"Cidade\" corretamente." );
			ValoresForm.cidade.className = "ClassErroForm";
			ValoresForm.cidade.focus();
			return false;
		}
	
		if(ValoresForm.estado.value=="")	{
			alert("Por favor, preencha o campo \"Estado\" corretamente." );
			ValoresForm.estado.className = "ClassErroForm";
			ValoresForm.estado.focus();
			return false;
		}
	
		if(ValoresForm.email.value=="" || !f.isEMailAddr(ValoresForm.email.value)){
			alert("Por favor, preencha o campo \"E-mail\" corretamente.");
			ValoresForm.email.className = "ClassErroForm";
			ValoresForm.email.focus();
			return false;
		}
		if((ValoresForm.re_email.value != ValoresForm.email.value) || (!f.isEMailAddr(ValoresForm.re_email.value))){
			alert("Por favor, preencha o campo \"Confirmar E-mail\" corretamente.");
			ValoresForm.re_email.className = "ClassErroForm";
			ValoresForm.re_email.focus();
			return false;
		}
	
		if(!f.isDate(ValoresForm.dataNascimento.value,ValoresForm.formatoData.value))	{
			alert("Por favor, preencha o campo \"Data de Nascimento\" corretamente.\nO campo será formatado automaticamente.");
			ValoresForm.dataNascimento.className = "ClassErroForm";
			ValoresForm.dataNascimento.focus();
			return false;
		}
	
		if(ValoresForm.fone.value=="" || ValoresForm.fone.value.length<12)	{
			alert("Por favor, preencha o campo \"Telefone\" corretamente." );
			ValoresForm.fone.className = "ClassErroForm";
			ValoresForm.fone.focus();
			return false;
		}
	
		if(ValoresForm.celfone.value != "" && ValoresForm.celfone.value.length < 12)	{
			alert("Por favor, preencha o campo \"Telefone Celular\" corretamente." );
			ValoresForm.celfone.className = "ClassErroForm";
			ValoresForm.celfone.focus();
			return false;
		}
		
		if(ValoresForm.ImagemSeguranca.value == "")	{
			alert("O campo \"Código de segurança\" não pode ficar vazio." );
			ValoresForm.ImagemSeguranca.className = "ClassErroForm textimagemseguranca";
			ValoresForm.ImagemSeguranca.focus();
			return false;
		}
	
		ValoresForm.submitTudo.disabled = true;
		ValoresForm.submitTudo.className = "botao_continuar_Correto";
		ValoresForm.submitTudo.value = "Aguarde...";
		form.action = "script/php/ValidarBriefing.php";
		form.method = "post";
		form.enctype = "multipart/form-data";
		form.target = "_top";
		form.submit();
	}
	else if(QualEnviar == "parceiros_form"){
		var ValoresForm = document.parceria_formulario001;
		
		if(ValoresForm.nome.value=="")	{
			alert("Por favor, preencha o campo \"Nome\" corretamente." );
			ValoresForm.nome.className = "ClassErroForm";
			ValoresForm.nome.focus();
			return false;
		}
		if(ValoresForm.fone.value=="" || ValoresForm.fone.value.length<12)	{
			alert("Por favor, preencha o campo \"Telefone\" corretamente." );
			ValoresForm.fone.className = "ClassErroForm";
			ValoresForm.fone.focus();
			return false;
		}
	
		if(ValoresForm.celfone.value != "" && ValoresForm.celfone.value.length < 12)	{
			alert("Por favor, preencha o campo \"Telefone Celular\" corretamente." );
			ValoresForm.celfone.className = "ClassErroForm";
			ValoresForm.celfone.focus();
			return false;
		}
		if(ValoresForm.cep.value=="" || ValoresForm.cep.value.length < 8) {
			alert("Por favor, preencha o campo \"CEP\" corretamente." );
			ValoresForm.cep.className = "ClassErroForm";
			ValoresForm.cep.focus();
			return false;
		}
		if(ValoresForm.endereco.value=="")	{
			alert("Por favor, preencha o campo \"Endereço para contato\" corretamente." );
			ValoresForm.endereco.className = "ClassErroForm";
			ValoresForm.endereco.focus();
			return false;
		}
		if(ValoresForm.numeroEndereco.value=="")	{
			alert("Por favor, preencha o campo \"Número\" corretamente." );
			ValoresForm.numeroEndereco.className = "ClassErroForm";
			ValoresForm.numeroEndereco.focus();
			return false;
		}
		if(ValoresForm.bairro.value=="")	{
			alert("Por favor, preencha o campo \"Bairro\" corretamente." );
			ValoresForm.bairro.className = "ClassErroForm";
			ValoresForm.bairro.focus();
			return false;
		}
	
		if(ValoresForm.cidade.value=="")	{
			alert("Por favor, preencha o campo \"Cidade\" corretamente." );
			ValoresForm.cidade.className = "ClassErroForm";
			ValoresForm.cidade.focus();
			return false;
		}
	
		if(ValoresForm.estado.value=="")	{
			alert("Por favor, preencha o campo \"Estado\" corretamente." );
			ValoresForm.estado.className = "ClassErroForm";
			ValoresForm.estado.focus();
			return false;
		}
	
		if(ValoresForm.email.value=="" || !f.isEMailAddr(ValoresForm.email.value)){
			alert("Por favor, preencha o campo \"E-mail\" corretamente.");
			ValoresForm.email.className = "ClassErroForm";
			ValoresForm.email.focus();
			return false;
		}
		if((ValoresForm.re_email.value != ValoresForm.email.value) || (!f.isEMailAddr(ValoresForm.re_email.value))){
			alert("Por favor, preencha o campo \"Confirmar E-mail\" corretamente.");
			ValoresForm.re_email.className = "ClassErroForm";
			ValoresForm.re_email.focus();
			return false;
		}
		if(ValoresForm.mensagem.value=="")	{
			alert("Por favor, preencha o campo \"Mensagem\" corretamente." );
			ValoresForm.mensagem.className = "ClassErroForm";
			ValoresForm.mensagem.focus();
			return false;
		}
		if(ValoresForm.ImagemSeguranca.value == "")	{
			alert("O campo \"Código de segurança\" não pode ficar vazio." );
			ValoresForm.ImagemSeguranca.className = "ClassErroForm textimagemseguranca";
			ValoresForm.ImagemSeguranca.focus();
			return false;
		}
		
		form = document.parceria_formulario001;
		ValoresForm.parceiros_form.disabled = true;
		ValoresForm.parceiros_form.className = "botao_continuar_Correto";
		ValoresForm.parceiros_form.value = "Aguarde...";
		form.action = "script/php/EnviaParceiros.php";
		form.method = "post";
		form.enctype = "multipart/form-data";
		form.target = "_top";
		form.submit();
		return true;
	}
	else if(QualEnviar == "inscricao_hospedagem"){
		form = document.inscricao_hospedagem;
		
		if(form.nome.value == ""){
			alert("Por favor, preencha o campo \"Nome\" corretamente." );
			form.nome.className = "ClassErroForm";
			form.nome.focus();
			return false;
		}
		if(form.fone.value == "" || form.fone.value < 12){
			alert("Por favor, preencha o campo \"Telefone\" corretamente." );
			form.fone.className = "ClassErroForm";
			form.fone.focus();
			return false;
		}
		if(!valida_cpf(form.cpf.value)){
			alert("Por favor, preencha o campo \"CPF\" corretamente." );
			form.cpf.className = "ClassErroForm";
			form.cpf.focus();
			return false;
		}
		if(form.titular_cpf.value==""){
			alert("Por favor, preencha o campo \"Titular do CPF\" corretamente." );
			form.titular_cpf.className = "ClassErroForm";
			form.titular_cpf.focus();
			return false;
		}
		if(form.titular_cpf.value == form.cpf.value){
			alert("Por favor, preencha o campo \"Titular do CPF\" corretamente." );
			form.titular_cpf.className = "ClassErroForm";
			form.titular_cpf.focus();
			return false;
		}

		var Radiomarcado = -1
		for (var i=0; i < form.primeira_inscricaopwd.length; i++) {
			if (form.primeira_inscricaopwd[i].checked) {
				Radiomarcado = i;
				resposta = form.primeira_inscricaopwd[i].value;
			}
		}
		
		if (Radiomarcado == -1) {
			alert("É sua primeira inscrição com a personalwd.com.br?");
			form.primeira_inscricaopwd[0].focus();
			return false;
		}

		if(!form.RadioDominio[0].checked && !form.RadioDominio[1].checked){
			alert("Pro favor, informe se deseja registrar um domínio para utilização ou se já possui um domínio devidamente registrado.");
			form.RadioDominio[0].focus();
			return false;
		}
		else {
			if(form.RadioDominio[1].checked){
				if(form.domain.value == ""){
					alert("Por favor, preencha o endereço do seu site corretamente.");
					form.domain.className = "ClassErroForm";
					form.domain.focus();
					return false;
				}
				else 
					if(form.dominio_encontrado.value != 0){
						alert("Por favor, preencha o endereço do seu site corretamente.\n\nEste domínio não está disponível!");
						form.domain.className = "ClassErroForm";
						form.domain.focus();
						return false;
					}
			}
			else
				if(form.RadioDominio[0].checked){
					if(form.JaTenhoDominio.value == "" || form.JaTenhoDominio.value == "http://" || (!f.isURL(document.inscricao_hospedagem.JaTenhoDominio.value))){
						alert("Por favor, preencha o endereço do seu site corretamente.");
						form.JaTenhoDominio.className = "ClassErroForm";
						form.JaTenhoDominio.focus();
						return false;
					}
				}
		}

		var Radiomarcado = -1
		for (var i=0; i < form.Radiocontrutor_site.length; i++) {
			if (form.Radiocontrutor_site[i].checked) {
				Radiomarcado = i;
				resposta = form.Radiocontrutor_site[i].value;
			}
		}
		
		if (Radiomarcado == -1) {
			alert("Deseja obter o construtor de site?");
			form.Radiocontrutor_site[0].focus();
			return false;
		}

		if(form.email.value=="" || !f.isEMailAddr(form.email.value)){
			alert("Por favor, preencha o campo \"E-mail\" corretamente.");
			form.email.className = "ClassErroForm";
			form.email.focus();
			return false;
		}
		if((form.re_email.value != form.email.value) || (!f.isEMailAddr(form.re_email.value))){
			alert("Por favor, preencha o campo \"Confirmar E-mail\" corretamente.");
			form.re_email.className = "ClassErroForm";
			form.re_email.focus();
			return false;
			alert("msg");

		}
		
		var Radiomarcado02 = -1;
		for (var i=0; i < form.radio_valores_hospedagem.length; i++) {
			if (form.radio_valores_hospedagem[i].checked) {
				Radiomarcado02 = i;
			}
		}
		
		if (Radiomarcado02 == -1) {
			alert("Por favor, escolha um dos planos listados!");
			form.radio_valores_hospedagem[0].focus();
			return false;
		}
		else {
			if(document.getElementById("hospedagem13").checked)
				if(document.getElementById("valor_hospedagem").value == "" || document.getElementById("valor_hospedagem").value < 10 || !eDigitoNuN(document.getElementById("valor_hospedagem").value)){
					alert("Por favor, insira o valor correto de 'GBs' desejados para o plano personalizado.");
					form.JaTenhoDominio.className = "ClassErroForm";
					document.getElementById("valor_hospedagem").focus();
					return false;
				}
		}
		if(form.ImagemSeguranca.value == "")	{
			alert("O campo \"Código de segurança\" não pode ficar vazio." );
			form.ImagemSeguranca.className = "ClassErroForm textimagemseguranca";
			form.ImagemSeguranca.focus();
			return false;
		}
		
		form.submitHospedagem.disabled = true;
		form.submitHospedagem.className = "botao_continuar_Correto";
		form.submitHospedagem.value = "Aguarde...";
		form.action = "script/php/Enviahospedagem.php";
		form.method = "post";
		form.enctype = "multipart/form-data";
		form.target = "_top";
		form.submit();
		return true;
		
	}
	else{
		alert("PersonalWD.com - Erro inesperado com \"formulario\"!\n\nPor favor, entre em contato com a administração do site e nos informe esse erro.\n\nCod. erro: 1x0002");
		return false;
	}
}
