/*Distributor Configurations or Brand assets not found*//*MatchMiss*/

/*Flixmedia Global Impressions Tracker*/


/*NOTE to minimise! Remove all PHP code above, bottom and below and replace after minimising */
if (typeof FlixjQ !== 'undefined') {
    (function ($) {
        if(location.href.search('flix-qa')!=-1)
            window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){console.log(Array.prototype.slice.call(arguments));}};
        else
            window.log=function(){};
        if(location.href.search('flix-logqa')!=-1)
            window.log5=function(){log5.history=log5.history||[];log5.history.push(arguments);if(this.console){console.log(Array.prototype.slice.call(arguments));}};
        else
            window.log5=function(){};

        if(typeof FlixjQ.fn.on=='undefined')
            FlixjQ.fn.on=FlixjQ.fn.live;

        if (typeof $.fn.logging == 'undefined') {
            var logoclickonce=0;
            var opts = {},
                comparisonTable,
                reviewsContainer,
                reviews_count = 0,
                trackingCall = false,
                trackingDomain = "//media.flixcar.com";
            trackingDomainBeat = "//rt.flix360.com/beat";
            /*NOTE PHP above */


            var beatDisabledRetailers=[3986,13395];

            /* Set Logging function */
            $.fn.logging = function (type, event, data, media, price, inPcount) {
                log5(type+"__"+event+"__"+data+"__"+media+"__"+price+"__"+inPcount)
                var page = window.location.href;

                var fireBeat=false,fireLog=true;
                
                data=data|| opts;

                data.page_name = page;
                data.event_type = event;
                data.event_detail = media;
                data.price = price;
                data.view_time = 0;

                var prodid=data.product;
                //get productid incase the main product is a matchmiss
                if(prodid==0 || prodid==null){
                    prodid=FlixjQ('.main_mot_product_wrapper:eq(0)').attr('alt')  || FlixjQ('[id^=flixinpage]:eq(0)').find('span[id^=inpage-data]').attr('id');
                    prodid=prodid.toString().replace('inpage-data-','')
                }
                if(type=='review'){
                    var prodid=FlixjQ('#flix-mobile_template-reviews').closest('.main_mot_product_wrapper').attr('alt')  || FlixjQ('.inpage_selector_reviews').closest('[id^=flixinpage]').find('span[id^=inpage-data]').attr('id') || data.product;
                    prodid=prodid.toString().replace('inpage-data-','')
                }

                if(type=='compare'){
                    var prodid=FlixjQ('.flix-compare').closest('.main_mot_product_wrapper').attr('alt')  || FlixjQ('.flix-compare').closest('[id^=flixinpage]').find('span[id^=inpage-data]').attr('id') || data.product;
                    prodid=prodid.toString().replace('inpage-data-','')
                }

                if(type=='visible'){
                    var prodid=FlixjQ('[id*=flixinpage_]:eq('+inPcount+')').find('span[id^=inpage-data]').attr('id') || FlixjQ('[id*=flixinpage_]:eq('+inPcount+')').attr('alt') || data.product;
                    prodid=prodid.toString().replace('inpage-data-','');
                }

                if(type=='3dfw'){ 
                    var prodid=FlixjQ('[id*=flixinpage_]:eq('+inPcount+')').find('span[id^=inpage-data]').attr('id') || FlixjQ('[id*=flixinpage_]:eq('+inPcount+')').attr('alt') || data.product;
                    prodid=prodid.toString().replace('inpage-data-','');
                    
                }

                

                var d = new Date();
                var _base = trackingDomain + '/' + type + '/log.gif';

                var url = _base + "?m=i"

                if(FlixjQ('#flix-mbl-page').length){
                    url += "&mot=1";
                }

                // flixlocationcontent tracking
                if(type=="flc"){
                    fireLog=false;
                    fireBeat=true;

                    var prodid=data.product || '';

                    url +="&mpn="+data.mpn + "&ean="
                        + data.ean + "&location="
                        + data.city
                }

                url +="&p="+prodid + "&d="
                    + data.distributor + "&l="
                    + data.language + "&pn=" + encodeURIComponent(data.page_name)
                    + "&et=" + data.event_type + "&ed="
                    + encodeURIComponent(data.event_detail)
                    + "&sid=" + data.session_id
                    + "&vtime=" + data.view_time
                    + "&gvid=" + data.gvid;
                url += "&cb=" + d.getTime();

                log5("Global log - type: "+type+"_ prodid: "+prodid);


                if(FlixjQ.fn.inPage && FlixjQ.fn.inPage.hasOwn( data.ab_data ) && data.ab_data.expire !== 'expired') {
                    //add AB tags only for the tracked product
                    if(FlixjQ('[data-flix-abid]').length && FlixjQ('[data-flix-abid]').attr('id').search(prodid)!=-1){

                        data.ab = "&ab="+data.ab_data.tst_id+"&abr="+data.ab_data.resource_ref+"&abid="+data.ab_data.cookie.abid;
                        url +=data.ab;
                    }
                }



                if (data.event_type == 'productpage' || data.event_type == 'addtocart') url += "&price=" + data.price;

                //check for no tracking
                if (typeof FlixjQ.fn.logging.noTracking!='undefined' && FlixjQ.fn.logging.noTracking==false && fireLog) {
                    var img = new Image();
                    img.src = url;
                }


                //ABtest for comparison only
                if(window.flixJsCallbacks['ab_'+opts.distributor]!= null && type=='compare'){
                    fireBeat=true
                }

                // beat url log
                if (typeof FlixjQ.fn.logging.noTracking!='undefined' && FlixjQ.fn.logging.noTracking==false && fireBeat && beatDisabledRetailers.indexOf(+data.distributor)<0) {
                    log5('Beat tracking', url)

                    var distributor_id=opts.distributor;
                    var ab_res_id = 'ab_'+distributor_id;
                    if(window.flixJsCallbacks[ab_res_id]!= null){
                        var ab_version=window.flixJsCallbacks[ab_res_id].version||'';
                        var target=window.flixJsCallbacks[ab_res_id].target||'';
                        var ab_visitor_id=window.flixJsCallbacks[ab_res_id].visitor_id||'';
                        var ab_groups=window.flixJsCallbacks[ab_res_id].groups||'';
                        var ab_id=window.flixJsCallbacks[ab_res_id].ab_id||'';
                        var device=window.flixJsCallbacks[ab_res_id].device||'';
                        url = url+"&version="+ab_version+"&target="+target+"&visitor_id="+ab_visitor_id+"&groups="+ab_groups+"&ab_id="+ab_id+"&device="+device;
                    }

                    //abtesting beaturl update
                    if(window.flixJsCallbacks['ab_'+opts.distributor]!= null && window.flixJsCallbacks['ab_'+opts.distributor].inpage!=null)
                        url ='//rt.flix360.io/beat'+url.replace(_base, '');
                    else if(window.flixJsCallbacks['ab_'+opts.distributor]!= null && window.flixJsCallbacks['ab_'+opts.distributor].inpage!=null && _base.search('dev')!=-1)
                        url ='//alpha-rt.flix360.io/beat'+url.replace(_base, '');
                    else
                        url=trackingDomainBeat+url.replace(_base, '');

                    if(type=='compare'){
                        url +="&fm_service=315";
                    }
                    var img = new Image();
                    img.src = url;
                }
            };
            $.fn.logging.trackingDomain=trackingDomain;

            /*NOTE PHP below */
            
/*Flixmedia Tracking Flag */
FlixjQ.fn.logging.noTracking=false
                        /*NOTE PHP above */

            $.fn.logging.prototype = {
                comparison: {
                    init: function () {

                        log5('comparison init-') 
                        if (opts.mpn === undefined) {
                            opts.mpn = '';
                        }
                        $.fn.logging('compare', 'impression', opts, opts.mpn);
                        this.clicks();

                        if(FlixjQ('.ui-tabs-nav li').length){
                            FlixjQ('.ui-tabs-nav li').on('click', function(){
                                
                                var tabno=FlixjQ(this).find('a').attr('href')
                                log5('Minisite logs-'+tabno)     
                                if(FlixjQ(tabno).find('.inpage_selector_comparison').length)  
                                    FlixjQ.fn.logging.prototype.comparison.elementInViewport('.inpage_selector_comparison');
                            })
                        }else if(FlixjQ('[data-for="flix-mbl-comparison"]').length){
                            FlixjQ('[data-for="flix-mbl-comparison"]').on('click', function(){ 
                                setTimeout(function(){ 
                                    window.addEventListener('scroll', FlixjQ.fn.logging.prototype.comparison.checkViewport);
                                }, 200);
                            });
                        }else{
                            window.addEventListener('scroll', FlixjQ.fn.logging.prototype.comparison.checkViewport);
                        }
                    },
                    clicks: function () {

                        $('.flix-comp-prod-title .flix-comp-clickable, .flix-comp-trac-product .flix-comp-clickable, .flix-comp-product .flix-comp-prod-image .flix-comp-clickable').on('click', function () {
                            var attached_mpn = $(this).attr('rel');
                            var price = $(this).attr('price');
                            $.fn.logging('compare', 'productpage', opts, attached_mpn, price);
                        });

                        $('.flix-comp-trac-buy .flix-comp-clickable').on('click', function () {
                            var attached_mpn = $(this).attr('rel');
                            var price = $(this).attr('price');
                            $.fn.logging('compare', 'addtocart', opts, attached_mpn, price);
                        });

                        $('.flix-comp-control-prev').on('click', function () {                         
                            $.fn.logging('compare', 'media', opts, 'prev');
                        });

                        $('.flix-comp-control-next').on('click', function () {                         
                            $.fn.logging('compare', 'media', opts, 'next');
                        });

                        $('.flix-comp-toggle').on('click', function () {                         
                            $.fn.logging('compare', 'media', opts, 'flix-arrow-toggle');
                        });

                    },
                    checkViewport: function(element) {
                        FlixjQ.fn.logging.prototype.comparison.elementInViewport('.inpage_selector_comparison');

                        FlixjQ.fn.logging.prototype.comparison.elementInViewport('#inpage_container');
                    },
                    visibilitychange: function(state, type){
                        //document.title = document.visibilityState;
                        log5('visibilitychange-'+type)
                        if(document.visibilityState=='hidden' ){
                            FlixjQ.fn.logging.prototype.comparison.dwelltimer('stop', '.inpage_selector_comparison')
                            FlixjQ.fn.logging.prototype.comparison.dwelltimer('stop', '#inpage_container')
                            
                        }
                        else{
                        }
                    }, 
                    dwelltimer: function(state, element){
                        //log5('dwelltimer-'+state+"__"+element)
                        var lastt=document.querySelector(element).dataset.flixtime || 0;
                       
                        if (lastt && lastt!=0 && state=='stop') {
                            var lastt=lastt
                            tdiff = Date.now() - lastt;
                            type='ct'
                            if(element && element.search('inpage_container')!=-1)
                                type='inpage'

                            var artime=type+'_time_'+tdiff;

                            log5(type+'-timer stop- '+tdiff); 
                            if(tdiff > 0){
                                FlixjQ.fn.logging('compare', 'dwelltime', null , artime);
                            }
                           
                            document.querySelector(element).removeAttribute('data-flixtime')
                        } 
                        else if (state=='start' && lastt==0 ){ 
                            log5('dwelltimer timer start'+element); 

                            //check stop dwell when user leaves the page
                            document.addEventListener('visibilitychange', FlixjQ.fn.logging.prototype.comparison.visibilitychange);

                            //minisite tab change
                            if(FlixjQ('.ui-tabs-nav li').length){
                                FlixjQ('.ui-tabs-nav li').one('click', function(){
                                    var tabno=FlixjQ(this).find('a').attr('href')
                                    log5('Minisite tab click-'+tabno)     
                                    if(FlixjQ(tabno).find('.inpage_selector_comparison').length==0)                                      
                                        FlixjQ.fn.logging.prototype.comparison.dwelltimer('stop', '.inpage_selector_comparison')
                                })
                            }
                            document.querySelector(element).dataset.flixtime= Date.now();
                                 
                        }       
                    },
                    elementInViewport: function(element) {
                        var myElement = document.querySelector(element);
                        if(myElement){
                            var bounding = myElement.getBoundingClientRect();
                            var myElementHeight = myElement.offsetHeight;
                            var myElementWidth = myElement.offsetWidth;
                            var bounding = myElement.getBoundingClientRect();

                            if (bounding.top >= -myElementHeight 
                                && bounding.left >= -myElementWidth
                                && bounding.right <= (window.innerWidth || document.documentElement.clientWidth) + myElementWidth
                                && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) + myElementHeight) {

                                if(!document.querySelector(element).dataset.flixtime){
                                    FlixjQ.fn.logging.prototype.comparison.dwelltimer('start', element )
                                    //log view CT  
                                    if(element=='.inpage_selector_comparison' && FlixjQ(element).is(":visible"))                 
                                        FlixjQ.fn.logging('compare', 'media', null , 'views');
                                }
                            } else {
                                if(document.querySelector(element).dataset.flixtime)
                                    FlixjQ.fn.logging.prototype.comparison.dwelltimer('stop', element)                                
                            }
                        }
                    }
                },
                reviews: {
                    init: function () {
                        reviews_count = reviewsContainer.attr('data-rcount');
                        $.fn.logging('review', 'page', opts, 'review_' + reviews_count);
                        this.clicks();
                    },
                    clicks: function () {

                        $('body').on('click', '[class*=-topreviews]', function () {
                            $.fn.logging('review', 'page', opts, 'review_scrollTo');
                        });

                        $('body').on('click', 'nav[class*=_pagination] ul li span', function () {
                            var page = $(this).attr("data-href");
                            $.fn.logging('review', 'page', opts, 'review_page_' + page);
                        });

                        $("div#minisite_tabs ul").find("[data-m-typeid='14']").on('click', function () {
                            $.fn.logging('review', 'matchhit', opts, 'review_tabClick');
                        });
                    }
                },
                pagetracking:{
                    init: function(){
                        //track when inpage is in viewport
                        log5('start inpage visible tracking')
                        var toptrac=[];
                        var middletrac=[];
                        var bottomtrac=[];
                        $(window).scroll(function() {
                            $('[id*=flixinpage_]').each(function(inPcount, b){

                                if($(this).find("#inpage_container").length>0 && $(this).find("#inpage_container").offset()){

                                    var top_of_element = $(this).find("#inpage_container").offset().top;
                                    var bottom_of_element = $(this).find("#inpage_container").offset().top + $(this).find("#inpage_container").outerHeight();
                                    var middle_of_element = $(this).find("#inpage_container").offset().top + $(this).find("#inpage_container").outerHeight()/2;

                                    var bottom_of_screen = $(window).scrollTop() + window.innerHeight;
                                    var top_of_screen = $(window).scrollTop();
                                    var pagepos='';

                                    if((bottom_of_screen > top_of_element) && (top_of_screen < bottom_of_element)){

                                        if(top_of_screen < top_of_element &&  $.inArray( inPcount, toptrac )==-1){
                                            log5('Top of inPage');
                                            pagepos='Top of inPage'
                                            toptrac.push(inPcount);
                                        }

                                        if(top_of_screen > middle_of_element &&  $.inArray( inPcount, middletrac )==-1){
                                            log5('Middle of inPage');
                                            pagepos='Middle of inPage'
                                            middletrac.push(inPcount);
                                        }

                                        if(bottom_of_screen > bottom_of_element && $.inArray( inPcount, bottomtrac )==-1){
                                            log5('Bottom of inPage');
                                            pagepos='Bottom of inPage'
                                            bottomtrac.push(inPcount);
                                        }

                                        if(typeof $.fn.inPage=='function' && pagepos!=''){
                                            var opts = $.fn.inPage.data;
                                            $.fn.logging('visible', 'media', opts, pagepos, null, inPcount)
                                        }

                                    }else {
                                        //log5('Inpage not visible yet')
                                    }
                                }
                            })
                        });



                    }
                },
                logotracking: {
                    init: function () {
                        log5('start logo tracking')
                        $.fn.logging('logo', 'page', opts, 'logo_page');
                        this.hover();
                        this.click();
                    },
                    hover: function () {
                        $('body').on('hover', '.flix-logop', function () {
                            if(logoclickonce==0)
                                $.fn.logging('logo', 'media', opts, 'logo_hover');
                            logoclickonce++;
                        });
                    },
                    click: function () {
                        $('body').on('touchstart', '.flix-logop', function () {
                            if(logoclickonce==0)
                                $.fn.logging('logo', 'media', opts, 'logo_click');
                            logoclickonce++;
                        });
                    }
                },
                ugctracking: {
                    init: function () {
                        log5('start ugc tracking')
                        FlixjQ.fn.logging('ugc', 'page', opts, 'ucg_page'); 
                        this.click();                       
                    },
                    click: function () {  
                        var timerId = null;                      
                        FlixjQ('body').on('click touchstart', '[data-flix-ucgmedia]', function () {
                            var opts2=opts;
                            var ucgtarget=FlixjQ(this).attr('data-flix-ucgmedia').toLowerCase()
                            if(FlixjQ(this).closest('.share-bubble').length)
                                ucgtarget='hotspot_'+ucgtarget                            
                            if(typeof opts=='undefined' && typeof flixhotspot && typeof flixhotspot.data!='undefined')
                                opts2=flixhotspot.data;
                            if(typeof window.flixlightboxclick=='undefined' && !timerId){
                                log5('clicked- '+ FlixjQ(this).attr('data-flix-ucgmedia'))
                                timerId = setTimeout(function(){
                                    FlixjQ.fn.logging('ugc', 'media', opts2, ucgtarget); 
                                    timerId = null;
                                },200);                                
                            }                           
                        });                        
                    }
                },
                flctracking: {
                    init: function() {
                        log5("start flc tracking via prototype");
                        this.checkmatch()
                    },
                    checkmatch:function(){
                        setTimeout(function(){
                            if($('#flix-location-content').children().length > 0 ){
                                $.fn.logging("flc", "location", opts, "flc_location ");
                                $.fn.logging.prototype.flctracking.click();
                            }else{
                                $.fn.logging("flc", "matchmisslocation ", opts, "flc_matchmisslocation  ");
                            }
                        },1500)
                    },
                    click: function() {
                        $("body").on("click touchstart", "[data-flix-flcmedia]", function() {
                            var opts2=opts;
                            var flctarget = FlixjQ(this).attr("data-flix-flcmedia").toLowerCase();
                            log5("clicked- " + flctarget);
                            $.fn.logging("flc", "locationmedia", opts2, flctarget)
                        })
                    }
                },
                buttontracking: {
                    init: function () {
                        var type='inpage';
                        if(typeof FlixjQ.fn.minisite!='undefined')
                            type='minisite'
                        var cc=0
                        var medialog=function(mediatext){

                            if(cc==0){
                                log5('clicked data-flix-media: '+mediatext)
                                cc=1;
                                $.fn.logging(type, 'media', opts, mediatext);
                                setTimeout(function(){ cc=0}, 500)
                            }
                        }
                        FlixjQ('body').on('click touchstart', '[data-flix-media]', function () {
                            var mediatext=FlixjQ(this).attr('data-flix-media')
                            medialog(mediatext)
                        });
                    }
                }
            };

            // File loader
            function loadComp(e, t) {
                if (-1 != e.search(".js") && 0 === FlixjQ("script[src='" + e + "']").length) {
                    var c = document.createElement("script");
                    c.type = "text/javascript", c.src = e, c.onload = t, document.head.appendChild(c);
                }
                if (-1 != e.search(".css") && 0 === FlixjQ("link[href='" + e + "']").length) {
                    var n = document.createElement("link");
                    n.rel = "stylesheet", n.href = e, n.type = "text/css", n.onload = t, document.head.appendChild(n);
                }
            }

            /* Get product options */
            $.fn.globalTracking = function (source) {
                if (trackingCall === false) {

                    if ($.fn.inPage && $.fn.inPage.data.product !== undefined) {
                        opts = $.fn.inPage.data;
                    } else if ($.fn.minisite && $.fn.minisite.data.product !== undefined) {
                        opts = $.fn.minisite.data;
                    } else {
                        return false;
                    }

                    $(document).ready(function () {
                        setTimeout(function(){
                            comparisonTable = $('.flix-compare');
                            reviewsContainer = $('.inpage_selector_reviews');

                            /* Load comparison table JS and CSS */
                            var abtablecheck=false
                            if(window.flixJsCallbacks['ab_'+opts.distributor] && window.flixJsCallbacks['ab_'+opts.distributor].inpage && window.flixJsCallbacks['ab_'+opts.distributor].inpage.inpages && window.flixJsCallbacks['ab_'+opts.distributor].inpage.inpages.disable_comparison_table &&  window.flixJsCallbacks['ab_'+opts.distributor].inpage.inpages.disable_comparison_table==true)
                                abtablecheck=true;
                            if (comparisonTable && comparisonTable.length > 0 && abtablecheck==false) {                                
                                loadComp(trackingDomain + '/delivery/static/comparison/standard/js/append.js');
                                loadComp(trackingDomain + '/delivery/static/comparison/standard/css/main.css');
                                $.fn.logging.prototype.comparison.init();
                            }

                            /* Reviews tracking */
                            if (reviewsContainer && reviewsContainer.length > 0) {
                                $.fn.logging.prototype.reviews.init();
                            }

                            /*Initialization page position tracking*/

                            if(FlixjQ.fn.inPage=='undefined' || (FlixjQ.fn.inPage && FlixjQ.fn.inPage.hasOwn( FlixjQ.fn.inPage.data.ab_data ))) {
                                if($("#inpage_container").length>0){
                                    $.fn.logging.prototype.pagetracking.init();
                                }
                            }else{
                                log5('No time tracking');
                                if(typeof FlixjQ.fn.inPage!='undefined' && typeof FlixjQ.fn.inPage.logTime!='undefined'){
                                   FlixjQ.fn.inPage.logTime= function(){}
                                }
                                if(typeof FlixjQ.fn.minisite!='undefined' && typeof FlixjQ.fn.minisite.logTime!='undefined'){
                                   FlixjQ.fn.minisite.logTime= function(){}
                                }
                                if(typeof FlixjQ.fn.compMinisite!='undefined' && typeof FlixjQ.fn.compMinisite.logTime!='undefined'){
                                   FlixjQ.fn.compMinisite.logTime= function(){}
                                }
                                if(typeof instance!='undefined' && typeof instance.logTime!='undefined'){
                                   instance.logTime= function(){}
                                }

                            }



                            //load 3dft JS and CSS */
                            if (FlixjQ('#flix-3dfwsrc').length) {
                                log5('Load 3dtw');
                                loadComp(trackingDomain + '/delivery/static/3dfw/3dfw.js');
                            }

                            if(FlixjQ('[skey]').length>0){
                                FlixjQ.fn.logging.prototype.logotracking.init();
                            }

                            if(FlixjQ('#flix-ugc-galfeatures').length>0){
                                FlixjQ.fn.logging.prototype.ugctracking.init();
                            }

                            //default button tracking
                            FlixjQ.fn.logging.prototype.buttontracking.init();

                            var compcc=0
                            function checkCompButton(){
                                if(FlixjQ('#inpage-iframe-modal a') && FlixjQ('#inpage-iframe-modal a').length && FlixjQ('#inpage-iframe-modal a').attr('onclick').search('scrollToComplimentary')!=-1){
                                    var s=FlixjQ('#inpage-iframe-modal a').attr('onclick')
                                    var id= s.split('(\"#link')[1].split('\")')[0]
                                    if(FlixjQ('[id^=flixinpage_'+id+']').length && FlixjQ('[id^=flixinpage_'+id+']').html().length==0){
                                        $('#inpage-iframe-modal a').hide();
                                        setTimeout(function(){
                                            if(compcc<10)
                                                checkCompButton()
                                            compcc++;
                                        }, 2000)
                                    }else{
                                        $('#inpage-iframe-modal a').show()
                                    }

                                }
                            }
                            //hide comp button if abtest hides complementary inpages
                            if(FlixjQ.fn.inPage && FlixjQ.fn.inPage.hasOwn( FlixjQ.fn.inPage.data.ab_data ))
                                checkCompButton();

                        }, 500);

                    });

                    trackingCall = true;
                }
            };

        }

    })(FlixjQ);
};


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

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


