function verificaFinalizar(form){
	campo = document.finaliza_compra.meio_pgto.value;
	if (campo.length == 0){
		alert("Atenção!\nSelecione alguma forma de pagamento.");
		return false;
	}
}

//Função de submit da Cesta Verifica
function validaEsqueci(form){
	if (form.email.value != ""){
		if (form.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
			alert("Atenção!\nO campo E-Mail deve ser preenchido um email válido.");
			form.email.focus();
			return false;
		}
	}else{
		alert("Atenção!\nO campo E-Mail deve ser preenchido.");
		return false;
	}
}


//Função de submit da Cesta Verifica
function verificaCesta(form){
	select = document.getElementById('tarifa').value;
	//campo = document.getElementById('taxa').value;
	if (select.length <= 0){
		alert("Atenção\nCalcule a tarifa corretamente.");
		return false;
	}else{
		document.location = 'finalizar_compra.asp';
	}
}

//Função de submit da Newsletter
function enviaNews(acao){
	
	var str_nome = document.newsletter.news_nome;
	var str_email = document.newsletter.news_email;
	
	if ( str_nome.value.length <= 0) {
		alert("O campo Nome deve ser preenchido");
    	str_nome.focus();
    	return false;
	}
	
    if ((str_email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)){
    	alert("O campo E-Mail deve ser preenchido corretamente");
    	str_email.focus();
    	return false;
	}
	
	if (acao == 'S') {
		document.getElementById('ch_Descadastra').value = 'S';
		document.newsletter.submit();
	
	}else{
		document.getElementById('ch_Descadastra').value = 'N';
		document.newsletter.submit();
	}

	
}

//Função de submit da Cesta.asp
function jReload()
{
	document.cesta_compras.submit();
}

// Menu e submenu
function menuOn(id,menu,caminho) {
	document.getElementById(id).style.display = '';	
	document.getElementById(menu).src = caminho;	
}

function menuOff(id,menu,caminho) {
	document.getElementById(id).style.display = 'none';	
	document.getElementById(menu).src = caminho;	
}

// Adiciona site aos Favoritos
function fnFavoritos() {
	title = "Otherland Store - O estilo de cada Aventura"
	url = "http://www.otherlandstore.com.br";
	if(window.sidebar){ window.sidebar.addPanel(title,url,""); }
    else if(window.external){ window.external.AddFavorite(url,title); }
	else if(window.opera && window.print){ return true; }
}

// Retira o ActiveX
function fnFlash(str_url, int_largura, int_altura) {
	document.writeln('<object type="application/x-shockwave-flash" data="' + str_url + '" width="' + int_largura + '" height="' + int_altura + '">');
	document.writeln('<param name="movie" value="' + str_url + '">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<param name="wmode" value="transparent">');
	document.writeln('</object>');
}

// Função abre janela Indique a um Amigo
function fnIndique(theURL,winName){
	var myWin = window.open(theURL,winName,'width=440,height=380,scrollbars=no');
	myWin.focus();
}

