function mostraBotao(bt){
	var a = setTimeout(document.getElementById(bt).style.display = "",2000);
	
}
function abreRastreio(dataPendente,dataPagamento,dataDespachado,dataCancelado,rastreio,titulo,track_number){
	
	var dataPendente = dataPendente;
	var dataPagamento = dataPagamento;
	var dataDespachado = dataDespachado;
	var dataCancelado = dataCancelado;
	
	this.fechaIframe('ifrRastreio','rastreioBtFechar');
	document.getElementById('rastreioTitulo').innerHTML = titulo;
	var pendente = document.getElementById("rastreioPendente");
	var pago = document.getElementById("rastreioPago");
	var despachado = document.getElementById("rastreioDespachado");
	var cancelado = document.getElementById("rastreioCancelado");
	var rastreio_num = document.getElementById("rastreioNumero");
	var rastreio_status_pendente = document.getElementById("rastreioStatusPendente");
	var rastreio_status_pago = document.getElementById("rastreioStatusPago");
	var rastreio_status_cancelado = document.getElementById("rastreioStatusCancelado");
	
	rastreio_status_pago.innerHTML = "";
	rastreio_status_pendente.innerHTML = "";
	rastreio_num.innerHTML = "";
	
	if(rastreio == "DESPACHADO" ||  rastreio == "OK"){
		
		pendente.className = "rastreioPendenteCor";
		pago.className = "rastreioPagoCor";
		despachado.className = "rastreioDespachadoHover";
		cancelado.className = "rastreioCanceladoNone";
		
		if (track_number != "") {
			rastreio_status_pendente.innerHTML = "<br><br><br>"+dataPendente;
			rastreio_status_pago.innerHTML = "<br><br><br>"+dataPagamento;
			rastreio_num.innerHTML = dataDespachado+"<br><br><a href='http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=002&P_COD_LIS=" + track_number + "' onclick='javascript:mostraBotao(\"rastreioBtFechar\");' target='ifrRastreio'>Clique aqui para acompanhar a entrega do seu pedido pelos CORREIOS</a>";
		}
		rastreio_status_cancelado.innerHTML = '';
		
	} else if(rastreio == "PENDENTE"){
		
		pendente.className = "rastreioPendenteHover";
		pago.className = "rastreioPago";
		despachado.className = "rastreioDespachado";
		cancelado.className = "rastreioCanceladoNone";
		
		rastreio_status_pendente.innerHTML = "Aguardando autorização de pagamento.<br><br>"+dataPendente;
		rastreio_status_cancelado.innerHTML = '';
		
	} else if(rastreio == "PAGO"){
		
		pendente.className = "rastreioPendenteCor";
		pago.className = "rastreioPagoHover";
		despachado.className = "rastreioDespachado";
		cancelado.className = "rastreioCanceladoNone";
		
		rastreio_status_pendente.innerHTML = "<br><br><br>"+dataPendente;
		rastreio_status_pago.innerHTML = "Pagamento realizado com sucesso. <br> Aguardando despache.<br><br>"+dataPagamento;
		rastreio_status_cancelado.innerHTML = '';
		
	}else if(rastreio == "CANCELADO"){
		
		cancelado.className = "rastreioCancelado";
		pendente.className = "rastreioPendenteNone";
		pago.className = "rastreioPagoNone";
		despachado.className = "rastreioDespachadoNone";
		
		rastreio_status_cancelado.innerHTML = 
		"<div style='width:600px; float:left; margin-left:-235px;'>" +
		"<span style='margin-left:-133px;'><img src='common/imgs/titles/tit_cancelado.png'></span><br><br>" +
		"<span style='margin-left:-185px;'>Pedido cancelado em "+ dataCancelado + "</span><br><br>" +
		"Entre em contato com nosso <a href='faleconosco.php'>atendimento</a> para maiores esclarecimentos." +
		"</div>";

	} 
	
//	document.getElementById('ifrRastreio').contentWindow.location = "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=002&P_COD_LIS="+rastreio;
}
function abreUrl(id){
	/*
	if(window.location.hostname == "server"){
		var ambiente = "server/territoriodosapato";
	} else {
		var ambiente = "www.territoriodosapato.com.br";
	} */
	// window.location.href = "http://"+ambiente+"/loja/areacliente.php?menu="+id;
	
	window.location.href = "areacliente-"+id;
}
function desmarcaRadio(nome){
	var radio = document.getElementsByName(nome);
	for(i=0; i < radio.length; i++){
		
		radio[i].checked = false;
	}
}
function prossegueCar4(){
	var a = new Ajax();
	a.onLoad = function() {
		/*
		if(window.location.hostname == "server"){
			var ambiente = "server/territoriodosapato";
		} else {
			var ambiente = "www.territoriodosapato.com.br";
		}
		window.location.href = "http://"+ambiente+"/loja/carrinho4.php"; */
		window.location.href = root+"carrinho4";
	};
	
	var radio = document.getElementsByName('rad_end');
	for(i=0; i < radio.length; i++){
		
		if(radio[i].checked){
			var id = radio[i].value;
			break;
		}
	}
	
//	window.open('include/routines.php?action=prossegueCar4&inserir=0&id='+id);
	a.get(root+'include/routines.php?action=prossegueCar4&inserir=0&id='+id);
}
function insereEndereco(){
	
	var a = new Ajax();
	a.onLoad = function() {

		abreMenu('enderecoentrega');
	}

	cep = document.getElementById('CEP_CEP1').value;
	endereco = document.getElementById('Endereço_TXT1').value;
	numero = document.getElementById('Número_NUM0').value;
	complemento = document.getElementById('Complemento_TXT0').value;
	bairro = document.getElementById('Bairro_TXT1').value;
	cidade = document.getElementById('Cidade_TXT1').value;
	estado = getSelectBoxValue(document.getElementById('Estado_CMB1'));
	
	if(cep == ""){
		alert("Por favor complete o campo 'CEP'");
	}else if(endereco == ""){
		alert("Por favor complete o campo 'Endereço'");
	}else if(numero == ""){
		alert("Por favor complete o campo 'Número'");
	}else if(bairro == ""){
		alert("Por favor complete o campo 'Bairro'");
	}else if(cidade == ""){
		alert("Por favor complete o campo 'Cidade'");
	}else if(estado == "" || estado == "-----" || estado == "Selecione"){
		alert("Por favor complete o campo 'Estado'");
	}else{
		a.get(root+'include/routines.php?action=insereEndereco&cep='+cep+'&endereco='+endereco+'&numero='+numero+'&complemento='+complemento+'&bairro='+bairro+'&cidade='+cidade+'&estado='+estado);
	}
}

