function LoadPage(valor)
{
	if (valor == '1')
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			document.getElementById('div_menu').style.width = '100%';
		}
		else
		{
			document.getElementById('div_menu').style.width = '200px';
			document.getElementById('SubMenu').style.width = '200px';
			document.getElementById('SubMenuTexto').style.margin = '2px';
			document.getElementById('SubMenuTexto').style.width = '200px';
		}
	}
	if (valor == '2')
	{
		if (navigator.appName == 'Microsoft Internet Explorer')
		{
			document.getElementById('div_menu').style.width = '100%';
		}
		else
		{
			document.getElementById('div_menu').style.width = '200px';
		}
		
		document.getElementById('produto_detalhes1').style.display = 'none';
		document.getElementById('produto_detalhes3').style.display = '';
	}
}



function produto_imagem_a(pagina)
{
	if (pagina == '2')
	{
		document.getElementById('img_1').style.display = 'none';
		document.getElementById('img_2').style.display = '';
		document.getElementById('img_3').style.display = 'none';
		document.getElementById("img_label").innerHTML = '2';
		document.getElementById('foto_2').style.display = '';
		document.getElementById('foto_3').style.display = 'none';
		document.getElementById('a_foto_1').style.display = '';
		document.getElementById('a_foto_2').style.display = 'none';
	}
}
function produto_imagem(pagina)
{
	if (pagina == '1')
	{
		document.getElementById('img_1').style.display = '';
		document.getElementById('img_2').style.display = 'none';
		document.getElementById('img_3').style.display = 'none';
		document.getElementById("img_label").innerHTML = '1';
	}
	
	if (pagina == '2')
	{
		document.getElementById('img_1').style.display = 'none';
		document.getElementById('img_2').style.display = '';
		document.getElementById('img_3').style.display = 'none';
		document.getElementById("img_label").innerHTML = '2';
		document.getElementById('foto_2').style.display = 'none';
		document.getElementById('foto_3').style.display = '';
		document.getElementById('a_foto_1').style.display = 'none';
		document.getElementById('a_foto_2').style.display = '';
	}
	
	if (pagina == '3')
	{
		document.getElementById('img_1').style.display = 'none';
		document.getElementById('img_2').style.display = 'none';
		document.getElementById('img_3').style.display = '';
		document.getElementById("img_label").innerHTML = '3';
	}
}




function seleciona_integrador(c,t)
{
	for(x=1; x<=t; x++)
	{
		integrador = eval('document.all.integrador' + x + '.style;');
		
		if(x==c)
		{
			integrador.display = '';
		}
		else
		{
			integrador.display = 'none';
		}		
	}
}

function seleciona_produto_detalhes(c,t)
{
	for(x=1; x<=t; x++)
	{
		produto_detalhes = eval('document.all.produto_detalhes' + x + '.style;');
		
		if(x==c)
		{
			produto_detalhes.display = '';
		}
		else
		{
			produto_detalhes.display = 'none';
		}		
	}
}





function seleciona_curso_evento(c)
{
	for(x=1; x<=2; x++)
	{
		curso_evento = eval('document.all.curso_evento' + x + '.style;');
		
		if(x==c)
		{
			curso_evento.display = '';
		}
		else
		{
			curso_evento.display = 'none';
		}		
	}
}




function seleciona_dica(c)
{
	for(x=1; x<=1; x++)
	{
		dica = eval('document.all.dica' + x + '.style;');
		
		if(x==c)
		{
			dica.display = '';
		}
		else
		{
			dica.display = 'none';
		}		
	}
}




function seleciona_artigo(c)
{
	for(x=1; x<=1; x++)
	{
		artigo = eval('document.all.artigo' + x + '.style;');
		
		if(x==c)
		{
			artigo.display = '';
		}
		else
		{
			artigo.display = 'none';
		}		
	}
}



function cadastro(texto)
{
	if (texto == 'busca')
	{
		document.getElementById('buscaCadastro').style.display = 'none';
		document.getElementById('buscaCadastroAvancada').style.display = '';
	}
	if (texto == 'cancelar_busca')
	{
		document.getElementById('buscaCadastro').style.display = '';
		document.getElementById('buscaCadastroAvancada').style.display = 'none';
	}
	if (texto == 'F')
	{
		document.getElementById('fisica').style.display = '';
		document.getElementById('juridica').style.display = 'none';
	}
	if (texto == 'J')
	{
		document.getElementById('fisica').style.display = 'none';
		document.getElementById('juridica').style.display = '';
	}
}



