//======================================================================
// EPSON Maxart site
//   enquete tracking function
//======================================================================

//==================================================
// global values
//==================================================
var gOET_TARGET_URL = "http://www.epson.jp/products/maxart/";
var gOET_COOKIE_PATH = "/";
var gOET_MAX_URL_COUNT = 30;
var gOET_MAX_URL_SIZE  = 2048;
var gOET_TARGET_DIR_LIST  = {"ad":"01","ad/050706":"02","ad/051017":"03","basic":"04","css":"05","dc":"06","dounyu":"07","dounyu/img":"08","gakko":"09","gyousyu":"0a","gyousyu/img":"0b","hansoku":"0c","hs":"0d","img":"0e","img/banner":"0f","img/cmn":"10","img_basic":"11","img_hs":"12","img_k3":"13","include":"14","js":"15","k3":"16","media":"17","media/img":"18","media/img/icon":"19","ndb":"1a","news":"1b","news/img":"1c","npc":"1d","npc/gakko2":"1e","npc/hansoku2":"1f","npc/maxartmedia":"20","npc/px5800print":"21","photographer":"22","photographer/css":"23","photographer/images":"24","photographer/js":"25","photographer_new":"26","photographer_new/css":"27","photographer_new/images":"28","popup":"29","popup/img":"2a","ps":"2b","ps/img":"2c","px10000":"2d","px10000/img":"2e","px5500":"2f","px5500/crispia":"30","px5500/crispia/img":"31","px5500/img":"32","px5500/report":"33","px5500/report/images":"34","px5800":"35","px5800/img":"36","px5800print":"37","px6200s":"38","px6200s/img":"39","px6500":"3a","px6500/img":"3b","px7500":"3c","px7500/img":"3d","px7500s":"3e","px7500s/img":"3f","px9500":"40","px9500/img":"41","px9500s":"42","px9500s/img":"43","setmodel":"44","setmodel/img":"45","software":"46","software/3rdpt":"47","software/cf_img":"48","software/img":"49","software/img/package":"4a","software/img/package/autodesk":"4b","software/img/package/colorbase":"4c","software/img/package/copyfactory2":"4d","software/img/package/easyphotoprint":"4e","software/img/package/gakkou2":"4f","software/img/package/pageproofer":"50","software/img/package/popfactory":"51","software/img/package/popprint":"52","software/img/package/printfactory":"53","software/img/package/rawprint":"54","software/img/package/word2":"55","ss":"56","ss/4adge":"57","ss/4adge/9s7s_img":"58","ss/img":"59","tec":"5a","tec/images":"5b","tokucho":"5c","tokucho/img":"5d","tokucho/tec":"5e","tokucho/tec/images":"5f","youto":"60","youto/img":"61"};
var gOET_TARGET_FILE_LIST = {"1.htm":"01","2.htm":"02","3.htm":"03","4.htm":"04","5.htm":"05","5k9s7s6s.htm":"06","6.htm":"07","9s7s.htm":"08","9s7s_e.htm":"09","9s7s_p.htm":"0a","9s7s_w.htm":"0b","autodesk.htm":"0c","cad.htm":"0d","choujaku.htm":"0e","color.htm":"0f","colorbase.htm":"10","construct.htm":"11","copy.htm":"12","copyfactory2.htm":"13","ctp.htm":"14","developer.htm":"15","developer02.htm":"16","dwf.htm":"17","easyphotoprint.htm":"18","feature03.htm":"19","free_download.htm":"1a","gakkou2.htm":"1b","genuine01.htm":"1c","genuine01_2.htm":"1d","genuine02.htm":"1e","genuine02_2.htm":"1f","genuine03.htm":"20","genuine03_2.htm":"21","genuine04.htm":"22","genuine04_2.htm":"23","genuine05.htm":"24","genuine05_2.htm":"25","genuine06.htm":"26","genuine06_2.htm":"27","genuine07.htm":"28","genuine07_2.htm":"29","genuine07a.htm":"2a","genuine07a_2.htm":"2b","genuine09.htm":"2c","genuine09_2.htm":"2d","genuine12.htm":"2e","genuine12_2.htm":"2f","genuine13.htm":"30","genuine13_2.htm":"31","genuine14.htm":"32","genuine14_2.htm":"33","genuine15.htm":"34","genuine15_2.htm":"35","genuine16.htm":"36","genuine16_2.htm":"37","genuine17.htm":"38","genuine17_2.htm":"39","genuine18.htm":"3a","genuine18_2.htm":"3b","genuine19.htm":"3c","genuine19_2.htm":"3d","genuine20.htm":"3e","genuine20_2.htm":"3f","genuine21.htm":"40","genuine21_2.htm":"41","genuine22.htm":"42","genuine22_2.htm":"43","genuine23.htm":"44","genuine23_2.htm":"45","genuine24.htm":"46","genuine24_2.htm":"47","genuine25.htm":"48","genuine25_2.htm":"49","genuine26.htm":"4a","genuine26_2.htm":"4b","genuine27.htm":"4c","genuine27_2.htm":"4d","genuine28.htm":"4e","genuine28_2.htm":"4f","genuine29.htm":"50","genuine29_2.htm":"51","genuine30.htm":"52","genuine30_2.htm":"53","genuine31.htm":"54","genuine31_2.htm":"55","genuine32.htm":"56","genuine32_2.htm":"57","genuine33.htm":"58","genuine33_2.htm":"59","genuine34.htm":"5a","genuine35.htm":"5b","genuine35_2.htm":"5c","genuine36.htm":"5d","genuine36_2.htm":"5e","genuine37.htm":"5f","genuine37_2.htm":"60","genuine38.htm":"61","genuine38_2.htm":"62","genuine39.htm":"63","genuine39_2.htm":"64","genuine40.htm":"65","genuine41.htm":"66","genuine41_2.htm":"67","genuine42.htm":"68","genuine42_2.htm":"69","graph.htm":"6a","gyousyu_construct.htm":"6b","gyousyu_kouri.htm":"6c","gyousyu_photo.htm":"6d","gyousyu_printing.htm":"6e","gyousyu_school.htm":"6f","gyousyu_service.htm":"70","impression.htm":"71","index.htm":"72","index2.htm":"73","index_2.htm":"74","index_3.htm":"75","info060413.htm":"76","info061004.htm":"77","information.htm":"78","information2.htm":"79","kouri.htm":"7a","lightfastness.htm":"7b","media.htm":"7c","media_3rdpt.htm":"7d","media_mc1.htm":"7e","media_mc2.htm":"7f","media_mc3.htm":"80","media_pm1.htm":"81","media_pm2.htm":"82","media_pm3.htm":"83","media_px1.htm":"84","media_px2.htm":"85","media_px3.htm":"86","mono.htm":"87","newinfo.htm":"88","nobori.htm":"89","owabi_061102.htm":"8a","pageproofer.htm":"8b","photo.htm":"8c","photographer01.htm":"8d","photographer02.htm":"8e","pop.htm":"8f","pop_nobori.htm":"90","pop_poster.htm":"91","popfactory.htm":"92","popprint.htm":"93","popup06.htm":"94","popup_img01.htm":"95","popup_img02-5500.htm":"96","popup_img02-5800.htm":"97","popup_img02-6500.htm":"98","popup_img02-7500.htm":"99","popup_img02-9500.htm":"9a","popup_img03.htm":"9b","popup_img04.htm":"9c","popup_img05.htm":"9d","popup_img06.htm":"9e","popup_img07-5500.htm":"9f","popup_img07-5800.htm":"a0","popup_img07-6200s.htm":"a1","popup_img07-6500.htm":"a2","popup_img07-7500.htm":"a3","popup_img07-7500s.htm":"a4","popup_img07-9500.htm":"a5","popup_img07-9500s.htm":"a6","popup_img08.htm":"a7","popup_img09.htm":"a8","popup_img10-6200s.htm":"a9","popup_img10-6500.htm":"aa","popup_img10-7500.htm":"ab","popup_img10-7500s.htm":"ac","popup_img10-9500.htm":"ad","popup_img10-9500s.htm":"ae","popup_img11.htm":"af","popup_img12.htm":"b0","poster.htm":"b1","presen.htm":"b2","print.htm":"b3","printfactory.htm":"b4","printing.htm":"b5","px10000_2.htm":"b6","px10000_3.htm":"b7","px10000_4.htm":"b8","px5500_1.htm":"b9","px5500_3.htm":"ba","px5500_4.htm":"bb","px5800_1.htm":"bc","px5800_3.htm":"bd","px5800_4.htm":"be","px5800_navi.htm":"bf","px6200s_1.htm":"c0","px6200s_2.htm":"c1","px6200s_3.htm":"c2","px6200s_4.htm":"c3","px6500_1.htm":"c4","px6500_2.htm":"c5","px6500_3.htm":"c6","px6500_4.htm":"c7","px7500_1.htm":"c8","px7500_2.htm":"c9","px7500_3.htm":"ca","px7500_4.htm":"cb","px7500s_1.htm":"cc","px7500s_2.htm":"cd","px7500s_3.htm":"ce","px7500s_4.htm":"cf","px9500_1.htm":"d0","px9500_2.htm":"d1","px9500_3.htm":"d2","px9500_4.htm":"d3","px9500s_1.htm":"d4","px9500s_2.htm":"d5","px9500s_3.htm":"d6","px9500s_4.htm":"d7","quality.htm":"d8","report01.htm":"d9","report02.htm":"da","report03.htm":"db","report04.htm":"dc","report05.htm":"dd","report06.htm":"de","report07.htm":"df","report08.htm":"e0","report09.htm":"e1","report10.htm":"e2","report11.htm":"e3","rip.htm":"e4","school.htm":"e5","service.htm":"e6","sokutei.htm":"e7","sougou.htm":"e8","special01.htm":"e9","special02.htm":"ea","special03.htm":"eb","speed.htm":"ec","taikousei.htm":"ed","utility.htm":"ee","word2.htm":"ef"};

