var checkDate={
	lagdate:1, // 最近の更新ありと見なす日数
	bannerId:"blog_banner",
	newSrc:"http://earth1.jp/images/blog_banner_new.gif",
	
	initialize:function(){
		var dateobj=new Date();
		this.nowmsec=dateobj.getTime();
		this.dateobj=dateobj;
		new Ajax.Request('http://earth1.jp/blog/date.html',{
			param:"cache="+this.nowmsec,
			onComplete:function(obj){
				var datestr=obj.responseText;
				if(datestr.length!=10) return false;
				
				checkDate.datestr=datestr;
				checkDate.checkAndChange();
			}
		});
		Event.observe(window,"load",this.pageloaded.bind(this),false);
	},
	pageloaded:function(){
		if(!$(this.bannerId)) return false;
		this.ifpageloaded=true;
		this.checkAndChange();
	},
	checkAndChange:function(){
		if(!(this.ifpageloaded && this.datestr)) return false;
		
		
		this.dateobj.setFullYear(Number(this.datestr.substr(0,4)));
		this.dateobj.setMonth(Number(this.datestr.substr(4,2))-1);
		this.dateobj.setDate(Number(this.datestr.substr(6,2)));
		this.dateobj.setHours(Number(this.datestr.substr(8,2)));
		
		var blogsec=this.dateobj.getTime(); //ブログのタイムスタンプ、ミリ秒
		var nowmsec = this.nowmsec ; // 今の時刻、タイムスタンプ、ミリ秒
		
		/*[nowmsec,blogsec,(this.lagdate * 86400 *1000)].each(function(num){
			$("footer").innerHTML += num + ":";
		});*/
		
		if((nowmsec - blogsec) < (this.lagdate * 86400 *1000)){
			$(this.bannerId).src=this.newSrc;
		}
		
	}
}
checkDate.initialize();