function registerAjaxInfo(path) {
   ajaxEngine.registerRequest( 'doAjax2', path );
   ajaxEngine.registerAjaxElement( 'mainbody' );
}

function doAjax(url) {
   if(url.substr(0,5)=="http:"){
     url = url.substr((url.indexOf('?')+1));
    }
	fadeIn();
	new Rico.Effect.FadeTo('mainbody', 0, 300, 10);
	var options = {onComplete: function() { new 
    Rico.Effect.FadeTo('mainbody', 1, 300, 10);decodeText()}, parameters:  url  };
	ajaxEngine.sendRequest("doAjax2", options) ;
}

function decodeText() {
   myDiv=document.getElementById('mainbody');
   myDiv.innerHTML=URLDecode(myDiv.innerHTML);
   document.getElementById('loading').style.display="none";
   ajaxLinks();
}

function URLDecode(psEncodeString){
  var lsRegExp = /\+/g;
  return unescape(String(psEncodeString).replace(lsRegExp, " "));
}

function fadeIn(){
	 var myWidth = 0, myHeight = 0;
  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;
  }
  
  myWidth=(myWidth/2)-100;
  myHeight=(myHeight/2)-100;
  document.getElementById('loading').style.top=myHeight+"px";
  document.getElementById('loading').style.left=myWidth+"px";
  document.getElementById('loading').style.display="block";
}