

/* Resource 3050 */

;function GetURLParameter(sParam){
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++) 
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam) 
        {
            return sParameterName[1];
        }
    }
}

function DeleteURLParameter(key, sourceURL) {
    var rtn = sourceURL.split("?")[0],
        param,
        params_arr = [],
        queryString = (sourceURL.indexOf("?") !== -1) ? sourceURL.split("?")[1] : "";
    if (queryString !== "") {
        params_arr = queryString.split("&");
        for (var i = params_arr.length - 1; i >= 0; i -= 1) {
            param = params_arr[i].split("=")[0];
            if (param === key) {
                params_arr.splice(i, 1);
            }
        }
        rtn = rtn + "?" + params_arr.join("&");
    }
    return rtn;
}

function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = "expires="+ d.toUTCString();
    document.cookie = cname + "=" + cvalue + "; " + expires+ ";path=/";     
}

function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i = 0; i <ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0)==' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length,c.length);
        }
    }    
    return "";    
}    

var oldUrl = '';
var alreadyPerformed = false;
$(function(){
    window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s=d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set._.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute("charset","utf-8");
$.src="https://v2.zopim.com/?4OxTQqwY2JCEkrfIdm8NHjRbSthBexGq";z.t=+new Date;$.type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");
    
    
    if(parent.location.hash.length > 1){
        callPage(($("#contentmaster").length > 0 ? "contentmaster" : ($("#main_contentmaster").length > 0 ? "main_contentmaster" : "contentmaster") ),'',parent.location.hash)
    }
    window.onhashchange = function (e) {
        if(oldUrl != ''){
            if(!alreadyPerformed){
                //callPage(($("#contentmaster").length > 0 && location.hash.indexOf(firstpagevarlog) < 0 ? "contentmaster" : ($("#main_contentmaster").length > 0 ? "main_contentmaster" : "contentmaster") ),'',location.hash);
                if(window.history.state && window.history.state.contentClass != ''){
                    callPage(window.history.state.contentClass,'',location.hash);
                }else{
                    callPage(($("#contentmaster").length > 0 && location.hash.indexOf(firstpagevarlog) < 0 ? "contentmaster" : ($("#main_contentmaster").length > 0 ? "main_contentmaster" : "contentmaster") ),'',location.hash);
                }
            }
        }
        alreadyPerformed = false;
    };
    $(window).on("popstate", function () {
        if(window.history.state && window.history.state.lastUrlState == 'reloadIt'){
            console && console.log('change go(1)');
            //window.history.go();
        }else if((parent.location.hash.length == 0 && alreadyPerformed) || (location.pathname.indexOf(firstpagevarlog) < 0 && parent.location.hash.length == 0 )){
            console && console.log('change go(2) ');
            window.history.go();
        }
    });
    var cookieScripts = function () {
        // Loading external javascript file
        $.cookiesDirective.loadScript({
            uri:'external.js',
            appendTo: 'eantics'
        });
    };
    $.cookiesDirective({
        privacyPolicyUri: 'myprivacypolicy.html',
        explicitConsent: false,
        position : 'top',
        backgroundColor: '#fffff',
        linkColor: '#000000'
    });
});
function callPage(contentParent,e,manualUrl){
    var firstpagevar = (username != '' ? firstpagevarlog : firstpagevarnotlog);
    var url= '#',canRedirect= false;
    if(manualUrl != undefined){
        url=manualUrl.slice(1,manualUrl.length);
        canRedirect = true;
    }else{
        if(clickProductListGridItem(e)){            
            var e = window.event || e;
            var targ = e.target || e.srcElement;
            var targetClicked=targ.className;
            
            if(targ.getAttribute('href') != null){
                url = targ.getAttribute('href');
            }else if(targ.parentElement.getAttribute('href') != null){
                url = targ.parentElement.getAttribute('href');
            }else if(targ.parentElement.parentElement.getAttribute('href') != null){
                url = targ.parentElement.parentElement.getAttribute('href');
            }else if(targ.parentElement.parentElement.parentElement.getAttribute('href') != null){
                url = targ.parentElement.parentElement.parentElement.getAttribute('href');
            }
            if(targetClicked != "glyphicon glyphicon-plus-sign" && targetClicked != "glyphicon glyphicon-minus-sign" && targetClicked.indexOf("nolink") < 0){
                canRedirect = true;
            } 
        } 
    }
    if(canRedirect &&  url != '#'){
        if($("#" +contentParent).length > 0 && e !=''){
            if(firstpagevar == url.slice(7,url.length) || url == '' ){
                url = firstpagevar;
                contentParent = (contentParent.indexOf('main_') >= 0 ? contentParent : 'main_'+contentParent);
            }
            var auxurl = url.split('/');
            if(auxurl.length >= 3 ){ auxurl[2]= 'main_'+auxurl[2];}
            $("#" +contentParent).fadeTo("fast", 0.3, function() {});
              $.get( (((url.indexOf(productfamilyparentaliasurl) >= 0 )|| (url.indexOf(productfamilyparent2aliasurl) >= 0 ) || (url.indexOf(searchurl) >= 0 )) && ($('#multiFilterContainer').length == 0 || contentParent.indexOf('main_') >= 0) ? auxurl.join('/') : url)+(url.indexOf('?') > 0 ? '&ajaxget=1' : '?ajaxget=1' ), function( data ) {
                if(oldUrl != ('#'+url) && ('#'+url) != parent.location.hash){
                    alreadyPerformed = true;
                }else{
                    alreadyPerformed = false;
                }
                if(typeof saveViewPage !== 'undefined'){
                    if(saveViewPage == 1){
                        NewRow(true,1,'viewPage',url);
                    }
                }
                if(typeof gaTrack !== 'undefined'){
                     gaTrack(url,url);
                }
                if(parent.location.hash.length > 1){
                    parent.location.hash = url;
                }else{//replaceState
                    window.history.pushState({contentClass:contentParent,lastUrlState:'reloadIt'},null,'/'+parent.location.pathname.split('/')[1]+'/'+firstpagevar+'#'+url)
                }
                jQuery('html,body').animate({scrollTop:0},0);
                $("#" +contentParent).html('');
                $("#" +contentParent).fadeTo("fast", 1, function() {});
                $("#" +contentParent).html( data );
                oldUrl = '#'+url;
                console && console.log( "Load was performed." );
                
                initializeAllJSComponents();
                initializeFiltersJSComponents();
            });
        }else{
            location.href = url;
        };    
    }
    return false; 
};

