/*redis*/

var _FFmpnTable = '';
var _FFeanTable = '';

if(!String.prototype.trim) {
  String.prototype.trim = function () {
    return this.replace(/^\s+|\s+$/g,'');
  };
}

function _FFOpenWin(sticky_URL_fix){
    var qliteWidth = 690; 
    var qliteHeight = 550; 
    var ModalWin = null; 
    var TP = 10;
    var LP = 10; 
    var settings = 'height=' + qliteHeight + ',width=' + qliteWidth + ',top=' + TP + ',left=' + LP + ',scrollbars=yes';
    if (!ModalWin || ModalWin.closed){ 
        ModalWin = window.open(sticky_URL_fix, 'ModalWin', settings)
        if (sticky_URL_fix.indexOf('quikcliplite') != -1) {
            ModalWin.moveTo(10, 10);
            ModalWin.resizeTo(qliteWidth, qliteHeight);
        } else {
            if (ModalWin && ModalWin.focus) ModalWin.focus();
        }
    } 
}



var _FFMatcher = {
    DATA_DOMAIN : ('https:' == document.location.protocol) ? 'https://media.flixsyndication.net/inpage/ssl/delivery/' : 'http://media.flixcar.com/delivery/',
    DATA_DOMAIN_FF : ('https:' == document.location.protocol) ? 'http://www.flixfacts.co.uk/view/' : 'http://www.flixfacts.co.uk/view/',
    DATA_DOMAIN_FF_LOGO : ('https:' == document.location.protocol) ? 'https://media.flixsyndication.net/minisite/ssl/logo/' : 'http://logo.flixfacts.co.uk/',
    CONFIG:'conf.txt',
    _ffscript : '', 
    _ffparams : '',
    _FFmpn : '',
    _FFean :'',
    _FFd :'',
    _FFlang : '',
    _FFfallbacklang : '',
    _FFcontId :'',
    _FFEmbType:'',
    _FFRating:'0',
    _FFCExists:{},
    _FFmatch:{},
    _FFpagedata: {},
    _FFSio_Ty: 0,
    _FFPid: 0,

    
    _FFshowButton: function (p_id, contId, isComplementary, type, lang, base_image, is_manual) {
        //isComplementary = 0;
        var html = _FFUtils._FFButtonHtml(p_id, isComplementary,lang, base_image, is_manual) ;
        
        _FFUtils._FFWriteHtml(contId, html, isComplementary);
        setTimeout(function(){
            _FFUtils._FFsendLog(contId, 'ok', p_id,type);
        }, 1000);
    },
    
    _FFshowRating: function (p_id, contId, isComplementary, type, lang, base_image) {
        append_content = '';
        if(_FFMatcher._FFRating > 0){
        
        
            var url = _FFMatcher.DATA_DOMAIN+"webcall/rating/159/"+lang+"/"+p_id;
            var image = _FFMatcher.DATA_DOMAIN+"static/energy_rating/images/small-"+_FFMatcher._FFRating+".png";
        
                        
            
            append_content += '<a href=\'javascript:;\' onclick=\'_FFOpenWin("'+url+'");\'>';
            
            append_content += '<img style="margin: 0 5px;" id="_flixrtng'+p_id+'" src="'+image+'" alt="Energy Rating" />';
            append_content += '</a>';
        
            _FFUtils._FFWriteHtml(contId, append_content, isComplementary);
                    }
     },

    _FFmain : function (div_container, d_id, lang, p_id, base_image, is_manual, pagedata) {
        _FFMatcher._FFlang = lang;
        _FFMatcher._FFd = d_id;
        _FFMatcher._FFPid = p_id;
        _FFMatcher._FFcontId = div_container;
        _FFMatcher._FFpagedata = pagedata;
        
        var type = 'mpn';
        
        _FFMatcher._FFshowButton(p_id, div_container, 0 ,type,lang, base_image, is_manual);
        
        
        _FFMatcher._FFshowRating(p_id, div_container, 1 ,type,lang, base_image);
   
    },

    _FFCheckComplimentaryProduct: function(code, text, contId, type, lang){
        if (text)
        {
            var code = code.replace("+",'\\+'); 
            var re = new RegExp(';'+code + ';', 'ig');
            var is_found=false;
            for (var i in text)
            {
                var r = ";"+text[i]+";";
                var found = r.match(re);
                if (found != null) {
                    var p_id = i;
                    is_found=true;
                    _FFMatcher._FFmatch[type]=1;
                    if (_FFMatcher._FFCExists[p_id]==undefined)
                    {
                        _FFMatcher._FFshowButton(p_id, contId, 1,type,lang);
                        _FFMatcher._FFCExists[p_id]=1;
                    }
                }
            }

        }
    },
        
    _FFisVideoTabExists: function(str){
        str = ','  + str + ',';
        var re = new RegExp(',1,', 'i');
        
        return str.search(re) >= 0;
    }
};

