if(!window.XMLHttpRequest && window.ActiveXObject)
   var XMLHttpRequest = function() { return new ActiveXObject("Microsoft.XMLHTTP"); }
   
setGlobalOnLoad(getOutsideData);
   
function getOutsideData(url)
{
	
	var a = ["forum", "lysenka", "shogiplayers", "rating_date", "81squareuniverse", "shogi_l", "takodori", "ufshogi"];
	var req = new Array();
	
	for (var i = 0; i < a.length; i++)
	{
		div = document.getElementById(a[i]);
		if (div)
		{
			getXMLDoc(req[i], "_extra/?p=" + a[i] + "&r=" + Math.random(1000000), div);
		}
	}
}   

function trimString (str) 
{
	str = this != window? this : str;
	return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}
	
String.prototype.trim = trimString;


function getXMLDoc(req, url, div)
{
   try
   {
      req = new XMLHttpRequest();
      if (req)
      {
         req.onreadystatechange = function () 
         {
            if (req.readyState == 4)
            {
               if (req.status == 200)
               {
                  if (req.responseText && req.responseText.trim().length > 0) 
				  {
					var temp = div.innerHTML;
					div.innerHTML = req.responseText;
					if (div.innerHTML.trim() == "") div.innerHTML = temp; 
				  }
               }
            }
         }
         req.open("GET", url, true);
         req.send("");
      }
   }
   catch(e) 
   {
      return;
   }
}


function setGlobalOnLoad(f) {
   var root = window.addEventListener || window.attachEvent ? window : document.addEventListener ? document : null
   if (root){
      if(root.addEventListener) root.addEventListener("load", f, false)
      else if(root.attachEvent) root.attachEvent("onload", f)
   } else {
      if(typeof window.onload == 'function') {
         var existing = window.onload
         window.onload = function() {
            existing()
            f()
         }
      } else {
         window.onload = f
      }
   }
}