// Função valida form do Indique a um Amigo
function verificaIndiqueAmigo(form){
	if(form.nome.value==""){
		alert("O campo Seu nome deve ser preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	var str_email = form.email.value;
    if(str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
    	alert("O campo Seu E-mail deve ser preenchido corretamente.");
    	form.email.focus();
    	return false;
	}
	var str_email = form.emailamigo.value;
    if(str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1){
    	alert("O campo E-mail do Destinatário deve ser preenchido corretamente.");
    	form.emailamigo.focus();
    	return false;
	}
}

// Verifica se a Data e valida
function validaData(DATA){
	var expReg = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
	var msgErro = 'Formato de data inválido.';
	var vdt = new Date();
	var vdia = vdt.getDay();
	var vmes = vdt.getMonth();
	var vano = vdt.getYear();
	var vano = parseInt(vano)+1900;
	if ((DATA.value.match(expReg))&&(DATA.value!='')){
		var dia = DATA.value.substring(0,2);
		var mes = DATA.value.substring(3,5);
		var ano = DATA.value.substring(6,10);
		if((mes==04 && dia > 30)||(mes==06 && dia > 30)||(mes==09 && dia > 30)||(mes==11 && dia > 30)){
			alert("Dia incorreto! O mês especificado contém no máximo 30 dias.");
			DATA.focus();
			return false;
		}
		else{
			//1
			if(ano%4!=0 && mes==2 && dia>28){
				alert("Data incorreta! O mês especificado contém no máximo 28 dias.");
				DATA.focus();
				return false;
			} 
			else{ //2
				if(ano%4==0 && mes==2 && dia>29){
					alert("Data incorreta! O mês especificado contém no máximo 29 dias.");
					DATA.focus();
					return false;
				}
				else{ //3
					if(ano > vano){
						alert("Data incorreta! Ano informado maior que ano atual.");
						DATA.focus();
						return false;
					}
					else{ //4
					//alert ("Data correta!");
					return true;
					} //4-else
				} //3-else
			}//2-else
		}//1-else
	}
	else{ //5
		alert(msgErro);
		DATA.focus();
		return false;
	} //5-else
}

// Verifica se o CPF e valido
function fVerificaCPF(campo){
	var CPF = campo.value; // Recebe o valor digitado no campo
	CPF = CPF.replace("-", "");
	CPF = CPF.replace(".", "");
	CPF = CPF.replace(".", "");
	if((CPF == '11111111111')||(CPF == '22222222222')||(CPF == '33333333333')||(CPF == '44444444444')||(CPF == '55555555555')||(CPF == '66666666666')||(CPF == '77777777777')||(CPF == '88888888888')||(CPF == '99999999999')||(CPF == '00000000000')||(CPF == '0')){
		document.getElementById('cpf_erro').style.display = '';
		document.getElementById('cpf_ok').style.display = 'none';
		return false;				  
	}
	else{
		// Aqui começa a checagem do CPF
		var posicao, i, soma, dv, dv_informado;
		var digito = new Array(10);
		dv_informado = CPF.substr(9, 2); // Retira os dois últimos dígitos do número informado
		// Desemembra o número do CPF na array DIGITO
		for(i=0; i<=8; i++){ digito[i] = CPF.substr(i,1); }
		// Calcula o valor do 10º dígito da verificação
		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]; }
		// Calcula o valor do 11º dígito da verificação
		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]; }
		// Verifica se os valores dos dígitos verificadores conferem
		dv = digito[9] * 10 + digito[10];
		if(CPF.length > 0){
			if(dv != dv_informado){
				document.getElementById('cpf_erro').style.display = '';
				document.getElementById('cpf_ok').style.display = 'none';
				return false;
			}
			else{
				document.getElementById('cpf_erro').style.display = 'none';
				document.getElementById('cpf_ok').style.display = '';
				return false;
			}
		}
		else{
			document.getElementById('cpf_erro').style.display = 'none';
			document.getElementById('cpf_ok').style.display = 'none';
		}
	}
}

