function n2_listaProdutos(_cat){
list = $('listaID_'+_cat);
Effect.toggle(list,'Blind');
new Ajax.Updater(list,'http://www.artpuxadores.com.br/admin/_ajax.php', {parameters:'acao=listaProdutos&_catid='+_cat, method: 'post',
oncomplete: function(){
TableKit.Sortable.addSortType(new TableKit.Sortable.Type('status', {
pattern : /^[New|Assigned|In Progress|Closed]$/,
normal : function(v) {
var val = 4;
switch(v) {
case 'New':
val = 0;
break;
case 'Assigned':
val = 1;
break;
case 'In Progress':
val = 2;
break;
case 'Closed':
val = 3;
break;
}
return val;
}
}
));
TableKit.options.editAjaxURI = '/echo/';
TableKit.Editable.selectInput('urgency', {}, [
['1','1'],
['2','2'],
['3','3'],
['4','4'],
['5','5']
]);
TableKit.Editable.multiLineInput('title');}
} );
}
function ajax_envia_mailing(tabela,lista){
Element.show( 'pop' )
$('pop').innerHTML = 'Salvando...'
//new Ajax.Request('http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=ordena&tabela='+tabela+'&'+lista, onSuccess:ajax_hide,method: 'get'});
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=ordena&tabela='+tabela+'&'+lista,asynchronous:true,method: 'get',onComplete:ajax_hide});
}
function ajax_ordena(tabela,lista){
Element.show( 'pop' );
$('pop').innerHTML = 'Salvando...'
//new Ajax.Request('http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=ordena&tabela='+tabela+'&'+lista, onSuccess:ajax_hide,method: 'get'});
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=ordena&tabela='+tabela+'&'+lista,asynchronous:true,method: 'get',onComplete:ajax_hide});
}
function ajax_insere(t){
new Insertion.Bottom('idcategorias',t.responseText );
}
function ajax_remover(id){
if(confirm('Tem certeza de que deseja remover esta imagem?\nImagem #'+id)){
Element.show( 'pop' );
$('pop').innerHTML = 'Excluindo...'
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=deletar_foto&id='+id,asynchronous:true,method: 'get',onComplete:ajax_mensagem_ok(id)});
}
}
function ajax_mensagem_ok(id){
setTimeout('Element.hide( "pop" );',2500)
Element.hide( 'foto_'+id );
}
function ajax_insere_campo_arquivo(){
Text = '';
Text += '
'
new Insertion.Bottom('fotos',Text );
Text = '';
}
function ajax_insere_campo_campo(){
Text = '';
Text += ' '
new Insertion.Bottom('campos',Text );
Text = '';
}
function ajax_insere_atributos_de_canais(){
Text = '';
Text += ' '
new Insertion.Bottom('atributos_de_canais',Text );
Text = '';
}
function ajax_atualiza_atributos(t,id){
new Ajax.Updater('atributos', 'http://www.artpuxadores.com.br/_ajax.php?acao=atualiza_atributos&tipo='+t+'&id='+id, {asynchronous:true});
}
function ajax_mensagem_atributo_ok(id){
setTimeout('Element.hide( "pop" );',2500)
Element.hide( 'atributos_de_canais'+id );
}
function ajax_remover_atributos_de_canais(id){
if(confirm('Tem certeza de que deseja remover esta imagem?'+id)){
Element.show( 'pop' );
$('pop').innerHTML = 'Excluindo...'
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=remover_atributos_de_canais&id='+id,asynchronous:true,method: 'get',onComplete:ajax_mensagem_atributo_ok(id)});
}
}
function ajax_ativar_canal(id){
$('pop').innerHTML = 'Carregando...'
new Ajax.Updater('status_canal'+id, 'http://www.artpuxadores.com.br/_ajax.php?acao=ativar_canal&id='+id, {asynchronous:true});
}
function ajax_desativar_canal(id){
$('pop').innerHTML = 'Carregando...'
new Ajax.Updater('status_canal'+id, 'http://www.artpuxadores.com.br/_ajax.php?acao=desativar_canal&id='+id, {asynchronous:true});
}
function ajax_adiciona_pedido(id){
$('pop').innerHTML = 'Carregando...'
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php?acao=adiciona_pedido&id='+id, {asynchronous:true});
}
function ajax_hide(t){
setTimeout('Element.hide( "pop" );',500)
}
function ajax_salva(t){
Element.hide( 'pop' );
//window.location='http://www.artpuxadores.com.br/_ajax.php?acao=salva_opt&nome='+t
//new Insertion.Bottom('idfabricantes','' );
new Ajax.Updater('fabricantes', 'http://www.artpuxadores.com.br/_ajax.php?acao=salva_opt&nome='+t, {asynchronous:true});
}
function pop_foto(t){
Element.show( 'pop' );
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php?acao=mostra_foto&imagem='+t, {asynchronous:true});
}
function ajax_outro(t){
if(t=='outro'){
Element.show( 'pop' );
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php?acao=mostra_campo', {asynchronous:true});
}
}
function ajax_pop_imagem(t){
Element.show( 'pop' );
new Ajax.Updater('pop', 'http://www.artpuxadores.com.br/_ajax.php?acao=mostra_foto&imagem='+t, {asynchronous:true});
}
function ajax_subcategoria(id,campo){
new Ajax.Request('http://www.artpuxadores.com.br/_ajax.php', {parameters:'acao=pega_subcategoria&campo='+campo+'&idcategorias='+id, onSuccess:ajax_insere});
}
function pega_dados(pars)
{
var url = 'ajax.php';
var myAjax = new Ajax.Request( url, { method: 'get', parameters: pars });
}
function showResponse(originalRequest)
{
//put returned XML in the textarea
return originalRequest.responseText;
}
function grabPosXML (tagName,id) {
if(ret = myAjax.transport.responseXML.documentElement.getElementsByTagName(tagName)[id].childNodes[0].nodeValue)
return ret
else
return "erro";
}
function confirma_delete(){
if(confirm('Tem certeza que deseja deletar os item selecionados?'))
document.form1.submit()
}
function troca_menu(objeto){
objeto.className='td_menu_over';
}
function restaura_menu(objeto){
objeto.className='td_menu';
}
function pega_cep(){
document.form1.acao.value='cep';
document.form1.submit();
}
function selall(){
if(document.form1.ok.value==false){
for (var i=0;i 5){ objeto.value = ""; }
if (objeto.value.length == 5){
objeto.value += "-";
}
}
function Tecla(e)
{
if(document.all) // Internet Explorer
var tecla = event.keyCode;
else if(document.layers) // Nestcape
var tecla = e.which;
if(tecla > 47 && tecla < 58 || tecla == 45) // numeros de 0 a 9
return true;
else
{
if (tecla != 8 || tecla == 45) // backspace
return false;
else
return true;
}
}
function ClearStr(str, char)
{
while((cx=str.indexOf(char))!=-1)
{
str = str.substring(0,cx)+str.substring(cx+1);
}
return(str);
}
function FormataData(Campo,teclapres)
{
var tecla = teclapres.keyCode;
var vr = new String(Campo.value);
vr = vr.replace( ".", "" );
vr = vr.replace( "/", "" );
vr = vr.replace( "/", "" );
tam = vr.length + 1;
if ( tecla != 9 && tecla != 8 )
{
if ( tam > 2 && tam < 5 )
Campo.value = vr.substr( 0, tam - 2 ) + '/' + vr.substr( tam - 2, tam );
if ( tam >= 5 && tam <= 10 )
Campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 );
}
}
function FormataCPF(Campo, teclapres){
var tecla = teclapres.keyCode;
var vr = new String(Campo.value);
vr = vr.replace(".", "");
vr = vr.replace(".", "");
vr = vr.replace("-", "");
tam = vr.length + 1;
if (tecla != 9 && tecla != 8){
if (tam > 3 && tam < 7)
Campo.value = vr.substr(0, 3) + '.' + vr.substr(3, tam);
if (tam >= 7 && tam <10)
Campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,tam-6);
if (tam >= 10 && tam < 12)
Campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,3) + '-' + vr.substr(9,tam-9);
}
}
function FormataCNPJ(Campo, teclapres){
var tecla = teclapres.keyCode;
var vr = new String(Campo.value);
if(Campo.lenght==19) return;
vr = vr.replace(".", "");
vr = vr.replace(".", "");
vr = vr.replace("/", "");
vr = vr.replace("-", "");
tam = vr.length + 1 ;
if (tecla != 9 && tecla != 8 ){
if (tam > 2 && tam < 6)
Campo.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
if (tam >= 6 && tam < 9)
Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,tam-5);
if (tam >= 9 && tam < 13)
Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,tam-8);
if (tam >= 13 && tam < 15)
Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4)+ '-' + vr.substr(12,tam-12);
}
}
function set_login(){
vr = cadastro.cli_cpf.value;
vr = vr.replace(".", "");
vr = vr.replace(".", "");
vr = vr.replace("/", "");
vr = vr.replace("-", "");
cadastro.cli_login.value=vr;
}
function muda(campo,teclapres){
var tecla = teclapres.keyCode;
p1 = campo.value;
if((tecla > 47 && tecla < 58) || (tecla > 95 && tecla < 106)){
p1 = p1.replace( ".", "" );
tam = p1.length;
p1 = p1.substr( 0, tam - 1 ) + '.' + p1.substr( tam - 1, tam ) ;
campo.value = p1;
}
}
function acessa_correios(){
window.open('http://www.correios.com.br/servicos/cep/cep_resp_pesq.cfm?CEP='+document.form1.cep.value)
}
function verifica_email(campo){
if(window.RegExp) {
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var reg2str = "^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if(!reg1.test(campo.value) && reg2.test(campo.value)) {
return true;
}
alert("E-mail incorreto!\rVerifique e digite novamente.");
return false;
}else{
if(campo.indexOf("@") >= 0)
return true;
return false;
}
}