//==================================================
// url data object
//==================================================
function oetUrlData() {
  this.dir  = "";
  this.file = "";
  var oDate = new Date();
  this.time = oDate.getTime();
  this.cookie = "";
}
oetUrlData.prototype.fromCookie = _oetUrlData_fromCookie;
oetUrlData.prototype.setUrl     = _oetUrlData_setUrl;
oetUrlData.prototype.toCookie   = _oetUrlData_toCookie;

//--------------------------------------------------
// method:fromCookie
//--------------------------------------------------
function _oetUrlData_fromCookie(argCookie) {

  this.cookie = argCookie;
  var tmpCookie = argCookie;
  var arrCookie = tmpCookie.split("|");
  for (var i=0; i<arrCookie.length; i++) {
    var nm = arrCookie[i].substr(0,2);
    var vl = arrCookie[i].substr(2);
    if      (nm == "D:") { this.dir  = vl; }
    else if (nm == "F:") { this.file = vl; }
    else if (nm == "T:") { this.time = vl; }
  }

  return this;
}

//--------------------------------------------------
// method:setUrl
//--------------------------------------------------
function _oetUrlData_setUrl(argUrl) {

  // URLを分解
  var spIdx = argUrl.lastIndexOf("/");

  var tgUrlDir, tgUrlFile;
  if (spIdx < 0) {
    // maxart直下
    tgUrlDir  = "";
    tgUrlFile = argUrl;
  } else {
    // サブディレクトリ有り
    tgUrlDir  = argUrl.substr(0,spIdx);
    tgUrlFile = argUrl.substr(spIdx + 1);
  }

  // URLをコード化する
  var zUrlDir = gOET_TARGET_DIR_LIST[tgUrlDir];
  if (zUrlDir) {
    zUrlDir = "$" + zUrlDir;
  } else {
    zUrlDir = tgUrlDir;
  }
  var zUrlFile = gOET_TARGET_FILE_LIST[tgUrlFile];
  if (zUrlFile) {
    zUrlFile = "$" + zUrlFile;
  } else {
    zUrlFile = tgUrlFile;
  }

  this.dir  = zUrlDir;
  this.file = zUrlFile;
  var oDate = new Date();
  this.time = oDate.getTime();
  this.cookie = this.toCookie();

  return this;
}

//--------------------------------------------------
// method:toCookie
//--------------------------------------------------
function _oetUrlData_toCookie() {
  var strCookie = "";

  strCookie += "D:" + this.dir  + "|";
  strCookie += "F:" + this.file + "|";
  strCookie += "T:" + this.time + "|";

  this.cookie = strCookie;
  return strCookie;
}