//win for minification
;(function(win){
    var $ = win.flixJsCallbacks.$ =function(){};
    win.flixJsCallbacks.$.fn = $.prototype;
    $.fn = $.prototype = new win.flixJsCallbacks.$;

    try {
        if( ! win.flixJsCallbacks.gvid ) {
            var ticks = 3;
            (function threeTicks() {
                if( win.flixJsCallbacks && typeof win.flixJsCallbacks.gvid == 'undefined' && ticks ) {
                    setTimeout(function(){ 
                        ticks--;
                        threeTicks();
                    },100)
                }
                else {
                    (function() {
                        if ( document.getElementById('data-flix-t-script') ) return;
                        win['flixgvid'] = function(obj){
                            try{
                                delete win['flixgvid'];
                                win.flixJsCallbacks = win.flixJsCallbacks || {};
                                win.flixJsCallbacks['gvid'] = obj['gvid'];
                             }catch(e){}
                        };
		
		
    	                           var _fscript = document.createElement('script');
                        _fscript.setAttribute("type","text/javascript");
                        _fscript.setAttribute("src", "https://prod.flixgvid.flix360.io/");
                        _fscript.setAttribute("async", "true");
                        _fscript.id = "data-flix-t-script";
                        document.getElementsByTagName('head')[0].appendChild(_fscript);  
			
			               
                    })();
                }
            })();
        }
    } catch(e){}

    $.fn.noShow = function(o, el) {
        var 
          opts, 
          gcookie, 
          tcookie,
          vtime; 

        this.urlMain = '//media.flixcar.com/delivery/';

        if ('https:' == document.location.protocol){
            this.urlMain = '//media.flixcar.com/delivery/';
        }
        //replace defaults with passed values
        for( var p in $.fn.noShow.defaults) {
            if( o.hasOwnProperty(p)) $.fn.noShow.defaults[p] = o[p];
        }

        opts = $.fn.noShow.defaults;
        tcookie = $.fn.noShow._getCookieName(opts,'inptime');
        gcookie = $.fn.noShow._getCookieName(opts,'inpsession');
        guid = $.fn.noShow.readCookie(gcookie) || '';
        if( !! guid) opts.session_id = guid;
        vtime = $.fn.noShow.readCookie(tcookie) || '';
        if ( ! vtime)  $.fn.noShow.createCookie(tcookie,0);
        opts.view_time = vtime;
        opts.product_id     = opts.product;
        opts.distributor_id = opts.distributor;
        opts.language = opts.language.toLowerCase ();
	
        opts.minisite_id = ( opts.minisite_id == 0 ) ? 0 : 'y';
        opts.page_name = $.fn.noShow.getURL();          

                            opts.event_type = "matchmisshotspot";

                    
        opts.event_detail = "";
        $.fn.noShow.data = opts;
        setTimeout(function(){$.fn.noShow.log(opts);},2000);         
    }; //end noShow;

    $.fn.noShow.getURL = function() {
        return win.location.href;
    };

    $.fn.noShow.hasOwn = function(obj) {
        for (var p in obj) {
            if (obj.hasOwnProperty(p)) {
                return true;
            }
        }
        return false;
    };

    $.fn.noShow._getCookieName = function(data,cookie_type) {
        if (!cookie_type) cookie_type='inpsession';
        var product = 0;
        var distributor = data.distributor > 0 ? data.distributor : data.distributor_id;
        
        return cookie_type+product+"_"+distributor+"_"+data.language;
        
    };

    $.fn.noShow.readCookie = 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){}
    }; 
    $.fn.noShow.eraseCookie = function( name ) {
        try{
            $.fn.noShow.createCookie(name,"",-1);
        }catch(e){}
    };
    $.fn.noShow.createCookie = 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=/; SameSite=None; Secure"; 
        }catch(e){}
    };  

    $.fn.noShow.fillOptions = function(opts){
        for (var key in opts){
            if (opts[key] && typeof(opts[key])=='string' && opts[key].substr(0,1)=="{" && opts[key].substr(-1,1)=="}")
            {
                opts[key] = $.fn.noShow.getQsParam(opts[key].substring(1,opts[key].length-1));
            }
        }
        return opts;
    };

    $.fn.noShow.writeSioTy = function( gvid, ab ) {
        try{
            if( ! arguments[1] ) { return false; }
            var
             tyPage = {
                'gvid': gvid,
                'tst_id': [ab.tst_id]
            },
            ticks = 3;

            (function testForFlixCookie() {
                if( $.fn.noShow.readCookie === null && ticks ) {
                    setTimeout(testForFlixCookie, 1000);
                    ticks--;
                }
                else if ( ticks ) {
                    if( $.fn.noShow.readCookie('sio_ty') === null ) {
                        $.fn.noShow.createCookie ( 'sio_ty', JSON.stringify( tyPage ) );
                    }
                    else{
                        var content = JSON.parse ( $.fn.noShow.readCookie( 'sio_ty' ) );
                        if( 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
                        $.fn.noShow.eraseCookie("sio_ty");
                        $.fn.noShow.createCookie( 'sio_ty', JSON.stringify( content ) );
                    }   
                }
            })();
        }catch(e){}
    };

    $.fn.noShow.getQsParam = function(name){
        var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(win.location.href);
    if (!results)
    { 
        return ''; 
    }
    return results[1] || '';
    };
    // noShow plugin default options
    $.fn.noShow.defaults = {
        distributor: 0,
        language:    "en",
        legacy:      "",
        mpn:         "",
        ean:         "",
        sku:         "",
        product:     0,
        css:         "",
        update:      10 ,
        gvid:        "",
        ab_data :    {},
        ab:          "",
        pd:          "",
        pagedata:    {},
        sio_ty:       0,
        session_id:  "",
	minisite_id: "y"

    };

    $.fn.noShow.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);
    };

    $.fn.noShow.parsePage = function ( pagedata, target ) {
      var 
          found = '', h = null, fallback = true, generic = {}, specific = {}, p,
          ignore = [], 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 = $.fn.noShow.parsePrice( found );
                if( value ) { found = value; }
            }

            return found.trim();
        }catch(e){ return ''; }
    };

    $.fn.noShow.getCanonical = function( data, esc ) {
        try {
            var
              ret, canonicalCheck, s;

            ret = $.fn.noShow.parsePage ( data.pagedata, 'pn' );
            canonicalCheck = win.location.protocol + '//' + win.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 > 1 ? escape(ret) : ret;
        } catch(e) {}
    };

    $.fn.noShow.parsePrice = 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( !! win.flixJsCallbacks.priceParser ) {
                    value = win.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;
    };

    $.fn.noShow.pageData =  function( data ) {
        var
          parsePage = $.fn.noShow.parsePage, getCanonical = $.fn.noShow.getCanonical,
          pData = {}, s, df, i, p, get = '', skip;
        //check we don't already have the information
        win.flixJsCallbacks.pageCapture = win.flixJsCallbacks.pageCapture || {};
        //method normalised with minisite_logo and l.v2.js - watchout for getCanonical param. 
        try{
            PAGEDATALOOP:
            for( p in data.pagedata ) {
                if( data.pagedata.hasOwnProperty(p)) {
                    switch( p ) {
                        case 'pageSpecific':
                            continue PAGEDATALOOP;
                            break;
                        case 'pn':
                            if( !! win.flixJsCallbacks.pageCapture[p] ) {
                                pData[p] = win.flixJsCallbacks.pageCapture[p];
                            }
                            else {
                                pData[p] = getCanonical( data.pagedata );
                                win.flixJsCallbacks.pageCapture[p] = pData[p];
                            }
                            break;
                        case 'br':
                        default:
                            if( !! win.flixJsCallbacks.pageCapture[p] ) {
                                pData[p] = win.flixJsCallbacks.pageCapture[p];
                            }
                            else {
                                pData[p] = parsePage ( data.pagedata, p );
                                win.flixJsCallbacks.pageCapture[p] = pData[p];
                            }
                            break;
                    }
                }
            }
            //overwrite price and add brand if being supplied by retailer
            df = ['mpn', 'ean', 'sku', 'price', 'brand'];
            skip = ['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 l.v2.js && minisite_logo
                    pData[ df[i] ] = document.querySelector('script[data-flix-' + df[i] + ']').getAttribute('data-flix-' + df[i]);
                    if( skip.indexOf(df[i]) < 0 ) {
                        win.flixJsCallbacks.pageCapture[ df[i] ] = pData[ df[i] ];
                    }
                    else {
                        if( !! data.pagedata && !! data.pagedata.pageSpecific && ! data.pagedata.pageSpecific.price ) {
                            if( df[i] === 'price' && $.fn.noShow.parsePrice( pData[ df[i] ] ) ) {
                                pData[ df[i] ] = $.fn.noShow.parsePrice( pData[ df[i] ] );
                                win.flixJsCallbacks.pageCapture[ df[i] ] = pData[ df[i] ];
                            }
                        }
                        if( !! data.pagedata && !! data.pagedata.pageSpecific && ! data.pagedata.pageSpecific.br ) {
                            //overwrite brand with standard naming
                            if( df[i] === 'brand' ) {
                                pData[ 'br' ] = pData[ df[i] ];
                                win.flixJsCallbacks.pageCapture['br'] = pData[ df[i] ];
                                delete pData['brand'];
                                delete win.flixJsCallbacks.pageCapture['brand'];
                            }
                        }
                    }
                }
            }      
        } catch(ignore){}
        
        for (var key in pData) {
            get += "&"+key+ '=' + encodeURIComponent( pData[key] );
        }

        return get;
    };

   $.fn.noShow.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',
            'r1cat':'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=' + $.fn.noShow.crypt('encrypt', encodeURIComponent(p.join('&')), o1.ut);
        url += '&es=' + $.fn.noShow.crypt('encrypt', encodeURIComponent(s.join('&')), o1.ut);

        return url;
    };
    $.fn.noShow.log = function (data) {
                try {
            var 
              d = new Date (),
              t = '',
              _base = '//media.flixcar.com/interactive/log.gif',
              _beatUrl = '//rt.flix360.com/beat',
              _beatNotActive = window.beat_disabled_retailers || [],
              _beatByLanguage = [],
              processed = null,
              encrypt = [],
              userAgents = [
                'symbian',
                'android',
                'ios'
              ]
            ;

            win.flixJsCallbacks.pageView = win.flixJsCallbacks.pageView || {log: false, beat: false};
            data.gvid = (win.flixJsCallbacks && win.flixJsCallbacks.gvid) ? win.flixJsCallbacks.gvid : '';
            
            if( !! window.flixJsCallbacks && window.flixJsCallbacks.a ) {
                //only invoked if mobile and abtest and blank == true.
                var urlpass = $.fn.noShow.pageData(data);
                data.service = "inpage";
                window.flixJsCallbacks.a.log( data, urlpass );
                return true;
            }

            d.setMinutes( d.getTimezoneOffset() );

            if( $.fn.noShow.hasOwn( data.ab_data ) && data.ab_data.expire !== 'expired') {
                data.ab = "&ab="+data.ab_data.tst_id+"&abr="+data.ab_data.resource_ref+"&abid="+data.ab_data.cookie.abid;
                if( ! $.fn.noShow.defaults.sio_ty ) {
                    $.fn.noShow.writeSioTy( win.flixJsCallbacks.gvid, data.ab_data);
                    $.fn.noShow.defaults.sio_ty++;
                }
            }
            var url = _base+"?m="+data.minisite_id+"&p=" + data.product_id + "&d=" + data.distributor_id + "&l=" + data.language + "&et=" + data.event_type + "&ed="+ encodeURIComponent(data.event_detail) +"&sid="+data.session_id+"&vtime="+data.view_time+"&gvid="+data.gvid+data.ab;
            url += "&ut=" + d.getTime ();
            url += $.fn.noShow.pageData( data );

            if( typeof win.flixJsCallbacks.imgCache === 'undefined' ) { win.flixJsCallbacks.imgCache = {};}
            var track = 'img_' + (new Date).getTime();
            win.flixJsCallbacks.imgCache[track] = new Image();
            if( ! win.navigator.userAgent.match(/(ios|symbian|android)/i) && data.distributor_id && (encrypt.indexOf(+data.distributor_id) >= 0)) {
                processed = $.fn.noShow.process( url );
            }
            if( ! window.flixJsCallbacks.pageView.log )  {
                url += "&pv=1";
                window.flixJsCallbacks.pageView.log = true;
            }
            win.flixJsCallbacks.imgCache[track].src = ( !! processed ) ? processed : url;
            win.flixJsCallbacks.imgCache[track].event_type = data.event_type;
            if( _beatNotActive.indexOf( +data.distributor_id ) < 0 ) {
                beat = 'img_' + (new Date()).getTime();
                window.flixJsCallbacks.imgCache[beat] = new Image(); 
                if( ! window.flixJsCallbacks.pageView.beat ) {
                    if( ! url.match(/pv\=1/)) url += "&pv=1";
                    window.flixJsCallbacks.pageView.beat = true;
                }
                window.flixJsCallbacks.imgCache[beat].src = _beatUrl + url.replace(_base, '');
                window.flixJsCallbacks.imgCache[beat].event_type = data.event_type;
            }
         }catch(e){}
    };
}(window));

