getContent = function(page, pars){
	var url = "conteudo/"+page+".php";
	var param = pars;
	
	var myAjax = new Ajax.Updater(
		'conteudo',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});
};

getContent2 = function(page, pars){
	var url = "conteudo/"+page+".php";
	var param = pars;
	
	var myAjax = new Ajax.Updater(
		'conteudo2',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});
};

produtoGD = function(id){
	var url = 'conteudo/produtosGd.php';
	var pars = 'id_produto='+id;
	
	var myAjax = new Ajax.Updater(
		'produto_gd',
		url, 
		{
			asynchronous: true,
			parameters	: pars,
			onComplete: displayProdutoGD,
			evalScripts: true
		});
};

paginasProdutos = function(cat, subcat, pagina){
	
	var url = "conteudo/produtosSel.php";
	var param = "cat="+cat+"&subcat="+subcat+"&pag="+pagina;
	
	var myAjax = new Ajax.Updater(
		'paginas',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});
};

setPaginacao = function(qtdreg, numreg, pagina,cat,subcat){
	
	var url = "conteudo/paginacao.php";
	var param = "qtdreg="+qtdreg+"&numreg="+numreg+"&pg="+pagina+"&cat="+cat+"&subcat="+subcat;
	
	var myAjax = new Ajax.Updater(
		'paginacao',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});
};

setPaginacao2 = function(qtdreg, numreg, pagina,cat,subcat){
	
	var url = "conteudo/paginacao.php";
	var param = "qtdreg="+qtdreg+"&numreg="+numreg+"&pg="+pagina+"&cat="+cat+"&subcat="+subcat;
	
	var myAjax = new Ajax.Updater(
		'paginacao2',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});
};

produtosCapa = function(){
	
	var url = "conteudo/produtosCp.php";
	
	var myAjax = new Ajax.Updater(
		'paginas',
		url, 
		{
			asynchronous: true,
			evalScripts: true
		});
};

setComprar = function(form){
	
	var url = "controle/setComprar.php";
	var pars = $(form).serialize();
	
	
	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});
};

atCart = function(form){
	
	var url = "controle/atCart.php";
	var pars = $(form).serialize();
	
	
	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});
};

popComprar = function(id){
	
	var url = "controle/popComprar.php";
	var param = "id="+id;
	
	var myAjax = new Ajax.Updater(
		'res',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});
};

setCadastro = function(form){
	
	var url = "controle/novoCadastro.php";
	var pars = $(form).serialize();
	
	
	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});
};

setLogin = function(form){
	
	var url = "controle/login.php";
	var pars = $(form).serialize();
	
	
	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});
};

setCadLogin = function(email, senha){
	
	var url = "controle/login.php";
	var param = "email="+email+"&senha="+senha;
	
	var myAjax = new Ajax.Updater(
		'res',
		url, 
		{
			method		: 'post', 
			evalScripts	: true,
			parameters	: param
		});

}

logoff = function(){

	var url = 'controle/logoff.php';
	var pars = '';

	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});

};


setEntrega = function(form){
	
	var url = "controle/setEntrega.php";
	var pars = $(form).serialize();
	
	
	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});
};

setPedido = function(){
	
	var url = "controle/setPedido.php";
	var pars = '';
	
	
	var myAjax = new Ajax.Updater(
	'res',
	url, 
	{
		method		: 'post', 
		evalScripts	: true,
		parameters	: pars
	});
};

cadCliente = function(email){
	
	var url = "controle/cadCliente.php";
	var param = "email="+email;
	
	var myAjax = new Ajax.Updater(
		'res',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});

}

email = function(campos){
	
	var url = "controle/contato.php";
	var param = campos;
	
	var myAjax = new Ajax.Updater(
		'res',
		url, 
		{
			asynchronous: true,
			evalScripts: true,
			parameters	: param
		});

}

enviaPedido = function(){
	
	var url = "controle/enviaPedido.php";
	var param = '';
	
	var myAjax = new Ajax.Updater(
		'res',
		url, 
		{
			method		: 'post', 
			evalScripts	: true,
			parameters	: param
		});

}

validaForm = function(form){
	icpf = '';
	for(i=0; i<$(form).length; i++){
//	alert($(form)[i].name);
		if($(form)[i].name != 'news'){
				if($(form)[i].value == ''){
					alert('Preencha todos os campos!');
					$($(form)[i].id).focus();
					return false;
				}
				
				if($(form)[i].name == 'cpf'){
					icpf = i;
				}
		}
	}
	if (icpf){
		if (!vercpf($(form)[icpf].value)){
			alert('Verifique o CPF!');
			$($(form)[i].id).focus();
			return false;
		}else{
			return true;
		}
	}else{
		return true;
	}
}

formatar = function(mascara, documento){
  var i = documento.value.length;
  var saida = mascara.substring(0,1);
  var texto = mascara.substring(i)
  
  if (texto.substring(0,1) != saida){
            documento.value += texto.substring(0,1);
  }
  
}


vercpf = function(scpf) {
	cpf1 = scpf.replace('.','');
	cpf2 = cpf1.replace('.','');
	cpf =  cpf2.replace('-','');
	
	if(cpf == '00000000000000' || cpf == '11111111111111' || cpf == '22222222222222' || cpf == '33333333333333' || cpf == '44444444444444' || cpf == '55555555555555' || cpf == '66666666666666' || cpf == '77777777777777' || cpf == '88888888888888' || cpf == '99999999999999') {
					return false;
				} else if(cpf.length != 14) {
					return true;
				} else {
					for (t = 12; t < 14; t++) {
						for (d = 0, p = t - 7, c = 0; c < t; c++) {
							d += cpf[c] * p;
							p   = (p < 3) ? 9 : --p;
						}
						
						d = ((10 * d) % 11) % 10;
						
						if (cpf[c] != d) {
							return true;
						}
					}
					
					return true;
				}
			}
