/*
Copyright (c) 2008, Blue Fish Development Group. All rights reserved.
base.js relies on the YUI library and provides custom functionality
*/

/*
 * Function: initPopupLinks
 * Checks the DOM for any anchor links with class 'popup-link' and attaches
 * onclick event listeners to open the popup.
 * See Also: <openPopup>
 */

function initPopupLinks() {
    // gather links
    var oPopupLinks = YAHOO.util.Dom.getElementsByClassName('popup-link', 'a');
    // add event listeners to each link
    for (var i=0; i < oPopupLinks.length; i++) {
        YAHOO.util.Event.addListener(oPopupLinks[i], "click", openPopup);
    }
}

/*
 * Function: openPopup
 * Opens a new window, focuses on the new window, and prevents the default link behavior.
 * Parameters: e - the click event.
 */
 
function openPopup(e) {
    // get this objects href and open it in a new window
    newWindow = window.open(this.href,'','height=700,width=635,resizable=yes,scrollbars=yes');
    if (window.focus) { 
        newWindow.focus();
    }
    // prevent link from being followed
    YAHOO.util.Event.preventDefault(e);
}

/*
 * Initiliaze Events 
 */
 
YAHOO.util.Event.onDOMReady(initPopupLinks);
