
function Centra( x, y) {

if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
posx=(myWidth-x)/2;
posy=(myHeight-y)/2;
if (posx<=0) posx=-1;
if (posy<=0) posy=-1;
        if (document.getElementById) {
        document.getElementById('contenidor').style.width = x;
        document.getElementById('contenidor').style.height = y;		
        document.getElementById('contenidor').style.left = posx;
        document.getElementById('contenidor').style.top = posy;
        }
}



function createRequestObject(){
var request_;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
 request_ = new ActiveXObject("Microsoft.XMLHTTP");
}else{
 request_ = new XMLHttpRequest();
}
return request_;
}

var http = createRequestObject();
var layerNomId;

function getInfo(pagina,nomcapa){
http.open('get', 'paginador.php?id='
  + pagina);
if (!nomcapa) nomcapa='contingut';
layerNomId=nomcapa;
http.onreadystatechange = handleInfo;

http.send(null);
}

function handleInfo(){
if(http.readyState == 1){
 document.getElementById('loading').innerHTML = 'Espera...';
}
if(http.readyState == 4){

 var response = http.responseText;

 document.getElementById(layerNomId).innerHTML = response;
  document.getElementById('loading').innerHTML = '';
}
}