function loadSite(nodeId, lang) {
    var xhr = getXhr();
    if(xhr != null) {
        loadPage(nodeId, lang, xhr);
    }
}

function getXhr() {
    var xhr = null; 
     
    if(window.XMLHttpRequest) // Firefox and others
       return new XMLHttpRequest(); 
    else if(window.ActiveXObject){ // Internet Explorer 
       try {
                return new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
               return new ActiveXObject("Microsoft.XMLHTTP");
            }
    }
    else { // XMLHttpRequest not supported
       return null;
    }
}

function loadPage(nodeId, lang, xhr) {
    xhr.onreadystatechange = function(){
	    if(xhr.readyState == 4 && xhr.status == 200){
	        updateDiv(xhr);
	    } else {
	       loading();
	    }
	}
	xhr.open('GET', 'http://www.wess.ch/' + lang + '/layout/set/ajax/content/view/full/' + nodeId, true);
	xhr.send(null);
}

function updateDiv(xhr) {
    document.getElementById('loading').style.display = 'none';
    document.getElementById('content_bottom').innerHTML = xhr.responseText;
}

function loading() {
    document.getElementById('loading').style.display = 'inline';
}
