function openAllWin(name)
{
    var h = screen.height - (screen.height * .2);
    var w = 593;
    newwindow=window.open(name,'child','height='+h+',width='+w+',resizable=yes,scrollbars=yes');
}

function displayFullBlock(id)
{
    var fullBlockname = 'fullBlock'+id;
    var fullblock = document.getElementById(fullBlockname);

    fullblock.style.display='block';
    fullblock.style.backgroundColor='#ff9';
    fullblock.style.paddingLeft='1em';
    fullblock.style.paddingBottom='0.5em';
    fullblock.style.width='16em';
    fullblock.style.zIndex='400';
}
function closeFullBlock(id)
{
    var fullBlockname = 'fullBlock'+id;
    var fullblock = document.getElementById(fullBlockname);

    fullblock.style.display='none';
    fullblock.style.backgroundColor='#fff';
    fullblock.style.paddingLeft='0em';
    fullblock.style.paddingBottom='0em';
    fullblock.style.width='0em';
    fullblock.style.zIndex='1';
}

var http_request = false;
var posttemp = false;

function makeRequest(bib, post) {
    http_request = false;
    if (window.XMLHttpRequest) { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }
    if (!http_request) {
        alert('Cannot create XMLHTTP instance');
        return false;
    }
    
    posttemp = post;
    http_request.onreadystatechange = alertContents;
    http_request.open('GET', 'http://tags.library.upenn.edu/cgi-bin/addtobib?bib='+bib+';post='+post, true);
    http_request.send(null);
    closeFullBlock(post);
    return false;
}

function alertContents() {
    if (http_request.readyState==4) {
        if (http_request.status == 200) {
            var xmldoc = http_request.responseXML.documentElement;
            var node = xmldoc.getElementsByTagName('data')[0].firstChild.nodeValue;
            var projectstring = xmldoc.getElementsByTagName('projectstring')[0].firstChild.nodeValue;
            var recordid = xmldoc.getElementsByTagName('recordid')[0].firstChild.nodeValue;
            recordid = 'project'+recordid;
            var projectLine = document.getElementById(recordid);
            projectLine.innerHTML = projectstring;
            if(projectLine.style.display == 'none') {
                projectLine.style.display = 'block';
            } else {
                projectLine.style.display = 'none';
            }
            alert(node);
        }
    }
}

function tagitSearch(search)
{
    search = "http://tags.library.upenn.edu/search/" + search;
    window.location=search;
}
