/* 
############################################################
# -------------------------------------------------------- #
# SOUDADO.COM © Todos os direitos reservados               #
# -------------------------------------------------------- #
############################################################
*/

function numeros(objEvent)
{
    var naveg = navigator.appName;
 	if (naveg == "Microsoft Internet Explorer"){
	var iKeyCode;  
    iKeyCode = objEvent.keyCode;  
    if(iKeyCode>=48 && iKeyCode<=57 || iKeyCode == 9) return true;
    return false;
 	}else{
	iKeyCode = objEvent.charCode;  
    if ( (iKeyCode >= 48 && iKeyCode <= 57 && objEvent.keyCode == 0) || objEvent.keyCode == 8 || objEvent.keyCode == 9) return true;
	return false;
 	}
		
}

function acharY(e)
{ 
    var posx = 0;
    var posy = 0;
	var naveg = navigator.appName;
    if (!e) var e = window.event;
    if (e.pageX || e.pageY)
    {
        posx = e.pageX;
        posy = e.pageY;
    }
    else if (e.clientX || e.clientY)
    {
        posx = e.clientX;
        posy = e.clientY;
    }
		
	document.getElementById('posX').innerHTML = posx;
	document.getElementById('posY').innerHTML = posy;

}

var te   = 0;
var ti = new Array(100);
var velocidade;

if (navigator.appName == "Microsoft Internet Explorer") velocidade = 15;
else velocidade = 2;

// Vai deixando ele visível
function tran(id,oque)
{
	if(oque == 1)	te = te + velocidade;
	else 	        te = te - velocidade;
	
	document.getElementById('c'+id).style.filter = "alpha(opacity="+ te +")";
	document.getElementById('c'+id).style.opacity = te/100;
	
	if     (te < 100 && oque == 1)  ti[id] = setTimeout("tran("+id+","+oque+")",10); 
	else if(te > 0 && oque == 2)    ti[id] = setTimeout("tran("+id+","+oque+")",10);
	else if(te <= 0 && oque == 2)
	{
		document.getElementById('c'+id).style.position = "absolute";
		document.getElementById('c'+id).style.top = "-150000px";
		document.getElementById('c'+id).style.visibility = "hidden";
	}
}

function categorias(id,oque)
{	
	if(oque == 1)	te = 0;
	else 	        te = 100;
	
	if(document.getElementById('c'+id).style.visibility == "" || document.getElementById('c'+id).style.visibility == "hidden" || oque == 2)
	{
		
		// Habilita o selecionado 
		document.getElementById('c'+id).style.filter = "alpha(opacity=0)";
		document.getElementById('c'+id).style.opacity = 0;
		document.getElementById('c'+id).style.position = "relative";	
		document.getElementById('c'+id).style.top = "0";
		document.getElementById('c'+id).style.visibility = "visible";
		
		// Inicia a fazer a transparencia
		tran(id,oque); 

	}
}


























function contagem(valueID)
{
	document.getElementById('contagem').innerHTML = "Máximo de 5.000 (" + document.getElementById(valueID).value.length + ") caracteres.";	
	
}

var qtddDIVs = 6;

function bloquear(id)
{
	document.getElementById(id).disabled = "disabled";	 
	document.getElementById(id).style.color = "#009900";	
	document.getElementById(id).style.border = "#009900 double 3px";
	document.getElementById(id).value = "Processando...";	
}

function corLINHA(n)
{
	document.getElementById("linha"+n).style.background = "#414040";
}


function SEMcorLINHA(n)
{
	document.getElementById("linha"+n).style.background = "#121212";
}


function ajustar()
{
	if(document.getElementById("tamanho").clientHeight > document.getElementById("tamanhoMENU").clientHeight)
	{ document.getElementById("ajustador").style.height = document.getElementById("tamanho").clientHeight; }
	else { document.getElementById("ajustador").style.height = document.getElementById("tamanhoMENU").clientHeight; }
}


function telaPROD(desejado,qtdd)
{

	// Deixa todos invisíveis e indisponíveis
	for(x=1;x<=qtdd;x++){ document.getElementById("passo"+x).style.position = "absolute"; }
	for(x=1;x<=qtdd;x++){ document.getElementById("passo"+x).style.visibility = "hidden"; }
	for(x=1;x<=qtdd;x++){ document.getElementById("passo"+x).style.top = "-1000px"; }
	
	// Deixa visível o passo escolhido
	document.getElementById("passo"+desejado).style.top = "0px";
	document.getElementById("passo"+desejado).style.visibility = "visible";
	document.getElementById("passo"+desejado).style.position = "static";
	
}

