// catch possible bugs with WebTV and other older browsers
var is_regexp = (window.RegExp) ? true : false;

var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    &&
    navigator.userAgent.indexOf('Mac') != -1
);

var W3CDOM = (!bugRiddenCrashPronePieceOfJunk && 
    document.getElementsByTagName && document.createElement);

window.onload = initialize; 

/* Why no window.onload = function () {} ? Because NN3 doesn't support the function
    constructor and gives an error message. This site must be accessible to NN3 */

function initialize ()
{

    /* Hide nifty stuff from old browsers */
    if (W3CDOM) {

        /* Go through all links. If any has a type="popup" write the popup 
            function into its onclick */
        var x = document.getElementsByTagName('a');
        for (var i=0;i<x.length;i++) {
            /* just a basic popup */
            if (x[i].getAttribute('type') == 'popup') {
                x[i].onclick = function () {
                    return pop(this.href)
                }
            }
        }
    }
    /* End hide. This is for all browsers */
}

// Popup

var popUp = null;

function pop(url)
{
	if (popUp && !popUp.closed)
		popUp.location.href = url;
	else
		popUp = window.open(url,'popUp','height=500,width=700,scrollbars=yes,resizable=yes,toolbar=no,location=no,status=no');
	popUp.focus();
	return false;
}