try {


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,ab_hotspot_data) {
    var
        data = {}, flixLogging, parsePage, crypt;

    try {
        if( identifier === 'skip' || identifier === 'alert' ) 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 = {a:function(inp){var r="";var c1,c2,c3,e1,e2,e3,e4;var i=0;inp=this.b(inp);while(i<inp.length){c1=inp.charCodeAt(i++);c2=inp.charCodeAt(i++);c3=inp.charCodeAt(i++);e1=c1>>2;e2=(c1&3)<<4|c2>>4;e3=(c2&15)<<2|c3>>6;e4=c3&63;if(isNaN(c2)){e3=e4=64}else if(isNaN(c3)){e4=64}r+=this.c(this.d[e1])+this.c(this.d[e2])+this.c(this.d[e3])+this.c(this.d[e4])}return r},c:function(k){return String.fromCharCode(k)},d:function(){var r=[];var q={45:1,48:57,61:1,65:90,95:1,97:122};for(var i in q){if(q[i]==1){r.push(i)}else{for(var z=i;z<=q[i];z++)r.push(z)}}return r}(),b:function(s){s=s.replace(/\r\n/g,"\n");var r="";for(var n=0,l=s.length;n<l;n++){var c=s.charCodeAt(n);if(c<128){r+=this.c(c)}else if(c>127&&c<2048){r+=this.c(c>>6|192);r+=this.c(c&63|128)}else{r+=this.c(c>>12|224);r+=this.c(c>>6&63|128);r+=this.c(c&63|128)}}return r}};

            var  process = function( str ){
                var
                    permitted = {
                        'm':'',
                        'p':'',
                        'd':'',
                        'l':'',
                        'et':'',
                        'ed':'d',
                        'sid':'',
                        'vtime':'',
                        'gvid':'',
                        'ut':'',
                        'br':'d',
                        'price':'',
                        'ref':'d',
                        'currency':'',
                        'pn':'d',
                        'h1':'d',
                        'ti':'d',
                        'img':'d',
                        'r1cat':'d',
                        'om':'d',
                        'mpn':'d',
                        'ean':'',
                        'sku':'d'
                    },
                    s1=str.split('?'),
                    s2 = s1[1] ? 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('=');
                    if ( permitted.hasOwnProperty(init[0])) {
                        o1[init[0]] = (permitted[init[0]] === 'd') ? decodeURIComponent(decodeURIComponent(init[1])) : init[1];
                    }

                }

                url += s1[0] + '?' + crypt.a(JSON.stringify(o1));
                return url;
            };

            flixLogging = function ( e ,ab_hotspot_data) {
                var
                    d = new Date (),
                    _base = '//media.flixcar.com/inpage/log.gif',
                    encrypt = [],
                    _beatUrl = encrypt.indexOf(+dist_id)!==-1 ? '//rt.flix360.com/enc/beat' : '//rt.flix360.com/beat',
                    _beatNotActive = window.beat_disabled_retailers || [],
                    _beatByLanguage = [],
                    beat,
                    fallback,
                    processed = null,
                    once_only = [
                        353,
                        1544,
                        2754,
                        607
                    ],
                    userAgents = [
                        'symbian',
                        'android',
                        'ios'
                    ],
                    key,
                    flixTag,
                    i,
                    url,
                    flixSource=null, indx=-1
                    ;

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



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

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

                flixTag = ['mpn', 'ean', 'sku'];
                for( i=0; i< flixTag.length; i++ ) {
                    if( document.querySelector('script[data-flix-' + flixTag[i] + ']') &&
                        document.querySelector('script[data-flix-' + flixTag[i] + ']').getAttribute('data-flix-' + flixTag[i]) ) {
                        url += "&" + flixTag[i] + "=" + document.querySelector('script[data-flix-' + flixTag[i] + ']').getAttribute('data-flix-' + flixTag[i]);
                    }
                }


                indx = window.location.search.indexOf('flxsrc=');
                if (indx!==-1)
                {
                    //save some parsing efforts on the basis that our source will always be added last
                    flixSource = window.location.search.substring(indx);
                }

                if( !! window.flixJsCallbacks.pageCapture ) {
                    for (key in window.flixJsCallbacks.pageCapture) {
                        if( window.flixJsCallbacks.pageCapture.hasOwnProperty(key)) {
                            if (key=='pn' && flixSource) window.flixJsCallbacks.pageCapture[key]+= (window.flixJsCallbacks.pageCapture[key].indexOf('?')!==-1 ? "&" : "?")+flixSource;
                            url += "&" + key + '=' + encodeURIComponent( window.flixJsCallbacks.pageCapture[key] );
                        }
                    }
                }
                else {
                    fallback = parsePage();
                    url += "&ti=" + fallback.title;
                    if(flixSource) {
                        var decoded = decodeURIComponent(fallback.pn);
                        fallback.pn = encodeURIComponent(decoded + (decoded.indexOf('?')!==-1 ? "&" : "?") +flixSource) ;
                    }
                    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( data.d && (encrypt.indexOf(+data.d) !==-1) && data.event_type === 'cart_click') {
                    url = process( url );
                }
                window.flixJsCallbacks.imgCache[track].src = ( !! processed ) ? processed : url;
                window.flixJsCallbacks.imgCache[track].event_type = data.event_type;


                // Hotspot A/B test Start
                if(typeof(ab_hotspot_data)!="undefined"){
                    if(ab_hotspot_data!=null){
                        var ab_visitor_id=ab_hotspot_data.visitor_id;
                        var ab_version=ab_hotspot_data.version
                        var ab_groups=ab_hotspot_data.groups
                        url += "&visitor_id="+ab_visitor_id+"&version="+ab_version+"&groups="+ab_groups;
                    }
                }
                // Hotspot A/B test END

                if(_beatNotActive.indexOf( +data.d ) < 0 && data.event_type === 'cart_click') {
                    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;

                    //abtesting beaturl update
                    if(window.flixJsCallbacks['ab_'+data.d]!= null && window.flixJsCallbacks['ab_'+data.d].inpage!=null){
                        setTimeout(function(){beat = 'img_' + (new Date()).getTime();}, 0);
                        window.flixJsCallbacks.imgCache[beat] = new Image();
                        var _beatUrl2=_beatUrl
                        _beatUrl2 ='//rt.flix360.io/beat'
                        if(_base.search('dev')!=-1)
                            _beatUrl2 ='//alpha-rt.flix360.io/beat'
                        
                        var ab_version=window.flixJsCallbacks['ab_'+data.d].version||'';
                        var target=window.flixJsCallbacks['ab_'+data.d].target||'';
                        var ab_visitor_id=window.flixJsCallbacks['ab_'+data.d].visitor_id||'';
                        var ab_groups=window.flixJsCallbacks['ab_'+data.d].groups||'';
                        var ab_id=window.flixJsCallbacks['ab_'+data.d].ab_id||'';
                        var device=window.flixJsCallbacks['ab_'+data.d].device||'';
                        url = url+"&version="+ab_version+"&target="+target+"&visitor_id="+ab_visitor_id+"&groups="+ab_groups+"&ab_id="+ab_id+"&device="+device;
                        
                        window.flixJsCallbacks.imgCache[beat].src = _beatUrl2 + url.replace(_base, '');
                        window.flixJsCallbacks.imgCache[beat].event_type = data.event_type;
                    }

                }
                //disable the target once it has fired.
                if( once_only.indexOf(data.d) >= 0 ) {
                    e.target.onmousedown = function(){};
                }
            };

            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 {
                for( var n = 0, l = ArrayList.length; n < l; n++ ) {
                    ArrayList[n].onmousedown = function(e) {
                        e = e || window.event;
                        data.event_type = "cart_click";
                        data.event_detail = 1;
                        flixLogging( e,ab_hotspot_data );

                        try {
                            //pap log
                            if(typeof FlixjQ.fn.ek!='undefined' && typeof foundpapmatch!='undefined' && foundpapmatch===1){
                                ekopts.event_type = "cart_click";
                                ekopts.event_detail = 1;
                                
                                FlixjQ.fn.ek.log(ekopts);
                            }
                        }catch(ignore){}
                    };
                }
            }
        }catch(ignore){}
    };