function calcular_valor(qtdd)
{
	// Zerar variáveis
	var calculo = 0;
	var itens = 0;
	
	for(x=1;x<=qtdd;x++) 
	{	
		if(document.getElementById("produto" + x).checked == true)	
		{
			calculo = calculo + eval(document.getElementById("produto" + x).value); 
			itens = itens + 1;
		}
	}	
	
	// Atualizar visual
	document.getElementById("valortotal").innerHTML = "<img src='imagens/linkY.gif' /> <b>Valor Total:</b> R$ <span id='valor1TOTAL'>" + calculo + ",00</span>";
	document.getElementById("itensTOTAL").innerHTML = "<img src='imagens/linkY.gif' /> <b>Itens:</b> " + itens;
}


function principal_passo(n)
{

	if (n <= 3) { de = 1; ate = 3; } else { de = 4; ate = 6; }
	
	for(x=de;x<=ate;x++){ document.getElementById("p"+x).style.position = "absolute"; }
	for(x=de;x<=ate;x++){ document.getElementById("p"+x).style.visibility = "hidden"; }
	for(x=de;x<=ate;x++){ document.getElementById("p"+x).style.top = "-1000px"; }
	for(x=de;x<=ate;x++){ document.getElementById("seta"+x).style.opacity = .30; document.getElementById("seta"+x).style.filter = "alpha(opacity=30)"; }

	document.getElementById("p"+n).style.top = "0px";
	document.getElementById("p"+n).style.visibility = "visible";
	document.getElementById("p"+n).style.position = "static";
	
	document.getElementById("seta"+n).style.opacity = .90; 
	document.getElementById("seta"+n).style.filter = "alpha(opacity=90)";

	ajustar();

}




function steam(numero)
{
	if(numero == 1)
	{
	document.getElementById("t1").style.visibility = "visible";	document.getElementById("t1").style.position = "relative";
	document.getElementById("t2").style.visibility = "hidden"; 	document.getElementById("t2").style.position = "absolute";
	document.getElementById("t3").style.visibility = "hidden"; 	document.getElementById("t3").style.position = "absolute";
	}
	if(numero == 2)
	{
	document.getElementById("t1").style.visibility = "hidden";	document.getElementById("t1").style.position = "absolute";
	document.getElementById("t2").style.visibility = "visible"; document.getElementById("t2").style.position = "static";
	document.getElementById("t3").style.visibility = "visible"; document.getElementById("t3").style.position = "relative";
	}
}


function premium(numero)
{
	if(numero == 1)
	{
	document.getElementById("pp1").style.visibility = "visible";	document.getElementById("pp1").style.position = "relative";
	document.getElementById("pp2").style.visibility = "hidden"; 	document.getElementById("pp2").style.position = "absolute";
	}
	if(numero == 2)
	{
	document.getElementById("pp1").style.visibility = "hidden";	document.getElementById("pp1").style.position = "absolute";
	document.getElementById("pp2").style.visibility = "visible"; document.getElementById("pp2").style.position = "relative";
	document.getElementById("loginPACC").value = "";
	}
}

function correcao(numero)
{
	if(numero == 1)
	{
	if(document.getElementById("steamCONFIRMA").checked == true) { steam(1); }	else { steam(2); }
	if(document.getElementById("paccCONFIRMA").checked == true) { premium(1); } else { premium(2); }
	}
	if(numero == 2)
	{
	/*document.getElementById("t1").style.visibility = "hidden";
	document.getElementById("t2").style.visibility = "hidden";
	document.getElementById("t3").style.visibility = "hidden";*/
	document.getElementById("pp1").style.visibility = "hidden";
	document.getElementById("pp2").style.visibility = "hidden";
	}
}