// Verifica se o CNPJ e valido
function fVerificaCNPJ(CNPJ)
{
	erro = new String;
	if (CNPJ.length < 18) erro += "É necessarios preencher corretamente o numero do CNPJ! \n\n";
	
	if ((CNPJ.charAt(2) != ".") || (CNPJ.charAt(6) != ".") || (CNPJ.charAt(10) != "/") || (CNPJ.charAt(15) != "-"))
	{
		if (erro.length == 0) erro += "É necessarios preencher corretamente o numero do CNPJ! \n\n";
	}
	// substituir os caracteres que nao sao numeros
	if(document.layers && parseInt(navigator.appVersion) == 4)
	{
		x = CNPJ.substring(0,2);
		x += CNPJ.substring(3,6);
		x += CNPJ.substring(7,10);
		x += CNPJ.substring(11,15);
		x += CNPJ.substring(16,18);
		CNPJ = x;
	}
	else
	{
		CNPJ = CNPJ.replace(".","");
		CNPJ = CNPJ.replace(".","");
		CNPJ = CNPJ.replace("-","");
		CNPJ = CNPJ.replace("/","");
	}
	
	if( (CNPJ == '11111111111111') || (CNPJ == '22222222222222') || (CNPJ == '33333333333333') || (CNPJ == '44444444444444') ||
		(CNPJ == '55555555555555') || (CNPJ == '66666666666666') || (CNPJ == '77777777777777') || (CNPJ == '88888888888888') ||
		(CNPJ == '99999999999999') || (CNPJ == '00000000000000') )
	{
		  document.getElementById('cnpj_erro').style.display = '';
		  document.getElementById('cnpj_ok').style.display = 'none';
		  return false;				  
	}
	else
	{
		var nonNumbers = /\D/;
		if (nonNumbers.test(CNPJ)) erro += "A verificacao de CNPJ suporta apenas numeros! \n\n";
		var a = [];
		var b = new Number;
		var c = [6,5,4,3,2,9,8,7,6,5,4,3,2];
		
		for (i=0; i<12; i++)
		{
			a[i] = CNPJ.charAt(i);
			b += a[i] * c[i+1];
		}
		if ((x = b % 11) < 2) { a[12] = 0 } else { a[12] = 11-x }
		b = 0;
		
		for (y=0; y<13; y++)
		{
			b += (a[y] * c[y]);
		}
		if ((x = b % 11) < 2) { a[13] = 0; } else { a[13] = 11-x; }
		
		if ((CNPJ.charAt(12) != a[12]) || (CNPJ.charAt(13) != a[13]))
		{
			erro +="Digito verificador com problema!";
		}
		if (erro.length > 0)
		{
		    document.getElementById('cnpj_erro').style.display = '';
		    document.getElementById('cnpj_ok').style.display = 'none';
			return false;
		}
		else
		{
			document.getElementById('cnpj_erro').style.display = 'none';
			document.getElementById('cnpj_ok').style.display = '';
		}
		return true;
	}
}

// Ainda CNPJ
function fun_toggle_instrucoes(div){
	_div = document.getElementById(div);

	novo_display = (_div.style.display == 'block') ? 'none' : 'block';
	novo_display_selects = (novo_display == 'none') ? '' : 'none';

	_div.style.display = novo_display;
	showOrHideAllDropDowns(novo_display_selects);
}

function showOrHideAllDropDowns(newState) {
	var elements = document.documentElement.getElementsByTagName('select');

	for (var i=0; i<elements.length; i++) {
		elements[i].style.display = newState;
	}
}

// Mascara de Campos
function fnMascara(objeto, evt, mask)
{ 
	var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
	var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';	
	var Numeros = '0123456789';
	var Fixos  = '().-:/ ';
	var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";

	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	if (evt) {
 	var ntecla = (evt.which) ? evt.which : evt.keyCode;
 	tecla = Charset.substr(ntecla - 32, 1);
 	if (ntecla < 32) return true;

 	var tamanho = value.length;
 	if (tamanho >= mask.length) return false;

 	var pos = mask.substr(tamanho,1);
 	while (Fixos.indexOf(pos) != -1)
	 	{
 	 		value += pos;
 	 		tamanho = value.length;
 	 		if (tamanho >= mask.length) return false;
 	 		pos = mask.substr(tamanho,1);
		}

 	switch (pos) 
		{
   			case '#' : if (Numeros.indexOf(tecla) == -1) return false; break; //somente numeros
   			case 'A' : if (LetrasU.indexOf(tecla) == -1) return false; break; //somente letras maiusculas
   			case 'a' : if (LetrasL.indexOf(tecla) == -1) return false; break; //somente letras minusculas
   			case 'Z' : if (Letras.indexOf(tecla) == -1) return false; break; //somente letras
   			case '*' : objeto.value = value; return true; break; // letras e numeros
   			default : return false; break;
 		}
	}
	objeto.value = value;
	return true;
}

