
 	UserID = 'harehareyukai';
	PID = '4';
	cookieNameFirstLoginDate = UserID + '-' + PID + '-' + 'FirstLoginDate';
	cookieNameLastLoginDate = UserID + '-' + PID + '-' + 'LastLoginDate';
	cookieNameVisitCount = UserID + '-' + PID + '-' + 'VisitCount';
	cookieNamefLogin = UserID + '-' + PID + '-' + 'fLogin';
	cookieNamelLogin = UserID + '-' + PID + '-' + 'lLogin';
	cookieLife = 24 * 90;	// 
	
 	today = getToday();
	mo = distMonitor();
	mr = distMonitorResolution();
	md = distMonitorDepth();
	os = distOS();
	br = distBrowser();
	ref = distReferrer();
	fl = getFirstLogin( today );
	ll = getLastLogin( today );
		
	if( fl == today || ll == today ){
		setCookie( cookieNameFirstLoginDate, today, cookieLife );
		setCookie( cookieNameLastLoginDate, today, cookieLife );
		setCookie( cookieNameVisitCount, 1, cookieLife);
		now = new Date();
		setCookie( cookieNamefLogin, now.getTime(), cookieLife );
		setCookie( cookieNamelLogin, now.getTime(), cookieLife );
		fl = today;
		ll = today;
		rc = 0;
		rf = "0-x";
		rl = "0-x";
	}else{
		rc = getVisitCount();
		rl = getRepeaterLastLogin();
		rf = getRepeaterFirstLogin();
	}

	la = distLanguage();
	url = makeURL();
	
	
	document.write('<SCRIPT Language="javascript" src="', url, '"',  '>', '</SCRIPT>');
	function makeURL(){

		url = 'http://statsp.fpop.net/analyzer/analyze_pc.php?uid=harehareyukai&pid=4';

		url += '&OS='+os;
		url += '&Browser='+br;
		url += '&Monitor='+mo;
		url += '&Resolution='+mr;
		url += '&Depth='+md;
		url += '&RepeaterCount='+rc;
		url += '&Language='+la;
		url += '&RepeaterLastLogin='+rl;
		url += '&RepeaterFirstLogin='+rf;
		url += '&FirstLogin='+fl;
		url	+= '&LastLogin='+ll;
		url += '&Referrer='+escape( ref );
		return url;
	}



	
	function getToday(){
		var now = new Date();
		var year = now.getYear();
		var month = now.getMonth() + 1;
		var day = now.getDate();
		var hour = now.getHours();
		var min = now.getMinutes();
		var sec = now.getSeconds();
		if(year < 2000) { year += 1900; }
		
		if(month < 10) { month = "0" + month; }
		if(day < 10) { day = "0" + day; }
		if(hour < 10) { hour = "0" + hour; }
		if(min < 10) { min = "0" + min; }
		if(sec < 10) { sec = "0" + sec; }
		return year.toString()+month.toString()+day.toString()+hour.toString()+min.toString()+sec.toString();
	}

	
	function getFirstLogin( today ){
		date = getCookie( cookieNameFirstLoginDate );
		if( date == null || false == dateCheck( date, today) ){
			setCookie( cookieNameFirstLoginDate, today, cookieLife );
			login = today;
		}else{
			login = date;
		}
		return login;
	}

	
	
	function getLastLogin( today ){
		date = getCookie( cookieNameLastLoginDate );
		if( date == null || false == dateCheck( date, today) ){
			login = today;
		}else{
			login = date;
		}
		setCookie( cookieNameLastLoginDate, today, cookieLife );	// クッキーの更新
		return login;
	}

	
	function getVisitCount(){
		count = getCookie( cookieNameVisitCount );
		if( count == null ){
			count = 1;
		}else{
			count++;
		}
		setCookie( cookieNameVisitCount, count, cookieLife);
		
		count = count - 1;
		return count;
	}

	
	function getRepeaterFirstLogin(){
		var past = "0-x";
		var fLogin = getCookie( cookieNamefLogin );
		now = new Date();
		var nLogin = now.getTime();
		if( fLogin == null ){
			setCookie( cookieNamefLogin, nLogin, cookieLife );
			past = "0-x";
		}else{
			past = nLogin - fLogin;
			past = Math.round( past / ( 60 * 1000 )); // Change millisecond to minutes
			if( past <= 10 ){
				past = past + "-m"; 
			}else if(( past > 10 ) && ( past <= 60 )){
				past = ( Math.ceil(past / 10) * 10 ) + "-m";
			}else if(( past >= 60 ) && ( past < ( 60 * 24 ))){
				past = Math.floor( past / 60 ) + "-h";
			}else{
				past = Math.floor( past / ( 60 * 24 )) + "-d";
			}
			setCookie( cookieNamefLogin, fLogin, cookieLife );
		}
		return past;
	}

	
	function getRepeaterLastLogin(){
		now = new Date();
		
		var nLogin = now.getTime();
		var past = 0;
		var lLogin = getCookie( cookieNamelLogin );
		
		if( lLogin != null ){
			past = nLogin - lLogin;
			past = Math.round( past / ( 60 * 1000 ));	// Change millisecond to minutes
			if( past <= 10 ){
				past = past + "-m"; 
			}else if(( past > 10 ) && ( past <= 60 )){
				past = ( Math.ceil(past / 10) * 10 ) + "-m";
			}else if(( past >= 60 ) && ( past < ( 60 * 24 ))){
				past = Math.floor( past / 60 ) + "-h";
			}else{
				past = Math.floor( past / ( 60 * 24 )) + "-d";
			}
			
		}else{
			
			past = "0-x";
		}
		// Reset LastLogin Time
		
		setCookie( cookieNamelLogin, nLogin, cookieLife );
		return past;
	}
	
	/* 言語（国） */
	function distLanguage(){
		lang = navigator.systemLanguage;
		return lang;
	}

	/* リファラ */
	function distReferrer(){
		var ref = "";
		if( document.referrer != 0 ){
			ref = document.referrer;
		}
		return ref;
	}

	/* モニター統計 */
	function distMonitor(){
		var x = screen.width;
		var y = screen.height;
		var color = screen.colorDepth;
		x = String( x );
		y = String( y );
		color = String( color );
		monitor = x+'x'+y+'_'+color;
		return monitor;
	}
	
	/* モニター解像度 */
	function distMonitorResolution(){
		var x = screen.width;
		var y = screen.height;
		x = String( x );
		y = String( y );
		return x+'x'+y;
	}
	
	/* モニターカラー数 */
	function distMonitorDepth(){
		var color = screen.colorDepth;
		color = String( color );
		return color;
	}	
	
	/* OS */
	function distOS(){
		var os = "other";
		var ua = navigator.userAgent.toUpperCase();
		var machine = navigator.platform;
	
		if( machine.indexOf("Win") != -1 ){
			os = 'win';
		}else if( machine.indexOf("Mac") != -1 ){
			os = 'mac';
		}else if(machine.indexOf("X11") != -1 || ua.indexOf("LINUX") != -1 || ua.indexOf("BSD") != -1){
			os = 'linux'
		}
		
	
		if( os == 'win'){
			if(ua.indexOf("NT 6.0") != -1 ){
				os = "winvista";
			}else if(ua.indexOf("NT 5.2") != -1 || ua.indexOf("WS 2003") != -1){
				os = "win2003";
			}else if(ua.indexOf("NT 5.1") != -1 || ua.indexOf("WS XP") != -1){
				os = "winxp";
			}else if(ua.indexOf("NT 5.0") != -1 || ua.indexOf("WS 2000") != -1){
				os = "win2k";
			}else if(ua.indexOf("WIN 9x 4.90") != -1 || ua.indexOf("WS ME") != -1){
				os = "winme";
			}else if(ua.indexOf("WIN98") != -1 || ua.indexOf("WS 98") != -1){
				os = "win98";
			}else if(ua.indexOf("NT 4.0") != -1 || ua.indexOf("WINNT4") != -1){
				os = "winnt4";
			}else if(ua.indexOf("WIN95") != -1 || ua.indexOf("WS 95") != -1){
				os = "win95";
			}else if(ua.indexOf("WS CE") != -1){
				os = "wince";
			}else if(ua.indexOf("WS NT") != -1 || ua.indexOf("WINNT") != -1){
				os = "winnt";
			}else if(ua.indexOf("WS 3.1") != -1){
				os = "win3";
			}
		}else if( os == 'mac' ){
			if( ua.indexOf("MAC OS X") != -1 || ua.indexOf("IE 5.2") != -1 ){
				os = "macx";
			}else{
				os = "maco";
			}
		}
		return os;
	}

	
	function distBrowser(){
		var browser = 'other';
		
		var name = navigator.appName;
		var codeName = navigator.appCodeName;		//DEBUG
		var version = navigator.appVersion;			//DEBUG
		var mVersion = navigator.appMinorVersion;	//DEBUG
		var agent = navigator.userAgent;
		
	//	return name+'***'+codeName+'***'+version+'***'+mVersion+'***'+agent;	//DEBUG
	
		if( name.indexOf('Microsoft Internet Explorer' ) != -1 ){
			if( agent.indexOf('MSIE 6.0' ) != -1 ){
				//Operaはie系
				if( agent.indexOf('Opera' ) != -1 ){
					browser = 'opera';
				}else{
					browser = 'ie6';
				}
			}else if(agent.indexOf('MSIE 7.') != -1){
				browser = 'ie7';
			}else if(agent.indexOf('MSIE 5.5') != -1){
				browser = 'ie5.5';
			}else if(agent.indexOf('MSIE 5.0') != -1){
				browser = 'ie5';
			}
		}else if( name.indexOf('Netscape' ) != -1 ){
			if( agent.indexOf('Firefox') != -1 ){
				browser = 'firefox';
			}else if( agent.indexOf('Netscape') != -1 ){
				if( agent.indexOf('7') != -1 ){
					browser = 'nn7';
				}else if( agent.indexOf('6') != -1 ){
					browser = 'nn6';
				}
			
			}else if( agent.indexOf('X11') != -1 ){
				browser = 'mozilla';
			}else if( agent.indexOf('Safari') != -1 ){
				browser = 'safari';
			}
		}else if( name.indexOf('Opera' ) != -1 ){
			browser = 'opera';
		}
		return browser;
	}
	
	
	function getCookie(name){
		var value = null;
		ck = document.cookie.split(';');
		for(loop = 0; loop < ck.length; loop++){
			data = ck[loop];
			if( data.search(name) != -1){
				value = data.split('=');
				value = unescape(value[1]);
			}
		}
		return value;
	}
	
	
	function setCookie(name, val, term){
		var term = term*60*60*1000;
		val = escape(val);
		expire = new Date();
		expire.setTime(expire.getTime()+term);
		var day=expire.toGMTString();
		document.cookie = name + "=" + val + ";expires=" + day + ";";
	}
	
	
		
	function dateCheck(str, today){
		today = parseInt( today );
		str = parseInt(str);
		if( str >= today || str < 20000000000000 ){
			return false;
		}
		str = str.toString();
		if( str.length != 14 ){
			return false;
		}
		var year = str.substring(0,4);
		var month = str.substring(4,6);
		var day = str.substring(6,8);
		var hour = str.substring(8,10);
		var min = str.substring(10,12);
		var sec = str.substring(12,14);
		
		year = parseInt(year, 10);
		month = parseInt(month, 10);
		month = month - 1;
		day = parseInt(day, 10);
		hour = parseInt(hour, 10);
		min = parseInt(min, 10);
		sec = parseInt(sec, 10);

		var dates = new Date(year,month,day,hour,min,sec);

		if (dates.getYear() < 1900) {
			if (year != dates.getYear() + 1900) { return false; }
		} else {
			if (year != dates.getYear()) { return false; }
		}
		if (month != dates.getMonth()) { return false; }
		if (day != dates.getDate()) { return false; }
		if (hour != dates.getHours()) { return false; }
		if (min != dates.getMinutes()) { return false; }
		if (sec != dates.getSeconds()) { return false; }
		return true;
	}


document.write('<div style="position:absolute; left:1px; top:1px; "><a href="http://statsp.fpop.net/analyzer/ad_pc.php" target="_blank"><img src="http://statsp.fpop.net/img/bar.gif" id="fpop_ad" name="fpop_ad" border="0" ></a></div>');

function setImgSrc(imgURL)
{
  	document.fpop_ad.src = imgURL;
}

function changeImage(){
	setTimeout( 'setImgSrc("http://statsp.fpop.net/img/clear.gif")', 15000 );
}
preImg = new Image();
preImg.src = "http://statsp.fpop.net/img/clear.gif";
changeImage();

