var mList;
function loadInfor(){
alert();
}
function dispMenu(){
	var dList;
	var count = 0;
	var hMes = '';
	hMes += '<table align="center" class="mainframe" border="0" cellpadding="0" cellspacing="0">';
	for (i = 0; i < mList.length; i++){
		if (mList[i] != ''){
			dList = mList[i].split(','); 
			if (dList[3] != 'off'){
				count++;
				if (count % 2 == 1){
					hMes += '<tr>';
				}
				hMes += '<td width="300" height="36" valign="top" align="left" >';
				if (count % 2 == 0){
					hMes += '<img name="image_' + count + '" src="./img/br' + (count / 2) + '_on.gif" class="br_menu" border="0" alt="' + dList[2] + '">';
					hMes += '<a href="./cgi/' + dList[1] + '" onMouseOut="imageOn(' + count + ');"  onMouseOver="imageOff(' + count + ');" class="ar_menu">';
					hMes += dList[0];
					hMes += '</a>';
				} else {
					hMes += '<img name="image_' + count + '" src="./img/bl' + ((count + 1) / 2) + '_on.gif" class="bl_menu" border="0" alt="' + dList[2] + '">';
					hMes += '<a href="./cgi/' + dList[1] + '" class="al_menu" onMouseOut="imageOn(' + count + ');"  onMouseOver="imageOff(' + count + ');">';
					hMes += dList[0];
					hMes += '</a>';
				}
				hMes += '</td>';
				if (count % 2 == 0){
					hMes += '</tr>';
				}
			}
		}
	}
	if (count % 2 == 1){
		hMes += '</tr>';
	}
	hMes += '</table>';
	return hMes;
}
function imageOff(Index){
	if (Index % 2 == 0){
		document.userForm['image_' + Index].src = './img/br' + (Index / 2) + '_off.gif';
	} else {
		document.userForm['image_' + Index].src = './img/bl' + ((Index + 1) / 2) + '_off.gif';
	}
}
function imageOn(Index){
	if (Index % 2 == 0){
		document.userForm['image_' + Index].src = './img/br' + (Index / 2) + '_on.gif';
	} else {
		document.userForm['image_' + Index].src = './img/bl' + ((Index + 1) / 2) + '_on.gif';
	}
}
function pageChange(Url){
	location.href = Url;
}
function loadMenu(){
	xmlhttp = createXMLHttp();
	if (xmlhttp){
		xmlhttp.onreadystatechange = getMenu;
		xmlhttp.open('GET', './cgi/index.txt',false);
		xmlhttp.send(null);
	}else{
		alert("サーバーにアクセスできませんでした");
	}
}
function getMenu(){
	var i;
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
		listData = xmlhttp.responseText;
		mList = listData.split('\n');
		mList.shift();
		DispHTML('menu', dispMenu());
		loadIndex('./cgi/information/data/index.txt');
	}
}
function loadIndex(file){
	var xmlhttp = createXMLHttp();
	if (xmlhttp){
		xmlhttp.onreadystatechange = function () {
			loadIndexRes(xmlhttp);
		};
    if ( typeof ActiveXObject!="undefined" ) {
			xmlhttp.open('GET', file,false);
		} else {
			xmlhttp.open('GET', file);
		}
		xmlhttp.send(null);
	}else{
		alert("サーバーにアクセスできませんでした");
	}
}
function setData(mList, Sec){
	var i = 0;
	var str = '';
	while (i < mList.length){
		if (mList[i].indexOf('[' + Sec + ']') == 0){
			i++;
			while ((i < mList.length) && (mList[i].indexOf('[') != 0)){
				str += mList[i] + '\n';
				i++;
			}
		}
		i++;
	}
	return str;
}
function loadIndexRes(xmlhttp){
	var List, Line, i,mmList;
	var hMes = '<dl>';
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
		mmList = xmlhttp.responseText.split('\n');
		List = setData(mmList, 'Index').split('\n');
		for (i = 0; i < List.length; i++){
			if (List[i].indexOf('［new］') >= 0){
				Line = List[i].split(',');
				hMes += '<dt>';
				hMes += '<a href="./cgi/txttohtm.cgi?def=information/webdiary.cfg&text2=index.txt&text=' + Line[1] + '&temp=maintemp.html" class="ft_title">' + Line[0] + '</a>';
				hMes += '<span class="ft_catch">(' + Line[5] + ')</span>';
				hMes += '</dt>';
				hMes += '<dd class="ft_catch">' + Line[3] + '</dd><p>';
			}
		}
		hMes += '</dl>';
		DispHTML('footer', hMes);
	}
}