function initializeAllJSComponents(){   
    if(typeof initializeSelectPicker == 'function'){    initializeSelectPicker();}
    if(typeof initializeSliderPicker == 'function'){    initializeSliderPicker();}
    //if(typeof initializeDatePicker == 'function'){      initializeDatePicker();}
    if(typeof adjustDatePicker == 'function'){      	adjustDatePicker();}
    if(typeof initializeInputFile == 'function'){       initializeInputFile();}
    if(typeof initializeNumberPickers == 'function'){   initializeNumberPickers();}
    if(typeof zoomProductListItem == 'function'){       zoomProductListItem();}
    if(typeof initializeVerticalMenu == 'function'){    initializeVerticalMenu();}
    if(typeof initializeToggleVerticalMenu == 'function'){    initializeToggleVerticalMenu();}
    if(typeof adjustProductDetail == 'function'){    adjustProductDetail();}
}

function initializeFiltersJSComponents(){
	if(typeof toggleToggableFiltersDesktop == 'function'){    toggleToggableFiltersDesktop();}
    if(typeof toggleToggableFiltersMobile == 'function'){    toggleToggableFiltersMobile();}
    if(typeof initializeToggleToggableFiltersBtns == 'function'){    initializeToggleToggableFiltersBtns();}
}

/* Resource 2408 */

