function lightbox()
{
    var lightbox = document.getElementById('lightbox');
    var popupbox = document.getElementById('popupbox');

    popupbox.innerHTML = '<img src="' + path + '/images/loading.gif"><br>Loading...';
   
    hideSelects('hidden');
            
    lightbox.style.top=document.body.scrollTop;
    lightbox.style.display='block';

    popupbox.style.display='block';
    popupbox.style.top=document.body.scrollTop+200;
    popupbox.style.left='25%';
    popupbox.style.width='50%';

}

function hideLightbox()
{
    hideSelects('visible');
    document.getElementById('lightbox').style.display='none';
    document.getElementById('popupbox').style.display='none';
}

function hideSelects(visibility)
{
    selects = document.getElementsByTagName('select');
    for(i = 0; i < selects.length; i++) {
        selects[i].style.visibility = visibility;
    }
}

function showMenu(MenuId, ParentId)
{
    document.getElementById(MenuId).style.display='block';

    if(navigator.appName == 'Microsoft Internet Explorer'){
        document.getElementById(MenuId).style.position = 'relative';
    }
}


function CallRefWorks(MenuId, CallBackUrl, BibId, RefWorksUrl, RefVendor, RefFilter)
{
    RefVendor = escape(RefVendor);
    RefVendor = 'vendor=' + RefVendor;
    var Filter = 'filter=' + RefFilter;
    var Encoding = 'encoding=65001';
    CallBackUrl = CallBackUrl + '%2FRecord%2F';
    var CallBackUrl1 = 'url=' + CallBackUrl;
    var CallBackUrl2 = '%2FExport%3Fstyle%3DMARC';

    var URL = RefWorksUrl + '?' + RefVendor + '&' + Filter + '&' + Encoding + '&' + CallBackUrl1 + BibId + CallBackUrl2;

    window.open( URL , 'RefWorks');
    document.getElementById(MenuId).style.display='none';
}


function ProcessGBSBookInfo(booksInfo) {
    for (isbn in booksInfo) {
       var element = document.getElementById(isbn);
       var bookInfo = booksInfo[isbn];
       if (bookInfo) {
          element.href = bookInfo.preview_url;
          element.target="_blank";
          if (bookInfo.preview == "full" ||
              bookInfo.preview == "partial") {
            element.style.display = '';
          }
        }
     }
}