// Validacao de Login
function verificaAreaRestrita(form) {
var str_email = form.area_login.value;
var str_senha = form.area_senha.value;
	if (str_email == 'E-mail:')
	{ 
		alert("Atenção!\nPreencha o campo E-Mail!");
		form.area_login.focus();
		return false;
	}
	
	if (str_senha == 'senha')
	{ 
		alert("Atenção!\nPreencha o campo Senha!");
		form.area_senha.focus();
		return false;
	}
	
	if (str_email.length > 0){
		 if ((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1))
		{
			alert("Atenção!\nO campo Login deve ser preenchido corretamente");
			form.area_login.focus();
			return false;
		}
	}else{
		alert("Atenção!\nPreencha o campo E-Mail!")
		return false;
	}

	if (str_senha.length <= 1){
		alert("Atenção!\nO campo Senha deve estar preenchido corretamente.");
		form.area_senha.focus();
		return false;
	}
}

function verificaLogin(form) {
	var str_email = form.area_login.value;
    if ((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)){
    	alert("O campo Login deve ser preenchido corretamente");
    	form.area_login.focus();
    	return false;
	}
	
	if (form.area_senha.value.length <= 1){
		alert("O campo Senha deve estar preenchido corretamente.");
		form.area_senha.focus();
		return false;
	}
}

function verificaEsqueciSenha(form) {
	var str_email = form.email_senha.value;
    if ((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)){
    	alert("O campo Email deve ser preenchido corretamente");
    	form.email_senha.focus();
    	return false;
	}
}

// Validacao de Busca
function verificaBusca(form){
	if(form.palavra.value.length <= 1){
		alert("O campo Buscar deve estar preenchido corretamente.");
		form.palavra.focus();
		return false;
	}
}

// Validaca de Newslleter
function verificaNews(form) {
	if ((form.news_nome.value.length <= 1) || (form.news_nome.value == 'Nome:')) {
		alert("O campo Nome deve estar preenchido corretamente.");
		form.news_nome.focus();
		return false;
	}
	
	var str_email = form.news_email.value;
    if ((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)){
    	alert("O campo Email deve ser preenchido corretamente");
    	form.news_email.focus();
    	return false;
	}
	document.getElementById('ch_Descadastra').value = 'N';
}

// Validacao da Compra
function verificaCompra(form) {
	if (form.cor.value.length <= 0){
		alert("Atenção!\nVocê deve escolher a cor do produto.");
		form.cor.focus();
		return false;
	}
	
	if (form.tamanho.value.length <= 0){
		alert("Atenção!\nVocê deve escolher o tamanho do produto.");
		form.tamanho.focus();
		return false;
	}
}

// Validacao de Contato
function verificaContato(form){
	if(form.nome.value.length <= 1){
		alert("O campo Nome deve estar preenchido corretamente.");
		form.nome.focus();
		return false;
	}
	
	var str_email = form.email.value;
    if((str_email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)||(str_email == 'Email:')){
    	alert("O campo E-mail deve ser preenchido corretamente");
    	form.email.focus();
    	return false;
	}
	
/*	if(form.telefone.value.length <= 13){
		alert("O campo Telefone deve estar preenchido corretamente.");
		form.telefone.focus();
		return false;
	}*/
	
	if(form.cidade.value.length <= 1 ){
		alert("O campo Endereço deve estar preenchido corretamente.");
		form.cidade.focus();
		return false;
	}
	
	if(form.estado.value.length <= 1 ){
		alert("O campo Cidade deve estar preenchido corretamente.");
		form.estado.focus();
		return false;
	}
	
	
	
	if(form.estado.value.length <= 1 ){
		alert("O campo Estado deve estar preenchido corretamente.");
		form.estado.focus();
		return false;
	}
	
	
	
	if(form.mensagem.value.length <= 1 ){
		alert("O campo Mensagem deve estar preenchido corretamente.");
		form.mensagem.focus();
		return false;
	}
}

