//Informe abaixo os juros para parcelamento e o máximo de parcelas
var Juros=new Array(0,0,0,0,0,0,0,0,0,0);

// Guarda em variavel a pagina atual
var sPag = document.location.href.toUpperCase()
var IDLoja;
var soIDLoja;
var BaseLoja;
function setReferencias(idloja, baseloja) {
	IDLoja = idloja
	soIDLoja = IDLoja.slice(0, IDLoja.indexOf("&"))
	BaseLoja = baseloja
}

// Funcao que valida a busca
function VerTexto(oNome) {
	if (oNome.Texto.value == '' || oNome.Texto.value.length < 2) {
		alert('Busca inválida.');
		oNome.Texto.focus();
		return false;
	} else {
		return true;
	}
}

// Funcao que calcula o numero maximo de parcelas por produto
function QuantasParcelas(PrecoProd, MaxProduto) {
var ParcelaMinima = 18, NumParcelasMax = 10, i=Math.floor(PrecoProd/ParcelaMinima);

if ((i>MaxProduto) && (MaxProduto > 0)) {return MaxProduto}
else{
if (i>NumParcelasMax){return NumParcelasMax}
else{return i}
}
}

// Funcao que mostra o preco cheio e as parcelas, ou o preço De/Por
function mostraPreco1(PrecoOri, PrecoNum) {
        if (PrecoOri > PrecoNum) {
		document.write("De "+ FormatPrecoReais(PrecoOri) + " por " + FormatPrecoReais(PrecoNum) + " Economize R$ " + Math.round(PrecoOri-PrecoNum))
	} else {
		document.write(FormatPrecoReais(PrecoOri))
		MaxParcelas = QuantasParcelas(PrecoNum)
		if (MaxParcelas > 1) {
			document.write(" ou até "
					+ MaxParcelas
					+ "X "
					+ FormatPrecoReais(PrecoOri/MaxParcelas))
		}
	}
}


// Funcao que mostra opcoes de parcelamento no detalhe do produto
function MostraParcelas(PrecoProd, MaxProduto) {
	var ComSem, EstiloLinha, p=QuantasParcelas(PrecoProd, MaxProduto);

	if ((PrecoProd == 0) ||  (p == 1))
		return;
	if ((MaxProduto == 0) )
		MaxProduto = p;
	document.write("<table cellpadding=0 cellspacing=0 border=0 id=tabParcelas><tr><td colspan=2 class=titulo>Opções de parcelamento</td></tr><tr><td class=subTitulo>Número de<br>parcelas</td><td class=subTitulo>Valor de<br>cada parcela</td></tr>");
	for (var i = 0; i < MaxProduto; i++) {
		if (Juros[i] > 0)
			ComSem = "com juros";
		else
			ComSem = "sem juros";
		if ((i % 2) == 0)
			EstiloLinha = 'par';
		else
			EstiloLinha = 'impar';
		document.write("<tr class="
				+ EstiloLinha
				+ "><td class="
				+ EstiloLinha
				+ ">"
				+ (i + 1)
				+ "x "
				+ ComSem
				+ "</td><td class="
				+ EstiloLinha
				+ ">"
				+ FormatPrecoReais(CalculaParcelaJurosCompostos(PrecoProd, i
								+ 1)) + "</td></tr>");
	}
	document.write("</table>");
}

// Nao sei pra que serve isso ainda
function MostraCarrinhoDisp(Estoque, IDProduto) {
	if (Estoque > 0) {
		document.write("<a href='javascript:Compra" + IDProduto
				+ "();'><img src=" + BaseLoja
				+ "/images/bComprar.gif  alt='Comprar'></a>");
	} else {
		document
				.write("<a href='javascript:MostraDisp(535,"
						+ IDProduto
						+ ")'><img src="
						+ BaseLoja
						+ "/images/bEsgotado.gif alt='Esgotado, quero ser avisado quando ficar disponível'></a>");
	}
}

