var __MSGS=new Array(),__IDEshop=null,__data=new Date(),__mes=__data.getMonth(),__ano=__data.getFullYear(),BACKSPACE=8,DELETE=46,TAB=9,FRENTE=39,TRAS=37;function isEmail(a){var b=String(a),e=null,d=null,c=null;b=Replace(b," ","");e=/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;d=/^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;c=/^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;if(e.test(b)&&d.test(b)&&c.test(b)){return true}else{return false}}function selEstado(c,f,b){var e=new JUtility(),d=null,a=0,g=null;if((this.arguments&&this.arguments.length<3)||b==null||typeof(b)=="undefined"){b=""}if(e!=null&&typeof(e)!="undefined"){g=jQuery("#"+f);g.html("").append('<option value=""> Carregando... </option>').end();d=e.GetCidades(c);if(d!=null&&typeof(d)!="undefined"){jQuery("#"+f).html("");for(a=0;a<d.length;a++){if(b!=""&&b==d[a].id){jQuery("#"+f).append('<option value="'+d[a].id+'" selected="selected">'+d[a].desc+"</option>")}else{jQuery("#"+f).append('<option value="'+d[a].id+'">'+d[a].desc+"</option>")}}}}}function delItem(b,a){jConfirm(__MSGS[0],"Alerta",function(c){if(c==true){var d=new ShoppingCar();if(d!=null&&typeof(d)!="undefined"){if(d.DelItem(b)){getProdutosCarrinho()}else{jAlert(__MSGS[1],"Mensagem")}jQuery("#lblQtd").html(d.GetTotal(__IDEshop))}}})}function atualizaQtd(e,b,a){jAlert("Aguarde ...","Mensagem");if(jQuery("#tQtd"+e).val()==""||jQuery("#tQtd"+e).val()=="0"){delItem(e)}else{var d=new ShoppingCar(),c=null;if(d!=null&&typeof(d)!="undefined"){c=d.ModifyAmount(e,Number(jQuery("#tQtd"+e).val()));if(c[0]==true){jAlert(c[1],"Mensagem");getProdutosCarrinho()}else{jAlert(c[1],"Mensagem")}}}}function getProdutosCarrinho(){var b=new ShoppingCar(),a=null;shtml="";if(b!="undefined"){shtml=b.getProdutos(__IDEshop);if(shtml==""){a=new JUtility();if(a!=null&&typeof(a)!="undefined"){jQuery("#StepCart").css("display","none");jQuery("#cBtCompr").css("display","none");jQuery("#cSCProds").html(a.GetBoxCarrinhoVazio())}}else{jQuery("#cSCProds").html(shtml);jQuery(".tQtd").mask("9")}jQuery("#lblQtd").html(b.GetTotal(__IDEshop))}}function Replace(c,a,b){if(c!=null&&typeof(c)!="undefined"&&c!=""&&c.length>0){while(c.indexOf(a)!=-1){c.replace(a,b)}}return c}function removeElMenuVazio(){var a=null;jQuery(".navStore ul li div ul:empty").remove();a=jQuery(".navStore ul li div:empty");a.parent().each(function(){jQuery(this).children().removeClass("mEb").addClass("mEd")});a.remove()}function moveNext(){jQuery("#cTVMini").hide();jQuery("#ifrTVMini").attr("src","about:blank");if(__qtdImg!=null){if((__curImg+1)<__qtdImg){++__curImg;ChangeImg(__curImg)}}}function movePrev(){jQuery("#cTVMini").hide();jQuery("#ifrTVMini").attr("src","about:blank");if(__qtdImg!=null){if(__curImg>0){--__curImg;ChangeImg(__curImg)}}}function askAttr(h,m,b,l,c,n,e,j,d){var k='<div class="pnAtr"><p class="atr">'+h+'</p><p class="atp">Tipo: <select id="cboAskAttr"></select></p><input type="button" id="btnAskAttr" value="&nbsp;&nbsp;OK&nbsp;&nbsp;"/></div>',g=new Array(),f=0,a=false;g=m.split(";");if(g.length>0){jAlert(k,"Mensagem");jQuery.alerts._hideButtons();jQuery("#cboAskAttr").append(jQuery('<option value="">Selecione</option>'));for(f=0;f<g.length;f++){jQuery("#cboAskAttr").append(jQuery('<option value="'+g[f]+'">'+g[f]+"</option>"))}jQuery("#btnAskAttr").click(function(){if(jQuery("#cboAskAttr").val()!=""){a=addSC(b,l,c,n,e,jQuery("#cboAskAttr").val(),j);if(a==true){jAlert(d,"Mensagem")}}})}else{jAlert("Ocorreu um erro ao tentar realizar a operação!","Mensagem")}}function addSC(a,h,b,j,c,d,e){jAlert("Aguarde ...","Mensagem");jQuery.alerts._hideButtons();var f=new ShoppingCar(),g=null,i=true;if(f!=null&&typeof(f)!="undefined"){g=f.AddItem(a,h,(d==null?"":d),(b==null?"":b),(j==null?"":j),(e==null?"1":e));if(g[0]==true){if(c!=null){jQuery(c).removeClass("addCart").addClass("addCartCheck").end()}}else{i=false;jAlert(g[1],"Mensagem")}jQuery("#lblQtd").html(f.GetTotal(__IDEshop));jQuery("#cCar").fadeOut(1000).fadeIn(1000).end()}else{i=false}return i}function removeAllFromSelect(d,a){var c=0;d=$(d);if(d!=null&&typeof(d)!="undefined"){c=(a==true?0:1);while(d.length>c){d.remove(c)}}}function removeAllChilds(a){if(a!=null&&typeof($(a))=="object"){while(a.childNodes.length>0){a.removeChild(a.childNodes[0])}}}function LimitTextArea(b,c,a){b=$(b);if(b!=null&&typeof(b)!="undefined"){if(b.value.length>a){b.value=b.value.substring(0,a)}if(c!=null&&typeof(c)!="undefined"){c=$(c);c.value=a-b.value.length}}}function validateGroupFields(b,a){if(jQuery("input[name="+b+"]:checked").length>=a){return true}return false}function goPage(d){var b=0,f=0,e=0,c=0,a=0;if(typeof(d)!="undefined"&&d!=""){_pagNum=parseInt(d)+_pSecion;b=parseInt(_pagNum/_secionLimit);if(_pagNum>(_pSecion+_secionLimit)){f=_pagNum%_secionLimit;if(f!=0){b++}if(b<1){b=1}_pSecion=(b-1)*_secionLimit}else{if(parseInt(_pSecion+_secionLimit)>_pagNum){e=parseInt(_pSecion+_secionLimit)-_pagNum;c=parseInt(e/_secionLimit);if(c!=0){a=e%_secionLimit;if(a==0){c--}else{c++}if(c<1){c=1}_pSecion=(c-1)*_secionLimit}}}if(_pagNum<_secionLimit){_pSecion=0}getListWithPagination()}return void (0)}function jumpPage(b){var a=0,c=0;if(typeof(b)!="undefined"&&b!=""){if(parseInt(b)<=_totalPage&&parseInt(b)>0){_pagNum=parseInt(b);a=parseInt(_pagNum/_secionLimit);c=_pagNum%_secionLimit;if(c==0){a--}_pSecion=a*_secionLimit;getListWithPagination()}}}function initPaging(){var j=jQuery(".paginacao"),b=null,h=null,m=null,c=0,f=0,l=null,a=null,d=null,k=null,g=null,e=null;j.empty();if(parseInt(_totalPage)>1){if(_totalPage>0){if(_pagNum>_secionLimit){b=document.createElement("li");b.className="seta";h=document.createElement("a");h.href="#p"+(_pSecion);jQuery(h).click(function(){jumpPage(_pSecion)});m=document.createElement("img");m.src=_imgPgLeft;m.alt=_lblAnterior;h.appendChild(m);b.appendChild(h);j.append(b)}f=_totalPage>(_pSecion+_secionLimit)?_secionLimit:(_totalPage-_pSecion);for(c=1;c<=f;c++){l=document.createElement("li");a=document.createTextNode(c+_pSecion);d=document.createElement("a");if((c+_pSecion)==_pagNum){d.href="javascript:void(0);";l.className="select";d.appendChild(a);l.appendChild(d)}else{d.href="#p"+(c+_pSecion);if(jQuery.browser.msie){d.onclick="goPage("+(c)+")"}else{jQuery(d).click(function(){k=this.href.substring(this.href.indexOf("#p")+2);goPage((k-_pSecion))})}d.appendChild(a);l.appendChild(d)}j.append(l)}if(_totalPage>(_pSecion+_secionLimit)){g=document.createElement("li");g.className="point";g.appendChild(document.createTextNode("..."));j.append(g);b=document.createElement("li");b.className="seta";h=document.createElement("a");h.href="#p"+((_pagNum+1)<=_totalPage?(_secionLimit+1):1);if(jQuery.browser.msie){h.onclick="goPage("+((_pagNum+1)<=_totalPage?(_secionLimit+1):1)+");"}else{jQuery(h).click(function(){k=this.href.substring(this.href.indexOf("#p")+2);goPage(((_pagNum+1)<=_totalPage?(_secionLimit+1):1))})}e=document.createElement("img");e.src=_imgPgRight;e.alt=_lblProximo;h.appendChild(e);b.appendChild(h);j.append(b)}}}}function unique(b){var d=new Array(0),c=0;for(c=0;c<b.length;c++){if(!contains(d,b[c])){d.length+=1;d[d.length-1]=b[c]}}return d}function contains(b,d){var c=0;for(c=0;c<b.length;c++){if(b[c]==d){return true}}return false}function validarCNPJ(d){var g=d,n="",o=/\D/,m=[],l=new Number,j=[6,5,4,3,2,9,8,7,6,5,4,3,2],f=0,k=0;try{if(g.length==19){g=g.substring(1,g.length)}if(g.length<18){return false}if((g.charAt(2)!=".")||(g.charAt(6)!=".")||(g.charAt(10)!="/")||(g.charAt(15)!="-")){return false}if(document.layers&&parseInt(navigator.appVersion)==4){n=g.substring(0,2);n+=g.substring(3,6);n+=g.substring(7,10);n+=g.substring(11,15);n+=g.substring(16,18);g=n}else{g=g.replace(".","");g=g.replace(".","");g=g.replace("-","");g=g.replace("/","")}if(o.test(g)){return false}for(f=0;f<12;f++){m[f]=g.charAt(f);l+=m[f]*j[f+1]}if((n=l%11)<2){m[12]=0}else{m[12]=11-n}l=0;for(k=0;k<13;k++){l+=(m[k]*j[k])}if((n=l%11)<2){m[13]=0}else{m[13]=11-n}if((g.charAt(12)!=m[12])||(g.charAt(13)!=m[13])){return false}return true}catch(h){}}function validarCPF(f){try{var h="",l="",d=null,g=0,k="",b="",a=0;d=f;h=d.substring(0,3);h+=d.substring(4,7);h+=d.substring(8,11);h+=d.substring(12,14);l=h;if(isNaN(l)){return false}if(l=="00000000000"||l=="11111111111"||l=="22222222222"||l=="33333333333"||l=="44444444444"||l=="55555555555"||l=="66666666666"||l=="77777777777"||l=="88888888888"||l=="99999999999"){return false}k=l.substr(0,9);b=l.substr(9,2);a=0;for(g=0;g<9;g++){a+=k.charAt(g)*(10-g)}if(a==0){return false}a=11-(a%11);if(a>9){a=0}if(b.charAt(0)!=a){return false}a*=2;for(g=0;g<9;g++){a+=k.charAt(g)*(11-g)}a=11-(a%11);if(a>9){a=0}if(b.charAt(1)!=a){return false}return true}catch(j){}}function _SN(d){var c=null,b=null;if(typeof(d)!="object"){d=window.event}c=(d.keyCode?"keyCode":d.which?"which":"charCode");b=(d.which?d.which:d.keyCode?d.keyCode:d.charCode);if(c=="keyCode"&&((b==BACKSPACE)||(b==TAB)||(b==FRENTE)||(b==TRAS)||(b==DELETE))&&navigator.userAgent.indexOf("MSIE")==-1){return true}if(b==13){return false}if((b<48)||(b>57)){d.returnValue=false;return false}return true}function getPageSize(){var c=0,a=0,b=0,d=0;if(window.innerHeight&&window.scrollMaxY){c=window.innerWidth+window.scrollMaxX;a=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){c=document.body.scrollWidth;a=document.body.scrollHeight}else{c=document.body.offsetWidth;a=document.body.offsetHeight}}if(self.innerHeight){if(document.documentElement.clientWidth){b=document.documentElement.clientWidth}else{b=self.innerWidth}d=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){b=document.documentElement.clientWidth;d=document.documentElement.clientHeight}else{if(document.body){b=document.body.clientWidth;d=document.body.clientHeight}}}if(a<d){pageHeight=d}else{pageHeight=a}if(c<b){pageWidth=c}else{pageWidth=b}arrayPageSize=new Array(pageWidth,pageHeight,b,d);return arrayPageSize}function changeTabs(f,h,g){var d=0,c=$(f),a=c.getElementsByTagName("li"),b=null,e=null;for(d=0;d<a.length;d++){if(d==0&&g!=1){a[d].style.borderLeft="1px solid #ccc"}else{if(d==0&&g==1){a[d].style.borderLeft="none"}}a[d].className="";if((d+1)==g){a[d].className="tbon"}}b=$(h);e=b.getElementsByClassName("show_tabs");for(d=0;d<e.length;d++){e[d].style.display="none";if((d+1)==g){e[d].style.display=""}}}function preloadImages(){var g=document,e=0,c=null,f=0;if(g.images){if(!g._pImage){g._pImage=new Array()}e=g._pImage.length;if(arrFts!="undefined"&&arrFts!=null&&arrFts!=""){try{c=arrFts.split(",")}catch(b){}}else{c=preloadImages.arguments}try{if(c!=null){for(f=0;f<c.length;f++){g._pImage[e]=new Image;g._pImage[e++].src=c[f]}}}catch(b){}}}function GerarSWF(b,e,a,d,c){document.writeln('<object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+a+'" height="'+e+'" id="'+d+'">');document.writeln('<param name="allowScriptAccess" value="always" />');document.writeln('<param name="movie" value="'+b+'" />');document.writeln('<param name="menu" value="false" />');document.writeln('<param name="quality" value="high" />');document.writeln('<param name="wmode" value="transparent" />');document.writeln('<param name="FlashVars" value="'+c+'" />');document.writeln('<embed src="'+b+'" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer"  allowScriptAccess="always" wmode="transparent" FlashVars="'+c+'" menu="false" quality="high" id="'+d+'" width="'+a+'" height="'+e+'"></embed>');document.writeln("</object>")}function GerarSWF_2(b,e,a,d,c){document.write('<object id="globalnav-object" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+a+'" height="'+e+'" id="'+d+'">');document.write('<param name="allowScriptAccess" value="always" />');document.write('<param name="movie" value="'+b+'" />');document.write('<param name="menu" value="false" />');document.write('<param name="quality" value="high" />');document.write('<param name="allowFullScreen" value="true" />');document.write('<param name="scale" value="noscale" />');document.write('<param name="FlashVars" value="'+c+'" />');document.write('<embed src="'+b+'" type="application/x-shockwave-flash" pluginspage=" http://www.macromedia.com/go/getflashplayer"  allowScriptAccess="always" FlashVars="'+c+'" menu="false" quality="high" allowFullScreen="true" scale="noscale" id="'+d+'" width="'+a+'" height="'+e+'"></embed>');document.writeln("</object>")}function _ow(c,d,h,a,b){var f=getPageSize(),e=(f[2]-d)/2,g=(f[3]-h)/2,i=null;if(a!=null&&typeof(a)!="undefined"){a=((a=="1"||a.toLowerCase()=="yes")?"1":"0")}else{a="0"}if(b!=null&&typeof(b)!="undefined"){b=((b=="1"||b.toLowerCase()=="yes")?"1":"0")}else{b="0"}i=window.open(c,"subWind","scrollbars="+a+",menubar=0,location=0,resizable="+b+",toolbar=0,status=0,top="+g+",left="+e+",height="+h+",width="+d);i.focus()}function setResizeOverlay(b,a){if(arguments==1||a==undefined){jQuery("#"+b).css("width",jQuery(document).width()+"px").css("height",jQuery(document).height()+"px").end()}else{jQuery("#"+b).css("width",jQuery("#"+a).width()+"px").css("height",jQuery("#"+a).height()+"px").end()}}function setCenterPosition(c){var a=jQuery("#"+c),b=jQuery(window);if(b.height()<a.height()){a.css("top","0px")}else{a.css("top",((b.height()-a.height())/2)+"px")}if(b.width()<a.width()){a.css("left","0px")}else{a.css("left",((b.width()-a.width())/2)+"px")}};