function ShootiConcierge() { this.ScnHostName = "http://townmarket.jp/"; this.ScnServiceRoot = "/concierge/web/"; this.SCN_SCUSER_ID = ""; this.SCN_SEESION_ID = ""; this.SR_ID = ""; this.action_name = ""; this.start_time=""; this.end_time=""; this.item_id="0"; this.extraInfo="0"; this.sc_frg = new Boolean(true); this.ss_frg = new Boolean(true); this.cc_frg = "1"; } ShootiConcierge.prototype = { initialize: function(item) { this.items = item; }, createSession: function() { var cookies = []; D_SCN_SCUSER_ID = "88fa50c10e6fe5a8ad982bb9f8513de9"; this.SCN_SEESION_ID = "656d0712f60afa38de09eb7f76b14ce5"; SCN_SCUSER_ID = ""; SCN_SEESION_ID =""; SR_ID = ""; if (document.cookie != "") { cookies = document.cookie.split("; "); cookies.each(function( obj, index ) { var params = obj.split("="); if(params[0] == 'SCN_SCUSER_ID'){ sc_frg = false; SCN_SCUSER_ID = params[1]; }else if(params[0] == 'SCN_SEESION_ID'){ ss_frg = false; SCN_SEESION_ID = params[1]; }else if(params[0] == 'DLCCSP0001'){ SR_ID = params[1]; } }) ; } if(SCN_SCUSER_ID != ""){ this.sc_frg = sc_frg; this.SCN_SCUSER_ID = SCN_SCUSER_ID; } if(SCN_SEESION_ID != ""){ this.ss_frg = ss_frg; this.SCN_SEESION_ID = SCN_SEESION_ID; } if(SR_ID != ""){ this.SR_ID = SR_ID; } document.cookie = "SCN_SEESION_ID=" + this.SCN_SEESION_ID + "; path=/;"; if (this.sc_frg != false && this.cc_frg != false){ this.SCN_SCUSER_ID = D_SCN_SCUSER_ID; document.cookie = "SCN_SCUSER_ID=" + this.SCN_SCUSER_ID +"; expires=Tue,1-Jan-2030 00:00:00 GMT; path=/;"; this.action_name = "php/cg.php"; arguments[0] = this.setDefault(arguments[0], "log"); new Image().src = this.makeUrl(arguments[0]); }else{ if(this.ss_frg != false){ this.action_name = "php/Reception_log.php"; arguments[0] = this.setDefault(arguments[0], "log"); new Image().src = this.makeUrl(arguments[0]); } } now = new Date(); time = now.getTime(); this.start_time = time; return; }, SendItem: function() { this.item_id = arguments[0].item_id; this.extraInfo = arguments[1].extraInfo; this.SendStartLog(); return; }, SendStartLog: function() { if(this.item_id != ""){ this.action_name = "php/Action_log.php"; arguments[0] = this.setDefault(arguments[0], "log"); new Image().src = this.makeUrl(arguments[0]); } return; }, SendEndLog: function() { if(this.item_id != 0){ this.action_name = "php/End_log.php"; arguments[0] = this.setDefault(arguments[0], "log"); new Image().src = this.makeUrl(arguments[0]); } return; }, importSessionInfo: function() { if ( arguments[0] ) { this.sessinId = arguments[0][this.ScnParNames.SC_SESSION_ID]; this.writeSiteCookieId(); } }, callJsonResScript: function() { var url = arguments[0]; if ( arguments[1] && arguments[1] != "" ) { url += "?" + arguments[1]; url += "&callback=" + "SCN_concierge." + arguments[2]; }else { url += "?callback=" + "SCN_concierge." + arguments[2]; } var rs = document.createElement('script'); rs.setAttribute('src', url); rs.setAttribute('charset', this.Encode || "UTF-8"); rs.setAttribute('type', 'text/javascript'); document.getElementsByTagName('head')[0].appendChild(rs); return; }, makeUrl: function() { var url = this.ScnHostName + this.ScnServiceRoot + this.action_name; if ( arguments[0] ) { url += "?" + this.makePars(arguments[0]); } return url; }, makePars: function() { var pars = ""; if ( arguments[0] ) { var params = new Array(); arguments[0].each(function(obj, index){ params.push(obj.id + "=" + encodeURIComponent(obj.value.toString())); }); pars += params.join("&"); } return pars; }, writeSiteCookieId: function() { var cm = new CookieManager({shelfLife:this.CookieLife}); cm.setCookie(this.ScnCookieNames.SC_SESSION_ID, this.sessinId); }, setDefault: function() { now = new Date(); time = now.getTime(); this.end_time = time; arguments[0] = arguments[0] || []; arguments[0].push({ id: 'item_id', value: this.item_id}); arguments[0].push({ id: 'SCN_SCUSER_ID', value: this.SCN_SCUSER_ID}); arguments[0].push({ id: 'SCN_SEESION_ID' , value: this.SCN_SEESION_ID}); arguments[0].push({ id: 'SR_ID' , value: this.SR_ID}); arguments[0].push({ id: 'START_TIME', value: this.start_time}); arguments[0].push({ id: 'END_TIME', value: this.end_time}); arguments[0].push({ id: 'extraInfo', value: this.extraInfo}); return arguments[0]; } } var SCN_concierge = new ShootiConcierge(); SCN_concierge.createSession(); function createSession() { return SCN_concierge.createSession(arguments[0]); } function debug() { $("debug").innerHTML = SCN_concierge.sessinId; } function onUnLoad() { SCN_concierge.SendEndLog(); } Event.observe(window, "unload", onUnLoad);