// JavaScript Document
function FilterData()
{
	var tf = document.getElementById("filterTF");
	if (!tf.value)
	{
		// If the text field is empty, remove any filter
		// that is set on the data set.
		
		myLists.filter(function(ds, row, rowNumber) { return null; }); /*表示しない*/
		myFeatures.filter(function(ds, row, rowNumber) { return row; });/*表示する */
		return;
	}

	// Set a filter on the data set that matches any row
	// that begins with the string in the text field.
	
	var regExpStr = tf.value;
	
	/*if(document.getElementByName("radio").checked=true){*/
	/*if(document.forms[0]["radio"].value=="or"){*/
	while((n= regExpStr.lastIndexOf(",")) !=-1){
		regExpStr=regExpStr.replace(",", "|");}
	while((n= regExpStr.lastIndexOf("、")) !=-1){
		regExpStr=regExpStr.replace("、", "|");}
	while((n= regExpStr.lastIndexOf(" ")) !=-1){
		regExpStr=regExpStr.replace(" ", "|");}
	while((n= regExpStr.lastIndexOf("　")) !=-1){
		regExpStr=regExpStr.replace("　", "|");}
	while((n= regExpStr.lastIndexOf("｜")) !=-1){
		regExpStr=regExpStr.replace("｜", "|");}
	regExpStr=regExpStr.replace("||", "|");
	/*}*/
	
	var regExp = new RegExp(regExpStr, "i");
	
/*	show_hide(1);*/
/*	var filterFunc = function(ds, row, rowNumber)*/
/*	var filterFunc = function(ds, row, index) addfilter*/
		 filterFunc=function(ds, row, rowNumber){
		var str = row["@subject"];
		if (str && str.search(regExp) != -1){
			return row;
		}
		str=row["@author"];
		if (str && str.search(regExp) != -1){
			return row;
		}
		str=row["@translater"];
		if (str && str.search(regExp) != -1){
			return row;
		}	
		str = row["@articles"];
		if (str && str.search(regExp) != -1){
			flag=1;		
			return row;	
		}
		str = row["@title"];
		if (str && str.search(regExp) != -1){	
			return row;	
		}
		str = row["@date"];
		if (str && str.search(regExp) != -1){	
			return row;	
		}
		var str = row["@Esubject"];
		if (str && str.search(regExp) != -1){
			return row;
		}
		str=row["@Eauthor"];
		if (str && str.search(regExp) != -1){
			return row;
		}
		str=row["@Etranslater"];
		if (str && str.search(regExp) != -1){
			return row;
		}	
		/*str = row["@Earticles"];
		if (str && str.search(regExp) != -1){
			flag=1;		
			return row;	
		}*/
		str = row["@Etitle"];
		if (str && str.search(regExp) != -1){	
			return row;	
		}
		return null;
}
filterFeature=function(ds, row, rowNumber){
	return null;
}
	/*	myLists.filter(filterFunc);	*/
	myLists.filter(filterFunc);
	myFeatures.filter(filterFeature);
/*	window.alert(regExp);*/
}



function StartFilterTimer(){
	if (StartFilterTimer.timerID){
		clearTimeout(StartFilterTimer.timerID);
	}
	StartFilterTimer.timerID = setTimeout(function() { StartFilterTimer.timerID = null; FilterData(); }, 100);
}
