var BrowserDetect={
    init:function(){
        this.browser=this.searchString(this.dataBrowser)||"An unknown browser";
        this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version"
    },
    searchString:function(d){
        for(var a=0;a<d.length;a++){
            var b=d[a].string;
            var c=d[a].prop;
            this.versionSearchString=d[a].versionSearch||d[a].identity;
            if(b){
                if(b.indexOf(d[a].subString)!=-1){
                    return d[a].identity
                }
            }
            else{
                if(c){
                    return d[a].identity
                }
            }
        }
    },
    searchVersion:function(b){
        var a=b.indexOf(this.versionSearchString);
        if(a==-1){
            return
        }
        return parseFloat(b.substring(a+this.versionSearchString.length+1))
    },
    dataBrowser:[{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"}]
};
BrowserDetect.init();
var tc_exit_popup=function(options){
    this.options={popURL_NOFF:"http://google.fr",popURL_FF:"http://google.fr",bmphrase:"Vidéos pornos et photos de sexe gratuit",MessageAlerte:"Merci à très bientôt !",bmURL:"",dossier_js:"http://www.mature-jeunot.com/js/",desactive_exit_popup:false,typeMSG:"alert",messageCloseit:"Merci d'avoir visité notre site!\n\nVoici un nouveau site Gratuit qui déchire ! \nDes miliers de videos PORNO HD Gratuites en 3 clics.\n=> Des Mamans en manque de cul baisent avec des JEUNOTS !\n=> Des Jeunes salopes de 18ans filment leur DEPUCELAGE avec leur mec !\n=> Des Beurettes Voilées se font défoncées dans des caves !\n\nCliquez sur ANNULER",navigateur:BrowserDetect.browser+" "+BrowserDetect.version,height:screen.availHeight-0,width:screen.availWidth-30,exit:true,isXPSP2:false};
    this.vars={popDialogOptions:"dialogWidth:"+this.options.width+"px; dialogHeight:"+this.options.height+"px; dialogTop:0px; dialogLeft:0px; edge:Raised; center:0; help:0; resizable:1; scroll:1; status:0",popWindowOptions:"scrollbars=1, menubar=1, toolbar=1, location=1, personalbar=1, status=1, resizable=1"};
    this.iie=null;
    this.stop=function(){
        this.options.desactive_exit_popup=true; 
    };
    this.ext=function(){
        if(this.options.desactive_exit_popup){
            return;
        }
        if(this.options.exit){
            this.options.exit=false;
            this.options.isXPSP2=(window.navigator.userAgent.indexOf("SV1")!=-1);
            if(this.options.navigateur=="Explorer 6"){
                if(this.options.isXPSP2){
                    this.brs();
                    this.iie.launchURL(this.options.popURL_NOFF)
                }
                else{
                    eval("window.showModalDialog(this.options.popURL_NOFF,'grossesortie',this.vars.popDialogOptions)")
                }
                if(this.options.typeMSG!="favoris"){
                    alert(this.options.MessageAlerte)
                }
            }
            else{
                if(this.options.navigateur=="Explorer 7"||this.options.navigateur=="Explorer 8"){
                    document.getElementById("zone_exit_popup_flash").innerHTML='<embed src="'+this.options.dossier_js+"popup.swf?popURL="+encodeURIComponent(this.options.popURL_NOFF)+'" autostart="true" width="0" height="0"></embed>';
                    if(this.options.typeMSG!="favoris"){
                        alert(this.options.MessageAlerte)
                    }
                    else{
                        window.external.AddFavorite(this.options.bmURL,this.options.bmphrase)
                    }
                }
                else{
                    document.getElementById("zone_exit_popup_flash").innerHTML='<embed src="'+this.options.dossier_js+"popup.swf?popURL="+encodeURIComponent(this.options.popURL_NOFF)+'" autostart="true" width="0" height="0"></embed>';
                    alert(this.options.MessageAlerte)
                }
            }
        }
    };
    this.brs=function(){
        document.getElementById("zone_exit_popup_flash").innerHTML='<object id="iie" width="0" height="0" classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6"></object>'};
        this.ff=function(){
            if(this.options.desactive_exit_popup){
                return
            }
            this.exitUrl=btoa(this.options.popURL_FF);
            if(BrowserDetect.browser=="Firefox"){
                document.getElementById("zone_exit_popup_flash").innerHTML='<embed src="'+this.options.dossier_js+"ff.asx?url="+encodeURIComponent(this.options.exitUrl)+'" autostart="true" width="0" height="0"></embed>';
                if(this.options.typeMSG=="favoris"){
                    window.sidebar.addPanel(this.options.bmphrase,this.options.bmURL,"")
                }
                else{
                    alert(this.options.MessageAlerte+"-"+this.options.navigateur)
                }
            }
        };
        this.array_merge=function(arr1,arr2){
            if((arr1&&(arr1 instanceof Array))&&(arr2&&(arr2 instanceof Array))){
                for(var idx in arr2){
                    arr1.push(arr2[idx])
                }
            }
            else{
                if((arr1&&(arr1 instanceof Object))&&(arr2&&(arr2 instanceof Object))){
                    for(var idx in arr2){
                        if(idx in arr1){
                            if(typeof arr1[idx]=="object"&&typeof arr2=="object"){
                                arr1[idx]=array_merge(arr1[idx],arr2[idx])
                            }
                            else{
                                arr1[idx]=arr2[idx]
                            }
                        }
                        else{
                            arr1[idx]=arr2[idx]
                        }
                    }
                }
            }
            return arr1
        };
        this.array_merge(this.options,options);
        var divobj=document.createElement("div");
        divobj.id="zone_exit_popup_flash";
        window.document.body.appendChild(divobj);
        if(window.document.getElementById&&!window.document.all){if(this.options.popURL_FF!=""){
            var url=this.options.popURL_FF;
            var messageCloseit=this.options.messageCloseit;window.onbeforeunload=function ExitPop(){
                window.location=url;return messageCloseit
            }
        }
    }
    if(window.attachEvent){
        var obj=this;
        window.attachEvent("onunload",function(){obj.ext()})
    }
};