//--------------------------------------------------
// method:length
//--------------------------------------------------
function _oetUrlData_length() {
  return this.cookie.length;
}

//==================================================
// cookie data object
//==================================================
function oetCookieData() {
  var oDate = new Date();
  this.time = oDate.getTime();
  this.size = 0;
  this.urlData = new Array();

}
oetCookieData.prototype.fromCookie = _oetCookieData_fromCookie;
oetCookieData.prototype.addUrlData = _oetCookieData_addUrlData;
oetCookieData.prototype.toCookie   = _oetCookieData_toCookie;

//--------------------------------------------------
// method:fromCookie
//--------------------------------------------------
function _oetCookieData_fromCookie(argCookie) {

  var tmpCookie = argCookie;
  var arrCookie = tmpCookie.split("@");
  if (arrCookie.length < 2) { return this; }

  var strTime = arrCookie[0];
  var strSize = arrCookie[1];
  if (strSize != arrCookie.length - 3) { return this; }

  var arrUrlData = new Array();
  for (i=2; i<arrCookie.length - 1; i++){
    var oUrlData = new oetUrlData();
    oUrlData.fromCookie(arrCookie[i]);
    arrUrlData[i-2] = oUrlData;
  }

  this.time = strTime;
  this.size = strSize;
  this.urlData = arrUrlData;

  return this;
}

//--------------------------------------------------
// method:addUrlData
//--------------------------------------------------
function _oetCookieData_addUrlData(argUrlData) {

  var newUrlData = new Array();
  var newSize = 0;

  if (this.urlData.length != 0 && argUrlData.dir == this.urlData[0].dir &&  argUrlData.file == this.urlData[0].file ) {
    this.urlData[0].time = argUrlData.time - this.time;
    return this;
  }

  newUrlData[0] = argUrlData;
  newUrlData[0].time -= this.time;
  newSize = argUrlData.cookie.length;
  for (i=0; i<this.urlData.length && i<gOET_MAX_URL_COUNT-1; i++) {
    var aUrlData = this.urlData[i];
    newSize += aUrlData.cookie.length;
    if (newSize > gOET_MAX_URL_SIZE) { break; }
    newUrlData[i+1] = this.urlData[i];
  }

  this.urlData = newUrlData;
  this.size = newUrlData.length;

  return this;
}

//--------------------------------------------------
// method:toCookie
//--------------------------------------------------
function _oetCookieData_toCookie() {
  var strCookie = "";

  strCookie += this.time + "@";
  strCookie += this.urlData.length + "@";
  for (i = 0; i < this.urlData.length; i++) {
    strCookie += this.urlData[i].toCookie() + "@";
  }

  this.cookie = strCookie;
  return strCookie;
}

//==================================================
// misc
//==================================================
function oetIsNumber(argNum) {
  var strNum = "0123456789";
  for (i = 0; i < strNum.length; i++) {
    if (strNum.indexOf(argNum.charAt(i)) < 0) { return false; }
  }
  return true;
}

//==================================================
// main process
//==================================================
function oet_client_main() {

  // 対象URLかどうかのチェック
  var chkUrl = location.href;
  if (chkUrl.substr(0,gOET_TARGET_URL.length) != gOET_TARGET_URL) { return false; }
  var tgUrl = chkUrl.substr(gOET_TARGET_URL.length);

  var oUrlData = new oetUrlData();
  oUrlData.setUrl(tgUrl);

  var oCookieData = new oetCookieData();

  var strCookie = document.cookie;
  var arrCookie = strCookie.split("; ");
  var tgCookie = "";
  for (var i=0; i<arrCookie.length; i++) {
    if (arrCookie[i].substr(0,8) == "metdata=") {
      tgCookie = arrCookie[i].substr(8);
      break;
    }
  }

  if (tgCookie.length != 0) {
    oCookieData.fromCookie(tgCookie);
  }

  oCookieData.addUrlData(oUrlData);

  strCookie = oCookieData.toCookie();

  //document.cookie = "metdata=" + strCookie + ";path=" + gOET_COOKIE_PATH;
  ept_set_cookie(null, oCookieData);

  return true;
}