function updateEndereco(id){
	
	var a = new Ajax();
	a.onLoad = function() {

		alert("Endereço atualizado com sucesso!");
		abreMenu('enderecoentrega');
	}

	var cep = document.getElementById('CEP'+id+'_CEP1').value;
	var endereco = document.getElementById('Endereço'+id+'_TXT1').value;
	var numero = document.getElementById('Número'+id+'_NUM0').value;
	var complemento = document.getElementById('Complemento'+id+'_TXT0').value;
	var bairro = document.getElementById('Bairro'+id+'_TXT1').value;
	var cidade = document.getElementById('Cidade'+id+'_TXT1').value;
	var estado = getSelectBoxValue(document.getElementById('Estado'+id+'_CMB1'));
	
	if(cep == ""){
		alert("Por favor complete o campo 'CEP'");
	}else if(endereco == ""){
		alert("Por favor complete o campo 'Endereço'");
	}else if(numero == ""){
		alert("Por favor complete o campo 'Número'");
	}else if(bairro == ""){
		alert("Por favor complete o campo 'Bairro'");
	}else if(cidade == ""){
		alert("Por favor complete o campo 'Cidade'");
	}else if(estado == "" || estado == "-----" || estado == "Selecione"){
		alert("Por favor complete o campo 'Estado'");
	}else{
		a.get(root+'include/routines.php?action=atualizaEndereco&id='+id+'&cep='+cep+'&endereco='+endereco+'&numero='+numero+'&complemento='+complemento+'&bairro='+bairro+'&cidade='+cidade+'&estado='+estado);
	}
//	a.get('include/routines.php?action=atualizaEndereco&numero='+id);		
}

function deleteEndereco(id){
	
	var a = new Ajax();
	a.onLoad = function() {

		abreMenu('enderecoentrega');
	}

	r = confirm("Deseja realmente excluir esse endereço?");
	if(r == true){
		a.get(root+'include/routines.php?action=excluiEndereco&id='+id);	
	}
			
}

