
String.prototype.ucFirst=function(){return this.substr(0,1).toUpperCase()+this.substr(1,this.length);};String.prototype.trim=function(){var str=this.replace(/^\s*/g,"");str=str.replace(/\s*$/g,"");return str;}
String.prototype.soLetras=function(){return this.replace(/[^A-Za-z ]/g,'');}
String.prototype.soNumeros=function(){return this.replace(/[^0-9]/g,'');}
String.prototype.unLast=function(){return this.substring(0,this.length-1);}
String.prototype.substrReplace=function(valor,ini,quantidade){var modelo=this;var pEsquerda=modelo.substring(0,ini);var pFim=modelo.substring(ini);return pEsquerda+
pFim.replace(pFim.substring(0,(quantidade-pEsquerda.length)),valor);}
String.prototype.nl2br=function(){return this.replaceWith("\r","").replaceWith("\n","<BR />");}
String.prototype.repeat=function(m){return new Array(parseInt(m)+1).join(this);}
String.prototype.br2nl=function(){var valor=this;valor=valor.replaceWith("<br />","<BR />");valor=valor.replaceWith("<br>","<BR />")
valor=valor.replaceWith("<BR>","<BR />")
return valor.replaceWith("<BR />","\r\n");}
String.prototype.replaceWith=function(f,t){var valor=this;while(valor.indexOf(f)!=-1){valor=valor.replace(f,t);}
return valor.toString();}
Array.prototype.retiraUltimaPosicao=function(){return this.splice(this.length-1,1);}
Array.prototype.arraySearch=function(busca){var oarray=this;for(var i in oarray){if(oarray[i]==busca){return i;}}
return false;}
if(!Array.prototype.some){Array.prototype.some=function(fun){var len=this.length;if(typeof fun!="function")
throw new TypeError();var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this&&fun.call(thisp,this[i],i,this))
return true;}
return false;};}
if(!Array.prototype.forEach){Array.prototype.forEach=function(fun){var len=this.length;if(typeof fun!="function")
throw new TypeError();var thisp=arguments[1];for(var i=0;i<len;i++){if(i in this)
fun.call(thisp,this[i],i,this);}};}
var Util={go2:function(pg){document.location.href=pg;},$:function(el){if(typeof el=='string'){var el=document.getElementById(el);}
return el;},jQueryObj:function(elem){if(typeof elem=='string'&&elem.indexOf('#')!=0){return $('#'+elem);}else{return $(elem);}},forceFn:function(fn){return typeof fn=="undefined"?function(){}:fn;},label:function(el){$(el).hover(function(){$(this).css('cursor','pointer');},function(){$(this).css('cursor','');});$(el).click(function(){var ck=$(this).find(':checkbox');var cked=!$(ck).attr('checked');$(ck).attr('checked',cked);$(this).find(':radio').attr('checked',true);});},data:{explodeDB:function(stringData){if(jz.Validacao.vazio(stringData)){return stringData;}
var arrData=stringData.split("-");return new Date(arrData[0],arrData[1],arrData[2]);},explodeVisual:function(stringData){if(jz.Validacao.vazio(stringData)){return stringData;}
var arrData=stringData.split("/");return new Date(arrData[2],arrData[1],arrData[0]);}},getQSParam:function(from,strParamName){var strReturn="";var strHref=from;if(strHref.indexOf("?")>-1){var strQueryString=strHref.substr(strHref.indexOf("?"));var aQueryString=strQueryString.split("&");for(var iParam=0;iParam<aQueryString.length;iParam++){if(aQueryString[iParam].toLowerCase().indexOf(strParamName.toLowerCase()+"=")>-1){var aParam=aQueryString[iParam].split("=");strReturn=aParam[1];break;}}}
return unescape(strReturn);},getAParam:function(aTag,strParamName){if(aTag.getAttribute){return Util.getQSParam(aTag.getAttribute('href'),strParamName);}},textoSelect:function(elSelect){if(elSelect.selectedIndex>-1){return elSelect.options[elSelect.selectedIndex].text;}else{return false;}},removeFromSelect:function(elSelect,valor){var op;for(var i=0;i<elSelect.length;i++){if(elSelect.options[i].value.toLowerCase()==valor.toLowerCase()){elSelect.removeChild(elSelect.options[i]);break;}}},moeda:{formataNumero:function(valor){var valor=valor.toString();var len=valor.length;var novoValor='';if(valor!=''){if(len<=2){if(len==1){novoValor="0,0"+valor;}else{novoValor="0,"+parseInt(valor);}}else{novoValor=","+valor.substring(len-2,len+2);var dot;for(var i=3;i<=len;i++){dot=((i>3&&i%3==0)?'.':'');novoValor=valor.substring(len-i,len+1-i)+dot+novoValor;}}}
return novoValor;},numero:function(valor){var valor=valor.replace(/[\.,]/g,"");return Math.abs(valor);}},getRandomId:function(){var randomId=parseInt(540*Math.random());return randomId.toString();}}
Util.CSS={rulesName:function(){return Util.Browser.isIe()?'rules':'cssRules';},domNode:function(){return Util.Browser.isIe()?'owningElement':'ownerNode';},gi:function(){var stl=document.styleSheets;var arrInst=[];var rulesName=Util.CSS.rulesName();for(var i=0;i<stl.length;i++){for(var g=0;g<stl[i][rulesName].length;g++){arrInst.push(stl[i][rulesName][g]);}}
return arrInst;},addRule:function(newStyle){if(document.styleSheets[0].addRule){document.styleSheets[0].addRule(newStyle.getNome(),null,0);}else{document.styleSheets[0].insertRule(newStyle.getNome()+' { }',0);}},addAttributeStyle:function(newStyle){var arrInstances=Util.CSS.gi();var instance=null,arrAttributes=null;for(var i=0;i<arrInstances.length;i++){if(arrInstances[i].selectorText.trim().toLowerCase()!=newStyle.getNome().toLowerCase()){continue;}else{instance=arrInstances[i];}}
if(instance==null){Util.CSS.addRule(newStyle);instance=document.styleSheets[0][Util.CSS.rulesName()][0];}
arrAttributes=newStyle.getAttributes();for(var x=0;x<arrAttributes.length;x++){eval("instance.style."+arrAttributes[x].getNome()+" = arrAttributes[x].getValor()");}}}
Util.Style=function(nome){this.nome=nome;this.getNome=function(){return this.nome;}
this.att=[];this.Attribute=function(nome,valor){this.nome=nome;this.valor=valor;this.getNome=function(){return this.nome;}
this.getValor=function(){return this.valor;}}
this.setAttribute=function(nome,valor){this.att.push(new this.Attribute(nome,valor));}
this.getAttributes=function(){return this.att;}}
Util.Browser={agt:navigator.userAgent.toLowerCase(),isOpera:function(){return(Util.Browser.agt.indexOf('opera')>-1)},isSafari:function(){return(Util.Browser.agt.indexOf('safari')>-1)},isIe:function(){return(!Util.Browser.isOpera()&&Util.Browser.agt.indexOf('msie')>-1)},isIe6:function(){return Util.Browser.isIe()&&parseInt(navigator.appVersion)==4&&Util.Browser.agt.indexOf("msie 6.")!=-1;},isGecko:function(){return(!Util.Browser.isOpera()&&!Util.Browser.isSafari()&&Util.Browser.agt.indexOf("gecko")!=-1);}}
Util.Counter={word:function(valor,replaceHtmlTag){var replaceHtmlTag=typeof(replaceHtmlTag)=="undefined"||replaceHtmlTag?true:false;if(replaceHtmlTag){valor=Util.Replace.htmlTags(valor);}
return valor.split(/[\s\.\?]+/).length},char:function(valor,replaceHtmlTag){var replaceHtmlTag=typeof(replaceHtmlTag)=="undefined"||replaceHtmlTag?true:false;if(replaceHtmlTag){valor=Util.Replace.htmlTags(valor);}
return valor.length}}
Util.Replace={htmlTags:function(valor){return valor.replace(/<[^>]*>/g,"").replace(/[\s]+/g," ");}}
Util.File={comparaExtensao:function(nomeArquivo,extensao){var extensao=extensao.toLowerCase().replace('.','');var extensaoFile=nomeArquivo.substring(nomeArquivo.lastIndexOf('.')+1).toLowerCase();return extensaoFile==extensao;}}