function ept_set_cookie(oetObj, metObj) {
  var oOCookieData = new oetCookieData(); // offirio
  var oMCookieData = new oetCookieData(); // maxart

  var strCookie = document.cookie;
  var arrCookie = strCookie.split("; ");
  var tgOCookie = "";
  var tgMCookie = "";
  for (var i=0; i<arrCookie.length; i++) {
    if (arrCookie[i].substr(0,8) == "oetdata=") {
      tgOCookie = arrCookie[i].substr(8);
      oOCookieData.fromCookie(tgOCookie);
    }
    if (arrCookie[i].substr(0,8) == "metdata=") {
      tgMCookie = arrCookie[i].substr(8);
      oMCookieData.fromCookie(tgMCookie);
    }
  }

  if (oetObj) { oOCookieData = oetObj; }
  if (metObj) { oMCookieData = metObj; }

  var newOUrlData = new Array();
  var newMUrlData = new Array();
  var olen = oOCookieData.urlData.length;
  var mlen = oMCookieData.urlData.length;
  var ai = 0;
  var oi = 0;
  var mi = 0;
  var newSize = 0;
//  alert(olen + mlen);
  for (ai=0; ai<olen+mlen; ai++) {
    // offirio と maxart どちらにもオブジェクトがある場合
    if (oi < olen && mi < mlen) {
      var oOUrlData = oOCookieData.urlData[oi];
      var oMUrlData = oMCookieData.urlData[mi];

      // offirio と maxart どちらが新しいか
      var ot = new Date(parseInt(oOUrlData.time) + parseInt(oOCookieData.time));
      var mt = new Date(parseInt(oMUrlData.time) + parseInt(oMCookieData.time));
      if (ot > mt) {
//        alert('oimi - o '+'['+ot.toLocaleString()+']['+mt.toLocaleString()+']');
        // offirioの方が新しい
        newSize += oOUrlData.cookie.length;
        if (newSize > gOET_MAX_URL_SIZE) { break; }
        newOUrlData[oi] = oOUrlData;
        oi++;
      } else {
//        alert('oimi - m '+'['+ot.toLocaleString()+']['+mt.toLocaleString()+']');
        // maxartの方が新しい
        newSize += oMUrlData.cookie.length;
        if (newSize > gOET_MAX_URL_SIZE) { break; }
        newMUrlData[mi] = oMUrlData;
        mi++;
      }
    } else if (oi >= olen) {
//      alert('mi');
      // offirio のオブジェクトがないので maxart を処理する
      var oMUrlData = oMCookieData.urlData[mi];
      newSize += oMUrlData.cookie.length;
      if (newSize > gOET_MAX_URL_SIZE) { break; }
      newMUrlData[mi] = oMUrlData;
      mi++;
    } else if (mi >= mlen) {
//      alert('oi');
      // maxart のオブジェクトがないので offirio を処理する
      var oOUrlData = oOCookieData.urlData[oi];
      newSize += oOUrlData.cookie.length;
      if (newSize > gOET_MAX_URL_SIZE) { break; }
      newOUrlData[oi] = oOUrlData;
      oi++;
    } else {
//      alert('other');
    }
  }

  oOCookieData.urlData = newOUrlData;
  oOCookieData.size    = newOUrlData.length;
  oMCookieData.urlData = newMUrlData;
  oMCookieData.size    = newMUrlData.length;

  var strOCookie = "";
  var strMCookie = "";

  if (oOCookieData.urlData.length > 0) { strOCookie = oOCookieData.toCookie(); }
  if (oMCookieData.urlData.length > 0) { strMCookie = oMCookieData.toCookie(); }

  if (olen > 0) {
    if (strOCookie.length > 0) {
      document.cookie = "oetdata=" + strOCookie + ";path=" + gOET_COOKIE_PATH;
    } else {
      document.cookie = "oetdata=;expires=Thu, 01-Jan-1970 00:00:00 GMT;path=" + gOET_COOKIE_PATH;;
    }
  }
  if (mlen > 0) {
    if (strMCookie.length > 0) {
      document.cookie = "metdata=" + strMCookie + ";path=" + gOET_COOKIE_PATH;
    } else {
      document.cookie = "metdata=;expires=Thu, 01-Jan-1970 00:00:00 GMT;path=" + gOET_COOKIE_PATH;;
    }
  }
}

//**********************************************************************//
//**********************************************************************//
//**********************************************************************//