function getSelectBoxValue(selectBox){
	
	for ( var i = 0; i < selectBox.length; i++) {
		if(selectBox.options[i].selected == true){
			valor = selectBox.options[i].value;
			break;
		}
	}
	return valor;
}

function fechaDiv(){
		document.getElementById("conteudo").innerHTML = "";
		document.getElementById("btFecha").style.display = "none";
	}

function abreMenu(menu){

//	alert('e');
	url = window.location.href;
	arr_url = url.split("/");
	
	var arquivo = arr_url[arr_url.length -1];
	
	if(arquivo == "cadastro" ){

		if(window.location.hostname == "server"){
			var ambiente = "server/territoriodosapato";
		} else {
			var ambiente = "www.territoriodosapato.com.br";
		}
		
		window.location.href = "http://"+ambiente+"/areacliente-"+menu;
	}
	
	var a = new Ajax();
	a.onLoad = function() {
		
		if(this.html != ""){
			document.getElementById("conteudo").innerHTML = this.html;
		}
	}

	if(menu == ""){
		menu = "<?php echo $input->get('menu');?>";
	}
	
	a.get(root+'include/routines.php?action=areaCliente&menu='+menu);		
}
function fechaIframe(nome,bt){
	if(document.getElementById(nome)){
		document.getElementById(nome).contentWindow.location = "about:blank";
		document.getElementById(bt).style.display = "none";
	}
}
function labelFields() {
	var inputs = document.getElementsByTagName("input");
	var input;

	for (var i = 0; i < inputs.length; i++) {
		input = inputs[i];  

		if ((input.value.length > 0) && (input.value.length == input.id.lastIndexOf("_"))) {
			input.value = input.value.substr(0, input.value.length);
			input.defaultValue = input.value;

			input.onfocus = function () {
				if (this.value == this.defaultValue) {
					this.value = '';
				}
			}

			input.onblur = function () {
				if (this.value == '') {
					this.value = this.defaultValue;
				}
			}
		}
	}
}
function somaClique(action,tmp_id,tmp_caminho,tmp_target) {
	var a = new Ajax();
	a.onLoad = function() {
		if (!(!tmp_caminho)) {
			if (tmp_target == 2) {
				window.location = tmp_caminho;
			}
		}
	}
	a.get(root+'include/routines.php?action='+action+'&id='+tmp_id);
}
function somaCliqueFlash(tmp_caminho) {
	var a = new Ajax();
	a.onLoad = function() {
		if (!(!tmp_caminho)) {
			window.location = tmp_caminho;
		}
	}
	a.get(root+'include/routines.php?action=somaCliqueBanner&link='+tmp_caminho);
}
function swapI(obj,focus){
	if(focus){
		if(obj.value == obj.attributes["label"].value){
			obj.value = "";
		}
	} else {
		if(obj.value.trim() == ""){
			obj.value = obj.attributes["label"].value;
		}
	}
}
function swapId(tmp_old_id, tmp_new_id) {
	var obj = $$(tmp_old_id);

	if (obj) {
		obj.id = tmp_new_id;
	}
}
function refazerPedido(tmp_idpedido) {
	var endereco_ajax = root+'include/routines.php?action=refazerPedido&idpedido='+tmp_idpedido;
	var ajax = new Ajax();
	ajax.onLoad = function() {
		window.location = root+'carrinho1';
	}
	ajax.get(endereco_ajax);
}

function vrfPessoa() {
	var tipo = 2;

	if (document.frmCadastro.tipo[0].checked) {
		tipo = 1;
	}

	if (tipo == 1) {
		swapId('Nome_TXT0', 'Nome_TXT1');
		swapId('CPF_CPF0', 'CPF_CPF1');
		swapId('Sexo_RDO0', 'Sexo_RDO1');
		swapId('Sexo_RDO0', 'Sexo_RDO1');
		swapId('Data de nascimento_DAT0', 'Data de nascimento_DAT1');

		swapId('Razão Social_TXT1', 'Razão Social_TXT0');
		swapId('CPNJ_CNP1', 'CPNJ_CNP0');

		$$('div_pessoajuridica').style.display = 'none';
		$$('div_pessoafisica').style.display = '';
	} else {
		swapId('Nome_TXT1', 'Nome_TXT0');
		swapId('CPF_CPF1', 'CPF_CPF0');
		swapId('Sexo_RDO1', 'Sexo_RDO0');
		swapId('Sexo_RDO1', 'Sexo_RDO0');
		swapId('Data de nascimento_DAT1', 'Data de nascimento_DAT0');

		swapId('Razão Social_TXT0', 'Razão Social_TXT1');
		swapId('CPNJ_CNP0', 'CPNJ_CNP1');

		$$('div_pessoafisica').style.display = 'none';
		$$('div_pessoajuridica').style.display = '';
	}
}

