
var it_tempo	= 0;

/*# SCROLL ESQUERDA - Rola a div pra esquerda #*/
function scrollEsq(it_velocidade, vc_div) {
	var it_velocidade			= (it_velocidade) ? parseInt(it_velocidade) : 0;
	var dv_conteudo				= document.getElementById(vc_div);
	var it_largura				= 0;
	
	if (it_velocidade > 0 && dv_conteudo.scrollLeft != it_largura) {
		dv_conteudo.scrollLeft	= parseInt(dv_conteudo.scrollLeft - it_velocidade);
		
		it_tempo	= setTimeout("scrollEsq(" + it_velocidade + ", '" + vc_div + "')", 50);
	} else {
		clearTimeout(it_tempo);
		return false;
	}
}

/*# SCROLL DIREITA - Rola a div pra direita #*/
function scrollDir(it_velocidade, vc_div) {
	var it_velocidade			= (it_velocidade) ? parseInt(it_velocidade) : 0;
	var dv_conteudo				= document.getElementById(vc_div);
	var it_largura				= parseInt(dv_conteudo.scrollWidth);
	
	if (it_velocidade > 0 && dv_conteudo.scrollLeft < it_largura) {
		dv_conteudo.scrollLeft	= parseInt(dv_conteudo.scrollLeft + it_velocidade);
		
		it_tempo	= setTimeout("scrollDir(" + it_velocidade + ", '" + vc_div + "')", 50);
	} else {
		clearTimeout(it_tempo);
		return false;
	}
}


/*# MUDAR IMAGEM PRODUTO #*/
function mudarImagemProduto(obj,vc_img){

	//Muda o link da amplicação. Troca o arquivoID antigo, pelo que foi clicado
	document.getElementById('lk_galeria').href	= document.getElementById('lk_galeria').href.replace('arquivoID='+document.getElementById('arquivoID').value,'arquivoID='+vc_img) ;
	
	//Seta os campos hiddens. Que serão lidos pela função de ampliação.
	document.getElementById('imagem_urlVC').value	= obj.src.replace('thumbnail','grande');
	document.getElementById('arquivoID').value		= vc_img;
	
	
	//Muda a borda
	//Volta todos pro estilo normal
	for (i=0; i<document.getElementById('dv_thumbnail').childNodes.length-1;i++){
		document.getElementById('dv_thumbnail').childNodes[i].style.borderColor = '#000';
		document.getElementById('dv_thumbnail').childNodes[i].style.borderWidth = '1px';
	}
	//Destaca o Clicado
	obj.style.borderColor	= '#F30';
	obj.style.borderWidth	= '2px';
	
		
	//Troca a exibição da imagem do produto.
	var img		= parent.document.getElementById('im_produto');
	img.src		= obj.src.replace('thumbnail','pequena');
}


/* MUDAR COR - PRODUTOS RELACIONADOS*/
function mudarCor(id_produto, id_produto_relacionado){
	if (id_produto != id_produto_relacionado){
		self.location.href	= '?actA=4&produtoID='+id_produto_relacionado;
	}
}

function validaEmailAviso(){
	var form			= document.getElementById('frmAviso');
	var mensagem1		= 'ATENÇÃO!\n\n';
	var mensagem2		= '';
	var vc_focus 		= '';
	
	if(form.nomeVC.value.length == 0){
		mensagem2		+= '- Preencha o campo Nome.\n';
		if(vc_focus == ''){
			vc_focus = form.nomeVC;
		}
	}
	
	if(form.emailVC.value == ''){
		mensagem2		+= '- Preencha o campo E-mail.\n';
		if(vc_focus == ''){
			vc_focus = form.emailVC;
		}
	}
	else{
		mensagem2 	+=  verficaEmail(form.emailVC.value);		
		if(vc_focus == ''){
			vc_focus = form.emailVC;
		}
	}
	
	if (mensagem2 != ''){
		alert(mensagem1 + mensagem2);
		vc_focus.focus();
		return false;
	} else {
		return true
	}
}