// JavaScript Document

function ValidaPromocao(){
	erro = "";
	if (document.promocao.nome.value == "") {
		erro = erro + "• Preencha o campo Nome\n";
	}
		if (document.promocao.telefone.value == "") {
		erro = erro + "• Preencha o campo Telefone\n";
	}
		if (document.promocao.email.value == "") {
		erro = erro + "• Preencha o campo E-mail\n";
	}
	
	    if (document.promocao.resposta.value == "") {
		erro = erro + "• Preencha o campo Resposta\n";
	}
	
	if (erro == "") {
		document.promocao.submit();
	} else {	
		alert("Aconteceram os seguintes erros:           \n\n" + erro);	
	}

}

/*********************************************
 VALIDA ENCOMENDA
*********************************************/

function ValidaEncomenda(){
	erro = "";
	if (document.frmCarrinho.nome.value == "") {
		erro = erro + "• Preencha o campo Nome\n";
	}
	if (document.frmCarrinho.endereco.value == "") {
		erro = erro + "• Preencha o campo Endereço\n";
	}
	if (document.frmCarrinho.bairro.value == "") {
		erro = erro + "• Preencha o campo Bairro\n";
	}
	if (document.frmCarrinho.cidade.value == "") {
		erro = erro + "• Preencha o campo Cidade\n";
	}
	if (document.frmCarrinho.estado.value == "Selecione") {
		erro = erro + "• Preencha o campo Estado\n";
	}
	if (document.frmCarrinho.cep.value == "") {
		erro = erro + "• Preencha o campo Cep\n";
	}
	
	if (document.frmCarrinho.rem_email.value == "") {
		erro = erro + "• Preencha o campo E-mail\n";
	}
	if (document.frmCarrinho.rem_email.value != "") {
	
     var re = new RegExp;
     re = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
     var mailArr = re.exec(document.frmCarrinho.rem_email.value);
	
     if (mailArr == null) {
         erro = erro + "• O email digitado não é válido\n";
     }
	 }
	 if (document.frmCarrinho.fone.value == "(ddd)") {
		erro = erro + "• Preencha o campo Telefone\n";
	}
	if (erro == "") {
		document.frmCarrinho.submit();
	} else {	
		alert("Aconteceram os seguintes erros:           \n\n" + erro);	
	}

}






/*********************************************
 VALIDA COMENTARIO
*********************************************/

function ValidaForm(){
	erro = "";

	if (document.form.nome.value == "") {
		erro = erro + "• Preencha o campo Nome\n";
	}
	if (document.form.comentario.value == "") {
		erro = erro + "• Preencha o campo Comentário\n";
	}
	if (erro == "") {
		document.form.submit();
	} else {	
		alert("Aconteceram os seguintes erros:           \n\n" + erro);	
	}

}

/*********************************************
 VALIDA INFO
*********************************************/

function ValidaInfo(){
	erro = "";
	if (document.info.nome.value == "") {
		erro = erro + "• Você deve preencher o campo Nome.\n";
	}
	if (document.info.email.value == "") {
		erro = erro + "• Você deve preencher o campo E-mail.\n";
	}
	if (erro == "") {
		document.info.submit();
	} else {	
		alert("Aconteceram os seguintes erros:           \n\n" + erro);	
	}

}




function ValidaContato(){
	erro = "";
	if (document.contato.nome.value == "") {
		erro = erro + "• Preencha o campo Nome\n";
	}
	
	if (document.contato.email.value == "") {
		erro = erro + "• Preencha o campo E-mail\n";
	}
	
	if (document.contato.msg.value == "") {
		erro = erro + "• Preencha o campo Mensagem\n";
	}
	
 
	
	if (erro == "") {
		document.contato.submit();
	} else {	
		alert("Aconteceram os seguintes erros:           \n\n" + erro);	
	}

}