function testaCampoNr(campo) {
	var vCaracteresValidosNr = '0123456789';	// Define os caracteres válidos para números...
	var vCaracter;											// instancia manipulador de caracteres...
	var vValorCampo;	// Variavel com o valor do campo atual...
	if ((document.getElementById(campo)) && (document.getElementById(campo).value)) {
		vValorCampo	= document.getElementById(campo).value;
		for (n=0; n < vValorCampo.length; n++) {					// Para cada letra colocada no campo...
			vCaracter=vValorCampo.charAt(n);						// coloca letra atual no manipulador...
			if(vCaracteresValidosNr.indexOf(vCaracter)==-1){		// Se o caracter atual não está na lista de caracteres validos para numero.. 
				alert('Caracter inválido!!');
				document.getElementById(campo).focus();
				erro = 1;
				break;
			}
		}
	}
}

function verificaVendedor()
{
	if(document.formVendedor.dsVendedor.value == '')
	{
		alert('Selecione um vendedor!');
		document.formVendedor.dsVendedor.focus();
		return false;
	}
}


function verificaBusca()
{
	if(document.formBusca.dsBusca.value == '')
	{
		alert('Preencha o campo busca!');
		document.formBusca.dsBusca.focus();
		return false;
	}
	
	if(document.formBusca.idCategoria.value == '')
	{
		alert('Selecione uma categoria!');
		document.formBusca.idCategoria.focus();
		return false;
	}
}



function verificaIndicacao()
{
	if(document.formIndicacao.dsNome.value == '')
	{
		alert('Informe seu nome!');
		document.formIndicacao.dsNome.focus();
		return false;
	}
	
	if(document.formIndicacao.dsEmail.value == '')
	{
		alert('Informe seu e-mail!');
		document.formIndicacao.dsEmail.focus();
		return false;
	}
	else
	{
		if (/^([\w\.\-])+\@(([\w\-])+\.)+([\w ]{2,4})$/.test(document.formIndicacao.dsEmail.value) == false)   
		{ 
			alert("E-mail Inválido!");
			document.formIndicacao.dsEmail.select();
			document.formIndicacao.dsEmail.focus();
			return false;
		}
	}
	
	
	if(document.formIndicacao.dsNome2.value == '')
	{
		alert('Informe o nome de seu(a) amigo(a)');
		document.formIndicacao.dsNome2.focus();
		return false;
	}
	
	if(document.formIndicacao.dsEmail2.value == '')
	{
		alert('Informe o e-mail de seu(a) amigo(a)');
		document.formIndicacao.dsEmail2.focus();
		return false;
	}
	else
	{
		if (/^([\w\.\-])+\@(([\w\-])+\.)+([\w ]{2,4})$/.test(document.formIndicacao.dsEmail2.value) == false)   
		{ 
			alert("E-mail Inválido!");
			document.formIndicacao.dsEmail2.select();
			document.formIndicacao.dsEmail2.focus();
			return false;
		}
	}
}

function verificaCadastro()
{
	if(document.formCadastro.dsNome.value == '')
	{
		alert('Informe o Nome!');
		document.formCadastro.dsNome.focus();
		return false;
	}
	
	if(document.formCadastro.dsEmail.value == '')
	{
		alert('Informe seu e-mail!');
		document.formCadastro.dsEmail.focus();
		return false;
	}
	else
	{
		if (/^([\w\.\-])+\@(([\w\-])+\.)+([\w ]{2,4})$/.test(document.formCadastro.dsEmail.value) == false)   
		{ 
			alert("E-mail Inválido!");
			document.formCadastro.dsEmail.select();
			document.formCadastro.dsEmail.focus();
			return false;
		}
	}

	if(document.formCadastro.dsSenha.value == '')
	{
		alert('Informe o Senha');
		document.formCadastro.dsSenha.focus();
		return false;
	}
		
	if(document.formCadastro.dsSenha2.value == '')
	{
		alert('Repita a Senha');
		document.formCadastro.dsSenha2.focus();
		return false;
	}
	
	if(document.formCadastro.dsSenha.value != document.formCadastro.dsSenha2.value)
	{
		alert('As senhas devem coincidir');
		document.formCadastro.dsSenha.focus();
		return false;
	}
	
	if(document.formCadastro.dsEndereco.value == '')
	{
		alert('Informe o Endereço!');
		document.formCadastro.dsEndereco.focus();
		return false;
	}
	
	if(document.formCadastro.dsCep.value == '')
	{
		alert('Informe o Cep!');
		document.formCadastro.dsCep.focus();
		return false;
	}
	
	if(document.formCadastro.dsBairro.value == '')
	{
		alert('Informe o Bairro!');
		document.formCadastro.dsBairro.focus();
		return false;
	}
	
	if(document.formCadastro.dsCidade.value == '')
	{
		alert('Informe a Cidade!');
		document.formCadastro.dsCidade.focus();
		return false;
	}
	
	if(document.formCadastro.dsEstado.value == '')
	{
		alert('Selecione o estado!');
		document.formCadastro.dsEstado.focus();
		return false;
	}
}