// qualifyLink()
//
// Returns an href with the current root if it does not have
// a protocol defined
//
// Argument             Definition
// ========             ==========
// href                 Link to be qualified
//
// Returns the qualified link
//
function qualifyLink( href ) {

    var hrefRoot = location.protocol + '//' + location.host;

    // A qualified link starts with a protocol.
    // For now, we will look for a "://" to indicate this.
    // If the href does NOT have a protocol, add one
    if( !( (/:\/\//).test( href ) ) ) 
                
        // Set root to help address browser security issues
        return( hrefRoot + "/" + href );
    else
        return( href );
}

// openLinkInWindow()
//
// Open the link in a new window
//
// Argument             Definition
// ========             ==========
// href                 URL for the picture
// width                Width of the picture
// height               Height of the picture
//
function openLinkInWindow( href, title, width, height ) {


    var w = ((width == null) ? 800 : width) + 32;
    var h = ((height == null) ? 600 : height) + 96;

    var win = window.open(  qualifyLink( href ),
							title,
                            'width=' + w + ',height=' + h + ',' +
                            'location=no,menubar=no,' +
                            'status=no,toolbar=no,scrollbars=yes,resizable=no');

    if( win == null )
        alert( "Unable to open window. Check your pop-up blocker." );
    else {
        win.resizeTo(w, h);
        win.focus();
    }
}

