/* Ultimater's edited version of:
   http://jibbering.com/2002/4/httprequest.html
   to serve IE7 with XMLHttpRequest instead of ActiveX */

var xmlhttp=false;
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 	try {
 		 xmlhttp = new XMLHttpRequest();
 	} catch (e) {
 		 xmlhttp=false;
 	}
}

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
@end @*/
if (!xmlhttp){
 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
}


if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

/* Ultimater's edited version of:
   http://javascript.internet.com/ajax/ajax-navigation.html */

var please_wait = "<div style=\"height:280px;\"><br><br><br><center><font size=\"3px\"><b>Loading...</b></font></center></div>";

function open_url(url, targetId, sWithinDivTarget) {
  if(!xmlhttp)return false;
    var e=document.getElementById(targetId);if(!e)return false;
    if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = function() { response(url, e, sWithinDivTarget); }
    try{
      xmlhttp.send(null);
    }catch(l){
    while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
    e.appendChild(document.createTextNode("request failed"));
  }
}

function response(url, e, sWithinDivTarget) {
  if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
		if(sWithinDivTarget)
		{
			if (sWithinDivTarget.substr(0, 7).toLowerCase() == 'target=')
			{
			  tmp=tmp.replace(/<a/g, '<a '+sWithinDivTarget+' ');
				d.innerHTML=tmp;
			}
			else
			{
        tmp=tmp.replace(/<a/g, '<a onclick=\"'+sWithinDivTarget+'(this.getAttribute(\'href\')); return false;\" ');
		    d.innerHTML=tmp.replace(/onclick=\"javascript:/g, 'onclick=\"');
		  }
		}
		else
		{
		  d.innerHTML=tmp;
		}
    setTimeout(function(){
      while(e.firstChild)e.removeChild(e.firstChild);//e.innerHTML="" the standard way
      e.appendChild(d);
    },10)
}
function LoadDIV(sURL, sDIV, sWithinDivTarget){
	var currentTime = new Date();
	var mili=currentTime.getTime();
  open_url(sURL+'?'+mili, sDIV, sWithinDivTarget);
}