//==================================================
// global values (User Access Analysis)
//==================================================
var gOUAA_TARGET_URL = "http://www.epson.jp/products/maxart/";
var gOUAA_COOKIE_PATH = "/";
var gOUAA_MAX_URL_COUNT = 384;
var gOUAA_MAX_URL_SIZE  = 1536;
var gOUAA_HTML_COUNT_BEFOR = "<script type='text/javascript' language='JavaScript' src='http://www.epson.jp/cgi-bin/maxart/enq/count.cgi";
var gOUAA_HTML_COUNT_AFTER = "'></script>";
var gOUAA_TARGET_URL_LIST  = {"index.htm":"001","gakkou2.htm":"002","info060413.htm":"003","info061004.htm":"004","information.htm":"005","information2.htm":"006","newinfo.htm":"007","ad/050706/1.htm":"008","ad/050706/2.htm":"009","ad/050706/3.htm":"010","ad/050706/4.htm":"011","ad/050706/5.htm":"012","ad/050706/6.htm":"013","ad/051017/dwf.htm":"014","basic/":"015","dc/quality.htm":"016","dc/sougou.htm":"017","dc/speed.htm":"018","dounyu/":"019","dounyu/popup06.htm":"020","dounyu/report01.htm":"021","dounyu/report02.htm":"022","dounyu/report03.htm":"023","dounyu/report04.htm":"024","dounyu/report05.htm":"025","dounyu/report06.htm":"026","dounyu/report07.htm":"027","dounyu/report08.htm":"028","dounyu/report09.htm":"029","dounyu/report10.htm":"030","dounyu/report11.htm":"031","gakko/":"032","gyousyu/construct.htm":"033","gyousyu/":"034","gyousyu/kouri.htm":"035","gyousyu/photo.htm":"036","gyousyu/printing.htm":"037","gyousyu/school.htm":"038","gyousyu/service.htm":"039","hansoku/":"040","hs/":"041","k3/":"042","media/genuine01.htm":"043","media/genuine01_2.htm":"044","media/genuine02.htm":"045","media/genuine02_2.htm":"046","media/genuine03.htm":"047","media/genuine03_2.htm":"048","media/genuine04.htm":"049","media/genuine04_2.htm":"050","media/genuine05.htm":"051","media/genuine05_2.htm":"052","media/genuine06.htm":"053","media/genuine06_2.htm":"054","media/genuine07.htm":"055","media/genuine07_2.htm":"056","media/genuine07a.htm":"057","media/genuine07a_2.htm":"058","media/genuine09.htm":"059","media/genuine09_2.htm":"060","media/genuine12.htm":"061","media/genuine12_2.htm":"062","media/genuine13.htm":"063","media/genuine13_2.htm":"064","media/genuine14.htm":"065","media/genuine14_2.htm":"066","media/genuine15.htm":"067","media/genuine15_2.htm":"068","media/genuine16.htm":"069","media/genuine16_2.htm":"070","media/genuine17.htm":"071","media/genuine17_2.htm":"072","media/genuine18.htm":"073","media/genuine18_2.htm":"074","media/genuine19.htm":"075","media/genuine19_2.htm":"076","media/genuine20.htm":"077","media/genuine20_2.htm":"078","media/genuine21.htm":"079","media/genuine21_2.htm":"080","media/genuine22.htm":"081","media/genuine22_2.htm":"082","media/genuine23.htm":"083","media/genuine23_2.htm":"084","media/genuine24.htm":"085","media/genuine24_2.htm":"086","media/genuine25.htm":"087","media/genuine25_2.htm":"088","media/genuine26.htm":"089","media/genuine26_2.htm":"090","media/genuine27.htm":"091","media/genuine27_2.htm":"092","media/genuine28.htm":"093","media/genuine28_2.htm":"094","media/genuine29.htm":"095","media/genuine29_2.htm":"096","media/genuine30.htm":"097","media/genuine30_2.htm":"098","media/genuine31.htm":"099","media/genuine31_2.htm":"100","media/genuine32.htm":"101","media/genuine32_2.htm":"102","media/genuine33.htm":"103","media/genuine33_2.htm":"104","media/genuine34.htm":"105","media/genuine35.htm":"106","media/genuine35_2.htm":"107","media/genuine36.htm":"108","media/genuine36_2.htm":"109","media/genuine37.htm":"110","media/genuine37_2.htm":"111","media/genuine38.htm":"112","media/genuine38_2.htm":"113","media/genuine39.htm":"114","media/genuine39_2.htm":"115","media/genuine40.htm":"116","media/genuine41.htm":"117","media/genuine41_2.htm":"118","media/genuine42.htm":"119","media/genuine42_2.htm":"120","media/media.htm":"121","media/media_3rdpt.htm":"122","media/media_mc1.htm":"123","media/media_mc2.htm":"124","media/media_mc3.htm":"125","media/media_pm1.htm":"126","media/media_pm2.htm":"127","media/media_pm3.htm":"128","media/media_px1.htm":"129","media/media_px2.htm":"130","media/media_px3.htm":"131","ndb/":"132","news/owabi_061102.htm":"133","npc/gakko2/":"134","npc/hansoku2/":"135","npc/maxartmedia/":"136","npc/px5800print/":"137","photographer/":"138","photographer/photographer01.htm":"139","photographer/photographer02.htm":"140","photographer/special01.htm":"141","photographer/special02.htm":"142","photographer/special03.htm":"143","photographer_new/":"144","photographer_new/special01.htm":"145","photographer_new/special02.htm":"146","popup/gyousyu_construct.htm":"147","popup/gyousyu_kouri.htm":"148","popup/gyousyu_photo.htm":"149","popup/gyousyu_printing.htm":"150","popup/gyousyu_school.htm":"151","popup/gyousyu_service.htm":"152","popup/popup_img01.htm":"153","popup/popup_img02-5500.htm":"154","popup/popup_img02-5800.htm":"155","popup/popup_img02-6500.htm":"156","popup/popup_img02-7500.htm":"157","popup/popup_img02-9500.htm":"158","popup/popup_img03.htm":"159","popup/popup_img04.htm":"160","popup/popup_img05.htm":"161","popup/popup_img06.htm":"162","popup/popup_img07-5500.htm":"163","popup/popup_img07-5800.htm":"164","popup/popup_img07-6200s.htm":"165","popup/popup_img07-6500.htm":"166","popup/popup_img07-7500.htm":"167","popup/popup_img07-7500s.htm":"168","popup/popup_img07-9500.htm":"169","popup/popup_img07-9500s.htm":"170","popup/popup_img08.htm":"171","popup/popup_img09.htm":"172","popup/popup_img10-6200s.htm":"173","popup/popup_img10-6500.htm":"174","popup/popup_img10-7500.htm":"175","popup/popup_img10-7500s.htm":"176","popup/popup_img10-9500.htm":"177","popup/popup_img10-9500s.htm":"178","popup/popup_img11.htm":"179","popup/popup_img12.htm":"180","popup/sokutei.htm":"181","popup/taikousei.htm":"182","ps/":"183","ps/index_2.htm":"184","ps/index_3.htm":"185","px10000/feature03.htm":"186","px10000/px10000_2.htm":"187","px10000/px10000_3.htm":"188","px10000/px10000_4.htm":"189","px5500/":"190","px5500/px5500_1.htm":"191","px5500/px5500_3.htm":"192","px5500/px5500_4.htm":"193","px5500/crispia/":"194","px5500/report/impression.htm":"195","px5800/":"196","px5800/px5800_1.htm":"197","px5800/px5800_3.htm":"198","px5800/px5800_4.htm":"199","px5800/px5800_navi.htm":"200","px5800print/":"201","px6200s/px6200s_1.htm":"202","px6200s/px6200s_2.htm":"203","px6200s/px6200s_3.htm":"204","px6200s/px6200s_4.htm":"205","px6500/px6500_1.htm":"206","px6500/px6500_2.htm":"207","px6500/px6500_3.htm":"208","px6500/px6500_4.htm":"209","px7500/px7500_1.htm":"210","px7500/px7500_2.htm":"211","px7500/px7500_3.htm":"212","px7500/px7500_4.htm":"213","px7500s/px7500s_1.htm":"214","px7500s/px7500s_2.htm":"215","px7500s/px7500s_3.htm":"216","px7500s/px7500s_4.htm":"217","px9500/px9500_1.htm":"218","px9500/px9500_2.htm":"219","px9500/px9500_3.htm":"220","px9500/px9500_4.htm":"221","px9500s/px9500s_1.htm":"222","px9500s/px9500s_2.htm":"223","px9500s/px9500s_3.htm":"224","px9500s/px9500s_4.htm":"225","setmodel/cad.htm":"226","setmodel/choujaku.htm":"227","setmodel/":"228","setmodel/nobori.htm":"229","setmodel/pop_nobori.htm":"230","setmodel/pop_poster.htm":"231","setmodel/poster.htm":"232","setmodel/print.htm":"233","setmodel/school.htm":"234","software/autodesk.htm":"235","software/colorbase.htm":"236","software/copyfactory2.htm":"237","software/easyphotoprint.htm":"238","software/gakkou2.htm":"239","software/":"240","software/pageproofer.htm":"241","software/popfactory.htm":"242","software/popprint.htm":"243","software/printfactory.htm":"244","software/word2.htm":"245","software/3rdpt/cad.htm":"246","software/3rdpt/choujaku.htm":"247","software/3rdpt/color.htm":"248","software/3rdpt/copy.htm":"249","software/3rdpt/ctp.htm":"250","software/3rdpt/":"251","software/3rdpt/rip.htm":"252","ss/free_download.htm":"253","ss/":"254","ss/4adge/5k9s7s6s.htm":"255","ss/4adge/9s7s.htm":"256","ss/4adge/9s7s_e.htm":"257","ss/4adge/9s7s_p.htm":"258","ss/4adge/9s7s_w.htm":"259","tec/color.htm":"260","tec/developer.htm":"261","tec/developer02.htm":"262","tec/graph.htm":"263","tec/":"264","tec/index2.htm":"265","tec/lightfastness.htm":"266","tec/mono.htm":"267","tokucho/":"268","tokucho/quality.htm":"269","tokucho/speed.htm":"270","tokucho/utility.htm":"271","tokucho/tec/color.htm":"272","tokucho/tec/developer.htm":"273","tokucho/tec/developer02.htm":"274","tokucho/tec/graph.htm":"275","tokucho/tec/":"276","tokucho/tec/index2.htm":"277","tokucho/tec/lightfastness.htm":"278","tokucho/tec/mono.htm":"279","youto/cad.htm":"280","youto/choujaku.htm":"281","youto/copy.htm":"282","youto/":"283","youto/pop.htm":"284","youto/presen.htm":"285"};

