var tag_image = "http://rt.global.yamaha.com/";
var _host = document.location.hostname;
var _path = document.location.pathname;
var _search = document.location.search;
var _protocol = document.location.protocol;
var _referrer = document.referrer;
var _cookie = document.cookie + ";";

function aq_tag(){
  var abc = new Image(1,1);
  var i, path, rhost, rpath, param, cookie, tag_url;
  if (_protocol == "https:" && cksw == 1) tag_image= "https://rt.global.yamaha.com/";
  now=new Date();
  utctime=now.toGMTString();
  rhost = "";
  rpath = "";
  i = _referrer.indexOf("://");

  if (i > 0) {
    _referrer = _referrer.substring(i + 3, _referrer.length);
    i = _referrer.indexOf("/");
    if (i > 0) {
      rhost = _referrer.substring(0, i);
      rpath = _referrer.substring(i, _referrer.length);
    }
  }
  path = "";
  i = _path.indexOf("/");
  if (i >= 0) {
    path = _path.substring(1, _path.length);
  }
  param = "";
  if(_search.length > 1) {
    param = _search.replace("?","&");
  }
/*
  if(_search != null) {
    param = "&" + _search.substring(1,_search.length);
  }
*/
  cookie = getCookie("Apache");
  tag_url = tag_image + "?protocol=" + _protocol +
                        "&host=" + _host + "&path=" + path +
                        "&rhost=" + rhost + "&rpath=" + escape(rpath) +
                        param + "&cookie=" + cookie +
                        "&time=" + escape(utctime)
                        + "&rand=" + Math.random();
  abc.src = tag_url;
  }
function getCookie(keyname) {
  index1 = _cookie.indexOf(keyname,0);
  if(index1 != -1) {
    _cookie = _cookie.substring(index1,_cookie.length);
    index2 = _cookie.indexOf("=",0)+1;
    index3 = _cookie.indexOf(";",index2);
    return(unescape(_cookie.substring(index2,index3)));
  }
  return("");
}