function confirmarPASSO(passo,qtdd)
{
	if(passo == "produtos")
	{
		var texto = "<ul>";
		var ids = "<font color=#121212>0";
		var a = 0;
		
		// Verifica se algum produto foi selecionado
		for(x=1;x<=qtdd;x++) 
		{	
			if(document.getElementById("produto" + x).checked == true)	
			{ 
				a++; 
				texto = texto + "<li>" + document.getElementById("nomePROD" + x).value + "</li>"; 
				ids = ids + "-" + document.getElementById("idPROD" + x).value;
			}
		}	
		
		// Se não, dá erro
		if (a == 0) { telaPROD(1,qtddDIVs); return alert("Você precisa escolher no mínimo um produto para comprar."); }
		
		// Forma a lista dos produtos	
		document.getElementById("listaPRODUTOS").innerHTML = ids + "</font>" + texto + "</ul>";
		document.getElementById("produtos").value = ids + "</font>" + texto + "</ul>";
			
		// Valor total dos produtos
		document.getElementById("valorTconfir").innerHTML = "<ul><li>R$ " + document.getElementById("valor1TOTAL").innerHTML + "</li></ul><br>";
		document.getElementById("valores").value = "R$ " + document.getElementById("valor1TOTAL").innerHTML;
		
	}
	if(passo == "pessoais")
	{
		// Verifica se todos os campos estão preenchidos
		if (document.getElementById("cliente_nome").value == "" ||	
			document.getElementById("cliente_email").value == "") { telaPROD(2,qtddDIVs); return alert("É necessário preencher todos os campos."); }
		
		// Verifica se o nome é válido
		if (document.getElementById("cliente_nome").value.length < 10) { telaPROD(2,qtddDIVs); return alert("É necessário digitar seu nome completo."); }
		
		// Verifica o e-mail
		if (document.getElementById("cliente_email").value.indexOf("@") < 1)
  		{ telaPROD(2,qtddDIVs); return alert("É necessário digitar um e-mail válido."); }

		// Tudo ok, faz o texto
		var texto = "<ul>";
		
		if(document.getElementById("produtos").value.indexOf("VIP") >= 1 || document.getElementById("produtos").value.indexOf("OT$") >= 1) { texto = texto+ "<li><b>Nick no fórum:</b> "+ document.getElementById("nick").value +"</li>";  }
		
		if(document.getElementById("cliente_nome").value == "") { texto = texto + "<li><b>Nome:</b> -</li>";  }
		else { texto = texto + "<li><b>Nome:</b> "+ document.getElementById("cliente_nome").value +"</li>";  }
		
		if(document.getElementById("cliente_email").value == "") { texto = texto + "<li><b>E-mail:</b> -</li>";  }
		else { texto = texto + "<li><b>E-mail:</b> "+ document.getElementById("cliente_email").value +"</li>";  }	
		
		document.getElementById("listaDADOS").innerHTML = texto + "</ul>";
		document.getElementById("pessoais").value = texto + "</ul>";
					
		// Atualiza todos os valores do botão para o PagSeguro
		document.getElementById("item_valor_1").value = document.getElementById("valor1TOTAL").innerHTML;
		
	}
	/*if(passo == 3)
	{
		// Verifica se todos os campos estão preenchidos
		if ((document.getElementById("nickSTEAM").value == "") && 
			(document.getElementById("steamCONFIRMA").checked == true)) { telaPROD(2,3,qtddDIVs); return alert("É necessário colocar o login da sua conta steam."); }
		
		if ((document.getElementById("steamCONFIRMA").checked != true) && 
			(document.getElementById("contaSTEAM").value == "")) { telaPROD(2,3,qtddDIVs); return alert("É necessário colocar um nome para sua nova conta."); }
		
		var texto = "<ul>";
		
		if(document.getElementById("steamCONFIRMA").checked == true) { texto = texto + "<li><b>Possui conta?</b> Sim</li>";  }
		else { texto = texto + "<li><b>Possui conta?</b> Não</li>";  }
			
		if(document.getElementById("steamCONFIRMA").checked == true) { texto = texto + "<li><b>Login Steam:</b> "+ document.getElementById("nickSTEAM").value +"</li>";  }
		
		if(document.getElementById("steamCONFIRMA").checked != true) { texto = texto + "<li><b>Login:</b> "+ document.getElementById("contaSTEAM").value +"</li>";  }

		
		if(document.getElementById("steamCONFIRMA").checked != true) { texto = texto + "<li><b>Senha:</b> soudado123</li>";  }
		
		document.getElementById("steamdadosCONFIRMA").innerHTML = texto + "</ul>";
		document.getElementById("steamdados").value = texto + "</ul>";
		
	}*/
	if(passo == "rapidshare")
	{
		// Verifica se todos os campos estão preenchidos	
		if (document.getElementById("loginPACC").value == "" &&	
			document.getElementById("paccCONFIRMA").checked == true) { telaPROD(5,qtddDIVs); return alert("É necessário preencher a ID da sua conta."); }
		
		// Se comprar TrafficShare, verificar se está colocando uma conta já existente
		if (document.getElementById("produtos").value.indexOf("TrafficShare") >= 1 && document.getElementById("produtos").value.indexOf("Premium") <= 0 && document.getElementById("paccCONFIRMA").checked == false)
  		{ telaPROD(5,qtddDIVs); return alert("Compras de TrafficShare só são habilitadas para contas já existentes."); }	
		
		var texto = "<ul>";
		
		if(document.getElementById("paccCONFIRMA").checked == true) { texto = texto + "<li><b>Renovação/TrafficShare?</b> Sim</li>";  }
		else { texto = texto + "<li><b>Renovação/TrafficShare?</b> Não</li>";  }
			
		if(document.getElementById("loginPACC").value == "") { texto = texto + "<li><b>ID da Conta:</b> <i>nova conta</i></li>";  }
		else { texto = texto + "<li><b>ID da Conta:</b> "+ document.getElementById("loginPACC").value +"</li>";  }
			
		document.getElementById("dadosCONFIRMA").innerHTML = texto + "</ul>";
		document.getElementById("dados").value = texto + "</ul>";

	}
	if(passo == "servidores")
	{
		// Verifica se todos os campos estão preenchidos	
		if (document.getElementById("loginSERVIDOR").value == "") { telaPROD(6,qtddDIVs); return alert("É necessário preencher o LOGIN de sua conta."); }
				
		var texto = "<ul>";
		
		texto = texto + "<li><b>Servidor:</b> "+ document.getElementById("servidor").value +"</li>";  
		texto = texto + "<li><b>Conta:</b> "+ document.getElementById("loginSERVIDOR").value +"</li>";  
					
		document.getElementById("dadosCONFIRMA").innerHTML = texto + "</ul>";
		document.getElementById("dados").value = texto + "</ul>";

	}
}


