GetRandomHinshu();
function checkBrouser() {
  var ret = "";
  var strUA = "";
  strUA = navigator.userAgent.toLowerCase();

  if(strUA.indexOf("safari") != -1){		ret = "sf"; }
  else if(strUA.indexOf("firefox") != -1){	ret = "ff"; }
  else if(strUA.indexOf("opera") != -1){	ret = "op"; }
  else if(strUA.indexOf("netscape") != -1){	ret = "nn"; }
  else if(strUA.indexOf("msie") != -1){		ret = "ie"; }
  else if(strUA.indexOf("mozilla/4") != -1){	ret = "nn4"; }
  return ret;
}
function GetRandomHinshu(){
  if(window.XMLHttpRequest) {
    ajax = new XMLHttpRequest();
  } else if(window.ActiveXObject) {
    try {
      ajax = new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
      ajax = new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
  //非同期open
  if ("ff" == checkBrouser()) {
    ajax.onload = statusCheck_random;
  } else {
    ajax.onreadystatechange = statusCheck_random;
  }
  if (0<=document.URL.indexOf('search',0)) {
    ajax.open("GET", "/search/random.php?ajax="+encodeURIComponent("1")+"&search="+encodeURIComponent("1"),false);
  } else {
    ajax.open("GET", "/search/random.php?ajax="+encodeURIComponent("1"),false);
  }
  ajax.send("");
}
function statusCheck_random() {
  if (ajax.readyState == 4 && ajax.status == 200) {
    var res = ajax.responseText;
    res = res.replace(/,/g," ");
    res = res.replace(/\n/g," ");

    // document.writeを退避
    (function() {
      var s = document.write;
      el = document.getElementById('random_hinshu');
      document.write = function(t) {
        el.innerHTML += t;
      };

      // 退避したdocument.writeを戻す関数
      document.write.res = function() {
        document.write = s;
      }
    })();

    document.write(res);

    // document.writeを元に戻す
    document.write.res();

  }
}