;;(function(n){n.cookiesDirective=function(u){var f=n.extend({explicitConsent:!0,position:"top",duration:10,limit:0,message:null,cookieScripts:null,privacyPolicyUri:"privacy.html",scriptWrapper:function(){},fontFamily:"helvetica",fontColor:"#FFFFFF",fontSize:"13px",backgroundColor:"#000000",linkColor:"#CA0000"},u),e;t("cookiesDirective")?f.scriptWrapper.call():(f.limit>0?(t("cookiesDisclosureCount")?(e=t("cookiesDisclosureCount"),e++,i("cookiesDisclosureCount",e,1)):i("cookiesDisclosureCount",1,1),f.limit>=t("cookiesDisclosureCount")&&r(f)):r(f),f.explicitConsent||f.scriptWrapper.call())};n.cookiesDirective.loadScript=function(t){var r=n.extend({uri:"",appendTo:"body"},t),u=String(r.appendTo),i=document.createElement("script");i.src=r.uri;i.type="text/javascript";i.onload=i.onreadystatechange=function(){!i.readyState||i.readyState=="loaded"||i.readyState=="complete"};switch(r.appendTo){case"head":n("head").append(i);break;case"body":n("body").append(i);break;default:n("#"+u).append(i)}};var t=function(n){for(var t,r=n+"=",u=document.cookie.split(";"),i=0;i<u.length;i++){for(t=u[i];t.charAt(0)==" ";)t=t.substring(1,t.length);if(t.indexOf(r)==0)return t.substring(r.length,t.length)}return null},i=function(n,t,i){var r,u;i?(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toGMTString()):u="";document.cookie=n+"="+t+u+"; path=/"},u=function(){var n,i,r,t;return navigator.appName=="Microsoft Internet Explorer"?(i=navigator.userAgent,r=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})"),r.exec(i)!=null&&(n=parseFloat(RegExp.$1)),n<=8?!0:n==9?document.compatMode=="BackCompat"?(t=document.createElement("meta"),t.content="IE=EmulateIE8",document.getElementsByTagName("head")[0].appendChild(t),!0):!1:!1):!1},r=function(t){var r=t,s,c,f,o,e;if(r.css="fixed",u()&&(r.position="top",r.css="absolute"),s="",r.cookieScripts){var h=r.cookieScripts.split(","),l=h.length,a="";if(l>1){for(c=0;c<l-1;c++)a+=h[c]+", ";s=" We use "+a.substring(0,a.length-2)+" and "+h[l-1]+" scripts, which all set cookies. "}else s=" We use a "+h[0]+" script which sets cookies."}f="";f+='<div id="epd">';f+='<div id="cookiesdirective" style="position:'+r.css+";"+r.position+":-300px;left:0px;width:100%;";f+="height:auto;background:"+r.backgroundColor+";opacity:."+r.backgroundOpacity+";";f+="-ms-filter: “alpha(opacity="+r.backgroundOpacity+")”; filter: alpha(opacity="+r.backgroundOpacity+");";f+="-khtml-opacity: ."+r.backgroundOpacity+"; -moz-opacity: ."+r.backgroundOpacity+";";f+="color:"+r.fontColor+";font-family:"+r.fontFamily+";font-size:"+r.fontSize+";";f+='text-align:center;z-index:1000;">';f+='<div style="position:relative;height:auto;width:90%;padding:10px;margin-left:auto;margin-right:auto;">';r.message||(r.explicitConsent?(r.message="This site uses cookies. Some of the cookies we ",r.message+="use are essential for parts of the site to operate and have already been set."):r.message="Este website funciona melhor com a utilização de cookies, opção que atualmente se encontra ativada. Se continuar partiremos do princípio que está de acordo com a receção de cookies.");f+=r.message;r.explicitConsent?(f+=s+"You may delete and block all cookies from this site, but parts of the site will not work.",f+='To find out more about cookies on this website, see our <a style="color:'+r.linkColor+";font-weight:bold;",f+="font-family:"+r.fontFamily+";font-size:"+r.fontSize+';" href="'+r.privacyPolicyUri+'">privacy policy<\/a>.<br/>',f+='<div id="epdnotick" style="color:#ca0000;display:none;margin:2px;"><span style="background:#cecece;padding:2px;">You must tick the "I accept cookies from this site" box to accept<\/span><\/div>',f+='<div style="margin-top:5px;">I accept cookies from this site <input type="checkbox" name="epdagree" id="epdagree" />&nbsp;',f+='<input type="submit" name="explicitsubmit" id="explicitsubmit" value="Continue" /><br/><\/div><\/div>'):f+='<div style="margin-top:5px;" class="col-xs-12"><center><div style="margin: 5px;float: none;" class="col-xs-4"><input class="btn btn-fix-color" type="submit" name="impliedsubmit" id="impliedsubmit" value="Não mostrar esta mensagem novamente"/><\/div><\/center><center><\/div><center><\/div>';f+="<\/div><\/div>";n("body").append(f);o=r.position.toLowerCase();o!="top"&&o!="bottom"&&(o="top");e=[];o=="top"?(e["in"]={top:"0"},e.out={top:"-300"}):(e["in"]={bottom:"0"},e.out={bottom:"-300"});n("#cookiesdirective").animate(e["in"],1e3,function(){r.explicitConsent?n("#explicitsubmit").click(function(){n("#epdagree").is(":checked")?(i("cookiesDirective",1,365),n("#cookiesdirective").animate(e.out,1e3,function(){n("#cookiesdirective").remove();location.reload(!0)})):n("#epdnotick").css("display","block")}):n("#impliedsubmit").click(function(){i("cookiesDirective",1,365);n("#cookiesdirective").animate(e.out,1e3,function(){n("#cookiesdirective").remove()})});setTimeout(function(){n("#cookiesdirective").animate({opacity:"0"},2e3,function(){n("#cookiesdirective").css(o,"-300px")})},r.duration*1e3)})}})(jQuery);