//==================================================
// access data object
//==================================================
function ouaaUrlData() {
  this.code    = "";          // URLコード
  this.date    = "";          // 最終アクセス日
  this.revisit = "";          // 再訪問フラグ
  this.session = false;       // セッションフラグ
  this.cookie  = "";          // Cookieデータ
}
ouaaUrlData.prototype.fromCookie      = _ouaaUrlData_fromCookie;
ouaaUrlData.prototype.toCookie        = _ouaaUrlData_toCookie;
ouaaUrlData.prototype.setUrl          = _ouaaUrlData_setUrl;

//--------------------------------------------------
// method:fromCookie
//--------------------------------------------------
function _ouaaUrlData_fromCookie(argCookie) {

  this.cookie = argCookie;
  var tmpCookie = argCookie;
  var arrCookie = tmpCookie.split("|");
  if (arrCookie.length != 3) { return; }

  this.code    = arrCookie[0];
  this.date    = arrCookie[1];
  this.revisit = arrCookie[2];

  return this;
}

//--------------------------------------------------
// method:toCookie
//--------------------------------------------------
function _ouaaUrlData_toCookie() {
  var strCookie = "";

  strCookie = this.code  + "|" + this.date  + "|" + this.revisit;

  this.cookie = strCookie;
  return strCookie;
}

//--------------------------------------------------
// method:setUrl
//--------------------------------------------------
function _ouaaUrlData_setUrl(argUrl) {

  // URLをコード化する
  var zUrlCode = gOUAA_TARGET_URL_LIST[argUrl];
  if (!zUrlCode) {
    zUrlCode = argUrl;  // コード化出来ないためそのまま保存
  }

  // 日付データの作成
  var oDate = new Date();
  var strDate = ("0"  + oDate.getYear()).substr(-1)
    + ("00" + oDate.getMonth()).substr(-2)
    + ("00" + oDate.getDate()).substr(-2);

  this.code    = zUrlCode;
  this.date    = strDate;
  this.revisit = "";
  this.session = true;
  this.cookie  = this.toCookie();

  return this;
}

//==================================================
// cookie data object (User Access Analysis)
//==================================================
function ouaaCookieData() {
  var oDate = new Date();
  this.date    = "";            // 最終アクセス日
  this.revisit = "";            // 再訪問フラグ
  this.size    = 0;             // アクセス履歴数
  this.urlData = new Array();   // アクセス履歴

  this.session = false;         // セッションフラグ

  this.uniqueSiteFlag  = false; // 日別ユニークサイト呼び出しフラグ
  this.uniquePageFlag  = false; // 日別ユニークページ呼び出しフラグ
  this.revisitSiteFlag = false; // 再訪問サイト呼び出しフラグ
  this.revisitPageFlag = false; // 再訪問ページ呼び出しフラグ

  this.cookie  = "";            // Cookieデータ
}
ouaaCookieData.prototype.fromCookie       = _ouaaCookieData_fromCookie;
ouaaCookieData.prototype.toCookie         = _ouaaCookieData_toCookie;
ouaaCookieData.prototype.toSessionCookie  = _ouaaCookieData_toSessionCookie;
ouaaCookieData.prototype.addUrl           = _ouaaCookieData_addUrl;
ouaaCookieData.prototype.getUrlData       = _ouaaCookieData_getUrlData;
ouaaCookieData.prototype.checkUrl         = _ouaaCookieData_checkUrl;
ouaaCookieData.prototype.countUniqueSite  = _ouaaCookieData_countUniqueSite;
ouaaCookieData.prototype.countUniquePage  = _ouaaCookieData_countUniquePage;
ouaaCookieData.prototype.countRevisitSite = _ouaaCookieData_countRevisitSite;
ouaaCookieData.prototype.countRevisitPage = _ouaaCookieData_countRevisitPage;

//--------------------------------------------------
// method:fromCookie
//--------------------------------------------------
function _ouaaCookieData_fromCookie(argCookie, argSessionCookie) {

  this.cookie = argCookie;

  var tmpCookie = argCookie;
  var arrCookie = tmpCookie.split("@");
  if (arrCookie.length < 3) { return this; }

  var strDate    = arrCookie[0];
  var strRevisit = arrCookie[1];
  var strSize    = arrCookie[2];
  if (strSize != arrCookie.length - 4) { return this; }

  var tmpSC = argSessionCookie;
  var arrSC = tmpSC.split("@");

  var arrUrlData = new Array();
  for (i = 3; i < arrCookie.length - 1; i++) {
    var oUrlData = new ouaaUrlData();
    oUrlData.fromCookie(arrCookie[i]);
    for (n = 0; n < arrSC.length - 1; n++) {
      if (arrSC[n] == oUrlData.code) {
        oUrlData.session = true;
        break;
      }
    }
    arrUrlData[i-3] = oUrlData;
  }

  this.date    = strDate;
  this.revisit = strRevisit;
  this.size    = arrUrlData.length;
  this.urlData = arrUrlData;
  if (argSessionCookie != "") {
    this.session = true;
  }

  return this;
}

//--------------------------------------------------
// method:toCookie
//--------------------------------------------------
function _ouaaCookieData_toCookie() {
  var strCookie = "";

  strCookie += this.date + "@";
  strCookie += this.revisit + "@";
  strCookie += this.urlData.length + "@";
  for (i = 0; i < this.urlData.length; i++) {
    strCookie += this.urlData[i].toCookie() + "@";
  }


  this.cookie = strCookie;
  return strCookie;
}

//--------------------------------------------------
// method:toSessionCookie
//--------------------------------------------------
function _ouaaCookieData_toSessionCookie() {
  var strCookie = "";

  for (i = 0; i < this.urlData.length; i++) {
    if (this.urlData[i].session == true) {
      strCookie += this.urlData[i].code + "@";
    }
  }

  return strCookie;
}

