// $Header: /home/cvsroot3/vogue_apache/docs/js/s10040/count0.js,v 1.1 2007/02/09 04:51:35 pvstaff Exp $
function ANT_getCookie(key) {
	if (!document.cookie) return ("undefined");
	var v = document.cookie;
	var ns = v.indexOf(key+"="); if (ns<0) return ("undefined"); ns = ns + key.length + 1;
	var ne = v.indexOf(";",ns); if (ne<0) ne = v.length;
	return unescape(v.substring(ns,ne));
}
function ANT_setCookie(key, val, tmp) {
	tmp = key + "=" + escape(val) + "; ";
	exp = new Date();
	exp.setTime(exp.getTime() + 1000*60*60*24*1);
	tmp += "expires=" + exp.toGMTString();
	document.cookie = tmp;
}
function ANT_setCookie2(key, val, tmp) {
	tmp = key + "=" + escape(val) + "; ";
	document.cookie = tmp;
}
function ANT_clearCookie(key) {
	document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}
function ANT_CommonValue(beacon_kind) {
	var referer = "CurrentReferrer=" + escape(document.referrer);
	var cururl = "CurrentUrl=" + escape(document.URL);
	var filecookieok = "FileCookieOk=";
	var memcookieok = "MemCookieOk=";
	var now = new Date();
	var uniquekey = "UniqueKey=" + now.getTime();
	var station = ANT_getCookie("station");
	var retvalue = "";
	ANT_setCookie("filecookie","filecheck");
	if (ANT_getCookie("filecookie") == "filecheck") {
		filecookieok += "true";
	} else {
		filecookieok += "false";
	}
	ANT_clearCookie("filecookie");
	ANT_setCookie2("memcookie","memcheck");
	if (ANT_getCookie("memcookie") == "memcheck") {
		memcookieok += "true";
	} else {
		memcookieok += "false";
	}
	var protocol_str;
	if ( location.href.indexOf("https://",0) == 0 ){
		protocol_str = "https://";
	}else{
		protocol_str = "http://";
	}
	retvalue = protocol_str + "s10040.tracking.home.ne.jp/sites/" + beacon_kind + "/?";
	retvalue += filecookieok+"&"+memcookieok+"&"+cururl+"&"+referer+"&"+uniquekey;
	if (station != "undefined") {
		retvalue += "&station="+station;
	}
	return retvalue;
}
function ANT_PageBeacon() {
	var commonvalue = ANT_CommonValue("page");
	var display = "DisplayResolution=" + screen.width + "x" + screen.height + "x" + screen.colorDepth;
	document.write('<span style="position:absolute; left:0px; top=0px">');
	document.write("<img src='"+commonvalue+"&"+display);
	document.write("' width=1 height=1>");
	document.write('</span>');
}
function ANT_ClickBeacon(areacode) {
	var imgsrc = ANT_CommonValue("click");
	imgsrc += "&AreaCode="+areacode;
	BeaconImage = new Image();
	BeaconImage.src = imgsrc;
	BeaconImage.height = 1;
	BeaconImage.width = 1;
}
function ANT_DownloadBeacon(downloadcode) {
	var imgsrc = ANT_CommonValue("download");
	imgsrc += "&DownloadCode="+downloadcode;
	BeaconImage = new Image();
	BeaconImage.src = imgsrc;
	BeaconImage.height = 1;
	BeaconImage.width = 1;
}

ANT_PageBeacon();

