function XMLrq(fragment_url, element_id) {
    var element = document.getElementById(element_id);
    
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        xmlhttp = new XMLHttpRequest();
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    element.innerHTML = '<p><em>Carregant...</em></p>';
    xmlhttp.open("GET", fragment_url);
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
            element.innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.send(null);
}

function XMLrqUltimes(fragment_url, element_id,opcio,max) {
	for(i=0;i<=max;i++)
	{
		$('#ou'+i).removeClass();
	}
	/*document.getElementById("ou1").className='';
	document.getElementById("ou2").className='';
	document.getElementById("ou3").className='';*/
	document.getElementById(opcio).className='active';
	
	$('#'+element_id).html('<p><img src="imatges/indicator.gif"><em>Carregant...</em></p>');
	$.get(fragment_url,function(data)
	{
		$('#'+element_id).html(data);
		TB_init();
		JT_init();
	});
}

function XMLrqTop(fragment_url, element_id,opcio) {
	
	document.getElementById("ou0").className='';
	document.getElementById("ou1").className='';
	document.getElementById("ou2").className='';
	document.getElementById("ou3").className='';
	document.getElementById("ou4").className='';
	document.getElementById(opcio).className='active';
	var element_top = document.getElementById(element_id);
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        xmlhttptop = new XMLHttpRequest();
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        xmlhttptop = new ActiveXObject("Microsoft.XMLHTTP");
    }

    element_top.innerHTML = '<p><img src="imatges/indicator.gif"><em>Carregant...</em></p>';
    xmlhttptop.open("GET", fragment_url);
    xmlhttptop.onreadystatechange = function() {
        if (xmlhttptop.readyState == 4 && xmlhttptop.status == 200) {
            element_top.innerHTML = xmlhttptop.responseText;
       }
    }
    xmlhttptop.send(null);
}

function XMLrqForum(fragment_url, element_id) {
	
	var element_forum = document.getElementById(element_id);
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        xmlhttpforum = new XMLHttpRequest();
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        xmlhttpforum = new ActiveXObject("Microsoft.XMLHTTP");
    }

    element_forum.innerHTML = '<p><img src="imatges/indicator.gif"><em>Carregant...</em></p>';
    xmlhttpforum.open("GET", fragment_url);
    xmlhttpforum.onreadystatechange = function() {
        if (xmlhttpforum.readyState == 4 && xmlhttpforum.status == 200) {
            element_forum.innerHTML = xmlhttpforum.responseText;
       }
    }
    xmlhttpforum.send(null);
}