//--------------------------------------------------
// method:addUrl
//--------------------------------------------------
function _ouaaCookieData_addUrl(argUrl) {

  // 既にオブジェクトがあれば終了
  if (this.getUrlData(argUrl)) { return; }

  // UrlDataオブジェクトを作成
  var ouUrlData = new ouaaUrlData();
  ouUrlData.setUrl(argUrl);

  this.urlData[this.size] = ouUrlData;
  this.size++;

  return this;
}

//--------------------------------------------------
// method:getUrlData
//--------------------------------------------------
function _ouaaCookieData_getUrlData(argUrl) {

  // URLをコード化する
  var zUrlCode = gOUAA_TARGET_URL_LIST[argUrl];
  if (!zUrlCode) {
    zUrlCode = argUrl;
  }

  for (i = 0; i < this.urlData.length; i++) {
    if (this.urlData[i].code == zUrlCode) {
      return this.urlData[i];
    }
  }

  return;
}

//--------------------------------------------------
// method:checkUrl
//--------------------------------------------------
function _ouaaCookieData_checkUrl(argUrl) {

  // 今日の日付
  var oDate = new Date();
  var strDate = ("0"  + oDate.getYear()).substr(-1)
    + ("00" + oDate.getMonth()).substr(-2)
    + ("00" + oDate.getDate()).substr(-2);

  if (this.session == false) {
    // 初回アクセス

    // 日別ユニーク判断
    if (this.date != strDate) {
      this.uniqueSiteFlag = true;
    }

    // 再訪問判断
    if (this.date != "" && this.revisit == "") {
      this.revisitSiteFlag = true;
      this.revisit = "1";
    }

  }
  // 今日の日付を設定
  this.date = strDate;
  this.session = true;

  // URLオブジェクト
  var ouUrlData = this.getUrlData(argUrl);

  if (!ouUrlData) {
    // 初回アクセス
    this.uniquePageFlag = true;
    this.addUrl(argUrl);

  } else {
    if (ouUrlData.session == false) {

      // 日別ページユニーク判断
      if (ouUrlData.date != strDate) {
        this.uniquePageFlag = true;
      }

      // 再訪問ページ判断
      if (ouUrlData.revisit == "") {
        this.revisitPageFlag = true;
        ouUrlData.revisit = "1";
      }

    }
    ouUrlData.date = strDate;
    ouUrlData.session = true;
  }

}

//--------------------------------------------------
// method:countUniqueSite - 日別ユニーク
//--------------------------------------------------
function _ouaaCookieData_countUniqueSite() {

  if (this.uniqueSiteFlag) {

    // カウンターの呼び出し
    var strParam = "?t=1&u=";
    document.write(gOUAA_HTML_COUNT_BEFOR + strParam + gOUAA_HTML_COUNT_AFTER);

  }

  return true;
}

//--------------------------------------------------
// method:countUniquePage - 日別ユニーク(ページ)
//--------------------------------------------------
function _ouaaCookieData_countUniquePage(argUrl) {

  if (this.uniquePageFlag) {

    // カウンターの呼び出し
    var strUrl = escape(argUrl.replace(/[\/\.]/g, '_'));
    var chkIdx = -1;
    chkIdx = strUrl.indexOf('%');
    if (chkIdx < 0) {
      var strParam = "?t=2&u=" + strUrl;
      document.write(gOUAA_HTML_COUNT_BEFOR + strParam + gOUAA_HTML_COUNT_AFTER);
    }
  }

  return;
}

//--------------------------------------------------
// method:countRevisitSite - 再訪問
//--------------------------------------------------
function _ouaaCookieData_countRevisitSite() {

  if (this.revisitSiteFlag) {

    // カウンターの呼び出し
    var strParam = "?t=3&u=";
    document.write(gOUAA_HTML_COUNT_BEFOR + strParam + gOUAA_HTML_COUNT_AFTER);

  }

  return;
}

//--------------------------------------------------
// method:countRevisitPage - 再訪問(ページ)
//--------------------------------------------------
function _ouaaCookieData_countRevisitPage(argUrl) {

  if (this.revisitPageFlag) {

    // カウンターの呼び出し
    var strUrl = escape(argUrl.replace(/[\/\.]/g, '_'));
    var chkIdx = -1;
    chkIdx = strUrl.indexOf('%');
    if (chkIdx < 0) {
      var strParam = "?t=4&u=" + strUrl;
      document.write(gOUAA_HTML_COUNT_BEFOR + strParam + gOUAA_HTML_COUNT_AFTER);
    }
  }

  return;
}

//==================================================
// main process (User Access Analysis)
//==================================================
function ouaa_client_main() {

  // 対象URLかどうかのチェック
  var chkUrl = location.href;
  if (chkUrl.substr(0,gOUAA_TARGET_URL.length) != gOUAA_TARGET_URL) { return false; }
  var tgUrl = chkUrl.substr(gOUAA_TARGET_URL.length);
  var chkIdx = -1;
  chkIdx = tgUrl.indexOf('?');   if (chkIdx >= 0) { tgUrl = tgUrl.substr(0, chkIdx); }
  chkIdx = tgUrl.indexOf('#');   if (chkIdx >= 0) { tgUrl = tgUrl.substr(0, chkIdx); }
  chkIdx = tgUrl.indexOf('%23'); if (chkIdx >= 0) { tgUrl = tgUrl.substr(0, chkIdx); }
  chkIdx = tgUrl.indexOf('%3f'); if (chkIdx >= 0) { tgUrl = tgUrl.substr(0, chkIdx); }
  chkIdx = tgUrl.indexOf('%3F'); if (chkIdx >= 0) { tgUrl = tgUrl.substr(0, chkIdx); }
  tgUrl = tgUrl.replace(/\/index.htm$/,'/');
  if (tgUrl == "") { tgUrl = "index.htm"; }

  // 操作対象Cookieを取り出す
  var strCookie = document.cookie;
  var arrCookie = strCookie.split(";");
  var tgCookie = "";
  var ssCookie = "";
  for (i=0; i<arrCookie.length; i++) {
    var wkCookie = arrCookie[i].replace(/(^\s+|\s+$)/g,'');
    if (wkCookie.substr(0,9) == "muaadata=") {
      tgCookie = wkCookie.substr(9);
    }
    if (wkCookie.substr(0,12) == "muaasession=") {
      ssCookie = wkCookie.substr(12);
    }
  }

  // Cookieからオブジェクトの作成
  var ouCookieData = new ouaaCookieData();
  if (tgCookie.length != 0) {
    ouCookieData.fromCookie(tgCookie, ssCookie);
  }

  // カウンター判断
  ouCookieData.checkUrl(tgUrl);

  // カウンターの呼び出し
  ouCookieData.countUniqueSite();         // 日別ユニーク
  ouCookieData.countUniquePage(tgUrl);    // 日別ユニーク(ページ)
  ouCookieData.countRevisitSite();        // 再訪問
  ouCookieData.countRevisitPage(tgUrl);   // 再訪問(ページ)

  epuaa_set_cookie(null, ouCookieData);

  // アクセスしたURLの情報を更新
//  strCookie = ouCookieData.toCookie();
//  strSessionCookie = ouCookieData.toSessionCookie();

//  var exDate = new Date();
//  exDate.setTime(exDate.getTime() + 30 * 24 * 60 * 60 * 1000);
//  document.cookie = "muaadata=" + strCookie + "; path=" + gOUAA_COOKIE_PATH + "; expires=" + exDate.toGMTString();
//  document.cookie = "muaasession=" + strSessionCookie + "; path=" + gOUAA_COOKIE_PATH;

  return true;
}