function ValidaCurriculo(){
	erro = "";
	if (document.trabalhe.nome.value == "") {
		erro = erro + "• Preencha o campo Nome\n";
	}
		if (document.trabalhe.cpf.value == "") {
		erro = erro + "• Preencha o campo CPF\n";
	}
		if (document.trabalhe.endereco.value == "") {
		erro = erro + "• Preencha o campo Endereço\n";
	}
	if (document.trabalhe.bairro.value == "") {
		erro = erro + "• Preencha o campo Bairro\n";
	}
	if (document.trabalhe.cidade.value == "") {
		erro = erro + "• Preencha o campo Cidade\n";
	}
	if (document.trabalhe.estado.value == "Selecione") {
		erro = erro + "• Preencha o campo Estado\n";
	}
	if (document.trabalhe.pais.value == "") {
		erro = erro + "• Preencha o campo País\n";
	}
		if (document.trabalhe.cep.value == "") {
		erro = erro + "• Preencha o campo CEP\n";
	}
		if (document.trabalhe.nascimento_dia.value == "Selecione") {
		erro = erro + "• Preencha o campo Dia de Nascimento\n";
	}
	if (document.trabalhe.nascimento_mes.value == "Selecione") {
		erro = erro + "• Preencha o campo Mês de Nascimento\n";
	}
		if (document.trabalhe.nascimento_ano.value == "Selecione") {
		erro = erro + "• Preencha o campo Ano de Nascimento\n";
	}
	if (document.trabalhe.sexo.value == "") {
		erro = erro + "• Preencha o campo Sexo\n";
	}
	if (document.trabalhe.ddd_residencial.value == "") {
		erro = erro + "• Preencha o campo DDD Residencial\n";
	}
		if (document.trabalhe.tel_residencial.value == "") {
		erro = erro + "• Preencha o campo Telefone Residencial\n";
	}
		if (document.trabalhe.estadocivil.value == "") {
		erro = erro + "• Preencha o campo Estado Civil\n";
	}
		if (document.trabalhe.cargo_pretendido.value == "") {
		erro = erro + "• Preencha o campo Cargo Pretendido\n";
	}
		if (document.trabalhe.formacao.value == "") {
		erro = erro + "• Preencha o campo Formação Acadêmico\n";
	}
		if (document.trabalhe.email.value == "") {
		erro = erro + "• Preencha o campo E-mail\n";
	}
	

	
	if (erro == "") {
		document.trabalhe.submit();
	} else {	
		alert("Aconteceram os seguintes erros:           \n\n" + erro);	
	}

}

/***********************************************************
 FUNÇÕES FLASH
 **********************************************************/
 if(Browser == undefined){
	var Browser = {
		isIE: function(){ return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
	}
}

var Flash = function(movie, id, width, height, initParams){

	this.html = "";
	this.attributes = this.params = this.variables = null;
	
	this.variables = new Array();
	this.attributes = {
		"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
		"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0",
		"type": "application/x-shockwave-flash"
	}
	this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer_br" };
	
	if(movie) {
		this.addAttribute("data", movie);
		this.addParameter("movie", movie);
	}
	
	if(id && id != null) this.addAttribute("id", id);
	if(width) this.addAttribute("width", width);
	if(height) this.addAttribute("height", height);
	
	if(initParams != undefined){
		for(var i in initParams){
			this.addParameter(i.toString(), initParams[i]);
		}
	}
	
}
Flash.version = "1.2b";
Flash.getObjectByExceptions = function(obj, excep){
	var tempObj = {};
	for(var i in obj){
		var inclui = true;
		for(var j=0; j<excep.length; j++)
			if(excep[j] == i.toString()) { inclui = false; break; };
		if(inclui) tempObj[i] = obj[i];
	}
	return tempObj;
}
Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; }
Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; }
Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); }
Flash.prototype.getFlashVars = function(){
	var tempString = new Array();
	
	for(var i=0; i<this.variables.length; i++)
		tempString.push(this.variables[i].join("="));
		
	return tempString.join("&");
}
Flash.prototype.toString = function(){
	
	this.params.flashVars = this.getFlashVars();
	if(Browser.isIE()){
		//IE
		this.html = "<ob" + "ject";
		var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect>";
	} else {
		//non-IE
		this.html = "<!--[if !IE]> <--> <obj" + "ect";
		var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </obj" + "ect> <!--> <![endif]-->";
	}

	return this.html;
	
}
Flash.prototype.write = Flash.prototype.outIn = Flash.prototype.writeIn = function(w){
	if(typeof w == "string" && document.getElementById) var w = document.getElementById(w);
	if( w != undefined && w ) w.innerHTML = this.toString();
	else document.write( this.toString() );
}