// JavaScript Document
// XMLHttpsオブジェクト作成
function createXMLHttpH()
{
try {
return new ActiveXObject ("Microsoft.XMLHTTP");
}catch(e){
try {
return new XMLHttpRequest();
}catch(e) {
return null;
}
}
return null;
}
function createXMLHttpF()
{
try {
return new ActiveXObject ("Microsoft.XMLHTTP");
}catch(e){
try {
return new XMLHttpRequest();
}catch(e) {
return null;
}
}
return null;
}


function geth(pageURL) {
xmlhttph = createXMLHttpH();
if (xmlhttph)
{
xmlhttph.onreadystatechange = setPageDataH;
xmlhttph.open('GET', pageURL);
xmlhttph.send(null);
}else{
alert("XMLHttpRequest失敗");
}
}
function setPageDataH()
{
if (xmlhttph.readyState == 4 && xmlhttph.status == 200)
{
document.getElementById("myheader").innerHTML = xmlhttph.responseText;
}
}


function getf(pageURL) {
xmlhttpf = createXMLHttpF();
if (xmlhttpf)
{
xmlhttpf.onreadystatechange = setPageDataF;
xmlhttpf.open('GET', pageURL);
xmlhttpf.send(null);
}else{
alert("XMLHttpRequest失敗");
}
}
function setPageDataF()
{
if (xmlhttpf.readyState == 4 && xmlhttpf.status == 200)
{
document.getElementById("myfooter").innerHTML = xmlhttpf.responseText;
}
}




//現在の月を取得する
function getcurrentmonth()
{
now = new Date();
month = now.getMonth() + 1; // 月
return month;	
}

//現在の月によってヘッダ(id=myheader)とフッタ(id=myfooter)を読み込む　
//同時にテキスト（id=textmenu）メニューを消す。


function designchange()
{

cmonth = getcurrentmonth();

//季節を判別する
season = 'su';

if(cmonth == 1){season = 'wi';}
else if (cmonth == 2){season = 'wi';}
else if (cmonth == 3){season = 'sp';}
else if (cmonth == 4){season = 'sp';}
else if (cmonth == 5){season = 'su';}
else if (cmonth == 6){season = 'su';}
else if (cmonth == 7){season = 'su';}
else if (cmonth == 8){season = 'su';}
else if (cmonth == 9){season = 'su';}
else if (cmonth == 10){season = 'au';}
else if (cmonth == 11){season = 'au';}
else if (cmonth == 12){season = 'wi';}
else{season = 'su';};



//季節のバナーを割り当てる
if(season == 'wi')
{
geth("/parts/wi.htm");
getf("/parts/foot_wi.htm");
document.getElementById('mytextmenu').style.visibility = "hidden";	
//gets('/parts/foot_wi.htm');

}
else if(season == 'sp')
{
geth("/parts/sp.htm");
getf("/parts/foot_sp.htm");
document.getElementById('mytextmenu').style.visibility = "hidden";
//document.getElementById('mytextmenu').style.height = "0px";
}
else if(season == 'su')
{
geth("/parts/su.htm");
getf("/parts/foot_su.htm");
document.getElementById('mytextmenu').style.visibility = "hidden";	
//gets('/parts/foot_su.htm');
}
else if(season == 'au')
{
geth("/parts/au.htm");
getf("/parts/foot_au.htm");
document.getElementById('mytextmenu').style.visibility = "hidden";
//gets('/parts/foot_au.htm');
}

}

//実行
designchange();

