/* externalLinks
 *
 * Converts all anchor tags which contain 'rel="external"' to open in a
 * new window (i.e. 'target="_blank"').
 * Runs when the document loads.
 *
 * Required because the 'target' attribute has been removed from HTML 4 strict.
 *
 * Written by Kevin Yank: http://www.sitepoint.com.
 *
 */

function externalLinks()
{
    if (document.getElementsByTagName)
    {
        var anchors = document.getElementsByTagName("a");
        for (var i = 0; i < anchors.length; i++)
        {
            var anchor = anchors[i];
            if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
                anchor.target = "_blank";
        }
    }
}

window.onload = externalLinks;


/* popwin
 *
 * Opens a popup window.
 *
 * Parameters:-
 *      pageref         - URL to load
 *      winname         - name for the window
 *      w               - window width (pixels)
 *      h               - window height (pixels)
 *      p1              - scroll | noscroll
 *      p2              - resize | noresize
 *
 */

function popwin(pageref, winname, w, h, p1, p2)
{
    window.open(pageref, winname, 'status=no,menubar=no,scrollbars='
                +((p1=='scroll' || p2=='scroll')? 'yes' : 'no')
                +',resizable=' +((p1=='resize' || p2=='resize')? 'yes' : 'no')
                +',width='+w+',height='+h);
}
