
var frameId = "reportFrame"
var selectId = "reportList"
var errorMsgId = "errorMsg"

/*
 * Opens a report in a new window
 */
function displayReportInNewWindow(selectId) {
    
    try {
        tryUrl(document.getElementById(selectId).value)
    } catch(ex) {
        document.getElementById(errorMsgId).style.display = "inline"
        document.getElementById(frameId).style.display = "none"
        adjustTopFrame()
        return
    }
    var url = document.getElementById(selectId).value
    var name = "reportWindow"
    window.open(url,name)
}


/*
 * Attempts to verify if a document is available and throws
 * an exception if it isn't
 */
function tryUrl(url) {
    xmlhttp = new XMLHttpRequest()
    xmlhttp.open("HEAD",url,true)
    try {
        xmlhttp.send(null)
    } catch(ex) {
        throw ex
    }
}