// MENU (nem isso)
startList = function() {
	if (document.all && document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i = 0; i < navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI") {
				node.onmouseover = function() {
					this.className += " over";
				}
				node.onmouseout = function() {
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload = startList;

// BANNERS
function banAsse(q) {
	var banner = [];
	function bannerObj(url, imagem, nome, info) {
		this.url = url
		this.imagem = imagem
		this.nome = nome
		this.info = info
	}
	if (q == 1) {
		// ASSESSORIAS primeira linha
		banner[0] = new bannerObj(
				"http://www.marcospauloreis.net/",
				"mpr.gif",
				"MPR",
				"Tel.: (11) 3841-3646<br><a href='mailto:site@marcospauloreis.net'>site@marcospauloreis.net</a>");
		banner[1] = new bannerObj(
				"http://www.race.com.br/",
				"race.gif",
				"Race",
				"Tel.: (11) 5184-1003<br>Cel.: (11) 8331-0304<br><a href='mailto:race@race.com.br'>race@race.com.br</a>");
		banner[2] = new bannerObj("http://www.miguelsarkis.com.br/",
				"miguelsarkis.gif", "Miguel Sarkis", "Tel.: (11) 3052-1280");
		banner[3] = new bannerObj(
				"http://www.fabioguimaraes.com.br/",
				"fabioguimaraes.gif",
				"Fabio Guimarães",
				"Tel.: (11) 3842-6223<br>Tel.: (11) 3842-8496<br>Tel.: (11) 3845-0066<br><a href='mailto:fabio@fabioguimaraes.com.br'>fabio@fabioguimaraes.com.br</a>");
		banner[4] = new bannerObj(
				"http://www.pntreinamento.com.br/site/pn_parceiros/parceiros.jsp?e=fYa23AuWT&f=2",
				"pntreinamento2.gif",
				"Paulo Nogueira",
				"Cel: (11) 9947-5518<br><a href='mailto:'pntreinamento@pntreinamento.com.br' style='font-size:9px;'>pntreinamento@pntreinamento.com.br</a>");
		banner[5] = new bannerObj("http://www.findyourself.com.br/",
				"findyourself.gif", "Find Yourself",
				"Tel.: (11) 3554-9500<br>Cel.: (11) 7863-0557");
		banner[6] = new bannerObj(
				"http://www.triiron.com/",
				"triiron.gif",
				"Tri Iron",
				"Tel: (11) 9170-8179<br>Tel.: (11) 4399-3596<br><a href='mailto:triiron@terra.com.br'>triiron@terra.com.br</a>");
		banner[7] = new bannerObj("http://www.limiarassessoria.com.br/",
				"limiar.gif", "Limiar", "Tel.: (11) 3032-3570");
		banner[8] = new bannerObj(
				"mailto:nelsonevencio@terra.com.br",
				"nelsonevencio.gif",
				"Nelson Evêncio",
				"Cel: (11) 9997-0812<br>Tel.: (11) 5566-3830<br><a href='mailto:nelsonevencio@terra.com.br'>nelsonevencio@terra.com.br</a>");
		banner[9] = new bannerObj(
				"http://www.crosstrainer.com.br/",
				"crosstrainer.gif",
				"Cross Trainer",
				"Tel: (11) 5819-9495<br>Cel: (11) 9144-6987<br><a href='mailto:crosstrainer@crosstrainer.com.br'>crosstrainer@crosstrainer.com.br</a>");
		banner[10] = new bannerObj("http://www.runefun.com.br/", "runefun.gif",
				"Run & Fun", "Tel.: (11) 5096-4746");
		banner[11] = new bannerObj(
				"http://www.sadroperformance.com.br",
				"sandroperformance.gif",
				"Sandro Performance",
				"Tel.: (11) 9299-4581<br><a href='mailto:sandroperformance@hotmail.com'>sandroperformance@hotmail.com</a>");
		banner[12] = new bannerObj("http://www.nzptrainers.com.br", "nzp.gif",
				"NZP", "Tel.: (11) 5539-5604 ramal 330");
		banner[13] = new bannerObj(
				"mailto:cleber.guilherme@hotmail.com",
				"cleber.gif",
				"Prof. Ms. Cleber da Silva Guilherme",
				"Cel.: (11) 9423-5908<br><a href='mailto:cleber.guilherme@hotmail.com'>cleber.guilherme@hotmail.com</a>");
		banner[14] = new bannerObj("http://www.upfit.com.br", "upfit_2.gif",
				"UPFIT - Sidney Togumi",
				"<a href='mailto:stogumi@upfit.com.br'>stogumi@upfit.com.br</a>");
		banner[15] = new bannerObj("http://www.fitfam.com.br", "fifam_2.gif",
				"Fitfam", "Cel.: (81) 3272-1205");
	} else {
		// ASSESSORIAS segunda linha
		banner[0] = new bannerObj(
				"http://www.acaototal.com/",
				"acaototal.gif",
				"Ação Total",
				"Tel.: (11) 5083-4978<br>Fax: (11) 5549-7915<br><a href='mailto:faleconosco@acaototal.com'>faleconosco@acaototal.com</a>");
		banner[1] = new bannerObj(
				"http://www.5ways.com.br/",
				"5ways.gif",
				"5 Ways Sport Consulting",
				"Tel.: (11) 4427-3756<br>Cel.: (11) 8187-9608<br><a href='mailto:atendimento@5ways.com.br'>atendimento@5ways.com.br</a>");
		banner[2] = new bannerObj(
				"http://www.topnotch.com.br/",
				"topnotch.gif",
				"Top Notch Training",
				"Tel: (11) 5565-3690<br><a href='mailto:topnotchtraining@uol.com.br'>topnotchtraining@uol.com.br</a>");
		banner[3] = new bannerObj("http://www.flexxi360.com.br/",
				"flexxi360.gif", "Flexxi 360", "Tel.: (11) 3368-0360");
		banner[4] = new bannerObj(
				"http://www.sistemahelix.com.br/",
				"sistemahelix.gif",
				"Sistema Helix",
				"Tel.: (11) 3884-8541<br><a href='mailto:contato@sistemahelix.com.br'>contato@sistemahelix.com.br</a>");
		banner[5] = new bannerObj("http://www.andrecamposperformance.com.br/",
				"andrecampos.gif", "Andre Campos", "Tel.: (11) 7817-6818");
		banner[6] = new bannerObj("http://www.metasedesafios.com.br/",
				"metasedesafios.gif", "Metas e Desafios",
				"Tel.: (11) 7192-3622<br>Tel.: (11) 7297-6266");
		banner[7] = new bannerObj("http://www.stellakrieger.com.br/",
				"stellakrieger.gif",
				"BodyExpression by Stella Krieger Personal Trainer",
				"Tel.: 5531-1649<br>Tel.: 5096-6093");
		banner[8] = new bannerObj("http://www.vo2clubedecorrida.com.br/",
				"vo2.gif", "VO2", "Tel.: 3831-0208");
		banner[9] = new bannerObj("http://www.fitnesscompany.com.br/",
				"fitnesscompany.gif", "Fitness Company",
				"Tel.: (11) 4365 4842<br>Tel.: (11) 8338 9559");
		banner[10] = new bannerObj(
				"http://www.brancaesportes.com.br/",
				"brancaesportes.gif",
				"Branca Esportes",
				"<a href='mailto:contato@brancaesportes.com.br'>contato@brancaesportes.com.br</a>");
		banner[11] = new bannerObj(
				"http://www.hronline.com.br/",
				"hronline.gif",
				"HR/Run More Assessoria Técnica",
				"Tel.: 3213-4343<br><a href='mailto:atendimento@hronline.com.br'>atendimento@hronline.com.br</a>");
		banner[12] = new bannerObj("http://www.ctdio.net", "dios.gif",
				"Dio´s Running Team", "Tel.: (11) 3473-6945");
		banner[15] = new bannerObj("http://www.mitokondria.com.br",
				"mitokondria.jpg", "MitokondriA", "Tel.: (21) 8136-3083");
	}
	n = Math.floor(Math.random() * banner.length)
	document.write("<a href='" + banner[n].url + "' target='_blank'><img src='"
			+ BaseLoja + "images/assessoria/" + banner[n].imagem
			+ "'></a><br><b>" + banner[n].nome + "</b><br>" + banner[n].info)
}

//Abre Chat Alkes por Carneiro
function abreChat() {
var pop_window = window.open("about:blank","janela","width=350,height=350,resizable=0,toolbar=0,location=0,directories=0,status=1,menubar=0");
pop_window.focus();
document.getElementById('auto').submit();
}