// Validacao do Cadastro
function fnTestaCampo(strLblCampo,strCampo,intTamanho,strTipo) {
		//T - Input Text Caracter
		//N - Input Text Inteiro
		//R - Radio Button
		//C - Checkbox
		//S - Select
        //E - Input Text Caracter E-Mail
		
		if ((strTipo == "T") || (strTipo == "E"))
		{
			if (strCampo.value.length == 0 || strCampo.value.length < intTamanho)
			{
				alert("Por favor, preencha o campo " + strLblCampo + " corretamente.");
				strCampo.focus();
				return false;
			}
            else if (strTipo == "E")
            {
                //	
                if ((strCampo.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) || (strCampo.value == "Email:") || (strCampo.value == "E-mail:")) 
            	{
            		alert("Por favor, preencha o campo " + strLblCampo + " corretamente.");
                    strCampo.focus();
            		return false;
            	}
            }
		}
        else if ( strTipo == "R" )
		{
            var contador ;
            var flag ;
            
            flag = false ;
            
            for ( contador = 0 ; contador < strCampo.length ; contador ++ )
            {
                if ( strCampo[contador].checked )
                {
                    flag = true ;
                }
            }
            
            if ( !flag )
            {
                alert("Por favor, preencha o campo " + strLblCampo + " corretamente.");
                return false ;
            }
		}
		else if ( strTipo == "C" )
		{
			if ( strCampo.checked  == false )
			{
				alert("Por favor, preencha o campo " + strLblCampo + " corretamente.");
				return false ;
			}
		}
		else if ( strTipo == "S" )
		{
			if ( strCampo.selectedIndex == -1 || strCampo.value == "" || strCampo.options[strCampo.selectedIndex].text == "")
			{
				alert("Por favor, preencha o campo " + strLblCampo + " corretamente.");
				return false;
			}
		}
}

