function BrowserCheck() {
    var b = navigator.appName;
    var a = navigator.userAgent;
    this.mac = (a.indexOf('Mac')>0);
    this.win = (a.indexOf('Win')>0);
    if (b=="Netscape") this.b = "ns";
    else if (b=="Microsoft Internet Explorer") this.b = "ie";
    else this.b = b;
    this.v = parseInt(navigator.appVersion);
    this.ns = (this.b=="ns" && this.v>=4);
    this.ns4 = (this.b=="ns" && this.v==4);
    this.ns5 = (this.b=="ns" && this.v==5);
    this.ie = (this.b=="ie" && this.v>=4);
    this.ie4 = (navigator.userAgent.indexOf('MSIE 4')>0);
    this.ie5 = (navigator.userAgent.indexOf('MSIE 5')>0);
    if (this.ie5) this.v = 5;
    this.min = (this.ns||this.ie);
}

// automatically create the "is" object
//is = new BrowserCheck();

function printen() {
    is = new BrowserCheck();
    // Deze functie werkt niet op de Mac, om onduidelijke reden.
    if(!is.mac)
    {
        window.print();
    } else {
        alert("Het is niet mogelijk de pagina vanzelf af te drukken.\nAls dat niet het geval is kunt u met de rechterknop van uw muis in het venster klikken en dan kiezen voor de optie 'Afdrukken';");
    }
    //else alerter("printmelding.html");
    window.close();
}

function printSpecial(PrintStijl, divnaam, Titel)
{   //Aangepast door Paul VdL. Februari 2005
    //Inspiratie van http://winfolinx.com/tips/howto/various/printready.htm en Beco (Hedwig)
    //Werkt met IE 5 of hoger.
    //Neemt eventuele Javascripten in de head mee. Zorgd voor een goede stabiliteit!
    //
    //Om deze script te gebruiken moet je een stijl aanmaken in de css die 'printerfriendly_Normal' heet en
    //een stijl die 'printerfriendly_Small' heet
    //
    //"PrintStijl" - optioneel - bevat de CSS stijl die gewenst is voor het printen
    //"divnaam" - optionnel - is handig in het geval meerdere printsecties aanwezig kunnen zijn op één blad
    //"Titel" - optioneel - geeft een titel aan het document. Als blank pakt hij de titel van het document.
    //Plaatst de titel van de pagina in de printscherm
    //

    var gAutoPrint = true; // Tells whether to automatically call the print function

    //Checks Function entries
    if (PrintStijl=='')
    {
        var PrintStijl='printerfriendly_Normal';
    }
    if (Titel=='')
    {
        var Titel = document.title;
    }
    if (divnaam=='')
    {
        var divnaam = 'printReady';
    }

    //Creates printer-friendly popup

    var gAutoPrint = true; // Flag for whether or not to automatically call the print function
    if (document.getElementById != null)
    {
        var html = '<HTML>\n<HEAD>\n';
        html += '<link rel="STYLESHEET" href="duurzaam.css" type="text/css">';
        // include de javascript in het te openen venster
        html += '<script language="JavaScript" src="js/print.js"></script>';

        //Neemt headscripten mee (bv resaltatexto) Zeer belangrijk!
        if (document.getElementsByTagName != null)
                {
                    var headTags = document.getElementsByTagName("head");
                    if (headTags.length > 0)
                        html += headTags[0].innerHTML;
                }


        // roep de functie printen() aan als het window opent.
        html += '\n</HEAD>\n<BODY onload="window.focus();printen();">\n';


        var printReadyElem = document.getElementById(divnaam);
        //alert(printReadyElem.innerHTML);
        if (printReadyElem != null) {
            //html += '<div class="'+PrintStijl+'"><b>'+Titel+'</b><br><br>'+printReadyElem.innerHTML+'</div><br><br><div class="printerfriendly_Small">Deze informatie is onderdeel van de website "Duurzaam ondernemen", te vinden op http://www.duurzaamondernemen.nl en wordt u aangeboden door <img src="images/nl/becologo_klein.jpg">. U kunt de informatie van de site gebruiken mits u de bron vermeldt. BECO en alle andere partijen die aan deze website hebben bijgedragen geven geen garantie voor de juistheid en/of volledigheid van gegevens, ontwerpen, constructies, producten of productiemethoden voorkomende of beschreven op deze website, noch voor de geschiktheid daarvan voor enige bijzondere toepassing. De praktijkvoorbeelden zijn uitsluitend bedoeld ter informatie.</div>';
            html += '<div class="'+PrintStijl+'"><b>'+Titel+'</b><br><br>'+printReadyElem.innerHTML+'</div><br><br><div class="printerfriendly_Small">This information is a part of the  website "Sustainability" available at http://www.duurzaamondernemen.nl and http://www.crsinpractice.net, developed by <img src="images/en/becologo_klein.jpg">. You can use the contents of the website on condition that you make a reference to the source of the information. BECO and all other parties that have contributed to the contents of the website do not give any guarantees for the accuracy or completeness of the data, designs, constructions, products or production methods described in these web pages, neither for the their suitability to any special applications. The examples provided on this "Sustainability" website is provided for information purposes only. </div>';
           

        } else {
            alert("Er is een fout opgetreden, probeer het opnieuw.");
            return;
        }

        html += '\n</BODY>\n</HTML>';
        //alert(html);

        var printWin = null;
        w = 800;
        h = 600;
        LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
        TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
        settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable';
        printWin = window.open("", divnaam, settings);

        printWin.document.write(html);
        printWin.document.close();
    }
}
