function getCenteredCoords(width, height) {
    var xPos = null;
    var yPos = null;
    if (window.ActiveXObject) {
        xPos = window.event.screenX - (width/2) + 100;
        yPos = window.event.screenY - (height/2) - 100;
    } else {
        var parentSize = [window.outerWidth, window.outerHeight];
        var parentPos = [window.screenX, window.screenY];
        xPos = parentPos[0] +
               Math.max(0, Math.floor((parentSize[0] - width) / 2));
        yPos = parentPos[1] +
               Math.max(0, Math.floor((parentSize[1] - (height*1.25)) / 2));
    }
    return [xPos, yPos];
};

function openOpenIDWindow(openid) {
    //document.getElementById('ops').style.display = 'none';
    //document.getElementById('bucket').innerHTML = 'Signing you in <img src="/static/spinner.gif"/>';
    var w_w = 750, w_h = 600;
    var w = window.open('/service/openid/start/?openid_identifier='+encodeURIComponent(openid), 'openid_popup', 'width=' + w_w + ',height=' + w_h + ',location=1,status=1,resizable=yes,scrollbars=1');

    var coords = getCenteredCoords(w_w, w_h);
    w.moveTo(coords[0],coords[1]);
    return false;
};
function handleOpenIDResponse(openid_args) {
    //document.getElementById('ops').style.display = 'none';
    //document.getElementById('bucket').innerHTML = 'Verifying OpenID response';
    alert(openid_args);
    /*
    YAHOO.util.Connect.asyncRequest('GET', '/service/openid/finish/?'+openid_args,
    {'success': function(r) {
        document.getElementById('bucket').innerHTML = r.responseText;
    }});*/
}