var _FFUtils = {

    _FFStripTags: function(str) {
        return str.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi, '').replace('"','');
    },

    _FFStripScripts: function(str) {
        return str.replace(new RegExp('<script[^>]*>([\\S\\s]*?)<\/script>', 'img'), '');
    },

    _FFParseQueryString: function(query, key, default_,lowercase) {
          if (default_ == null) default_ = '';
          if (lowercase!=0) lowercase=1;
          key = key.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
          var regex = new RegExp('[\\?&]' + key + '=([^&#]*)');
          var qs = regex.exec(query);
          if(qs == null)
            return default_;
          else
            return lowercase ? unescape(qs[1].toLowerCase()) : unescape(qs[1]);
    },
    _FFIsUrlistExist: function(){
        if (window["_FFConfig"]==undefined) return false;
        if (window["_FFConfig"]['url']==undefined) return false;
        if (window["_FFConfig"]['url'][_FFMatcher._FFd]!=undefined) return true;
        return false;
    },
    _FFIsComplimentaryExist: function(){
        if (window["_FFConfig"]==undefined) return false;
        if (window["_FFConfig"]['cdis']==undefined) return true;
        if (window["_FFConfig"]['cdis'][_FFMatcher._FFd]==undefined) return true;
        return false;
    },

    _FFGetVideoLogo:function(p_id,isComplimentary){
        var clogo = (window["_FFConfig"]['dsl'][_FFMatcher._FFd] == undefined) ? window["_FFConfig"]['pl']['cdef'].replace('%l',_FFMatcher._FFlang) : window["_FFConfig"]['pl']['ddef'].replace('%d',_FFMatcher._FFd);
        if (window["_FFConfig"]['pl'][p_id]==undefined) return clogo;
        if (window["_FFConfig"]['pl'][p_id][_FFMatcher._FFlang]==undefined) return  clogo;
        if (window["_FFConfig"]['pl'][p_id][_FFMatcher._FFlang][_FFMatcher._FFd]==undefined) return window["_FFConfig"]['pl']['pdef'].replace('%p',p_id).replace('%l',_FFMatcher._FFlang);
        
        return window["_FFConfig"]['pl']['pddef'].replace('%d',_FFMatcher._FFd).replace('%l',_FFMatcher._FFlang).replace('%p',p_id);
        
    },
    _FFWriteHtml: function (id, html,isComplementary){
        var dv = document.getElementById(id);
        if (dv) {
            try{
                dv.innerHTML = (isComplementary)? dv.innerHTML + html : html;
            }catch(e){}
        }
    },
    _FFButtonHtml:function( p_id, isComplementary, lang, base_image, is_manual){
        var html='';
        var d = _FFMatcher._FFd;
        var l = lang;
        
        var r = _FFMatcher._FFRev;
        var matchtype='';
    
        var ab = '';
    
        
        var url = _FFMatcher.DATA_DOMAIN+"minisite/show/159/"+lang+"/"+p_id + ab;
        
        url += "?pn=" + _FFUtils._FFgetCanonical('escape');
        
        if(isComplementary){
            //http://www.flixfacts.co.uk/view/mediaplayer/
            var url = _FFMatcher.DATA_DOMAIN_FF+"?d=159&l="+lang+"&p="+p_id + ab;
                url += "&pn=" + _FFUtils._FFgetCanonical('esc');
        }
        
        html += '<a href=\'javascript:;\' onclick=\'_FFOpenWin("'+url+'");_FFUtils._FFsendLog("","page",'+p_id+',"'+matchtype+'");\'>';
        
        var _customimg = _FFUtils._FFParseQueryString(_FFMatcher._ffparams, 'img', '',0);
        var _alt = _FFUtils._FFParseQueryString(_FFMatcher._ffparams, 'alt', '',0);

        _customimg = _FFUtils._FFStripTags(_FFUtils._FFStripScripts(_customimg));
        _alt = _FFUtils._FFStripTags(_FFUtils._FFStripScripts(_alt));

        var needed = /MSIE ((5\.5)|[6])/.test(navigator.userAgent) && navigator.platform == 'Win32'; 

                if (is_manual) {
                html += '<img  id="_flixbtn'+p_id+'" alt="'+_alt+'" border="0" src="'+base_image+'"/>';
            }
            else {
                if( isComplementary ) {
                    if( p_id == null ) {
                         html += '<img  id="_flixbtn'+p_id+'" alt="'+_alt+'" border="0" src=""/>';
                    }
                    else {
                        html += '<img  id="_flixbtn'+p_id+'" alt="'+_alt+'" border="0" src="'+_FFMatcher.DATA_DOMAIN_FF_LOGO+'/'+base_image+'"/>';
                        //html += '<img  id="_flixbtn'+p_id+'" alt="'+_alt+'" border="0" src="'+base_image+'"/>';
                    }
                } 
                else {
                    html += '<img  id="_flixbtn'+p_id+'" alt="'+_alt+'" border="0" src="'+_FFMatcher.DATA_DOMAIN+'/'+base_image+'"/>';
                }
            }
        
        html += '</a>';

        return html;
    },

    _FFsendLog: function( contId, type, p_id, matchtype ) {
        try{
            var 
              params = {},
              d = new Date(),
              h='', canonical='', abid, gvid,
              processed = null,
              encrypt = [96,5434,5420,336,1058],
              userAgents = [
                'symbian',
                'android',
                'ios'
              ],
              _beatUrl = '//rt.flix360.com/beat',
              _beatNotActive = [],
              _beatByLanguage = ['fr','us','en','nl'],
              beat;

            d.setMinutes( d.getTimezoneOffset());
    
            params['mpn'] = _FFMatcher._FFmpn;
            params['ean'] = _FFMatcher._FFean;
            params['l'] = _FFMatcher._FFlang;
            params['d'] = _FFMatcher._FFd;
            params['p_id'] = p_id; 
            params['ut'] = d.getTime();
            params['to'] = d.getTimezoneOffset();
            params['ss'] = screen.width+'x'+screen.height;

            try {
                if( window.flixJsCallbacks && window.flixJsCallbacks.gvid ) {
                    params['gvid'] = window.flixJsCallbacks.gvid;
                }
                else {
                    if( ! (window.flixJsCallbacks && window.flixJsCallbacks.gvid) && document.getElementById('data-flix-t-script') ) {
                        setTimeout(function(){
                            _FFUtils._FFsendLog(contId, type, p_id, matchtype);
                        },200);
                        return;
                    }
                    else if ( window.flixJsCallbacks && window.flixJsCallbacks.gvid ) {
                        params['gvid'] = window.flixJsCallbacks.gvid;
                    }
                    else if ( ! document.getElementById('data-flix-t-script') ) {
                        window['flixgvid'] = function(obj){
                            try{
                                delete window['flixgvid'];
                                window.flixJsCallbacks = window.flixJsCallbacks || {};
                                window.flixJsCallbacks['gvid'] = obj['gvid'];
                                params['gvid'] = window.flixJsCallbacks.gvid;
                             }catch(e){}
                        };

                        var _fscript = document.createElement('script');
                        _fscript.setAttribute("type","text/javascript");
                        _fscript.setAttribute("src", "//t.flix360.com/?f=flixgvid");
                        _fscript.setAttribute("async", "true");
                        _fscript.id = "data-flix-t-script";
                        document.getElementsByTagName('head')[0].appendChild(_fscript);
                                        
                        setTimeout(function(){
                            _FFUtils._FFsendLog(contId, type, p_id, matchtype);
                        },200);
                        return;
                    }
                }
            }catch(e){}

            if( p_id == null ){
                                            }

            var
              parsePage = _FFUtils._FFParsePage, getCanonical = _FFUtils._FFgetCanonical,
              data = { pagedata: _FFMatcher._FFpagedata }, pData = {}, s, df, i, p, p2;
            //check we don't already have the information
            window.flixJsCallbacks.pageCapture = window.flixJsCallbacks.pageCapture || {};
            //method normalized with inpage.php and l.v2.js except getCanonical
            try{
                PAGEDATALOOP:
                for( p in data.pagedata ) {
                    if( data.pagedata.hasOwnProperty(p)) {
                        switch( p ) {
                            case 'pageSpecific':
                                continue PAGEDATALOOP;
                                break;
                            case 'pn':
                                if( !! window.flixJsCallbacks.pageCapture[p] ) {
                                    pData[p] = window.flixJsCallbacks.pageCapture[p];
                                }
                                else {
                                    pData[p] = getCanonical();
                                    window.flixJsCallbacks.pageCapture[p] = pData[p];
                                }
                                break;
                            case 'ti':
                            case 'h1':
                                if( !! window.flixJsCallbacks.pageCapture[p] ) {
                                    pData[p] = window.flixJsCallbacks.pageCapture[p];
                                }
                                else {
                                    pData[p] = ( !! document.getElementsByTagName( data.pagedata[p].terms )[0] )
                                        ? document.getElementsByTagName( data.pagedata[p].terms )[0].textContent.trim()
                                        : '';
                                    window.flixJsCallbacks.pageCapture[p] = pData[p];
                                }
                                break;
                            case 'br':
                            default:
                                if( !! window.flixJsCallbacks.pageCapture[p] ) {
                                    pData[p] = window.flixJsCallbacks.pageCapture[p];
                                }
                                else {
                                    pData[p] = parsePage ( data.pagedata, p );
                                    window.flixJsCallbacks.pageCapture[p] = pData[p];
                                }
                                break;
                        }
                    }
                }
                //overwrite price and add brand if being supplied by retailer
                df = ['mpn', 'ean', 'sku', 'price', 'brand'];
                for( i=0; i<df.length; i++ ) {
                    if( document.querySelector('script[data-flix-' + df[i] + ']') &&
                        document.querySelector('script[data-flix-' + df[i] + ']').getAttribute('data-flix-' + df[i]) ) {
                        //differs here from inpage and noshow
                        pData[ df[i] ] = document.querySelector('script[data-flix-' + df[i] + ']').getAttribute('data-flix-' + df[i]);
                        if( df[i] === 'price' && _FFUtils._FFparsePrice( pData[ df[i] ] ) ) {
                            pData[ df[i] ] = _FFUtils._FFparsePrice( pData[ df[i] ] );
                        }
                        //overwrite brand with standard naming
                        if( df[i] === 'brand' ) {
                            pData[ 'br' ] = pData['brand'];
                            delete pData['brand'];
                        }
                    }
                }

                for( p2 in pData ){
                    if( pData.hasOwnProperty(p2)) {
                        params[p2] = encodeURIComponent(pData[p2]);
                    }
                }

            } catch(ignore){}

            var llurl= ('https:' == document.location.protocol) ? 'https://media.flixsyndication.net/minisite/ssl/log/minisite/log.gif?' : 'http://media.flixcar.com/minisite/log.gif?';

            switch (type){
                case "ok" :
                    llurl+= "et=matchhit&";
                    break;
                case "page": llurl+= "et=page&";break;
                case "vis": llurl+= "&v="+matchtype+"&";break;
                default :
                    llurl+= "et=matchmiss&";
                    break;
            }

            for (var key in params) {
                llurl += ((key=='p_id') ? 'm' : key )+ '=' + escape(params[key]) + '&';
            }
            llurl +='ver=2';

            if( typeof window.flixJsCallbacks.imgCache === 'undefined' ) { window.flixJsCallbacks.imgCache = {};}
            var track = 'img_' + (new Date()).getTime();
            window.flixJsCallbacks.imgCache[track] = new Image();

            if( ! window.navigator.userAgent.match(/(ios|symbian|android)/i) && !! params['d'] && (encrypt.indexOf(+params['d']) >= 0)) {
                processed = _FFUtils._FFProcess( llurl );
            }
            window.flixJsCallbacks.imgCache[track].src = ( !! processed ) ? processed : llurl+Math.random();
            window.flixJsCallbacks.imgCache[track].event_type = ( llurl.match(/et=(\w+)/i) ) ? llurl.match(/et=(\w+)/i)[1] : 'notcaptured';

            if( _beatNotActive.indexOf( +params['d'] ) < 0 && _beatByLanguage.indexOf(params['l']) >= 0) {       
                setTimeout(function(){beat = 'img_' + (new Date()).getTime();}, 0);
                window.flixJsCallbacks.imgCache[beat] = new Image();
                var _replace = ('https:' == document.location.protocol) ? 'https://media.flixsyndication.net/minisite/ssl/log/minisite/log.gif' : 'http://media.flixcar.com/minisite/log.gif';
                window.flixJsCallbacks.imgCache[beat].src = _beatUrl + llurl.replace(_replace, '');
                window.flixJsCallbacks.imgCache[beat].event_type = ( llurl.match(/et=(\w+)/i) ) ? llurl.match(/et=(\w+)/i)[1] : 'notcaptured';
            }
        }catch(e){}
    },

    _FFgetCanonical: function( esc ) {
        try {
            var
              ret, canonicalCheck, s;

            ret = _FFUtils._FFParsePage ( _FFMatcher._FFpagedata, 'pn' );

            canonicalCheck = window.location.protocol + '//' + window.location.hostname + '/';
            if( ! ret || ret === canonicalCheck || ret.length + 1 <= canonicalCheck.length) { ret = document.URL; }

            s = ret.indexOf('#');
            if( s != -1 ) { ret = ret.substring(0,s); }

            return arguments.length > 0 ? escape(ret) : ret;

        } catch(e) {}
    },    
    _FFParsePage: function ( pagedata, target ) {
        var 
          found = '', h = null, fallback = true, generic = {}, specific = {}, p,
          ignore = ['ti', 'h1'], precedence, hit = false;

        try {
            for( p in pagedata ) {
                if( pagedata.hasOwnProperty(p)) {
                    if( p == 'pageSpecific' ) {
                        specific = pagedata.pageSpecific;
                    }
                    else if ( ignore.indexOf( p ) === -1 ) {
                        generic[p] = pagedata[p];
                    }
                }
            }
            //set the precedence on availability in pageSpecific file. 
            precedence = ( !! specific[ target ] ) ? specific[ target ] : generic[ target ];
            if ( ! specific[ target ] ) { fallback = false; }

            //if pagespecific or generic is a function forget terms and attr arrays initially.             
            if( typeof precedence === 'function' ) {
                found = precedence();
                if ( ! found ) { fallback = true; }
            }

            if( ! found && !! precedence && !! precedence.terms && precedence.terms.length ) {
                for(var i = 0; i < precedence.terms.length; i++ ) {
                    h = document.querySelector ( precedence.terms[i] );
                    if ( h && !! h.textContent.trim() ) {
                        hit = true;
                        break;
                    }
                    else if ( h && h instanceof HTMLElement ) {
                        for ( var j = 0; j < precedence.attr.length; j++ ) {
                            if ( h.hasAttribute (precedence.attr[j] ) ) {
                                found = h.getAttribute ( precedence.attr[j] );
                                hit = true;
                                break;
                            }
                        }
                    }
                }
            }
            //fallback to generic if nothing found and not already run. 
            if( fallback && ! hit ) {
                precedence = generic[ target ];
                if( typeof precedence === 'function' ) {
                    found = precedence();
                }
                
                if( ! found && !! precedence && !! precedence.terms && precedence.terms.length ) {
                    for(var i = 0; i < precedence.terms.length; i++ ) {
                        h = document.querySelector ( precedence.terms[i] );
                        if ( h && !! h.textContent.trim() ) {
                            hit = true;
                            break;
                        }
                        else if ( h && h instanceof HTMLElement ) {
                            for ( var j = 0; j < precedence.attr.length; j++ ) {
                                if ( h.hasAttribute (precedence.attr[j] ) ) {
                                    found = h.getAttribute ( precedence.attr[j] );
                                    hit = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            //extract text content if we reach here.
            if ( ! found && h && h instanceof HTMLElement) {
                found = h.textContent.trim();
            }
            //enter only if we are a number with \. or , and its a price check
            if( target === 'price' && !! found ) {
                var 
                  value = _FFUtils._FFparsePrice( found );
                if( value ) { found = value; }
            }

            return found.trim();
        }catch(e){ return ''; }
    },
    _FFparsePrice: function( price ) {
        try{
            if( !! price && ! price.trim().match(/[a-z][\.,\u20AC]+/gi)) {
                var 
                  value = price.trim().replace(/[^0-9\.,\u20AC]/gi, ''),
                  l = value.length, vl, v = '';
                if( !! window.flixJsCallbacks.priceParser ) {
                    value = window.flixJsCallbacks.priceParser.regEx( value );
                    l = value.length;
                }
                switch( true ) {
                    case (!! value.charAt( l - 3 ).match(/[\.,\u20AC]/)):
                        value = value.substr(0, (l - 3)) + '*' +  value.substr( (l - 2) );
                        break;              
                    case (!! value.charAt( l - 2 ).match(/[\.,\u20AC]/)):
                        value = value.substr(0, (l - 2)) + '*' +  value.substr( (l - 1) );
                        break;
                    default:
                        value = value.split('.');
                        vl = (value.length - 1);
                        if( value.length > 1 && value[ vl ].length > 2 ){ value[ vl ] = value[ vl ].substr(0,2);}
                        for( var i=0, vTruel = value.length; i<vTruel; i++) {
                            ( i == (vTruel - 2)) ? v += value[i] + '*' : v += value[i];
                        }
                        value = v;
                        break;
                }
                value = value.replace(/[\.,\u20AC]+/g, '');
                value = value.replace(/\*/, '.');
                return value;
            }
        } catch(ignore){}
        return false;
    },
    _FFisVisible: function(el){
        try  {

            var i = document.getElementById(el);
            var off = _FFUtils._FFgetOffset(i);
            var r = document.elementFromPoint(off.x+10,off.y+10);
            if (r!=null) _FFUtils._FFsendLog(null,"vis",el,(r.id==el) ? "1":"0");
        } catch(e) {
            return false;
        }

    },
    _FFgetOffset:function(el){
        var _x = 0;
        var _y = 0;
        try
        {
            while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
                _x += el.offsetLeft - el.scrollLeft;
                _y += el.offsetTop - el.scrollTop;
                el = el.offsetParent;
            }   
        }
        catch (e){}
        return { y: _y, x: _x };
    },
    _FFcrc32: function (str, contId){ 
        str = _FFUtils._FFencode(str);
        var table = "00000000 77073096 EE0E612C 990951BA 076DC419 706AF48F E963A535 9E6495A3 0EDB8832 79DCB8A4 E0D5E91E 97D2D988 09B64C2B 7EB17CBD E7B82D07 90BF1D91 1DB71064 6AB020F2 F3B97148 84BE41DE 1ADAD47D 6DDDE4EB F4D4B551 83D385C7 136C9856 646BA8C0 FD62F97A 8A65C9EC 14015C4F 63066CD9 FA0F3D63 8D080DF5 3B6E20C8 4C69105E D56041E4 A2677172 3C03E4D1 4B04D447 D20D85FD A50AB56B 35B5A8FA 42B2986C DBBBC9D6 ACBCF940 32D86CE3 45DF5C75 DCD60DCF ABD13D59 26D930AC 51DE003A C8D75180 BFD06116 21B4F4B5 56B3C423 CFBA9599 B8BDA50F 2802B89E 5F058808 C60CD9B2 B10BE924 2F6F7C87 58684C11 C1611DAB B6662D3D 76DC4190 01DB7106 98D220BC EFD5102A 71B18589 06B6B51F 9FBFE4A5 E8B8D433 7807C9A2 0F00F934 9609A88E E10E9818 7F6A0DBB 086D3D2D 91646C97 E6635C01 6B6B51F4 1C6C6162 856530D8 F262004E 6C0695ED 1B01A57B 8208F4C1 F50FC457 65B0D9C6 12B7E950 8BBEB8EA FCB9887C 62DD1DDF 15DA2D49 8CD37CF3 FBD44C65 4DB26158 3AB551CE A3BC0074 D4BB30E2 4ADFA541 3DD895D7 A4D1C46D D3D6F4FB 4369E96A 346ED9FC AD678846 DA60B8D0 44042D73 33031DE5 AA0A4C5F DD0D7CC9 5005713C 270241AA BE0B1010 C90C2086 5768B525 206F85B3 B966D409 CE61E49F 5EDEF90E 29D9C998 B0D09822 C7D7A8B4 59B33D17 2EB40D81 B7BD5C3B C0BA6CAD EDB88320 9ABFB3B6 03B6E20C 74B1D29A EAD54739 9DD277AF 04DB2615 73DC1683 E3630B12 94643B84 0D6D6A3E 7A6A5AA8 E40ECF0B 9309FF9D 0A00AE27 7D079EB1 F00F9344 8708A3D2 1E01F268 6906C2FE F762575D 806567CB 196C3671 6E6B06E7 FED41B76 89D32BE0 10DA7A5A 67DD4ACC F9B9DF6F 8EBEEFF9 17B7BE43 60B08ED5 D6D6A3E8 A1D1937E 38D8C2C4 4FDFF252 D1BB67F1 A6BC5767 3FB506DD 48B2364B D80D2BDA AF0A1B4C 36034AF6 41047A60 DF60EFC3 A867DF55 316E8EEF 4669BE79 CB61B38C BC66831A 256FD2A0 5268E236 CC0C7795 BB0B4703 220216B9 5505262F C5BA3BBE B2BD0B28 2BB45A92 5CB36A04 C2D7FFA7 B5D0CF31 2CD99E8B 5BDEAE1D 9B64C2B0 EC63F226 756AA39C 026D930A 9C0906A9 EB0E363F 72076785 05005713 95BF4A82 E2B87A14 7BB12BAE 0CB61B38 92D28E9B E5D5BE0D 7CDCEFB7 0BDBDF21 86D3D2D4 F1D4E242 68DDB3F8 1FDA836E 81BE16CD F6B9265B 6FB077E1 18B74777 88085AE6 FF0F6A70 66063BCA 11010B5C 8F659EFF F862AE69 616BFFD3 166CCF45 A00AE278 D70DD2EE 4E048354 3903B3C2 A7672661 D06016F7 4969474D 3E6E77DB AED16A4A D9D65ADC 40DF0B66 37D83BF0 A9BCAE53 DEBB9EC5 47B2CF7F 30B5FFE9 BDBDF21C CABAC28A 53B39330 24B4A3A6 BAD03605 CDD70693 54DE5729 23D967BF B3667A2E C4614AB8 5D681B02 2A6F2B94 B40BBE37 C30C8EA1 5A05DF1B 2D02EF8D";
     
        var crc = 0; 
        var x = 0;
        var y = 0;
     
        crc = crc ^ (-1);
            for( var i = 0, iTop = str.length; i < iTop; i++ ) {
            y = ( crc ^ str.charCodeAt( i ) ) & 0xFF;
            x = "0x" + table.substr( y * 9, 8 );
            crc = ( crc >>> 8 ) ^ x;
        }
     
        crc = crc ^ (-1);
        
        _FFUtils._FFWriteLog(contId, str + ' => ' + crc);
        
        return crc;
    },
    _FFgetDomain: function (contId) {
        return 'logo.flixfacts.co.uk';
        var _ffscript = document.getElementById(_ffId).getAttribute('src');
        var found = _ffscript.match(/http:\/\/([^\/]+)\//);
        return found[1];     
    },
    _FFencode: function (str_data){ 
        var utftext = '';
     
        for (var n = 0; n < str_data.length; n++) {
            var c = str_data.charCodeAt(n);
            if (c < 128) {
                utftext += String.fromCharCode(c);
            } else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            } else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
        }
     
        return utftext;
    },
    _FFmakeRequest: function (url, callback,contId){
        var head = document.getElementsByTagName("head")[0];
        var script = document.createElement("script");
        script.src = url;
        _FFMatcher[contId+"ajax"]++;
        script.onload = script.onreadystatechange = function(){
            if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete"){
                if (callback) callback();
                script.onload = script.onreadystatechange = null;
                head.removeChild( script );
            }
            _FFMatcher[contId+"ajax"]--;

        }

        head.appendChild(script);
    },
    _FFReadCookie: function ( name ) {
        try{
            var nameEQ = name + "=";
            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,c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
            }

            return null;
        }catch(e){}
    },
    _FFEraseCookie: function( name ) {
        try {
            _FFUtils._FFCreateCookie(name,"",-1);
        }catch(e){}
    },     
    _FFCreateCookie: function ( name,value,days,path ) {
        try {
            if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
            }
            else var expires = "";

            document.cookie = name+"="+value+expires+"; path=/";
        }catch(e){}
    },
    _FFCrypt: function(e,m,p){
        var CryptoJS=CryptoJS||function(q,k){var e={},l=e.lib={},p=function(){},c=l.Base={extend:function(a){p.prototype=this;var b=new p;a&&b.mixIn(a);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
        s=l.WordArray=c.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=k?b:4*a.length},toString:function(a){return(a||d).stringify(this)},concat:function(a){var b=this.words,m=a.words,n=this.sigBytes;a=a.sigBytes;this.clamp();if(n%4)for(var r=0;r<a;r++)b[n+r>>>2]|=(m[r>>>2]>>>24-8*(r%4)&255)<<24-8*((n+r)%4);else if(65535<m.length)for(r=0;r<a;r+=4)b[n+r>>>2]=m[r>>>2];else b.push.apply(b,m);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<
        32-8*(b%4);a.length=q.ceil(b/4)},clone:function(){var a=c.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],m=0;m<a;m+=4)b.push(4294967296*q.random()|0);return new s.init(b,a)}}),b=e.enc={},d=b.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var m=[],n=0;n<a;n++){var r=b[n>>>2]>>>24-8*(n%4)&255;m.push((r>>>4).toString(16));m.push((r&15).toString(16))}return m.join("")},parse:function(a){for(var b=a.length,m=[],n=0;n<b;n+=2)m[n>>>3]|=parseInt(a.substr(n,
        2),16)<<24-4*(n%8);return new s.init(m,b/2)}},a=b.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var m=[],n=0;n<a;n++)m.push(String.fromCharCode(b[n>>>2]>>>24-8*(n%4)&255));return m.join("")},parse:function(a){for(var b=a.length,m=[],n=0;n<b;n++)m[n>>>2]|=(a.charCodeAt(n)&255)<<24-8*(n%4);return new s.init(m,b)}},u=b.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}},
        t=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new s.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=u.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,m=b.words,n=b.sigBytes,r=this.blockSize,c=n/(4*r),c=a?q.ceil(c):q.max((c|0)-this._minBufferSize,0);a=c*r;n=q.min(4*a,n);if(a){for(var t=0;t<a;t+=r)this._doProcessBlock(m,t);t=m.splice(0,a);b.sigBytes-=n}return new s.init(t,n)},clone:function(){var a=c.clone.call(this);
        a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=t.extend({cfg:c.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){t.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,m){return(new a.init(m)).finalize(b)}},_createHmacHelper:function(a){return function(b,m){return(new w.HMAC.init(a,
        m)).finalize(b)}}});var w=e.algo={};return e}(Math);
        (function(){var q=CryptoJS,k=q.lib.WordArray;q.enc.Base64={stringify:function(e){var l=e.words,p=e.sigBytes,c=this._map;e.clamp();e=[];for(var k=0;k<p;k+=3)for(var b=(l[k>>>2]>>>24-8*(k%4)&255)<<16|(l[k+1>>>2]>>>24-8*((k+1)%4)&255)<<8|l[k+2>>>2]>>>24-8*((k+2)%4)&255,d=0;4>d&&k+0.75*d<p;d++)e.push(c.charAt(b>>>6*(3-d)&63));if(l=c.charAt(64))for(;e.length%4;)e.push(l);return e.join("")},parse:function(e){var l=e.length,p=this._map,c=p.charAt(64);c&&(c=e.indexOf(c),-1!=c&&(l=c));for(var c=[],s=0,b=0;b<
        l;b++)if(b%4){var d=p.indexOf(e.charAt(b-1))<<2*(b%4),a=p.indexOf(e.charAt(b))>>>6-2*(b%4);c[s>>>2]|=(d|a)<<24-8*(s%4);s++}return k.create(c,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
        (function(q){function k(a,b,c,d,m,n,r){a=a+(b&c|~b&d)+m+r;return(a<<n|a>>>32-n)+b}function e(a,b,c,d,m,n,r){a=a+(b&d|c&~d)+m+r;return(a<<n|a>>>32-n)+b}function l(a,b,c,d,m,n,r){a=a+(b^c^d)+m+r;return(a<<n|a>>>32-n)+b}function p(a,b,c,d,m,n,r){a=a+(c^(b|~d))+m+r;return(a<<n|a>>>32-n)+b}for(var c=CryptoJS,s=c.lib,b=s.WordArray,d=s.Hasher,s=c.algo,a=[],u=0;64>u;u++)a[u]=4294967296*q.abs(q.sin(u+1))|0;s=s.MD5=d.extend({_doReset:function(){this._hash=new b.init([1732584193,4023233417,2562383102,271733878])},
        _doProcessBlock:function(b,c){for(var d=0;16>d;d++){var s=c+d,m=b[s];b[s]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}var d=this._hash.words,s=b[c+0],m=b[c+1],n=b[c+2],r=b[c+3],x=b[c+4],u=b[c+5],q=b[c+6],y=b[c+7],z=b[c+8],A=b[c+9],B=b[c+10],C=b[c+11],D=b[c+12],E=b[c+13],F=b[c+14],G=b[c+15],f=d[0],g=d[1],h=d[2],j=d[3],f=k(f,g,h,j,s,7,a[0]),j=k(j,f,g,h,m,12,a[1]),h=k(h,j,f,g,n,17,a[2]),g=k(g,h,j,f,r,22,a[3]),f=k(f,g,h,j,x,7,a[4]),j=k(j,f,g,h,u,12,a[5]),h=k(h,j,f,g,q,17,a[6]),g=k(g,h,j,f,y,22,a[7]),
        f=k(f,g,h,j,z,7,a[8]),j=k(j,f,g,h,A,12,a[9]),h=k(h,j,f,g,B,17,a[10]),g=k(g,h,j,f,C,22,a[11]),f=k(f,g,h,j,D,7,a[12]),j=k(j,f,g,h,E,12,a[13]),h=k(h,j,f,g,F,17,a[14]),g=k(g,h,j,f,G,22,a[15]),f=e(f,g,h,j,m,5,a[16]),j=e(j,f,g,h,q,9,a[17]),h=e(h,j,f,g,C,14,a[18]),g=e(g,h,j,f,s,20,a[19]),f=e(f,g,h,j,u,5,a[20]),j=e(j,f,g,h,B,9,a[21]),h=e(h,j,f,g,G,14,a[22]),g=e(g,h,j,f,x,20,a[23]),f=e(f,g,h,j,A,5,a[24]),j=e(j,f,g,h,F,9,a[25]),h=e(h,j,f,g,r,14,a[26]),g=e(g,h,j,f,z,20,a[27]),f=e(f,g,h,j,E,5,a[28]),j=e(j,f,
        g,h,n,9,a[29]),h=e(h,j,f,g,y,14,a[30]),g=e(g,h,j,f,D,20,a[31]),f=l(f,g,h,j,u,4,a[32]),j=l(j,f,g,h,z,11,a[33]),h=l(h,j,f,g,C,16,a[34]),g=l(g,h,j,f,F,23,a[35]),f=l(f,g,h,j,m,4,a[36]),j=l(j,f,g,h,x,11,a[37]),h=l(h,j,f,g,y,16,a[38]),g=l(g,h,j,f,B,23,a[39]),f=l(f,g,h,j,E,4,a[40]),j=l(j,f,g,h,s,11,a[41]),h=l(h,j,f,g,r,16,a[42]),g=l(g,h,j,f,q,23,a[43]),f=l(f,g,h,j,A,4,a[44]),j=l(j,f,g,h,D,11,a[45]),h=l(h,j,f,g,G,16,a[46]),g=l(g,h,j,f,n,23,a[47]),f=p(f,g,h,j,s,6,a[48]),j=p(j,f,g,h,y,10,a[49]),h=p(h,j,f,g,
        F,15,a[50]),g=p(g,h,j,f,u,21,a[51]),f=p(f,g,h,j,D,6,a[52]),j=p(j,f,g,h,r,10,a[53]),h=p(h,j,f,g,B,15,a[54]),g=p(g,h,j,f,m,21,a[55]),f=p(f,g,h,j,z,6,a[56]),j=p(j,f,g,h,G,10,a[57]),h=p(h,j,f,g,q,15,a[58]),g=p(g,h,j,f,E,21,a[59]),f=p(f,g,h,j,x,6,a[60]),j=p(j,f,g,h,C,10,a[61]),h=p(h,j,f,g,n,15,a[62]),g=p(g,h,j,f,A,21,a[63]);d[0]=d[0]+f|0;d[1]=d[1]+g|0;d[2]=d[2]+h|0;d[3]=d[3]+j|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32;var m=q.floor(c/
        4294967296);b[(d+64>>>9<<4)+15]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360;b[(d+64>>>9<<4)+14]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;a.sigBytes=4*(b.length+1);this._process();a=this._hash;b=a.words;for(c=0;4>c;c++)d=b[c],b[c]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return a},clone:function(){var a=d.clone.call(this);a._hash=this._hash.clone();return a}});c.MD5=d._createHelper(s);c.HmacMD5=d._createHmacHelper(s)})(Math);
        (function(){var q=CryptoJS,k=q.lib,e=k.Base,l=k.WordArray,k=q.algo,p=k.EvpKDF=e.extend({cfg:e.extend({keySize:4,hasher:k.MD5,iterations:1}),init:function(c){this.cfg=this.cfg.extend(c)},compute:function(c,e){for(var b=this.cfg,d=b.hasher.create(),a=l.create(),k=a.words,p=b.keySize,b=b.iterations;k.length<p;){q&&d.update(q);var q=d.update(c).finalize(e);d.reset();for(var v=1;v<b;v++)q=d.finalize(q),d.reset();a.concat(q)}a.sigBytes=4*p;return a}});q.EvpKDF=function(c,e,b){return p.create(b).compute(c,
        e)}})();
        CryptoJS.lib.Cipher||function(q){var k=CryptoJS,e=k.lib,l=e.Base,p=e.WordArray,c=e.BufferedBlockAlgorithm,s=k.enc.Base64,b=k.algo.EvpKDF,d=e.Cipher=c.extend({cfg:l.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c);this._xformMode=a;this._key=b;this.reset()},reset:function(){c.reset.call(this);this._doReset()},process:function(a){this._append(a);return this._process()},
        finalize:function(a){a&&this._append(a);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(a){return{encrypt:function(b,c,d){return("string"==typeof c?H:v).encrypt(a,b,c,d)},decrypt:function(b,c,d){return("string"==typeof c?H:v).decrypt(a,b,c,d)}}}});e.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var a=k.mode={},u=function(a,b,c){var d=this._iv;d?this._iv=q:d=this._prevBlock;for(var e=0;e<c;e++)a[b+e]^=
        d[e]},t=(e.BlockCipherMode=l.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a;this._iv=b}})).extend();t.Encryptor=t.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize;u.call(this,a,b,d);c.encryptBlock(a,b);this._prevBlock=a.slice(b,b+d)}});t.Decryptor=t.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=a.slice(b,b+d);c.decryptBlock(a,b);u.call(this,
        a,b,d);this._prevBlock=e}});a=a.CBC=t;t=(k.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,e=[],k=0;k<c;k+=4)e.push(d);c=p.create(e,c);a.concat(c)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};e.BlockCipher=d.extend({cfg:d.cfg.extend({mode:a,padding:t}),reset:function(){d.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a,
        this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var w=e.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),a=(k.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?p.create([1398893684,
        1701076831]).concat(a).concat(b):b).toString(s)},parse:function(a){a=s.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=p.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return w.create({ciphertext:a,salt:c})}},v=e.SerializableCipher=l.extend({cfg:l.extend({format:a}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return w.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,blockSize:a.blockSize,formatter:d.format})},
        decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),k=(k.kdf={}).OpenSSL={execute:function(a,c,d,e){e||(e=p.random(8));a=b.create({keySize:c+d}).compute(a,e);d=p.create(a.words.slice(c),4*d);a.sigBytes=4*c;return w.create({key:a,iv:d,salt:e})}},H=e.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:k}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,
        a.keySize,a.ivSize);d.iv=c.iv;a=v.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return v.decrypt.call(this,a,b,c.key,d)}})}();
        (function(){function q(){for(var b=this._X,d=this._C,a=0;8>a;a++)p[a]=d[a];d[0]=d[0]+1295307597+this._b|0;d[1]=d[1]+3545052371+(d[0]>>>0<p[0]>>>0?1:0)|0;d[2]=d[2]+886263092+(d[1]>>>0<p[1]>>>0?1:0)|0;d[3]=d[3]+1295307597+(d[2]>>>0<p[2]>>>0?1:0)|0;d[4]=d[4]+3545052371+(d[3]>>>0<p[3]>>>0?1:0)|0;d[5]=d[5]+886263092+(d[4]>>>0<p[4]>>>0?1:0)|0;d[6]=d[6]+1295307597+(d[5]>>>0<p[5]>>>0?1:0)|0;d[7]=d[7]+3545052371+(d[6]>>>0<p[6]>>>0?1:0)|0;this._b=d[7]>>>0<p[7]>>>0?1:0;for(a=0;8>a;a++){var e=b[a]+d[a],k=e&65535,
        l=e>>>16;c[a]=((k*k>>>17)+k*l>>>15)+l*l^((e&4294901760)*e|0)+((e&65535)*e|0)}b[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0;b[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0;b[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0;b[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0;b[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0;b[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0;b[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0;b[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}var k=CryptoJS,e=k.lib.StreamCipher,l=[],p=[],c=[],s=k.algo.Rabbit=
        e.extend({_doReset:function(){for(var b=this._key.words,c=this.cfg.iv,a=0;4>a;a++)b[a]=(b[a]<<8|b[a]>>>24)&16711935|(b[a]<<24|b[a]>>>8)&4278255360;for(var e=this._X=[b[0],b[3]<<16|b[2]>>>16,b[1],b[0]<<16|b[3]>>>16,b[2],b[1]<<16|b[0]>>>16,b[3],b[2]<<16|b[1]>>>16],b=this._C=[b[2]<<16|b[2]>>>16,b[0]&4294901760|b[1]&65535,b[3]<<16|b[3]>>>16,b[1]&4294901760|b[2]&65535,b[0]<<16|b[0]>>>16,b[2]&4294901760|b[3]&65535,b[1]<<16|b[1]>>>16,b[3]&4294901760|b[0]&65535],a=this._b=0;4>a;a++)q.call(this);for(a=0;8>
        a;a++)b[a]^=e[a+4&7];if(c){var a=c.words,c=a[0],a=a[1],c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,a=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,e=c>>>16|a&4294901760,k=a<<16|c&65535;b[0]^=c;b[1]^=e;b[2]^=a;b[3]^=k;b[4]^=c;b[5]^=e;b[6]^=a;b[7]^=k;for(a=0;4>a;a++)q.call(this)}},_doProcessBlock:function(b,c){var a=this._X;q.call(this);l[0]=a[0]^a[5]>>>16^a[3]<<16;l[1]=a[2]^a[7]>>>16^a[5]<<16;l[2]=a[4]^a[1]>>>16^a[7]<<16;l[3]=a[6]^a[3]>>>16^a[1]<<16;for(a=0;4>a;a++)l[a]=(l[a]<<8|l[a]>>>24)&
        16711935|(l[a]<<24|l[a]>>>8)&4278255360,b[c+a]^=l[a]},blockSize:4,ivSize:2});k.Rabbit=e._createHelper(s)})();
        if( e === 'encrypt') return CryptoJS.Rabbit.encrypt(m,p).toString();
        if( e === 'decrypt') return CryptoJS.Rabbit.decrypt(m,p).toString(CryptoJS.enc.Utf8);
    },
    _FFProcess: function( str ){
        /**
         * - ept encrypt, primary, truncate[val,[[?]100]]
         * - ep  encrypt, primary
         * - u   unencrypted
         * - ut  unencrypted, truncate
         * - est encrypt, secondary, truncate
         * - es  encrypt, secondary
         */
        function truncate(s,l) { var l = l || 100; return String(s).substr(0,+l); }
        var 
          permitted = {
            'm':'u',
            'p':'u',
            'd':'u',
            'l':'u',
            'et':'ep',
            'ed':'ep',
            'sid':'ep',
            'vtime':'ep',
            'gvid':'ep',
            'ut':'u',
            'br':'es',
            'price':'es',
            'ref':'est',
            'currency':'es',
            'pn':'est?30',
            'h1':'est',
            'ti':'est',
            'img':'es',
            'r1.cat':'est250',
            'om':'est250',
            'mpn':'u',
            'ean':'u',
            'sku':'u',
            'ab': 'es',
            'abr':'es',
            'abid':'es'
        },
        s1=str.split('?'),
        s2 = s1[1].split('&'),
        o1 = {}, get, m, url = "",
        u = [], p = [], s = [],
        e = null;

        for(var i=0, l=s2.length; i<l; i++) {
            var init = s2[i].split('=');
            o1[init[0]] = init[1];
        }

        for( var prop in permitted ) {
            if( permitted.hasOwnProperty(prop)) {
                switch( true ) {
                    case /u$/.test(permitted[prop]):
                        if(!!o1[prop]) u.push(prop + '=' + o1[prop]);
                        break;
                    case /ep$/.test(permitted[prop]):
                        if(!!o1[prop]) p.push(prop + '=' + o1[prop]);
                        break;
                    case /es$/.test(permitted[prop]):
                        if(!!o1[prop]) s.push(prop + '=' + o1[prop]);
                        break;
                    case /est$/.test(permitted[prop]):
                        if(!!o1[prop]) s.push(prop + '=' + truncate(o1[prop]));
                        break;
                    case /est\?\d+$/.test(permitted[prop]):
                        if(/%3F/g.test(o1[prop])) {
                            get = o1[prop].split('%3F');
                            get[1] = truncate(get[1], 30);
                            s.push(prop + '=' + (get.join('%3F')));
                        }
                        else { s.push(prop + '=' + o1[prop]); }
                        break;
                    case /est\d+$/.test(permitted[prop]):
                        m = permitted[prop].match(/\d+/g)[0];
                        if(!!o1[prop]) s.push(prop + '=' + truncate(o1[prop], m));
                        break;
                    default:
                    //add any unknowns to unencrypted
                        u.push(prop + '=' + (o1[prop] || ""));
                        break;
                }
            }
        }
        url += s1[0] + '?' + u.join('&');
        url += '&ep=' + _FFUtils._FFCrypt('encrypt', encodeURIComponent(p.join('&')), o1.ut);
        url += '&es=' + _FFUtils._FFCrypt('encrypt', encodeURIComponent(s.join('&')), o1.ut);

        return url;
    },
    _FFWriteSioTy: function( gvid, ab ) {
        try{
            var
             tyPage = {
                'gvid': gvid,
                'tst_id': [ab.tst_id]
            },
            ticks = 3;

            if( ! arguments[1] ) { return false; }

            (function testForFlixCookie() {
                if( _FFUtils._FFReadCookie === null && ticks ) {
                    setTimeout(testForFlixCookie, 1000);
                    ticks--;
                }
                else if ( ticks ) {
                    if( _FFUtils._FFReadCookie('sio_ty') === null ) {
                        _FFUtils._FFCreateCookie ( 'sio_ty', JSON.stringify( tyPage ) );
                    }
                    else{
                        var content = JSON.parse ( _FFUtils._FFReadCookie( 'sio_ty' ) );
                        if( ab.expire && ab.expire === 'expired'  ) {
                            for(var i = 0; i < content.tst_id.length; i++ ) {
                                if ( content.tst_id[i] == ab.tst_id ) {
                                    content.tst_id.splice ( i, 1);
                                }
                            }
                        }
                        else {
                            if( ! $.inArray( tyPage.tst_id, content.tst_id[0] )) {
                                content.tst_id[0][ content.tst_id[0].length ] = tyPage.tst_id;
                            }           
                        }
                        //delete && reinstate
                        _FFUtils._FFEraseCookie("sio_ty");
                        _FFUtils._FFCreateCookie( 'sio_ty', JSON.stringify( content ) );
                    }   
                }
            })();
        }catch(e){}
    }
};


var _FFBase64 = {
 
    // private property
    _keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 
    // public method for encoding
    encode : function (input) {
        var output = "";
        var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
        var i = 0;
 
        input = _FFBase64._utf8_encode(input);
 
        while (i < input.length) {
 
            chr1 = input.charCodeAt(i++);
            chr2 = input.charCodeAt(i++);
            chr3 = input.charCodeAt(i++);
 
            enc1 = chr1 >> 2;
            enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
            enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
            enc4 = chr3 & 63;
 
            if (isNaN(chr2)) {
                enc3 = enc4 = 64;
            } else if (isNaN(chr3)) {
                enc4 = 64;
            }
 
            output = output +
            this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
            this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
 
        }
 
        return output;
    },
 
    // private method for UTF-8 encoding
    _utf8_encode : function (string) {
        string = string.replace(/\r\n/g,"\n");
        var utftext = "";
 
        for (var n = 0; n < string.length; n++) {
 
            var c = string.charCodeAt(n);
 
            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }
 
        }
 
        return utftext;
    }
};
_name = 'flix_minisite_56361';

    document.write('<div id="'+_name+'"></div>');
try{
_FFMatcher._FFmpn = '';
_FFMatcher._FFean = '';
}catch(e){}
window.flixJsCallbacks = window.flixJsCallbacks || {};
window.flixJsCallbacks.pageGeneric = window.flixJsCallbacks.pageGeneric || {};
window.flixJsCallbacks.pageSpecific = window.flixJsCallbacks.pageSpecific || {};

/*OFFICE MAX US | 159*/
window.flixJsCallbacks.pageSpecific = {
    br:  function(){
        return ( !! window.R3_COMMON && !! window.R3_COMMON.brand ) ? JSON.stringify(  window.R3_COMMON.brand ) : '';
    },
    'r1.cat': function(){
        return ( !! window.R3_ITEM && !! window.R3_ITEM.categories ) ? JSON.stringify(  window.R3_ITEM.categories ) : '';
    },
    currency: function(){
        return 'us';
    },
    price: function(){
        var
          price,
          remove,
          check = [
            '.price_amount',
            '.price'
          ];

          PRICECHECK:
          for(var i=0, l=check.length; i<l; i++) {
            price = document.querySelector( check[i] );
            if( price && price instanceof HTMLElement ) { break PRICECHECK; }
          }

          remove = price.querySelector('#sundaySkyprice');

        if( remove ) { price.removeChild( remove ); }

        return price.textContent || '';
    }
};
;window.flixJsCallbacks.pageGeneric = {
    br: {
        terms: [
            '.fpLinkBrandProducts[title]',
            '[itemprop="brand"]',
            '[itemprop="brand"][content]',
            '[data-brand]',
            '.specification',
            '[brandname]',
            '[itemprop="manufacturer"]',
            '.brand',
            '#productBrandName[value]'
        ],
        attr: [
            'title',
            'content',
            'data-brand',
            'brandname',
            'value'        
        ]
    },
    price: {
        terms: [
            '[property="og:price:amount"][content]',
            '[itemprop="price"]',
            '[itemprop="generic"]',
            '[itemprop="price"][content]',
            '.finalprice',
            '.price-current-label',
            '.fpPriceBig',
            '.prijs',
            '.price',
            '.pdp-price-total',
            '.pounds',
            '.pricelarge',
            '[data-price]'
        ],
        attr: [
            'content'
        ]
    },
    ref: function() {
        return document.referrer || '';
    },
    currency: {
        terms: [
            '[property="og:price:currency"][content]',
            '[itemprop="priceCurrency"][content]',
            '.currency[title]',
            '.value-title[title]',
            '.currency'
        ],
        attr: [
            'content',
            'title'
        ]        
    },
    pn: {
        terms: [
            '[property="og:url"][content]',
            '[rel="canonical"][href]'
        ],
        attr: [
            'content',
            'href'
        ]
    },
    h1: {
        terms: 'h1'
    },
    ti: {
        terms: 'title'
    },
    img: {
        terms: [
            '[property="og:image"]'
        ],
        attr: [
            'content'
        ]
    },
    'r1.cat': '',
    om: {}
};


window.flixJsCallbacks.pageGeneric.pageSpecific = window.flixJsCallbacks.pageSpecific || {};


_FFMatcher._FFmain(_name, '159', 'us','581864','static/distributor/159/buttons/default-us.gif', 0, window.flixJsCallbacks.pageGeneric);


/*found=1*/

if(!String.prototype.trim) {
  String.prototype.trim = function () {
    return this.replace(/^\s+|\s+$/g,'');
  };
}

if ( ! Array.prototype.forEach ) {
    Array.prototype.forEach = function (fn, scope) {
        'use strict';
        var i, len;
        for (i = 0, len = this.length; i < len; ++i) {
            if (i in this) {
                fn.call(scope, this[i], i, this);
            }
        }
    };
}

window.flixJsCallbacks = window.flixJsCallbacks || {};

window.flixJsCallbacks.flixCartClick = function (identifier, dist_id, language) {
	var 
	  data = {}, flixLogging, parsePage, crypt;

	try {
		if( identifier === 'skip' ) return false;
		parsePage = function() {
			var
			  canonicalCheck, s, found = '', h, title = '', i, j,
			  terms = [
			    '[property="og:url"]',
			    '[rel="canonical"]'
			  ],
			  attr = [
			  	'content',
			  	'href'
			  ]
			;

			//write code here for fallback to just grabbing title and pn. 
			if( !! document.getElementsByTagName( 'title')) {
				title = document.getElementsByTagName('title')[0].textContent.trim();
			}
			//parse pn vs canoncial here. 	
			for (i = 0; i < terms.length; i++ ) {
				h = document.querySelector ( terms[i] );
				if ( h && !! h.textContent.trim() ) {
					break;
				}
				else if( h && h instanceof HTMLElement ){
					for ( j = 0; j < attr.length; j++ ) {
						if ( h.hasAttribute (attr[j] ) ) {
							found += h.getAttribute ( attr[j] );
							break;
						}
					}
				}
			}

			if ( ! found && h && h instanceof HTMLElement) {
				found = h.textContent.trim();
			}

	    canonicalCheck = window.location.protocol + '//' + window.location.hostname + '/';

	    if( ! found || found === canonicalCheck || found.length + 1 <= canonicalCheck.length) { found = document.URL; }

      s = found.indexOf('#');
      if( s !== -1 ) { found = found.substring(0,s); }

			return {
				title: encodeURIComponent(title),
				pn : encodeURIComponent(found)
			};
		}; //end parse page

		crypt = function(e,m,p){
      var CryptoJS=CryptoJS||function(q,k){var e={},l=e.lib={},p=function(){},c=l.Base={extend:function(a){p.prototype=this;var b=new p;a&&b.mixIn(a);b.hasOwnProperty("init")||(b.init=function(){b.$super.init.apply(this,arguments)});b.init.prototype=b;b.$super=this;return b},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
      s=l.WordArray=c.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=b!=k?b:4*a.length},toString:function(a){return(a||d).stringify(this)},concat:function(a){var b=this.words,m=a.words,n=this.sigBytes;a=a.sigBytes;this.clamp();if(n%4)for(var r=0;r<a;r++)b[n+r>>>2]|=(m[r>>>2]>>>24-8*(r%4)&255)<<24-8*((n+r)%4);else if(65535<m.length)for(r=0;r<a;r+=4)b[n+r>>>2]=m[r>>>2];else b.push.apply(b,m);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<
      32-8*(b%4);a.length=q.ceil(b/4)},clone:function(){var a=c.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],m=0;m<a;m+=4)b.push(4294967296*q.random()|0);return new s.init(b,a)}}),b=e.enc={},d=b.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var m=[],n=0;n<a;n++){var r=b[n>>>2]>>>24-8*(n%4)&255;m.push((r>>>4).toString(16));m.push((r&15).toString(16))}return m.join("")},parse:function(a){for(var b=a.length,m=[],n=0;n<b;n+=2)m[n>>>3]|=parseInt(a.substr(n,
      2),16)<<24-4*(n%8);return new s.init(m,b/2)}},a=b.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var m=[],n=0;n<a;n++)m.push(String.fromCharCode(b[n>>>2]>>>24-8*(n%4)&255));return m.join("")},parse:function(a){for(var b=a.length,m=[],n=0;n<b;n++)m[n>>>2]|=(a.charCodeAt(n)&255)<<24-8*(n%4);return new s.init(m,b)}},u=b.Utf8={stringify:function(b){try{return decodeURIComponent(escape(a.stringify(b)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(b){return a.parse(unescape(encodeURIComponent(b)))}},
      t=l.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new s.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=u.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,m=b.words,n=b.sigBytes,r=this.blockSize,c=n/(4*r),c=a?q.ceil(c):q.max((c|0)-this._minBufferSize,0);a=c*r;n=q.min(4*a,n);if(a){for(var t=0;t<a;t+=r)this._doProcessBlock(m,t);t=m.splice(0,a);b.sigBytes-=n}return new s.init(t,n)},clone:function(){var a=c.clone.call(this);
      a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=t.extend({cfg:c.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){t.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,m){return(new a.init(m)).finalize(b)}},_createHmacHelper:function(a){return function(b,m){return(new w.HMAC.init(a,
      m)).finalize(b)}}});var w=e.algo={};return e}(Math);
      (function(){var q=CryptoJS,k=q.lib.WordArray;q.enc.Base64={stringify:function(e){var l=e.words,p=e.sigBytes,c=this._map;e.clamp();e=[];for(var k=0;k<p;k+=3)for(var b=(l[k>>>2]>>>24-8*(k%4)&255)<<16|(l[k+1>>>2]>>>24-8*((k+1)%4)&255)<<8|l[k+2>>>2]>>>24-8*((k+2)%4)&255,d=0;4>d&&k+0.75*d<p;d++)e.push(c.charAt(b>>>6*(3-d)&63));if(l=c.charAt(64))for(;e.length%4;)e.push(l);return e.join("")},parse:function(e){var l=e.length,p=this._map,c=p.charAt(64);c&&(c=e.indexOf(c),-1!=c&&(l=c));for(var c=[],s=0,b=0;b<
      l;b++)if(b%4){var d=p.indexOf(e.charAt(b-1))<<2*(b%4),a=p.indexOf(e.charAt(b))>>>6-2*(b%4);c[s>>>2]|=(d|a)<<24-8*(s%4);s++}return k.create(c,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
      (function(q){function k(a,b,c,d,m,n,r){a=a+(b&c|~b&d)+m+r;return(a<<n|a>>>32-n)+b}function e(a,b,c,d,m,n,r){a=a+(b&d|c&~d)+m+r;return(a<<n|a>>>32-n)+b}function l(a,b,c,d,m,n,r){a=a+(b^c^d)+m+r;return(a<<n|a>>>32-n)+b}function p(a,b,c,d,m,n,r){a=a+(c^(b|~d))+m+r;return(a<<n|a>>>32-n)+b}for(var c=CryptoJS,s=c.lib,b=s.WordArray,d=s.Hasher,s=c.algo,a=[],u=0;64>u;u++)a[u]=4294967296*q.abs(q.sin(u+1))|0;s=s.MD5=d.extend({_doReset:function(){this._hash=new b.init([1732584193,4023233417,2562383102,271733878])},
      _doProcessBlock:function(b,c){for(var d=0;16>d;d++){var s=c+d,m=b[s];b[s]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}var d=this._hash.words,s=b[c+0],m=b[c+1],n=b[c+2],r=b[c+3],x=b[c+4],u=b[c+5],q=b[c+6],y=b[c+7],z=b[c+8],A=b[c+9],B=b[c+10],C=b[c+11],D=b[c+12],E=b[c+13],F=b[c+14],G=b[c+15],f=d[0],g=d[1],h=d[2],j=d[3],f=k(f,g,h,j,s,7,a[0]),j=k(j,f,g,h,m,12,a[1]),h=k(h,j,f,g,n,17,a[2]),g=k(g,h,j,f,r,22,a[3]),f=k(f,g,h,j,x,7,a[4]),j=k(j,f,g,h,u,12,a[5]),h=k(h,j,f,g,q,17,a[6]),g=k(g,h,j,f,y,22,a[7]),
      f=k(f,g,h,j,z,7,a[8]),j=k(j,f,g,h,A,12,a[9]),h=k(h,j,f,g,B,17,a[10]),g=k(g,h,j,f,C,22,a[11]),f=k(f,g,h,j,D,7,a[12]),j=k(j,f,g,h,E,12,a[13]),h=k(h,j,f,g,F,17,a[14]),g=k(g,h,j,f,G,22,a[15]),f=e(f,g,h,j,m,5,a[16]),j=e(j,f,g,h,q,9,a[17]),h=e(h,j,f,g,C,14,a[18]),g=e(g,h,j,f,s,20,a[19]),f=e(f,g,h,j,u,5,a[20]),j=e(j,f,g,h,B,9,a[21]),h=e(h,j,f,g,G,14,a[22]),g=e(g,h,j,f,x,20,a[23]),f=e(f,g,h,j,A,5,a[24]),j=e(j,f,g,h,F,9,a[25]),h=e(h,j,f,g,r,14,a[26]),g=e(g,h,j,f,z,20,a[27]),f=e(f,g,h,j,E,5,a[28]),j=e(j,f,
      g,h,n,9,a[29]),h=e(h,j,f,g,y,14,a[30]),g=e(g,h,j,f,D,20,a[31]),f=l(f,g,h,j,u,4,a[32]),j=l(j,f,g,h,z,11,a[33]),h=l(h,j,f,g,C,16,a[34]),g=l(g,h,j,f,F,23,a[35]),f=l(f,g,h,j,m,4,a[36]),j=l(j,f,g,h,x,11,a[37]),h=l(h,j,f,g,y,16,a[38]),g=l(g,h,j,f,B,23,a[39]),f=l(f,g,h,j,E,4,a[40]),j=l(j,f,g,h,s,11,a[41]),h=l(h,j,f,g,r,16,a[42]),g=l(g,h,j,f,q,23,a[43]),f=l(f,g,h,j,A,4,a[44]),j=l(j,f,g,h,D,11,a[45]),h=l(h,j,f,g,G,16,a[46]),g=l(g,h,j,f,n,23,a[47]),f=p(f,g,h,j,s,6,a[48]),j=p(j,f,g,h,y,10,a[49]),h=p(h,j,f,g,
      F,15,a[50]),g=p(g,h,j,f,u,21,a[51]),f=p(f,g,h,j,D,6,a[52]),j=p(j,f,g,h,r,10,a[53]),h=p(h,j,f,g,B,15,a[54]),g=p(g,h,j,f,m,21,a[55]),f=p(f,g,h,j,z,6,a[56]),j=p(j,f,g,h,G,10,a[57]),h=p(h,j,f,g,q,15,a[58]),g=p(g,h,j,f,E,21,a[59]),f=p(f,g,h,j,x,6,a[60]),j=p(j,f,g,h,C,10,a[61]),h=p(h,j,f,g,n,15,a[62]),g=p(g,h,j,f,A,21,a[63]);d[0]=d[0]+f|0;d[1]=d[1]+g|0;d[2]=d[2]+h|0;d[3]=d[3]+j|0},_doFinalize:function(){var a=this._data,b=a.words,c=8*this._nDataBytes,d=8*a.sigBytes;b[d>>>5]|=128<<24-d%32;var m=q.floor(c/
      4294967296);b[(d+64>>>9<<4)+15]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360;b[(d+64>>>9<<4)+14]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;a.sigBytes=4*(b.length+1);this._process();a=this._hash;b=a.words;for(c=0;4>c;c++)d=b[c],b[c]=(d<<8|d>>>24)&16711935|(d<<24|d>>>8)&4278255360;return a},clone:function(){var a=d.clone.call(this);a._hash=this._hash.clone();return a}});c.MD5=d._createHelper(s);c.HmacMD5=d._createHmacHelper(s)})(Math);
      (function(){var q=CryptoJS,k=q.lib,e=k.Base,l=k.WordArray,k=q.algo,p=k.EvpKDF=e.extend({cfg:e.extend({keySize:4,hasher:k.MD5,iterations:1}),init:function(c){this.cfg=this.cfg.extend(c)},compute:function(c,e){for(var b=this.cfg,d=b.hasher.create(),a=l.create(),k=a.words,p=b.keySize,b=b.iterations;k.length<p;){q&&d.update(q);var q=d.update(c).finalize(e);d.reset();for(var v=1;v<b;v++)q=d.finalize(q),d.reset();a.concat(q)}a.sigBytes=4*p;return a}});q.EvpKDF=function(c,e,b){return p.create(b).compute(c,
      e)}})();
      CryptoJS.lib.Cipher||function(q){var k=CryptoJS,e=k.lib,l=e.Base,p=e.WordArray,c=e.BufferedBlockAlgorithm,s=k.enc.Base64,b=k.algo.EvpKDF,d=e.Cipher=c.extend({cfg:l.extend(),createEncryptor:function(a,b){return this.create(this._ENC_XFORM_MODE,a,b)},createDecryptor:function(a,b){return this.create(this._DEC_XFORM_MODE,a,b)},init:function(a,b,c){this.cfg=this.cfg.extend(c);this._xformMode=a;this._key=b;this.reset()},reset:function(){c.reset.call(this);this._doReset()},process:function(a){this._append(a);return this._process()},
      finalize:function(a){a&&this._append(a);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(a){return{encrypt:function(b,c,d){return("string"==typeof c?H:v).encrypt(a,b,c,d)},decrypt:function(b,c,d){return("string"==typeof c?H:v).decrypt(a,b,c,d)}}}});e.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var a=k.mode={},u=function(a,b,c){var d=this._iv;d?this._iv=q:d=this._prevBlock;for(var e=0;e<c;e++)a[b+e]^=
      d[e]},t=(e.BlockCipherMode=l.extend({createEncryptor:function(a,b){return this.Encryptor.create(a,b)},createDecryptor:function(a,b){return this.Decryptor.create(a,b)},init:function(a,b){this._cipher=a;this._iv=b}})).extend();t.Encryptor=t.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize;u.call(this,a,b,d);c.encryptBlock(a,b);this._prevBlock=a.slice(b,b+d)}});t.Decryptor=t.extend({processBlock:function(a,b){var c=this._cipher,d=c.blockSize,e=a.slice(b,b+d);c.decryptBlock(a,b);u.call(this,
      a,b,d);this._prevBlock=e}});a=a.CBC=t;t=(k.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,e=[],k=0;k<c;k+=4)e.push(d);c=p.create(e,c);a.concat(c)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};e.BlockCipher=d.extend({cfg:d.cfg.extend({mode:a,padding:t}),reset:function(){d.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a,
      this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var w=e.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),a=(k.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?p.create([1398893684,
      1701076831]).concat(a).concat(b):b).toString(s)},parse:function(a){a=s.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=p.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return w.create({ciphertext:a,salt:c})}},v=e.SerializableCipher=l.extend({cfg:l.extend({format:a}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var e=a.createEncryptor(c,d);b=e.finalize(b);e=e.cfg;return w.create({ciphertext:b,key:c,iv:e.iv,algorithm:a,mode:e.mode,padding:e.padding,blockSize:a.blockSize,formatter:d.format})},
      decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),k=(k.kdf={}).OpenSSL={execute:function(a,c,d,e){e||(e=p.random(8));a=b.create({keySize:c+d}).compute(a,e);d=p.create(a.words.slice(c),4*d);a.sigBytes=4*c;return w.create({key:a,iv:d,salt:e})}},H=e.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:k}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);c=d.kdf.execute(c,
      a.keySize,a.ivSize);d.iv=c.iv;a=v.encrypt.call(this,a,b,c.key,d);a.mixIn(c);return a},decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);c=d.kdf.execute(c,a.keySize,a.ivSize,b.salt);d.iv=c.iv;return v.decrypt.call(this,a,b,c.key,d)}})}();
      (function(){function q(){for(var b=this._X,d=this._C,a=0;8>a;a++)p[a]=d[a];d[0]=d[0]+1295307597+this._b|0;d[1]=d[1]+3545052371+(d[0]>>>0<p[0]>>>0?1:0)|0;d[2]=d[2]+886263092+(d[1]>>>0<p[1]>>>0?1:0)|0;d[3]=d[3]+1295307597+(d[2]>>>0<p[2]>>>0?1:0)|0;d[4]=d[4]+3545052371+(d[3]>>>0<p[3]>>>0?1:0)|0;d[5]=d[5]+886263092+(d[4]>>>0<p[4]>>>0?1:0)|0;d[6]=d[6]+1295307597+(d[5]>>>0<p[5]>>>0?1:0)|0;d[7]=d[7]+3545052371+(d[6]>>>0<p[6]>>>0?1:0)|0;this._b=d[7]>>>0<p[7]>>>0?1:0;for(a=0;8>a;a++){var e=b[a]+d[a],k=e&65535,
      l=e>>>16;c[a]=((k*k>>>17)+k*l>>>15)+l*l^((e&4294901760)*e|0)+((e&65535)*e|0)}b[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0;b[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0;b[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0;b[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0;b[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0;b[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0;b[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0;b[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}var k=CryptoJS,e=k.lib.StreamCipher,l=[],p=[],c=[],s=k.algo.Rabbit=
      e.extend({_doReset:function(){for(var b=this._key.words,c=this.cfg.iv,a=0;4>a;a++)b[a]=(b[a]<<8|b[a]>>>24)&16711935|(b[a]<<24|b[a]>>>8)&4278255360;for(var e=this._X=[b[0],b[3]<<16|b[2]>>>16,b[1],b[0]<<16|b[3]>>>16,b[2],b[1]<<16|b[0]>>>16,b[3],b[2]<<16|b[1]>>>16],b=this._C=[b[2]<<16|b[2]>>>16,b[0]&4294901760|b[1]&65535,b[3]<<16|b[3]>>>16,b[1]&4294901760|b[2]&65535,b[0]<<16|b[0]>>>16,b[2]&4294901760|b[3]&65535,b[1]<<16|b[1]>>>16,b[3]&4294901760|b[0]&65535],a=this._b=0;4>a;a++)q.call(this);for(a=0;8>
      a;a++)b[a]^=e[a+4&7];if(c){var a=c.words,c=a[0],a=a[1],c=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360,a=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360,e=c>>>16|a&4294901760,k=a<<16|c&65535;b[0]^=c;b[1]^=e;b[2]^=a;b[3]^=k;b[4]^=c;b[5]^=e;b[6]^=a;b[7]^=k;for(a=0;4>a;a++)q.call(this)}},_doProcessBlock:function(b,c){var a=this._X;q.call(this);l[0]=a[0]^a[5]>>>16^a[3]<<16;l[1]=a[2]^a[7]>>>16^a[5]<<16;l[2]=a[4]^a[1]>>>16^a[7]<<16;l[3]=a[6]^a[3]>>>16^a[1]<<16;for(a=0;4>a;a++)l[a]=(l[a]<<8|l[a]>>>24)&
      16711935|(l[a]<<24|l[a]>>>8)&4278255360,b[c+a]^=l[a]},blockSize:4,ivSize:2});k.Rabbit=e._createHelper(s)})();
      if( e === 'encrypt') return CryptoJS.Rabbit.encrypt(m,p).toString();
      if( e === 'decrypt') return CryptoJS.Rabbit.decrypt(m,p).toString(CryptoJS.enc.Utf8);
    };
	  process = function( str ){
	  /**
	   * - ept encrypt, primary, truncate[val,[[?]100]]
	   * - ep  encrypt, primary
	   * - u   unencrypted
	   * - ut  unencrypted, truncate
	   * - est encrypt, secondary, truncate
	   * - es  encrypt, secondary
	   */
    	function truncate(s,l) { var l = l || 100; return String(s).substr(0,+l); }
	    var 
      permitted = {
        'm':'u',
        'p':'u',
        'd':'u',
        'l':'u',
        'et':'ep',
        'ed':'ep',
        'sid':'ep',
        'vtime':'ep',
        'gvid':'ep',
        'ut':'u',
        'br':'es',
        'price':'es',
        'ref':'est',
        'currency':'es',
        'pn':'est?30',
        'h1':'est',
        'ti':'est',
        'img':'es',
        'r1.cat':'est250',
        'om':'est250',
        'mpn':'u',
        'ean':'u',
        'sku':'u',
        'alert' : 'es',
        'cart_click': 'es'
      },
      s1=str.split('?'),
      s2 = s1[1].split('&'),
      o1 = {}, get, m, url = "",
      u = [], p = [], s = [],
      e = null;

      for(var i=0, l=s2.length; i<l; i++) {
          var init = s2[i].split('=');
          o1[init[0]] = init[1];
      }

      for( var prop in permitted ) {
        if( permitted.hasOwnProperty(prop)) {
          switch( true ) {
            case /u$/.test(permitted[prop]):
              if(!!o1[prop]) u.push(prop + '=' + o1[prop]);
              break;
            case /ep$/.test(permitted[prop]):
              if(!!o1[prop]) p.push(prop + '=' + o1[prop]);
              break;
            case /es$/.test(permitted[prop]):
              if(!!o1[prop]) s.push(prop + '=' + o1[prop]);
              break;
            case /est$/.test(permitted[prop]):
              if(!!o1[prop]) s.push(prop + '=' + truncate(o1[prop]));
              break;
            case /est\?\d+$/.test(permitted[prop]):
              if(/%3F/g.test(o1[prop])) {
                  get = o1[prop].split('%3F');
                  get[1] = truncate(get[1], 30);
                  s.push(prop + '=' + (get.join('%3F')));
              }
              else { s.push(prop + '=' + o1[prop]); }
              break;
            case /est\d+$/.test(permitted[prop]):
              m = permitted[prop].match(/\d+/g)[0];
              if(!!o1[prop]) s.push(prop + '=' + truncate(o1[prop], m));
              break;
            default:
          	//add any unknowns to unencrypted
              u.push(prop + '=' + (o1[prop] || ""));
              break;
          }
        }
      }
      url += s1[0] + '?' + u.join('&');
      url += '&ep=' + crypt('encrypt', encodeURIComponent(p.join('&')), o1.ut);
      url += '&es=' + crypt('encrypt', encodeURIComponent(s.join('&')), o1.ut);
      return url;
  	};

		flixLogging = function () {
			var 
			  d = new Date (),
			  _base = 'http://media.flixcar.com/inpage/log.gif',
        _beatUrl = '//rt.flix360.com/beat',
        _beatNotActive = [],
        _beatByLanguage = ['fr','en','nl','us'],
        beat,
			  fallback,
        processed = null,
        encrypt = [96,5434,5420,336,1058],
        userAgents = [
          'symbian',
          'android',
          'ios'
        ],
			  key, mpn, ean;

			data.d = dist_id || '';
			data.l = language || '';
			data.view_time = 0;

			if ('https:' === document.location.protocol){
				_base = 'https://media.flixsyndication.net/inpage/ssl/log/inpage/log.gif';
			}

			data.gvid = ( window.flixJsCallbacks && window.flixJsCallbacks.gvid ) ? window.flixJsCallbacks.gvid : '';

			var url = _base+"?m=y&et="+data.event_type;
			url += "&ed="+encodeURIComponent(data.event_detail);
			url += "&gvid="+data.gvid;
			url += "&d="+data.d;
			url += "&l="+data.l;
			url += "&ut=" + d.getTime();

			if( !! window.flixJsCallbacks.pageCapture ) {
				for (key in window.flixJsCallbacks.pageCapture) {
					if( window.flixJsCallbacks.pageCapture.hasOwnProperty(key)) {
	           url += "&"+key+ '=' + encodeURIComponent( window.flixJsCallbacks.pageCapture[key] );
					}
        }
			}
			else {
				fallback = parsePage();
				url += "&ti=" + fallback.title;
				url += "&pn=" + fallback.pn;
			}

      if( typeof window.flixJsCallbacks.imgCache === 'undefined' ) { window.flixJsCallbacks.imgCache = {};}
      var track = 'img_' + (new Date).getTime();
      window.flixJsCallbacks.imgCache[track] = new Image();
      if( ! window.navigator.userAgent.match(/(ios|symbian|android)/i) && data.d && (encrypt.indexOf(+data.d) >= 0)) {
          processed = process( url );
      }      
      window.flixJsCallbacks.imgCache[track].src = ( !! processed ) ? processed : url; 
      window.flixJsCallbacks.imgCache[track].event_type = data.event_type;

      if( _beatNotActive.indexOf( +data.d ) < 0 && data.event_type === 'cart_click' && _beatByLanguage.indexOf(data.l) >= 0) {
        mpn = document.querySelector('script[data-flix-mpn]') || null;
        ean = document.querySelector('script[data-flix-ean]') || null;

        data.mpn = ( !! mpn ) ? mpn.getAttribute('data-flix-mpn') : '';
        data.ean = ( !! ean ) ? ean.getAttribute('data-flix-ean') : '';

        url += "&mpn=" + data.mpn;
        url += "&ean=" + data.ean;

        setTimeout(function(){beat = 'img_' + (new Date()).getTime();}, 0);
        window.flixJsCallbacks.imgCache[beat] = new Image();                    
        window.flixJsCallbacks.imgCache[beat].src = _beatUrl + url.replace(_base, '');
        window.flixJsCallbacks.imgCache[beat].event_type = data.event_type;
      }      
		};

		if( identifier !== 'alert') {
			var NodeList = document.querySelectorAll(identifier);
			var ArrayList = Array.prototype.slice.call(NodeList, 0);
		}


		if( identifier === 'alert' || ! ArrayList.length )  {
			data.event_type = "alert";
			data.event_detail = 'a2cX';

			var ticks = 10;
			(function nTicks() {
				if( window.flixJsCallbacks.gvid === 'undefined' && ticks ) {
					setTimeout(function(){ 
						ticks--;
						nTicks();
					},100);
				}
				else {
					flixLogging();					
				}
			}());
		}
		else {
			ArrayList.forEach(function(element) {
				if( document !== "undefined" && "classList" in document.documentElement) {
					if( ! element.classList.contains('flix_cart_click_check')) {
						element.classList.add('flix_cart_click_check');
					}
				}
				else  {
					if( element.className === "") {
						element.className = "flix_cart_click_check";
					}
					else if( ! element.className.test("flix_cart_click_check"))  {
						element.className += " flix_cart_click_check";
					}
				}
				element.onmousedown = function(e) {
					e = e || window.event; 
					data.event_type = "cart_click";
					data.event_detail = 1;
					flixLogging();
				};
			});
		}
	}catch(ignore){}
};
/*Office Depot US/159*/
;(function() {
    try{
        if(!!window.flixJsCallbacks && !!window.flixJsCallbacks.flixCartClick) {
            var ticks = 10;
            (function domTest() {
                if( ! document.querySelector('input#addToCartButtonId') && ticks ) {
                    setTimeout(function(){ 
                        ticks--;
                        domTest();
                    },5000);
                }
                else {
                    window.flixJsCallbacks.flixCartClick( 'input#addToCartButtonId', 159, 'en'); 
                }
            }());
        }
    }catch(ignore){}
  try {
    var dict = {
      "463663": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "526387": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "458324": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "754435": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "434207": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "636387": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "414964": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "215345": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "620002": "e198fded-b58b-45b2-9d2c-ea787542f020",
      "374317": "e198fded-b58b-45b2-9d2c-ea787542f020"
    };
    var _mfq = _mfq || [];
    for(var p in dict) {
      var regex = new RegExp( p, 'i');
      if( dict.hasOwnProperty(p) && regex.test( window.location.pathname )) {
        setTimeout((function() {
          var mf = document.createElement("script"); mf.type = "text/javascript"; mf.async = true;
          mf.src = "//cdn.mouseflow.com/projects/" + dict[p] + ".js";
          document.getElementsByTagName("head")[0].appendChild(mf);
        }()), 10000);
      }
    }
  } catch (ignore) {}
  try {
    var pages = [
      "463663",
      "526387",
      "458324",
      "754435",
      "434207",
      "215345",
      "636387",
      "414964",
      "620002",
      "374317"
    ];
    for( var i=0, l=pages.length; i<l; i++) {
      var regex = new RegExp(pages[i]);
      if( regex.test(window.location.pathname)) {
        setTimeout(function(){var a=document.createElement("script");
        var b=document.getElementsByTagName("script")[0];
        a.src=document.location.protocol+"//script.crazyegg.com/pages/scripts/0028/6203.js?"+Math.floor(new Date().getTime()/3600000);
        a.async=true;a.type="text/javascript";b.parentNode.insertBefore(a,b)}, 15000);
      }
    }
  }catch(ignore){}
}());