function checkCpf(tmp_cpf) {
	if (tmp_cpf != '') {
		var a = new Ajax();
		a.onLoad = function() {
			if (this.html != 1) {
				alert(this.html);
			}
		}
		a.get(root+'include/routines.php?action=checkCpf&cpf='+tmp_cpf);
	}
}
function checkCnpj(tmp_cnpj) {
	if (tmp_cnpj != '') {
		var a = new Ajax();
		a.onLoad = function() {
			if (this.html != 1) {
				alert(this.html);
			}
		}
		a.get(root+'include/routines.php?action=checkCnpj&cnpj='+tmp_cpf);
	}
}
function openEsqueci(){
	$$('div_login').style.display = 'none';
	$$('div_esquecisenha').style.display = '';
}
function closeEsqueci(){
	$$('div_esquecisenha').style.display = 'none';
	$$('div_login').style.display = '';
}
function chat() {
	window.open(root+'chat/login.php', 'Atendimento', 'width=400,height=500');
}

function formatPreco(tmp_number) {
	var r = "";
	var n = String((Math.round(tmp_number * 100) / 100));
	var c, i2;
	var offset = 0;

	if (n.indexOf(".") > -1) {
		var arr = n.split(".");

		offset = 3;
		r = "," + arr[1];
		if (arr[1].length == 1) {
			offset = 2;
			r = r + "0";
		}
	} else {
		r = ",00";
	}

	i2 = 0;
	for (var i = (n.length - offset - 1); i >= 0; i--) {
		c = n.charAt(i);

		if (c == ".") {
			break;
		}

		i2++;
		if (i2 > 3) {
			r =  c + "." + r;
			i2 = 1;
		} else {
			r = c + r;
		}

	}

	return r;
}

function moveBanner(action) {
	clearTimeout(banner);
	
	$$('li_bannerhome'+indicebanner).style.display = 'none';
	if (action == 'next') {
		indicebanner++;
		if (totalbanner <= indicebanner) {
			indicebanner = 0;
		}
	} else {
		indicebanner--;
		if (indicebanner < 0) {
			indicebanner = totalbanner-1;
		}
	}
	$$('li_bannerhome'+indicebanner).style.display = '';

	banner = setTimeout("moveBanner('next')",7000);
}

/************  PRODUTO  *************************/

function verifica_estoque(idproduto) {
	var ajax = new Ajax();
	ajax.onLoad = function() { // Resposta
		//alert(ajax.html);
		
		if (ajax.html != '') {
			if (ajax.html.charAt(0) != '!') { // Se não for erro, preenche
				$$("primeiro_option").innerHTML = 'Selecione';
				var opt = document.createElement("option");
				var t = document.createTextNode ("----------");
				opt.appendChild(t);
				document.getElementById("Tamanho_CMB1").appendChild(opt);

				var option = new Array();
				option = ajax.html.split("#");	// Quebra no caracter delimitador

				j=2;
				//alert(option.length);
				for ( i=0; i<option.length; i++ ) {
					//navego pelas chaves do array como um for //112
					arr = option[i].split("_");
					tamanhoid = arr[0];
					tamanhosite = arr[1];
					//alert(tamanhoid + '---' + tamanhosite);
					$$("Tamanho_CMB1").options[j]=new Option(tamanhosite, tamanhoid);
					j++;
				}
				document.getElementById('li_botaocompra').style.visibility = 'visible';
                                document.getElementById('aviseme').style.display = 'none';

			} else { // Se retornar erro, faz.
				document.getElementById('li_botaocompra').style.visibility = 'hidden';
                                document.getElementById('aviseme').style.display = '';
				document.getElementById("primeiro_option").text = 'Produto em falta.';
			}
		} else {
			document.getElementById('li_botaocompra').style.visibility = 'hidden';
                        document.getElementById('aviseme').style.display = '';
			document.getElementById("primeiro_option").text = 'Produto em falta.';
		}
	}

	ajax.get(root+'include/routines.php?action=checkEstoque&idproduto='+idproduto);
}

