// JavaScript Document

/* PopUp window ------------------------------------------------------- */
function m_win(url,windowname,width,height,modelid) {
 var features="location=no, menubar=no, status=no, scrollbars=no, resizable=no, toolbar=no,'popup'";
/*
 var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no,'popup'";
*/
if (width) {
  if (window.screen.width > width)
   features+=", left="+(window.screen.width-width)/2;
  else width=window.screen.width;
  features+=", width="+width;
 }
 if (height) {
  if (window.screen.height > height)
   features+=", top="+(window.screen.height-height)/2;
  else height=window.screen.height;
  features+=", height="+height;
 }
 var xWin;
 xWin = window.open(url,windowname,features);
 inModname(xWin,modelid);
}

function inModname(xWin,modelid){
	/*
	alert(xWin);
	alert(modelid);
	*/
	document.outform.modid.value = modelid;
}



/* Data File Name ------------------------------------------------------- */
var urla = './news/news.csv';

/* News Doc ------------------------------------------------------------ */
// 指定したURLを非同期でリクエスト
function getFile_news(){
//  sendRequest( urla, newsData, 'GET', '');
	sendRequest(newsData,'','GET',urla,true,true);
 }


// NEWS　レスポンスデータを表示
function newsData( res )
{
  //取得データステータスチェック
  var match_pattern = /404 Not Found/g;
  var ret = res.responseText.match(match_pattern);
  if(ret || !res.responseText){
	//404 Not Found の場合はデータなしとする。
	return;
  }
  // 各行を取得
  var rows = res.responseText.split('\r').join('').split('\n');
  var eName = "news_result1";
  for(var i = 0; i < rows.length; i++) {
    // 各セルを取得
    cells = rows[i].split(',');
    for(var j = 0; j < cells.length; j++) {
		/*
		if(cells[j] && j==1){
			document.getElementById(eName).innerHTML +=cells[j]+"<br>";
		}else if(cells[j] && j==0){
			document.getElementById(eName).innerHTML +=cells[j]+"：";
		}
		*/
			document.getElementById(eName).innerHTML +=cells[j]+"<br>";
  	}
  }
}


