//FILTRA AS SUBCATEGORIAS


function categoria(valor){
	url="conteudo.php?cat="+valor;
	ajax(url);
}

function subcategoria(valor){
	url="conteudo.php?sub="+valor;
	ajax(url);
}

function carqtd(valor,item){
	url="carrinho_complemento.php?qtd="+valor+"&item="+item;
	ajaxcar(url);
}

function cartotalitem(qtd,valor,div){
	div_result = div;
	url="carrinho_totalitem.php?qtd="+qtd+"&val="+valor;
	ajaxcaritem(url,div_result);
}

function cartotalped(){
	url="carrinho_total/";
	ajaxcar(url);
}

function ExibeFoto(p) {
	for (i=1; i<=5; i++ ) {
		var id_div = "foto" + i
		if (i == p) {
			document.getElementById(id_div).style.display = "block";
		} else {
			document.getElementById(id_div).style.display = "none";
		}
	}
}

function concordo(){
	
form = document.forms[1]
checkbox = form.checkbox

if(checkbox.checked == false){
alert("Para finalizar a compra é necessário que aceite o termo de Forma de Pagamento e Frete!")
form.checkbox.focus()
return;
}
else
form.action = 'finalizar.php'
form.submit()

}


function IsNumeric(sText){
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   
      if(IsNumber==true && sText>0){
      	return sText;
      }else{
      	return 1;
      }
      
    //  return IsNumber;
}

function display(id){
	
	if(id==1){
		document.getElementById('caracteristica').style.display='block';
		document.getElementById('aba_caracteristica').className='selected';
		document.getElementById('download').style.display='none';
		document.getElementById('aba_download').className='none';
		document.getElementById('caracteristica').width='908';
	}else{
		document.getElementById('caracteristica').style.display='none';
		document.getElementById('aba_caracteristica').className='none';
		document.getElementById('download').style.display='block';
		document.getElementById('aba_download').className='selected';
		document.getElementById('download').width='100%';
	}

}
