/**
 *  createXMLHttpRequest
 *  
 *  Returns an XMLHttpRequest object or null if
 *  XMLHttpRequest is not available.
 */
function createXMLHttpRequest() {
        
    var xhr = null;
    
    // standards compliant browsers (Firefox, Safari, IE7, etc.)
    if (window.XMLHttpRequest) { 
        xhr = new XMLHttpRequest();
    } 
    else {
        // older versions of Internet Explorer
        if (window.ActiveXObject) {
            try {
                xhr = new ActiveXObject("Msxml2.XMLHTTP");
            } 
            catch (e) {
                try {
                    xhr = new ActiveXObject("Microsoft.XMLHTTP");
                } 
                catch (e) {
                    // give up, no XMLHttpRequest available
                }
            }
        }
    }

    return xhr;

}


/**
 *  setLoadingBar
 *  
 *  Sets a loading bar gif and the given indicator text
 *  as the only content of element with given id.
 */
function setLoadingBar(indicatorText, elementId) {
    var indicatorElement = document.getElementById(elementId);            
    if  (indicatorElement) {
        indicatorElement.innerHTML = indicatorText + '<br /><img src="http://images.telkku.com/img/theme_default/loadingbar.gif" width="220" height="19" alt="" />';
    }
}


/**
 *  setLoadingIndicator
 *  
 *  Sets a loading indicator gif and the given indicator text
 *  as the only content of element with given id.
 */
function setLoadingIndicator(indicatorText, elementId) {
    var indicatorElement = document.getElementById(elementId);            
    if  (indicatorElement) {
        indicatorElement.innerHTML = indicatorText + '<br /><img src="http://images.telkku.com/img/theme_default/loadingindicator.gif" width="32" height="32" alt="" />';
    }
}