
        if(typeof(click_sabavision_banners) == 'undefined'){
    var click_sabavision_banners = {};
    }
        if(typeof(messageLogs) == 'undefined'){
    var messageLogs = {};
    }


    if(typeof(sabavisionFrameUrls ) == 'undefined'){
    var sabavisionFrameUrls = {};
    var sabavisionFrameUrlFirstFlag = true;
    }



    (function(url, lightboxFlag, scrolledFlag, fixedFlag, lightBoxJson, fixedBoxJson) {

    var reloadTime = 60000;
    var visitedTime = 200;
    var child;
    var campid;
    var campidArr = {};

        //eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 B=17.1l.S(/(M|N|U|1n|X|W)/);3 r=4(){F{8.V("Y");5 Z}H(e){5 12}};3 w=((\'11\'u 6)),y=(\'10\'u 6)||(6.v&&8 T v)||r();3 x=(s.L((s.O()*P)+1))*2;7(B||w||y){x+=1}4 1h(g,z,n){7(n){3 a=1g 1f();a.1i(a.1j()+(n*A*A*1k));3 d="; d="+a.1d()}q 3 d="";8.C=g+"="+z+d+"; 15=/"}4 18(g){3 j=g+"=";3 k=8.C.o(\';\');1b(3 i=0;i<k.9;i++){3 c=k[i];1a(c.19(0)==\' \')c=c.t(1,c.9);7(c.m(j)==0)5 c.t(j.9,c.9)}5 14}4 K(I,l){7(l){13+="&"+I+"="+l}};4 p(b){7(1c E=="4"){5 E(b)}q{5 16(b)}};3 h=\'\';7(((6.f.D).m("1e.J"))>0||((6.f.D).m("1m.J"))>0){h=p(8.f).o(\'%G\')[0]}q{F{h=p(6.Q.f.R).o(\'%G\')[0]}H(e){h=\'\'}};',62,86,'|||var|function|return|window|if|document|length|date|||expires||location|name|varloc||nameEQ|ca|val|indexOf|hours|split|encodeuri|else|touch|Math|substring|in|DocumentTouch|orientationChange|sabavisioniSmobileFlag|touchEvents|value|60|sabavisionisMobile|cookie|host|encodeURIComponent|try|23|catch|param|com|makeGetVar|floor|iPhone|iPod|random|100|parent|href|match|instanceof|iPad|createEvent|Mobile|BlackBerry|TouchEvent|true|ontouchstart|onorientationchange|false|url|null|path|escape|navigator|readCookie|charAt|while|for|typeof|toGMTString|sabavision|Date|new|createCookie|setTime|getTime|1000|userAgent|akairan|Android'.split('|'),0,{}));
      eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('3 C=11.10.Z(/(Y|12|13|16|15|14)/);3 A=6(){v{a.X("W");8 Q}t(e){8 P}};3 w=((\'O\'z 4)),E=(\'N\'z 4)||(4.x&&a R x)||A();3 y=(B.V((B.T()*18)+1))*2;5(C||w||E){y+=1}6 1n(l,F,o){5(o){3 d=1m 1o();d.1i(d.1j()+(o*G*G*1b));3 m="; m="+d.19()}g 3 m="";a.H=l+"="+F+m+"; 1e=/"}6 1h(l){3 p=l+"=";3 n=a.H.j(\';\');17(3 i=0;i<n.k;i++){3 c=n[i];U(c.S(0)==\' \')c=c.D(1,c.k);5(c.f(p)==0)8 c.D(p.k,c.k)}8 1f}6 1g(L,q){5(q){1d+="&"+L+"="+q}};6 h(b){5(1a I=="6"){8 I(b)}g{8 1c(b)}};3 9=\'\';5(((4.7.r).f("1k.M.u"))>0){v{9=h(4.J.7.K).j(\'%s\')[0]}t(e){9=\'\'}}g 5(((4.7.r).f("M.u"))>0||((4.7.r).f("1l.u"))>0){9=h(a.7).j(\'%s\')[0]}g{v{9=h(4.J.7.K).j(\'%s\')[0]}t(e){9=\'\'}};',62,87,'|||var|window|if|function|location|return|varloc|document|||date||indexOf|else|encodeuri||split|length|name|expires|ca|hours|nameEQ|val|host|23|catch|com|try|orientationChange|DocumentTouch|sabavisioniSmobileFlag|in|touch|Math|sabavisionisMobile|substring|touchEvents|value|60|cookie|encodeURIComponent|parent|href|param|sabavision|ontouchstart|onorientationchange|false|true|instanceof|charAt|random|while|floor|TouchEvent|createEvent|iPhone|match|userAgent|navigator|iPod|iPad|Mobile|BlackBerry|Android|for|100|toGMTString|typeof|1000|escape|url|path|null|makeGetVar|readCookie|setTime|getTime|api|akairan|new|createCookie|Date'.split('|'),0,{}))

        
        function guid() {
    function s4() {
    return Math.floor((1 + Math.random()) * 0x10000)
    .toString(16)
    .substring(1);
    }
    return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
    s4() + '-' + s4() + s4() + s4();
    }
    var uniqId  = guid();

        if(readCookie('_lightBox') && lightboxFlag){
    return false;
    }

    url += (varloc)? "&loc=" + varloc : '';
    url += (encodeuri(document.referrer))? "&ref=" + encodeuri(document.referrer):'';
    url += '&bannerid=clicknet_vars_frame6861'+uniqId; 
    var startStr = '', endStr = '';


    var bannerType = 'normal'; 
    window.removeElement = function(element) {
    element && element.parentNode && element.parentNode.removeChild(element);
    }

    var disableInMobile = false;

    var reponsiveFlag = '';
    var justMobileFlag = '';
    var fullWidthFlag = '';

        var appendedId = '';

        if(fixedFlag && !document.getElementById('sabaFixedBox'+fixedBoxJson[0]+fixedBoxJson[1])){

    startStr += '<div style="position: fixed; z-index: 99999; '+fixedBoxJson[0]+':0px; '+fixedBoxJson[1]+':0px; " id="sabaFixedBox'+fixedBoxJson[0]+fixedBoxJson[1]+'">';
        startStr += '<div style="cursor:pointer;font-family: arial;color: #fff;background-color: #FF4343;float: right;position: absolute;right: 6px;margin-top: -9px;padding: 1px 3px;" class="sabascrolledboxClose" onclick="removeElement(document.getElementById(\'sabaFixedBox'+fixedBoxJson[0]+fixedBoxJson[1]+'\'));">X</div>';
        endStr += '</div>';

    bannerType = 'fixed';
    disableInMobile = true;

    }else if(lightboxFlag && !readCookie('_lightBox') && !document.getElementById('sabalightBox')){

    startStr += '<style>.sabalightboxClose{font-family: arial; color:#fff; position: fixed; font-size: 40px; right: 60px; top: 30px; cursor: pointer; } .sabalightbox{ position:fixed; width:100%; height:100%; left: 0px; top:0px; background-color:#000 ;background-color: rgba(0,0,0,0.8); z-index:999999;  } .sabalightbox iframe{ left: 50%; top:50%; position:absolute; width: '+lightBoxJson['width']+'; height: '+lightBoxJson['height']+'; margin-top: '+lightBoxJson['marginTop']+'; margin-left: '+lightBoxJson['marginLeft']+'; }</style>';
    startStr += '<div class="sabalightbox" id="sabalightBox" >';
        startStr += '<div class="sabalightboxClose" onclick="removeElement(document.getElementById(\'sabalightBox\'));">X</div>';
        endStr += '</div>';
    createCookie('_lightBox','1',1);

    bannerType = 'lightbox';
    disableInMobile = true;

    }else if(scrolledFlag && !document.getElementById('sabascrolledbox')){
    startStr += '<style>.sabascrolledboxClose{font-family: arial;color: #fff;position: absolute;font-size: 16px;right: 11px;text-align: center;top: 10px;cursor: pointer;background-color: #DE1111;padding: 4px 8px; } .sabascrolledbox{     overflow: hidden; -webkit-transition: 0.25s; -moz-transition: 0.25s;-ms-transition: 0.25s; transition: 0.25s; height: 0px;position:fixed; width:100%; height:0px; left: 0px; top:0px; background-color: rgba(0,0,0,0.8); z-index:9999;  } .sabascrolledbox iframe{ left: 50%; top:0px; position:absolute; width: '+lightBoxJson['width']+'; height: '+lightBoxJson['height']+'; margin-left: '+lightBoxJson['marginLeft']+';  }</style>';
    startStr += '<div class="sabascrolledbox" id="sabascrolledbox" >';
        startStr += '<div class="sabascrolledboxClose" onclick="removeElement(document.getElementById(\'sabascrolledbox\')); document.removeEventListener(\'scroll\', sabaScrolledHandler);">X</div>';
        endStr += '</div>';

    sabaScrolledHandler = function(){ if(window.scrollY > 90){ document.getElementById('sabascrolledbox').style.height="95px"; }else{ document.getElementById('sabascrolledbox').style.height="0px"; } };
    if (document.addEventListener) {
    document.addEventListener('scroll', sabaScrolledHandler, false);
    } else if (document.attachEvent)  {
    document.attachEvent('scroll', sabaScrolledHandler);
    }

    disableInMobile = true;
    bannerType = 'scrolled';

    }else if(((sabavisioniSmobileFlag % 2) || reponsiveFlag) && 468){

    var maxSizeStr = '';
    if(!fullWidthFlag){
        maxSizeStr = 'max-width: 468px;max-height: 60px;';
    }
    startStr += '<style>.h_iframe-clicknet_vars_frame6861'+uniqId+'{position:relative; '+maxSizeStr+'} .h_iframe-clicknet_vars_frame6861'+uniqId+' .ratio {display:block;width:100%;height:auto;} .h_iframe-clicknet_vars_frame6861'+uniqId+' iframe {position:absolute;top:0;left:0;width:100%; height:100%;}</style>';
    startStr += '<div class="h_iframe-clicknet_vars_frame6861'+uniqId+'">';
        startStr += '<img class="ratio" src="https://click.sabavision.com/public/public/images/loadings/468x60.gif"/>';
        endStr += '</div>';
    url += '&responsive=true';
    }

        
    var disableDoubleClick = '';
    if(disableDoubleClick){
    url += '&disable_double_click=true';
    }

    docoument_keywords = function (){
    var keywords;
    var metas = document.getElementsByTagName('meta');

    for (var x=0,y=metas.length; x<y; x++) {
    if (metas[x].name.toLowerCase() == "keywords") {
    keywords = metas[x];
    }
    }

    if(keywords){
    return keywords.content;
    }

    return '';
    };


    

        if((sabavisioniSmobileFlag % 2) && disableInMobile){
    return false;
    }

        click_sabavision_banners['clicknet_vars_frame6861'+uniqId] = {type: bannerType,screen_visable: false};

        if (window.addEventListener) {
    window.addEventListener('message', receiveMessage, false);
    } else if (window.attachEvent)  {
    window.attachEvent('message', receiveMessage);
    }

    function receiveMessage(event){

    child = event.source;
    campid = event.data.campid;


        if(messageLogs[event.timeStamp]){
    return false;
    }
    messageLogs[event.timeStamp] = true;


    var origin = event.origin || event.originalEvent.origin; // For Chrome, the origin property is in the event.originalEvent object.
    if(true || origin.substr(0,27) == 'http://click.sabavision.com'){
    var data = event.data;
    actionHandler(data);
    }
    }

    function actionHandler(action){
        switch(action.name){
    case 'video-banner-expand':
        var bannerId= action.data.id;
        var extra = action.data.extra;
        if(window.location.hash=='#debug'){ console.log('clicknet_vars_frame6861'+uniqId); console.log('Banner expanded , id: '+bannerId); }
        if(action.data.showMode=='expand'){
            document.getElementById(bannerId).width = 600;
            document.getElementById(bannerId).height = 500;
            document.getElementById(bannerId).style.position = 'absolute';

            document.getElementById(bannerId).parentElement.style.position = 'relative';
            document.getElementById(bannerId).parentElement.style.width="600px";
            //document.getElementById(bannerId).parentElement.style.height="500px";
            document.getElementById(bannerId).parentElement.style['z-index'] ="999999999999";
        }else{
            document.getElementById(bannerId).width = 300;
            document.getElementById(bannerId).height = 250;
            document.getElementById(bannerId).style.position = 'absolute';

            document.getElementById(bannerId).parentElement.style.position = 'relative';
            document.getElementById(bannerId).parentElement.style.width="300px";
            document.getElementById(bannerId).parentElement.style.height="250px";
        }


    break;
    case 'banner-not-found':

    bannerId = action.data.id;
    removeElement(document.getElementById(bannerId));
    removeElement(document.getElementById(appendedId));

        if(click_sabavision_banners[bannerId].type == 'lightbox'){
    document.cookie = '_lightBox' + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;';
    removeElement(document.getElementById('sabalightBox'));
    }

    break;
    case 'banner-loaded':
        bannerId = action.data.id;
        bannerType = action.data.type;
        if(window.location.hash=='#debug'){ console.log('Banner Loaded , id: '+bannerId, 'Type:'+bannerType); }
    //addIframeSrc();
        setTimeout(function(){ window.scrollTo(0,window.scrollY+1); window.scrollTo(0,window.scrollY-1); } ,10);
    break;
    case 'banner-clicked':
    bannerId = action.data.id;
    frameReloadFlag = false;
    if(window.location.hash=='#debug'){ console.log('clicked on banner  , id: '+bannerId); }
    changeIframeBanner(bannerId);
    break;
    }

    if(action.name!='banner-clicked'){
    var postData = {
    'kw': encodeURIComponent(docoument_keywords())
    };
    if(child){

    //child.postMessage({'name':'page_keywords','data':postData}, 'https://click.sabavision.com/get_camp.php?id=40133,40134,40138,40137,40136,40135')
    }
    }
    }


        function posY(elm) {
    var test = elm,top = 0;
    while (!!test && test.tagName.toLowerCase() !== "body") {
    top += test.offsetTop;
    test = test.offsetParent;
    }
    return top;
    }

    function viewPortHeight() {
    var de = document.documentElement;
    if (!!window.innerWidth) {
    return window.innerHeight;
    } else if (de && !isNaN(de.clientHeight)) {
    return de.clientHeight;
    }
    return 0;
    }

    function scrollY() {
    if (window.pageYOffset) {
    return window.pageYOffset;
    }
    return Math.max(document.documentElement.scrollTop, document.body.scrollTop);
    }

    function elementH(elm) {
    return elm.offsetHeight;
    }

    function isHidden(el) {
    return (el.offsetParent === null);
    }

        var timeFlag = true, frameReloadFlag = true;
    var timerVar;
    var nextBanner;

    function bannerIsVisable(elmId) {
        if(window.location.hash=='#debug'){ console.log('banner visited , id: '+elmId); }
    clearInterval(timerVar);
    click_sabavision_banners[elmId]['screen_visable'] = true;

        if(!campidArr[campid]){
    campidArr[campid] = true;
    var postData = {
    'campid': campid
    };
    if(child){
    child.postMessage({'name':'pure_view','data':postData}, 'https://click.sabavision.com/get_camp.php?id=40133,40134,40138,40137,40136,40135')
    }
    }


    if(frameReloadFlag){
    frameReloadFlag = false;
    if(window.location.hash=='#debug'){ console.log('banner ready for reload , id: '+elmId); }
    //TODO: simple
    nextBanner = setInterval(function() {
        if(document.getElementById(elmId)){
          changeIframeBanner(elmId);
        }
    }, reloadTime);
    }


    }

    function changeIframeBanner(elmId){
                //if(window.location.hash=='#debug'){ console.log('reload banner, id: '+elmId); }
        //TODO: simple
        //clearInterval(nextBanner);
    //setTimeout(function(){
    //      var iframe = document.getElementById(elmId);
    //      iframe.src = iframe.src;
    //      frameReloadFlag = true;
    //      checkvisible(document.getElementById('clicknet_vars_frame6861'+uniqId));
    //   },(Math.floor((Math.random() * 10) + 1)) * 100);
        timeFlag = true;
        click_sabavision_banners[elmId]['screen_visable'] = false;

    }

    function checkvisible(elm) {
    if(typeof(elm) == 'string'){
    elm = document.getElementById(elm);
    }
    if(elm){

        var elmId = elm.id;
        var windowHeight = viewPortHeight(),
        elementHeight = elementH(elm),
        scrollPosition = scrollY(),
        elementY = posY(elm);
        var elemEnd = elementY + elementHeight - (elementHeight / 2);
        var elemStart = elementY + (elementHeight / 2);
        var pageStart = scrollPosition;
        var pageEnd = scrollPosition + windowHeight;

        if ((elemStart >= pageStart) && (elemEnd <= pageEnd)) {
        if (timeFlag) {
                if(window.location.hash=='#debug'){ console.log('banner in screen '+elm.id); }
        timeFlag = false;
        timerVar = setInterval(function() {
        clearInterval(timerVar);
        bannerIsVisable(elmId);
        }, visitedTime);

        }
        } else {
        clearInterval(timerVar);
        timeFlag = true;
        }
    }
    }

    if(bannerType == 'normal'){
    if (document.addEventListener) {
    document.addEventListener('scroll', function() {
    checkvisible(document.getElementById('clicknet_vars_frame6861'+uniqId));
    }, false);
    } else if (document.attachEvent)  {
    document.attachEvent('scroll', function() {
    checkvisible(document.getElementById('clicknet_vars_frame6861'+uniqId));
    });
    }

    }else{
        }

    //Object.keys(sabavisionFrameUrls).length ||
    //if(!sabavisionFrameUrlFirstFlag){
    //    sabavisionFrameUrls["clicknet_vars_frame6861"+uniqId] = url+'&vt='+sabavisioniSmobileFlag;
    //    url = 'https://click.sabavision.com/blank.html?';
    //}
    sabavisionFrameUrlFirstFlag = false;

    if(justMobileFlag && !( navigator.userAgent.match(/Android/i)  || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i))){
        return false;
    }

    if(appendedId){
    document.getElementById(appendedId).innerHTML += startStr+'<iframe frameborder="0" allowfullscreen name="clicknet_vars_frame6861'+uniqId+'" id="clicknet_vars_frame6861'+uniqId+'" width="468" height="60" frameborder=0 src="'+url+'&vt='+sabavisioniSmobileFlag+'" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no"  allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>'+endStr;
    }else{
    document.write(startStr+'<iframe frameborder="0" allowfullscreen name="clicknet_vars_frame6861'+uniqId+'" id="clicknet_vars_frame6861'+uniqId+'" width="468" height="60" frameborder=0 src="'+url+'&vt='+sabavisioniSmobileFlag+'" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe>'+endStr);
    }

    //TODO: simple
    //checkvisible(document.getElementById('clicknet_vars_frame6861'+uniqId));

    })("https://click.sabavision.com/showcamp.php?w=468&h=60&posdata[1]=40133-c--13962&posdata[2]=40134-b--13962&posdata[3]=40138-a--13962&posdata[4]=40137-b--13962&posdata[5]=40136-c--13962&posdata[6]=40135-a--13962&postype=other&t=1531246696&ct=e435d9dabf4ac38132c54ecd62ab4e8279e527e0&extra_click_url=",false,false,false,{'marginTop': '-30px', 'marginLeft': '-234px', 'width': '468px', 'height': '60px'},"");

    function addIframeSrc(){

    var flg = true;
    for(i in sabavisionFrameUrls){
    if(flg){
    document.getElementById(i).setAttribute('src', sabavisionFrameUrls[i]);
    delete sabavisionFrameUrls[i];
    flg = false;
    }
    }
    }

    