function epuaa_set_cookie(ouaaObj, muaaObj) {
  var ouOCookieData = new ouaaCookieData();
  var ouMCookieData = new ouaaCookieData();

  // 操作対象Cookieを取り出す
  var strCookie = document.cookie;
  var arrCookie = strCookie.split(";");
  var tgOCookie = "";
  var ssOCookie = "";
  var tgMCookie = "";
  var ssMCookie = "";
  for (i=0; i<arrCookie.length; i++) {
    var wkCookie = arrCookie[i].replace(/(^\s+|\s+$)/g,'');
    if (wkCookie.substr(0,9) == "ouaadata=") {
      tgOCookie = wkCookie.substr(9);
    }
    if (wkCookie.substr(0,12) == "ouaasession=") {
      ssOCookie = wkCookie.substr(12);
    }
    if (wkCookie.substr(0,9) == "muaadata=") {
      tgMCookie = wkCookie.substr(9);
    }
    if (wkCookie.substr(0,12) == "muaasession=") {
      ssMCookie = wkCookie.substr(12);
    }
  }

  // Cookieからオブジェクトの作成
  if (tgOCookie.length != 0) {
    ouOCookieData.fromCookie(tgOCookie, ssOCookie);
  }
  if (tgMCookie.length != 0) {
    ouMCookieData.fromCookie(tgMCookie, ssMCookie);
  }

  if (ouaaObj) { ouOCookieData = ouaaObj; }
  if (muaaObj) { ouMCookieData = muaaObj; }

  var newOUrlData = new Array();
  var newMUrlData = new Array();
  var olen = ouOCookieData.urlData.length;
  var mlen = ouMCookieData.urlData.length;
  var ai = 0;
  var oi = 0;
  var mi = 0;

  strCookie = ouOCookieData.toCookie() + ouOCookieData.toSessionCookie() + ouMCookieData.toCookie() + ouMCookieData.toSessionCookie();

  if (strCookie.length > gOUAA_MAX_URL_SIZE) {
    if (ouOCookieData.urlData.length > 0) {
      for (oi=1;oi<ouOCookieData.urlData.length;oi++) {
        newOUrlData[oi-1] = ouOCookieData.urlData[oi];
      }
    }
    if (ouMCookieData.urlData.length > 0) {
      for (mi=1;mi<ouMCookieData.urlData.length;mi++) {
        newMUrlData[mi-1] = ouMCookieData.urlData[mi];
      }
    }

    ouOCookieData.urlData = newOUrlData;
    ouMCookieData.urlData = newMUrlData;
  }

  var strOCookie = "";
  var strOSessionCookie = "";
  var strMCookie = "";
  var strMSessionCookie = "";

  if (ouOCookieData.urlData.length > 0) {
    strOCookie = ouOCookieData.toCookie();
    strOSessionCookie = ouOCookieData.toSessionCookie();
  }

  if (ouMCookieData.urlData.length > 0) {
    strMCookie = ouMCookieData.toCookie();
    strMSessionCookie = ouMCookieData.toSessionCookie();
  }

  var exDate = new Date();
  exDate.setTime(exDate.getTime() + 30 * 24 * 60 * 60 * 1000);

  if (olen > 0) {
    if (strOCookie.length > 0) {
      document.cookie = "ouaadata=" + strOCookie + "; path=" + gOUAA_COOKIE_PATH + "; expires=" + exDate.toGMTString();
      document.cookie = "ouaasession=" + strOSessionCookie + "; path=" + gOUAA_COOKIE_PATH;
    } else {
      document.cookie = "ouaadata=;expires=Thu, 01-Jan-1970 00:00:00 GMT;path=" + gOUAA_COOKIE_PATH;
      document.cookie = "ouaasession=;expires=Thu, 01-Jan-1970 00:00:00 GMT;path=" + gOUAA_COOKIE_PATH;
    }
  }

  if (mlen > 0) {
    if (strMCookie.length > 0) {
      document.cookie = "muaadata=" + strMCookie + "; path=" + gOUAA_COOKIE_PATH + "; expires=" + exDate.toGMTString();
      document.cookie = "muaasession=" + strMSessionCookie + "; path=" + gOUAA_COOKIE_PATH;
    } else {
      document.cookie = "muaadata=;expires=Thu, 01-Jan-1970 00:00:00 GMT;path=" + gOUAA_COOKIE_PATH;
      document.cookie = "muaasession=;expires=Thu, 01-Jan-1970 00:00:00 GMT;path=" + gOUAA_COOKIE_PATH;
    }
  }

  return;
}

//==================================================
// call main
//==================================================

oet_client_main();

ouaa_client_main();

//======================================================================
// EOF
//======================================================================
////////////////////////////////////////////////////////////////////////
// Local Variables:
// tab-width: 2
// End:
////////////////////////////////////////////////////////////////////////
