//
//  This JavaScript file should be used for JavaScript functions that can be
//  used across the Student Advantage site.
//    
//  James Farley
//  $Revision: 1.1 $ $Date: 2003/02/14 14:56:19 $
//

//
//  This function can be used to support an auto-tab feature.  It checks to 
//  see if the value entered in the first field has reached maximum length
//  and, if so, tabs the user to the "nextField".
//
function autotab( thisField, nextField ) {
    if( thisField.value.length == thisField.maxLength ) {
        nextField.focus();
    }
}

//
//  This function opens up a popup window for the given URL, title, width and
//  height.  Popup windows are windows with no toolbar, location bar, status
//  bar, etc.  They are typically used to display promos, terms & conditions
//  pages, etc.
//
function popup( url, title, width, height ) {
    window.open(url,title,'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=no,copyhistory=no,width=' + width + ',height=' + height).focus();
}

function bookmark(urlAddress, pageName) { 
    if (window.external) { 
        window.external.AddFavorite(urlAddress,pageName) 
    } else { 
        alert("Sorry! Your browser doesn't support adding bookmarks automatically."); 
    } 
} 

// cross-browser compatible way to get elements by id
function getObjectById( id )
{
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}