/**
 *
 * Function for enhancing all occurancies of <a> and <form> tags with rel="external" with a target="_blank"
 *
 * @editor Rory Bol, LETO grafisch serviceburo, <r.bol@letoservice.nl>
 *
 */

function externalLinks() {
    // Return if JS DOM1 is not supported
    if (!document.getElementsByTagName) return;
    // Fetch all <a>'s
    var anchors = document.getElementsByTagName("a");
    // Loop through all <a>'s
    for (var i=0; i<anchors.length; i++) {
        var anchor = anchors[i];
        // Check if the element contains a href and a rel "external" attribute
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
            // Set the target to Blank for those
            anchor.target = "_blank";
        }
    }
    // Do the same for forms with a rel = external
    var forms = document.getElementsByTagName("form");
    for (var i=0; i<forms.length; i++) {
        var frm = forms[i];
        if (frm.getAttribute("action") && frm.getAttribute("title") == "external") {
            frm.target = "_blank";
        }
    }
}


/**
 *
 * Function which sets the focus on a formfield
 *
 */

function focus(variabele) {
    document.getElementById(variabele).focus();
}


/**
 *
 * Function which sets the focus on a formfield
 *
 */

function favorites(bookmarkurl, bookmarktitel){
    if (document.all) {
        window.external.AddFavorite(bookmarkurl, bookmarktitel)
    }
}