function comprar(idproduto) {
	var tamanho = $$('Tamanho_CMB1').value;

	if ((tamanho >= 0) && (tamanho.trim() != '') && (tamanho.trim() != '----------')) {
		document.location = root+'include/routines.php?action=additem&id='+idproduto+'&qnt=1&tamanho=' + tamanho;
	} else {
		alert("Por favor, escolha um tamanho.");
		$$('Tamanho_CMB1').focus();
	}
}

function addcarrinho(idproduto) {
	var tamanho = $$('Tamanho_CMB1').value;
	if ((tamanho >= 0) && (tamanho.trim() != '') && (tamanho.trim() != '----------')) {
		var ajax = new Ajax();
		ajax.onLoad = function() { // Resposta
			$$('span_valortotalatual').innerHTML = ajax.html;
			alert('Item inserido no carrinho com sucesso.');
		}
		ajax.get(root+'include/routines.php?action=addcarrinho&id='+idproduto+'&qnt=1&tamanho=' + tamanho);
	} else {
		alert("Por favor, escolha um tamanho.");
		$$('Tamanho_CMB1').focus();
	}

}
/************ / PRODUTO  *************************/

/************  CARRINHO  *************************/
var proximoPasso = false;
function calcFrete()
{
	showProximoPasso(false);

	if (nenhum_produto)
	{
		alert("Seu carrinho está vazio.\nAdicione um produto para prosseguir.");
		return;
	}

	if (($$('CEP_CEP1').value == "") || ($$('CEP_CEP1').value.length < 9)) {
		$$('CEP_CEP1').focus();
		alert("Digite o cep corretamente");
		$$('CEP_CEP1').focus();

		return;
	}

	$$('id_frete').innerHTML = "Carregando...";
	$$('id_prazo').innerHTML = "Carregando...";
	var a = new Ajax();
	a.unique = true;
	a.onLoad = function () {
		this.runJS(this.html);
		
		//alert(this.html);
		$$('resposta_cep').innerHTML += this.html + "<br>";

		calcTotal();
	}

	var tipofrete = $$('Tipo de frete_CMB1').value;

	if (tipofrete != '') {
		a.get(root+"include/routines.php?action=ajax_frete&cep=" + $$('CEP_CEP1').value+"&tipofrete="+tipofrete+"&rand="+parseInt(Math.random() * 10000000000));
	} else {
		alert('Selecione um tipo de entrega.');
	}
}

function calcDesconto(cupom) {
	showProximoPasso(false);
	var a = new Ajax();
	a.onLoad = function(){
		retorno = this.html;

		if ((retorno == 1) || (cupom == '')) {
			updateList();
		} else {
			alert('Cupom não encontrado ou já utilizado.');
		}

	}
	a.get(root+"include/routines.php?action=calcDesconto&cupom="+cupom);
}

function calcTotal() {
	$$('id_subtotal').innerHTML = "R$ " + formatPreco(valor_subtotal);

	if ((!frete_gratis) && (!desconto_frete_gratis)) {
		if(valor_subtotal > 200 && typeof is_from_sul != "undefined" && is_from_sul) {
			alert('Para frete grátis, selecione a opção PAC.');
		}
		
		if (valor_frete > 0) {
			$$('id_frete').innerHTML = "R$ " + formatPreco(valor_frete);
			$$('id_prazo').innerHTML = tempo_frete+" Dia(s) úteis";

			showProximoPasso(true);
		} else {
			$$('id_frete').innerHTML = 'R$ 0,00';
			$$('id_prazo').innerHTML = "Não Disponível.";
			showProximoPasso(false);
		}		
	} else {
		$$('id_frete').innerHTML = 'Frete Grátis';
		$$('id_prazo').innerHTML = tempo_frete+" Dia(s) úteis";
		
		//		// Tarefa #4945
		//		var pacCodigo = 41106;
		//		var frete_tipo = jQuery('select.tipoFrete').val();
		//		// console.log(jQuery('select.tipoFrete'));
		//		if(parseInt(frete_tipo) !== pacCodigo) { // nao e PAC 
		//			jQuery('select.tipoFrete').removeAttr('selected');
		//			jQuery('select.tipoFrete option[value=' + pacCodigo + ']').attr('selected', 'selected');
		//			alert('Para frete grátis, foi selecionada a opção PAC.');
		//		}
		//		jQuery('select.tipoFrete').attr('disabled', 'disabled');
		
		showProximoPasso(true);
	}
	valor_subtotal++; valor_subtotal--;
	valor_frete++; valor_frete--;
	valor_desconto++; valor_desconto--;

	$$('id_total').innerHTML = "R$ " + formatPreco(valor_subtotal + valor_frete - valor_desconto);
}

