var prevWidth = 0;
var prevHeight = 0;
var curElement = null;

function showModificationDate () {
    document.write ("27 apr 2009");
}

//----------
// Detect printing

function isPrinting () {
    var divElement = document.getElementById ("navside");
    var curStyle = null;
    // IE does not support getComputedStyle but uses currentStyle.
    if (divElement != null) {
        if (window.getComputedStyle) {
            curStyle = window.getComputedStyle (divElement, null).visibility;
        } else if (divElement.currentStyle) {
            curStyle = divElement.currentStyle.visibility;
        }
    } else {
        curStyle = "unknown";
    }
    if (curStyle == "hidden") {
        return true;
    } else {
        return false;
    }
}

//----------
// Resizing DIV with ID info

function checkResize () {
    var height = 0;
    var width = 0;
    if (typeof window.innerWidth != 'undefined') {
        width = window.innerWidth;
        height = window.innerHeight;
    } else if (typeof document.documentElement != 'undefined'
            && typeof document.documentElement.clientWidth != 'undefined'
            && document.documentElement.clientWidth != 0) {
        width = document.documentElement.clientWidth;
        height = document.documentElement.clientHeight;
    } else {
        width  = document.getElementsByTagName('body')[0].clientWidth;
        height = document.getElementsByTagName('body')[0].clientHeight;
    }
    if (width != prevWidth || height != prevHeight) {
        prevWidth = width;
        prevHeight = height;
        if (isPrinting () == false) {
            doActualResize();
        }
    }
}

function doActualResize () {
    var divElement = document.getElementById ("info");
    divElement.style.height = (prevHeight - 199 - 30 - 30) + "px";
    divElement.style.width = (prevWidth - 143 - 10 - 10 - 10) + "px";
}

//----------
// FAQ stuff

function closeAnswerTR (divName) {
    var divElement = document.getElementById (divName);
    if (divElement != null) {
        curElement.style.display = "none";
        curElement.style.height = "1px";
    }
}

function showAnswerTR (divName) {
    if (curElement != null) {
        curElement.style.display = "none";
        curElement.style.height = "1px";
    }
    newElement = document.getElementById (divName);
    if (newElement != null && newElement != curElement) {
        curElement = newElement;
        curElement.style.display = "block";
        curElement.style.height = "auto";
    } else {
        curElement = null;
    }
}

//----------
// DIV manipulations

function removeDiv (divName) {
    var divElement = document.getElementById (divName);
    if (divElement != null) {
        var parent = divElement.parentNode;
        divElement.style.visibility = "hidden";
        parent.removeChild (divElement);
    }
}

//----------
// Writing content

function writeHead () {
    document.write (" Arccoth&nbsp;Professional&nbsp;Organizing&nbsp;&nbsp;&nbsp; ");
    document.write ("Het&nbsp;Struweel&nbsp;31,&nbsp;5501&nbsp;AN&nbsp;Veldhoven&nbsp;Nederland&nbsp;&nbsp;&nbsp; ");
    document.write ("Tel:&nbsp;06-22863472&nbsp;&nbsp;&nbsp; ");
    insertUserMail ();
    document.write ("&nbsp;&nbsp;&nbsp; WWW:&nbsp<a href=\"http://www.arccoth.nl/\">http://www.arccoth.nl</a>&nbsp;&nbsp;&nbsp; ");
    document.write ("Rabobank:&nbsp;10.92.59.823&nbsp;&nbsp;&nbsp; ");
    document.write ("KvK:&nbsp;17222611&nbsp;&nbsp;&nbsp; ");
}

function insertUserMail () {
    document.write ("Email:&nbsp;<a href=\"" + "mai" + "lto:" + "muter" + "@" + "arccoth.nl" +"\">muter" + "@" + "arccoth.nl</a>");
}

function insertWebMail () {
    document.write ("Email:&nbsp;<a href=\"" + "mai" + "lto:" + "info" + "@" + "arccoth.nl" +"\">info" + "@" + "arccoth.nl</a>");
}

function createSwappableContent (img1, img2, img3, altImg1, altImg2, altImg3, to) {
        document.write ("Beweeg de muiswijzer over de pijlen om van plaatje te wisselen.<p/>");
        document.write ("<div style=\"float: left;\" class=\"image\" onclick=\"lnp('" + to +"')\" class=\"image\">");
        document.write ("<img class=\"fotonav\" id=\"i1\" src=\"" + img1 + "\" onMouseOver=\"swapImages('i1', '" + img1 + "', 'i2', '" + img2 + "', 'i3', '" + img3 + "');\"/>");
        document.write ("<img id=\"i2\" src=\"" + img2 + "\"/>");
        document.write ("<img class=\"fotonav\" id=\"i3\" src=\"" + img3 + "\" onMouseOver=\"swapImages('i1', '" + altImg1 + "', 'i2', '" + altImg2 + "', 'i3', '" + altImg3 + "');\"/>");
        document.write ("</div>");
}

//----------
// image manipulation

function showImage (id, imageSrc) {
    var divElement = document.getElementById (id);
    if (divElement != null) {
        divElement.src = imageSrc;
    }
}

function swapImages (id, imageSrc, id2, imageSrc2, id3, imageSrc3) {
    var divElement = document.getElementById (id);
    if (divElement != null) {
        divElement.src = imageSrc;
    }
    divElement = document.getElementById (id2);
    if (divElement != null) {
        divElement.src = imageSrc2;
    }
    divElement = document.getElementById (id3);
    if (divElement != null) {
        divElement.src = imageSrc3;
    }
}

//----------
// Changing conten

function lnp (url) {
    window.location.href = url;
}

//----------
// Belstat

function showBelstat () {
    d = document;
    pag = "";
    col = "";
    scr = 0;
    b = navigator.appName;
    scr = screen.width + "*" + screen.height;
    ref = parent == self ? escape (window.document.referrer) : escape (top.document.referrer);
    pag = escape (d.URL);
    if (b != "Netscape") {
        col = screen.colorDepth;
    } else {
        col = screen.pixelDepth;
    }
    if (col == "undefined") {
        col="";
    }
    d.write("<a class=\"belstat\" href=\"http://www.belstat.nl/viewstat.asp?UserID=arccoth\&lang=nl\" target=\"_blank\"><img border=\"0\" src=\"http://www.belstat.nl/regstat.aspx?");
    d.write("UserID=arccoth&BColor=black&refer=" + ref + "&pag=" + pag + "&b=" + b + "&col=" + col + "&scr=" + scr);
    d.write("\" align=\"center\" width=\"16\" height=\"16\" alt=\"Monitored by BelStat - Your Site Counts\"><\/a>");
}

//----------
// W3C

function showW3C () {
    d = document;
    d.write("<a class=\"xhtml\" href=\"http://validator.w3.org/check?uri=referer\">");
    d.write("<img src=\"images/x/xhtml10.png\" alt=\"Valid XHTML 1.0 Transitional\" border=\"0\" align=\"center\"/>");
    d.write("</a>");
    d.write("<a class=\"css\" href=\"http://validator.w3.org/check?uri=referer\">");
    d.write("<img src=\"images/x/css2.png\" alt=\"Valid CSS!\" border=\"0\" align=\"center\"/>");
    d.write("</a>");
}

//----------
// main

function init() {
    removeDiv ("hidethis");
    checkResize ();
    setInterval(checkResize, 500);
}