function verificaCadastro(form) {
	if ( fnTestaCampo ( "Tipo" , form.tipopessoa , 0 , 'R' ) == false )
	return false ; 
	
	for (i=0; i<form.tipopessoa.length; i++){
	
	if (form.tipopessoa[i].checked) {
		
		resposta = form.tipopessoa[i].value;
	
		if (resposta == "F") {
		
			if ( fnTestaCampo ( "CPF" , form.cpf , 13 , 'T' ) == false )
			return false ; 
		
			if (form.cpf.value=="") {
				alert("Atenção!\nO campo CPF deve ser preenchido.");
				form.cpf.focus();
				return false;
			}
		
			else {
				fVerificaCPF(form.cpf);
				if(document.getElementById('cpf_ok').style.display == 'none') {
					alert("Atenção!\nDigite um CPF válido.");
					form.cpf.focus();
					return false;
				}
			}
			
			if ( fnTestaCampo ( "RG" , form.rg , 11 , 'T' ) == false )
			return false ;
	
			if ( fnTestaCampo ( "Nome" , form.nome , 0 , 'T' ) == false )
			return false ;
			
			if ( fnTestaCampo ( "Data de Nascimento" , form.data_nasc , 0 , 'T' ) == false )
			return false ; 
			}
	
		else if(resposta == "J") {
			
			if ( fnTestaCampo ( "CNPJ" , form.cnpj , 0 , 'T' ) == false )
			return false ; 
	
			if (form.cnpj.value=="") {
				alert("Atenção!\nO campo CNPJ deve ser preenchido.");
				form.cnpj.focus();
				return false;
			}
			
			else {
				fVerificaCNPJ(form.cnpj.value);
				if(document.getElementById('cnpj_ok').style.display == 'none') {
					alert("Atenção!\nDigite um CNPJ válido.");
					return false;
				}
			}
		
			if ( fnTestaCampo ( "Razão Social" , form.razaosocial , 0 , 'T' ) == false )
			return false ; 
		
			if ( fnTestaCampo ( "Cargo" , form.cargo , 0 , 'T' ) == false )
			return false ;
			}	
		}
	}
	
	if ( fnTestaCampo ( "Data de Nascimento" , form.data_nasc , 0 , 'T' ) == false )
	return false ;
	
	//if ( fnTestaCampo ( "Empresa" , form.empresa , 0 , 'T' ) == false )
	//return false ;
	
	if ( fnTestaCampo ( "Endereço" , form.endereco , 0 , 'T' ) == false )
	return false ; 

	if ( fnTestaCampo ( "Endereço" , form.endereco , 0 , 'T' ) == false )
	return false ; 
	
	if ( fnTestaCampo ( "Nº" , form.numero , 0 , 'T' ) == false )
	return false ; 
	
	if ( fnTestaCampo ( "Bairro" , form.bairro , 0 , 'T' ) == false )
	return false ; 
	
	if ( fnTestaCampo ( "CEP" , form.cep , 0 , 'T' ) == false )
	return false ; 

	if ( fnTestaCampo ( "E-mail" , form.email , 0 , 'E' ) == false )
	return false ; 
	
	if ( fnTestaCampo ( "Senha" , form.str_senha , 0 , 'T' ) == false )
	return false ;
	
	if ( fnTestaCampo ( "Confirma senha" , form.str_confirmasenha , 0 , 'T' ) == false )
	return false ;
	
	if ( fnTestaCampo ( "Telefone" , form.telefone , 13 , 'T' ) == false )
	return false ;
	
	if ( fnTestaCampo ( "Cidade" , form.cidade , 0 , 'T' ) == false )
	return false ; 
	
	if ( fnTestaCampo ( "Estado" , form.estado , 0 , 'S' ) == false )
	return false ; 

}

// Troca Juridica por Fisica
function verificaTipo(tipo) {
	if (tipo == 'F'){
		//Aparecem esses campos
		document.getElementById('fis_cpf').style.display = '';
		document.getElementById('fis_rg').style.display = '';
		document.getElementById('fis_nome').style.display = '';
		document.getElementById('fis_prof').style.display = '';
		
		//Esconde esses campos
		document.getElementById('jur_cnpj').style.display = 'none';
		document.getElementById('jur_razaosocial').style.display = 'none';
		document.getElementById('jur_cargo').style.display = 'none';	
	}
	
	else if(tipo == 'J'){
		//Esconde esses campos
		document.getElementById('fis_cpf').style.display = 'none';
		document.getElementById('fis_rg').style.display = 'none';
		document.getElementById('fis_nome').style.display = 'none';
		document.getElementById('fis_prof').style.display = 'none';
		
		//Aparecem esses campos
		document.getElementById('jur_cnpj').style.display = '';
		document.getElementById('jur_razaosocial').style.display = '';
		document.getElementById('jur_cargo').style.display = '';
	}

}

function fnExibeThumb(nomeImgThumb) 
{
	//Declara uma variavel para guardar a imagem temporaria.
	var imgTemp;
	
	//Na variavel temporaria, guarda a imagem atual, ou seja, o caminho completo ("http://www.otherlandstore.com.br/dbimagens....")
	imgTemp = nomeImgThumb.src;
	
	//na Imagem menor, guarda a imagem ja existente na maior
	nomeImgThumb.src = document.getElementById("maior").src;
	
	//No nomeImg ele guarda a imagem temporaria.
	document.getElementById("maior").src = imgTemp;
	
	//No id passado ele guarda a imagem temporaria
	document.getElementById("nomeImg").value = imgTemp;
}