//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function JSONscriptRequest(fullUrl){
	this.fullUrl   = fullUrl;
	this.noCacheIE = '&noCacheIE='+(new Date()).getTime();
	this.headLoc   = document.getElementsByTagName("head").item(0);
	this.scriptId  = 'boo_ei';
}
JSONscriptRequest.prototype.buildScriptTag = function(){
	this.scriptObj = document.createElement("script");
	this.scriptObj.setAttribute("type","text/javascript");
	this.scriptObj.setAttribute("charset","shift_jis");
	this.scriptObj.setAttribute("src",this.fullUrl+this.noCacheIE);
	this.scriptObj.setAttribute("id",this.scriptId);
}
JSONscriptRequest.prototype.addScriptTag = function(){
	this.headLoc.appendChild(this.scriptObj);
}
JSONscriptRequest.prototype.removeScriptTag = function(){
	this.headLoc.removeChild(this.scriptObj);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
var Days = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var css = new Object();
var oJsr;
var date = new Date();
var yea = date.getFullYear();
var mon = date.getMonth()+1;
booei(yea,mon);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function booei(yea,mon){
	var url = 'http://www.e-pcpal.com/booei/booei.cgi?mission=calen_js&call_back=calen';
	    url += '&yea='+yea;
	    url += '&mon='+mon;
	oJsr = new JSONscriptRequest(url);
	oJsr.buildScriptTag();
	oJsr.addScriptTag();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function calen(data){
	var cale = new String();
	var yea = data.yea;
	var mon = data.mon;
	var last_m = mon-1;
	var next_m = mon+1;
	var last_y = yea;
	var next_y = yea;
	if(last_m <= 0 ){last_m+=12;last_y--;}
	if(next_m >= 13){next_m-=12;next_y++;}
	style(data);
	uruu(yea);
	var start_week = week_judge(yea,mon,1);
	var last_day = Days[mon-1];
	cale += calendar(data,yea,mon,start_week,last_day,last_y,last_m,next_y,next_m);
	document.getElementById('booei').innerHTML = cale;
	oJsr.removeScriptTag();
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function calendar(data,year,month,start_week,last_day,last_y,last_m,next_y,next_m){
	var date = new Date();
	var now_ye = date.getFullYear();
	var now_mo = date.getMonth()+1;
	var today  = date.getDate();
	var linkc =  'style="color:'+data.Design[9].de+';text-decoration:none;"';
	//
	var cale = new String();
	cale += '<table'+css['table']+'>';
	cale += '<tr>';
	cale += '<td colspan="7"'+css['mo']+'>';
	cale += '<a href="javascript:booei('+last_y+','+last_m+');"'+linkc+'>&lt;&lt;</a> &nbsp;';
	cale += year+'年'+month+'月 &nbsp;';
	cale += '<a href="javascript:booei('+next_y+','+next_m+');"'+linkc+'>&gt;&gt;</a>';
	cale += '</td>';
	cale += '</tr>';
	for(var w=0;w<7;w++){cale += '<td'+css['cap']+'>'+data.Week[w].we+'</td>';}
	cale += '</tr>';
	var gyo   = Math.floor(last_day/7)+2;
	var start = 0;
	var day   = 1;
	for(var g=0;g<gyo;g++){
		cale += "<tr>";
		for(var w=0;w<7;w++){
			if(start == 0 && w == start_week){start++;}
			if(start == 0 || day > last_day){
				cale += '<td'+css['bla']+'>&nbsp;</td>';
			}else{
				var csw = 'day';
				if(data.Holidays[day-1].hol == 1){
					if(year == now_ye && month == now_mo && day == today){
						csw = 'holb';
					}else{
						csw = 'hol';
					}
				}else{
					if(year == now_ye && month == now_mo && day == today){
						csw = 'dayb';
					}else{
						csw = 'day';
					}
				}
				cale += '<td'+css[csw]+'>'+day+'</td>';
				day++;
			}
		}
		cale += "</tr>";
		if(day > last_day){break;}
	}
	cale += '<tr>';
	cale += '<td'+css['no']+' colspan="7">';
	cale += '<span style="background-color:'+data.Design[6].de+';width:10px;height:10px;line-height:120%;font-size:0px;margin:0px;padding:0px;"></span> &nbsp;営業';
	cale += ' &nbsp;';
	cale += '<span style="background-color:'+data.Design[7].de+';width:10px;height:10px;line-height:120%;font-size:0px;margin:0px;padding:0px;"></span> &nbsp;休業';
	if('1' == 1){
		var linkc =  'style="color:'+data.Design[13].de+';text-decoration:none;"';
		cale += '<p style="font-size:8pt;margin:3px 1px 1px 1px;padding:0px;text-align:center;overflow:hidden;display:block;"><a href="'+data.Cgi+'"'+linkc+'>ADMIN</a></p>';
	}
	cale += '</td>';
	cale += '</tr>';
	cale += '</table>';
	return cale;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function week_judge(yea,mon,day){
	if(mon < 3){
		mon+=12;
		yea--;
	}
	var wn = (yea+Math.floor(yea/4)-Math.floor(yea/100)+Math.floor(yea/400)+Math.floor((13*mon+8)/5)+day)%7;
	return wn;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function uruu(year){
	var uruu = 28;
	if((year % 4 == 0 && year % 100 != 0) || year % 400 == 0){
	    uruu = 29;
	}
	Days[1] = uruu;
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function style(data){
	var tdcom = 'width:auto;padding:3px 1px 2px 1px;line-height:120%;text-align:center;vertical-align:middle;border:solid '+data.Design[3].de+' '+data.Design[1].de+';';
	css['table']  = ' style="width:'+data.Design[19].de+';border-collapse:collapse;margin:0px;border:solid '+data.Design[2].de+' '+data.Design[0].de+';"';
	css['mo']     = ' style="'+tdcom+'font-size:'+data.Design[14].de+';color:'+data.Design[9].de+' ;background-color:'+data.Design[4].de+';"';
	css['cap']    = ' style="'+tdcom+'font-size:'+data.Design[15].de+';color:'+data.Design[10].de+';background-color:'+data.Design[5].de+';"';
	css['day']    = ' style="'+tdcom+'font-size:'+data.Design[16].de+';color:'+data.Design[11].de+';background-color:'+data.Design[6].de+';"';
	css['dayb']   = ' style="'+tdcom+'font-size:'+data.Design[16].de+';color:'+data.Design[11].de+';background-color:'+data.Design[6].de+';font-weight:bolder;"';
	css['hol']    = ' style="'+tdcom+'font-size:'+data.Design[17].de+';color:'+data.Design[12].de+';background-color:'+data.Design[7].de+';"';
	css['holb']   = ' style="'+tdcom+'font-size:'+data.Design[17].de+';color:'+data.Design[12].de+';background-color:'+data.Design[7].de+';font-weight:bolder;"';
	css['bla']    = ' style="'+tdcom+'font-size:'+data.Design[17].de+';background-color:'+data.Design[20].de+';font-weight:bolder;"';
	css['no']     = ' style="'+tdcom+'font-size:'+data.Design[18].de+';color:'+data.Design[13].de+';background-color:'+data.Design[8].de+';"';
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


