var Max_List = 40;
function loadEvent(stationcode, stationcode2, dir){
	loadeventDBMenu('event', encodeURL('event_db ED LEFT JOIN eventsupport_db ESD ON (ED.f_eventnumber = ESD.f_eventnumber or ED.f_sscode = ESD.f_creator)'),encodeURL('WHERE (BIN_AND(ED.f_flags,1)=0) and (ED.f_visibleflags != 8) and (f_publishdate &lt;= CURRENT_DATE) and ((ED.f_sscode = \''+ stationcode + '\') or (ESD.f_sscode = \''+ stationcode + '\')) and (ED.f_enddate >= CURRENT_DATE)'), 'イベント･セミナー', dir + 'cgi/wsdb_temp.cgi?template=temp_event_wf_data.html');
	loadeventDBMenu('event2', encodeURL('event_db ED LEFT JOIN eventsupport_db ESD ON (ED.f_eventnumber = ESD.f_eventnumber or ED.f_sscode = ESD.f_creator)'),encodeURL('WHERE (BIN_AND(ED.f_flags,1)=0) and (ED.f_visibleflags != 8) and (f_publishdate &lt;= CURRENT_DATE) and ((ED.f_sscode = \''+ stationcode2 + '\') or (ESD.f_sscode = \''+ stationcode2 + '\')) and (ED.f_enddate >= CURRENT_DATE)'), 'セミナー', dir + 'cgi/wsdb_temp.cgi?template=temp_event_data.html');
}

function loadeventDBMenu(id, tableName, Where, Title, Link){
	var xmlhttp = createXMLHttp();
	if (xmlhttp){
		xmlhttp.onreadystatechange = function () {
			geteventDB(xmlhttp, id, Title, Link);
		};
   	if ( typeof ActiveXObject!="undefined" ) {
			xmlhttp.open('POST', 'cgi/selectwsdl.cgi', true);
		} else {
			xmlhttp.open('POST', 'cgi/selectwsdl.cgi');
		}
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlhttp.send('table=' + tableName + '&field=DISTINCT ED.f_eventnumber,ED.f_title,ED.f_catch,ED.f_startdate,ED.f_enddate,ED.f_city,ED.f_visibleflags&order=' + encodeURL('ED.f_enddate ASC') + '&where=' + Where + '&quot="');
	}else{
		alert("サーバーにアクセスできませんでした");
	}
}
function geteventDB(xmlhttp, id, Title, Link){
	var hMes = '';
	var i, listData, Line, Count = 0;
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
		listData = xmlhttp.responseText.substr(0, xmlhttp.responseText.lastIndexOf('"')).substr(1).split('"\n"');
		hMes += '<table width="526" border="0" cellpadding="1" cellspacing="1">';
		for (i = 0; (i < Max_List) && (i < listData.length); i++){
			if (listData[i] != ''){
				Line = listData[i].split('","');
					hMes += '<tr>';
					hMes += '<td width="100" height="27" nowrap="nowrap"><div align="right">' + setGappi(Line[3]) + '：</div></td>';
					hMes += '<td width="369"><a href="' + Link + '&f_eventnumber=' + Line[0] + '" target="sub" class="link">【' + Line[5].replace('都', '').replace('県', '') + '】' + Line[1] + '</a>';
					if (Line[6] == 1){
						hMes += '<span class="style15" style="color:#FF3333">【募集中】</span><img src="img/share/new.gif" alt="" width="27" height="13" />';
					}
					hMes += '</td>';
					hMes += '<td width="4">&nbsp;</td>';
					hMes += '</tr>';
				Count++;
			}
		}
		hMes += '</table>';
		if (Count == 0){
			hMes = '';
		}
		DispHTML(id, hMes);
	}
}