/*Box UK|en|6053*/

window.flixJsCallbacks.pageSpecific = {
	 price:function () {
      var
        bread = window.top.document.querySelector("[class*=price]") || null, crumbs = [];
   try {
      if ( !! bread ) {
        crumbs = bread.textContent.trim().match(/[\d\,\.]+/)[0].replace(",","");
        return crumbs || false;
      }
    } 
    catch (e) {
    }      
  }
};


;(function() {
  try{
    if(!!window.flixJsCallbacks && !!window.flixJsCallbacks.flixCartClick) {
      var
       ticks = 5, a2cTest = null, query = null, skipTest = null, dist = '6053', lang = 'en',
       a2c = [
       '#divBuyButton',
        '#p-right div.p-buy '
       ],
       skip = [],
       retailerSpecificTest = function(){
        window.flixJsCallbacks.flixCartClick( 'skip', dist, lang );
        return false;
       };

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

      (function domTest() {
        A2CCHECK:
        for( var i = 0, l = a2c.length; i<l; i++ ) {
          a2cTest = document.querySelector( a2c[i] );
          if( a2cTest instanceof HTMLElement ) {
            query = a2c[i];
            break A2CCHECK;
          }
        }

        if( ! a2cTest && ticks ) {
          setTimeout(function(){ 
            ticks--;
            domTest();
          },5000);
        }
        else if ( !! query ) {
          window.flixJsCallbacks.flixCartClick( query, dist, lang);
        }
        else if ( ! ticks && skip.length ) {
          SKIPCHECK:
          for (var i = 0, l = skip.length; i<l; i++) {
            skipTest = document.querySelector( skip[i] );
            if( skipTest ) { 
              retailerSpecificTest( skipTest );
              break SKIPCHECK;
            }
          };
        }
        else {
          window.flixJsCallbacks.flixCartClick( 'alert', dist, lang);
        }
      }());
    }
  }catch(ignore){}
}());
;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 || {};



}catch(e){}


