
jz.C$=jz.CtrlTransactions={_ftrans:{},__showBar:function($id,$text,pos,duration){var $floating=$($id).html($text);var scrolling=function(){var top=$(document).scrollTop()+pos;$floating.css('top',top);};scrolling();$(window).scroll(scrolling);$floating.show('pulsate',{},800);setTimeout(function(){$floating.hide('drop',{},300);},duration);},_showSBar:function(){jz.CtrlTransactions.__showBar("#processing",' - Processando',50,2000);},_showPBar:function(){jz.CtrlTransactions.__showBar("#floating",' - Aguarde',100,1500);},_console:{tpend:function(id){console.log('Transação Pendente : %s',id);},tfinal:function(id){console.log('Transação Finalizada : %s',id);},tpends:function(){console.log('Transações Pendêntes : %s',$.toJSON(jz.CtrlTransactions._ftrans));}},_fnIndicPends:function(){jz.CtrlTransactions._console.tpends();jz.CtrlTransactions._showPBar();},add:function(){var _transID=Util.getRandomId();jz.CtrlTransactions._ftrans[_transID]='0';jz.CtrlTransactions._console.tpend(_transID);return _transID;},finished:function(transID){jz.CtrlTransactions._console.tfinal(transID);jz.CtrlTransactions._ftrans[transID]='1';},hasPendencia:function(){return array_search('0',jz.CtrlTransactions._ftrans)!==false;},submitBtn:function(btn,preSubmition,submition){$(btn).click(function(){if(jz.CtrlTransactions.hasPendencia()){jz.CtrlTransactions._fnIndicPends();return;}
jz.CtrlTransactions._showSBar();if(preSubmition(this)){jz.CtrlTransactions.submit(submition,this);}});},submit:function(fn,btn){if(jz.CtrlTransactions.hasPendencia()){jz.CtrlTransactions._fnIndicPends();return;}
fn(btn);}}