function PopupCentro(page,name,w,h,scrollresize){
var LeftPosition= (screen.width) ? (screen.width-w)/2 : 0;
var TopPosition= (screen.height) ? (screen.height-h)/2 : 0;
var Settings= 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrollresize+',toolbar=no,menubar=no,resizable='+scrollresize+',status=yes';
var Win= window.open(page,name,Settings);
return Win;
}
function addEvent(ev, obj, fcn){
if(typeof(obj)=="object"){
if(window.addEventListener){
obj.addEventListener(ev,fcn,true);
}else if(window.attachEvent){
obj.attachEvent("on"+ev,fcn);
}
}
}
function URLDecode(str){
if(str!=null && str!='undefined'){
return decodeURIComponent(str.replace(/\+/g,' '));
}else{
return '';
}
}
var querystring={
param : new Array(),
init : function(){
var params = window.location.search.replace('?','').split('&');
for(var i=0; i<params.length; i++){
if(params[i].indexOf('='!=-1)){
var arr=params[i].split('=');
this.param[arr[0].toLowerCase()]=URLDecode(arr[1]);
}
}
},
get : function(name){
if(name){
if(querystring.param[name.toLowerCase()]){
return querystring.param[name.toLowerCase()];
}else{
return '';
}
}else{
return window.location.search.replace('?','');
}
}
}
function stripHTML(str){
if(str!=null && str!='undefined'){
return str.replace(/(<([^>]+)>)/ig,"");
}else{
return '';
}
}
function filtra(obj, padrao){
try{
var ev= (e) ? e : event; 
var tk= (ie4) ? ev.keyCode : ev.which;
var letra= String.fromCharCode(tk);
for (x = 0; x < padrao.length; x++)
if (padrao.slice(x, x + 1) == letra) return true;
return true;
}catch (err){
return true;
}
}
function semTab(){
window.checatab=false;
}
function comTab(){
window.checatab=true;
} 
function pula(origem, tamanho, destino){
if(origem.value.length==tamanho && window.checatab){
destino.focus();
}
}
function isMailValid(src){
var regex=new RegExp("^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$");
return regex.test(src);
}
function veriricanewsletter(){
var Email=document.newsletterform.Email.value;
if (Email=="" || Email=="Seu e-mail"){
alert("Por favor, digite seu e-mail!")
document.newsletterform.Email.focus();
return false;
}
if (Email.indexOf('@', 0)==-1 || Email.indexOf('.', 0)==-1){ 
alert("Digite um e-mail v&aacute;lido!");
document.newsletterform.Email.focus();
return false;
}
}
function BannerClick(obj){
obj.onmouseup = function(){
var id = obj.id.replace('banner-anchor-','').replace('banner-swf-','');
$ez_ajax('Banners_Clique.asp?tipo=ajax&bannerid='+id);
obj.onmouseup = new Function('void(0);');
}
}
function Banner(id, src, width, height, title){
var swfObj = new SWFObject(src, title, width, height, '8');
swfObj.addParam('wmode', 'transparent');
swfObj.addParam('quality', 'high');
swfObj.write(id);
}
function hideFlyBanner(){
document.getElementById("global-fly").style.display = "none";
}
addEvent("load", window, function(){
var fly = document.getElementById("global-fly");
if(fly){
fly.style.display= "block";
fly.style.width= (!fly.style.width) ? document.getElementsByTagName('A')[0].offsetWidth + 'px' : fly.style.width;
fly.style.height= (!fly.style.height) ? document.getElementsByTagName('A')[0].offsetHeight + 'px' : fly.style.height;
var doch= document.getElementsByTagName('HTML')[0].clientHeight;
var docw= document.getElementsByTagName('HTML')[0].clientWidth;
var flyh= (fly.offsetHeight>0) ? fly.offsetHeight : parseInt(fly.style.height.replace('px',''));
var flyw= (fly.offsetWidth>0) ? fly.offsetWidth : parseInt(fly.style.width.replace('px',''));
var LeftPosition= (window.innerWidth) ? ((window.innerWidth-flyw)/2) : ((docw-flyw)/2);
var TopPosition= (window.innerHeight) ? ((window.innerHeight-flyh)/2) : ((doch-flyw)/2);
fly.style.left= LeftPosition+"px";
fly.style.top= TopPosition+"px";
setTimeout("hideFlyBanner()",(fly.style.zIndex-100)*1000);
}
});
function $ez_ajax(url,fcn){
if(window.XMLHttpRequest){
http_request=new XMLHttpRequest();
if (http_request.overrideMimeType){
http_request.overrideMimeType('text/xml');
}
}else if(window.ActiveXObject){
try{
http_request=new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try{
http_request=new ActiveXObject("Microsoft.XMLHTTP");
}catch(e){}
}
}
if(!http_request){
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
if(fcn){
http_request.onreadystatechange=fcn;
}
http_request.open('GET', url, true);
http_request.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
http_request.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
http_request.setRequestHeader("Pragma", "no-cache");
http_request.send(null);
}
function getSessionID(){
if(document.getElementById("SessionID")){
document.getElementById("SessionID").value = cfg.SessionID;
return true;
}else{
return false;
}
}
function DefinirTarifa(get){
$ez_ajax("Carrinho_Definir_Tarifa.asp?"+get, function(){
if(http_request.readyState==4){
if(http_request.status==200){
txt=http_request.responseText;
xml=http_request.responseXML;
if(txt=="Sessão Expirada!"){
location.reload();
}else{
document.getElementById("TOTAL").innerHTML=txt;
strValidaEntrega=true;
}
}
}
});
}
querystring.init();
var http_request=false;
var request=querystring.get;
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject = function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;
function verificaCampo(){
var Produto = document.getElementById("inputProduto").value.replace(/ /g,"");
if(Produto == ""){
alert("Informe um produto para pesquisa");
document.getElementById("inputProduto").focus();
return false;
}
}
addEvent('load', window, function(){
var links = document.getElementsByTagName('A');
for(var i = 0; i<links.length; i++){
if( links[i].className.indexOf('target-blank') != -1){
links[i].target='_blank';
}
if( links[i].className.indexOf('target-top') != -1){
links[i].target='_top';
}
if( links[i].className.indexOf('target-parent') != -1){
links[i].target='_parent';
}
}
if(document.getElementById('limpar-historico')){
document.getElementById('limpar-historico').href = cfg.File + ("?historico=limpar&"+window.location.search.replace('?','').replace(/historico\=.[^\&]+/g,'')).replace(/\&\&/g,'&');
}
    if (cfg.ChatOnline != '' && document.getElementById('ifrAO')){
        document.getElementById('ifrAO').src = 'ChatOnline.asp?u=' + cfg.ChatOnline;
   }
if(navigator.appVersion){
if(navigator.appVersion.indexOf('MSIE 6.')!=-1){
var inputs = document.getElementsByTagName('INPUT');
for(i=0;i<inputs.length;i++){
var input = inputs[i];
if((input.type=='text' || input.type=='password') && (input.className=='' || input.className=='undefined')){
input.className = 'input-text';
}
}
}
}
var MSG = stripHTML(request('msg')).replace(/\\n/g,'\n');
    if (MSG != ''){
        alert(MSG);
   }
});
function calcula(altura, peso){
altura = altura.toString().replace("0\.","");
altura = altura.toString().replace("0,","");
altura = altura.toString().replace("\.","");
altura = altura.toString().replace(",","");
var digits = /^\d+$/;
if(altura == "" || peso == "") alert(unescape("Por favor, insira n%FAmeros nos campos."));
else if(!digits.test(altura) || !digits.test(peso)) alert(unescape("Por favor, digite apenas n+%FAmeros."));
else{
altura = parseInt(altura);
var valor;
peso = parseInt(peso);
valor = (peso/((altura/100)*(altura/100)));
var indice = "";
if(valor<18.5) indice = "abaixo do peso ideal.<br>";
else if(valor<=25) indice = "com o peso normal.<br>";
else if(valor>25) indice = "acima do peso ideal.<br>";
var str = "\f<span>Seu IMC &eacute;: " + valor.toFixed(1) +"<br>Voc&ecirc; est&aacute; " + indice + "</span>";
var div = document.getElementById("texto");
div.innerHTML=str;
}
}
function enterHere(e, altura, peso){
    e = e || window.event;
    var code = e.keyCode || e.which;
    if(code == 13){
        calcula(altura, peso);
return false;
}
}