(function(win){
    var 
        d = new Date(),
        i = d.getTime(),
        inpcontainer,
        div = document.createElement('div');

    div.setAttribute('id', 'flixinpage_' + i);

    function scriptTest( src ) {
        var scriptTag = null, scs;
        scs = document.getElementsByTagName('script');
        for( var j=0; j<scs.length; j++ ) {
            if (scs[j].src.indexOf(src) >= 0) {
                scriptTag = scs[j];
                break;
            }
        }
        return scriptTag;
    }
    //we then need to find a parent element without using querySelect!
    var urlMain = '//media.flixcar.com/delivery/js/inpage/';
    if ( 'https:' == document.location.protocol ) {
        urlMain = '//media.flixcar.com/delivery/js/inpage/';
    }

    if( ! scriptTest( urlMain)) {
        urlMain = 'http://admin.flix360.com/js/inpage/';
    }

    inpcontainer = scriptTest( urlMain );
    inpcontainer = (!! inpcontainer && inpcontainer.parentElement) ? inpcontainer.parentElement : document.getElementById('flix-inpage');
    if( !! inpcontainer ) inpcontainer.appendChild(div);

    window.flixJsCallbacks.$.fn.noShow({
        distributor: '6053',
        language: 'en',
        product: '0',
        minisite_id: '',
        ab_data: null,
        pagedata: win.flixJsCallbacks.pageGeneric
    }, '#flixinpage_' + i );

}(window));

 
try{
    if (typeof (window.flixJsCallbacks) === "object" && typeof (window.flixJsCallbacks["_loadHotspotNoshowCallback"]) ==="function"){
        var flixCBfunctions =window.flixJsCallbacks["_loadHotspotNoshowCallback"];
        flixCBfunctions();
        window.flixJsCallbacks["_loadHotspotNoshowCallback"] = function(){}; /*emptying no show function so that it is triggered only once across all products*/
    }
}catch(e){}
/*found=0*/