function fechar()
{
	document.getElementById('cSUSPENSO').style.visibility = 'hidden';
	document.getElementById('cSUSPENSO2').style.visibility = 'hidden';
	document.getElementById('cSUSPENSO2').innerHTML = '';	
}


function variados(tipo,n)
{
	switch(tipo)
	{
		/* PEDIDOS - STEAM | MUDAR DE JOGOS PARA PACOTES */
		case 1:
		
		switch(n)
		{
			case 2:
				document.getElementById("s3").style.position = "absolute"; 
				document.getElementById("s3").style.visibility = "hidden"; 
				document.getElementById("s3").style.top = "-1000px"; 
				
				document.getElementById("s2").style.top = "0px";
				document.getElementById("s2").style.visibility = "visible";
				document.getElementById("s2").style.position = "static";
				
				document.getElementById("seta2").style.opacity = .90; document.getElementById("seta2").style.filter = "alpha(opacity=90)";
				document.getElementById("seta3").style.opacity = .30; document.getElementById("seta3").style.filter = "alpha(opacity=30)";
			break;
			
			case 3:
				document.getElementById("s2").style.position = "absolute"; 
				document.getElementById("s2").style.visibility = "hidden"; 
				document.getElementById("s2").style.top = "-1000px"; 
				
				document.getElementById("s3").style.top = "0px";
				document.getElementById("s3").style.visibility = "visible";
				document.getElementById("s3").style.position = "static";	
				
				document.getElementById("seta3").style.opacity = .90; document.getElementById("seta2").style.filter = "alpha(opacity=90)";
				document.getElementById("seta2").style.opacity = .30; document.getElementById("seta3").style.filter = "alpha(opacity=30)";
			break;
				
		}
		
		if(document.getElementById("tamanho").clientHeight > document.getElementById("tamanhoMENU").clientHeight)
		{ document.getElementById("ajustador").style.height = document.getElementById("tamanho").clientHeight; }
		else { document.getElementById("ajustador").style.height = document.getElementById("tamanhoMENU").clientHeight; }
		
		break;
	}
}


function aba(acao,divid)
{
	switch(acao)
	{
		case "hover":
			document.getElementById("aba" + divid).style.backgroundPosition='bottom';
			document.getElementById("aba" + (divid+1)).style.backgroundPosition='bottom';
			document.getElementById("aba" + (divid+2)).style.backgroundPosition='bottom';
		break;
		
		case "left":
			document.getElementById("aba" + divid).style.backgroundPosition='top';
			document.getElementById("aba" + (divid+1)).style.backgroundPosition='top';
			document.getElementById("aba" + (divid+2)).style.backgroundPosition='top';
		break;
	}
}



/* 
############################################################
##### SCRIPTS DESENVOLVIDOS POR VITOR HENRIQUE PEREIRA #####
############################################################
*/