function showProximoPasso(tmp_mostrar) {
	// PS: antes se mostrava mensagem que para prosseguir era necessário calcular o frete
	// agora se mostra mensagem de erro ao tentar continuar.
	// esse controle é feito pela booleana proximoPasso.
	
	// var d = 'none';
	// var d2 = '';
	// if (tmp_mostrar) {
		// d = '';
		// d2 = 'none';
	// }

	// $$('proximo_passo_topo').style.display = d;
	// $$('proximo_passo_baixo').style.display = d;
	// $$('proximo_passo_explicacao_topo').style.display = d2;
	// $$('proximo_passo_explicacao_baixo').style.display = d2;
	proximoPasso = tmp_mostrar;
}

function updateList() {
	f.send('frm');
}

function nextStep() {
	if(proximoPasso){
		document.location = root+"carrinho2";
	} else {
		alert('Calcule o frete para prosseguir.');
	}
}

function plus(tmp_k){
	var qnt = $$('qnt_'+tmp_k).value;
	qnt++;
	$$('qnt_txt_'+tmp_k).value = qnt;
	$$('qnt_'+tmp_k).value = qnt;
	updateList();
}
function minus(tmp_k){
	var qnt = $$('qnt_'+tmp_k).value;
	qnt--;
	$$('qnt_txt_'+tmp_k).value = qnt;
	$$('qnt_'+tmp_k).value = qnt;
	updateList();
}
function deleteFromList(tmp_k){
	$$('excluir_'+tmp_k).value = 1;
	updateList();
}
/************ / CARRINHO  *************************/

function pop2(tmp_src){
	var p = new Popup(625,550);
	p.template = 1;
	p.overflow = 'hidden';
	p.open(tmp_src);
}


function chat() {
	window.open('livezilla/chat.php', 'Atendimento', 'width=600,height=500');
}

function abreFoto(foto) {
	var popup = new Popup(500,390);
	popup.overflow = 'hidden';
	popup.template = 2;
	popup.position = 'fixed';
	//alert('../../inc/structure/pop_foto.php?foto='+foto);
	if (foto) {
		popup.open('pop_foto.php?foto='+foto);
	}
}

function abreMapa(id) {
	var popup = new Popup(500,400);
	popup.overflow = 'hidden';
	popup.template = 2;
	popup.position = 'fixed';
	popup.open('pop_mapa.php?id='+id);
}

function str_replace (search, replace, subject, count) {
    j = 0,
        temp = '',
        repl = '',
        sl = 0,        fl = 0,
        f = [].concat(search),
        r = [].concat(replace),
        s = subject,
        ra = Object.prototype.toString.call(r) === '[object Array]',        sa = Object.prototype.toString.call(s) === '[object Array]';
    s = [].concat(s);
    if (count) {
        this.window[count] = 0;
    } 
    for (i = 0, sl = s.length; i < sl; i++) {
        if (s[i] === '') {
            continue;
        }for (j = 0, fl = f.length; j < fl; j++) {
            temp = s[i] + '';
            repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
            s[i] = (temp).split(f[j]).join(repl);
            if (count && s[i] !== temp) {this.window[count] += (temp.length - s[i].length) / f[j].length;
            }
        }
    }
    return sa ? s : s[0];
}

function alteraLinkBusca(){
	var txtPesquisa = document.frmSearch.q.value;
        var link = root+'busca/'+str_replace('  ', ' ',str_replace('/','',str_replace('á','%E1',str_replace('ç','%E7',txtPesquisa))));
        window.location = link;
}

function alteraLinkFiltro(){
        var txtPreco = document.frmSearchSelect.valor.value;
        var txtCalce = document.frmSearchSelect.calce.value;
        var txtCategoria = document.frmSearchSelect.categoria.value;
        txtCategoria = str_replace('á','%E1',str_replace('ç','%E7',txtCategoria));
        var link = root+'busca/'+txtPreco+'-'+txtCalce+'-'+txtCategoria;
        window.location = link;
}
