function MM_jumpMenu(targ,selObj,restore)
{ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function hideSourceInfo()
{
	var sources = document.getElementById("sources").childNodes;

	for( var i=0; i<sources.length; i++ ) {
		var source = sources[i];
		showHideArticle(source, false);
	}
}

function showHideArticle(article, shouldShow)
{
	if (shouldShow) {
		article.style.display = 'block';
	} else {
		article.style.display = 'none';
	}
}

function setContentFilter( filter )
{
	var articles = document.getElementById("mainblock").childNodes;
	
	if (filter) {
	
		for( var i=0; i<articles.length; i++ ) {
			var article = articles[i];
			if( article.nodeName == 'DIV' ) {
				shouldShow = articleWithinSearch(article, filter);
				showHideArticle(article, shouldShow);
			}
		}
	} else {
		/* filter is null */
		for( var i=0; i<articles.length; i++ ) {
			var article = articles[i];
			if( article.nodeName == 'DIV' ) {
				showHideArticle(article, true);
			}
		}
	}
}

function articleWithinSearch(article, filter)
{
	if (article.innerHTML.toLowerCase().indexOf(filter.toLowerCase())>0)
	{
		return true;
	} else {
		return false;
	}
}



function setDateFilter( date_earliest, date_latest )
{
	var articles = document.getElementById("mainblock").childNodes;
	
	for( var i=0; i<articles.length; i++ ) {
		var article = articles[i];
		if( article.nodeName == 'DIV' ) {
			shouldShow = articleWithinDate(article, date_earliest, date_latest);
			showHideArticle(article, shouldShow);
		}
	}
}

function articleWithinDate(article, date_earliest, date_latest)
{
var articleDate = article.getAttribute("articleSortDate");

if (articleDate > date_earliest)
	{
		if (articleDate < date_latest)
		{
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}


function setSourceFilter( source_id )
{
	var articles = document.getElementById("mainblock").childNodes;
	
	for( var i=0; i<articles.length; i++ ) {
		var article = articles[i];
		if( article.nodeName == 'DIV' ) {
			shouldShow = articleWithinSource(article, source_id);
			showHideArticle(article, shouldShow);
		}
	}
}

function setSourceFilterAll()
{
	var articles = document.getElementById("mainblock").childNodes;
	
	for( var i=0; i<articles.length; i++ ) {
		var article = articles[i];
		if( article.nodeName == 'DIV' ) {
			showHideArticle(article, true);
		}
	}
}


function articleWithinSource(article, source_id)
{
var articleSourceID = article.getAttribute("articleSourceID");

if (articleSourceID == source_id)
	{
		return true;
	} else {
		return false;
	}
}