function reset_field (input) {
	input.value = '';
}


/**
* Toggles CurrentMainContent and ExhibitDocuments plus TagCloud and ExhibitFacets
* @method build
* @param {String} sTab. The Tab to activate - TagCloud | SetFilter
*/
togglefacets = function(sTab){
	if (sTab == "SetFilter") {
		$('#tagcloudtab').attr('class', 'SecondaryContentTabTop');
		$('#exhibitfacetstab').attr('class', 'SecondaryContentTabTopActive');
		getExhibitFacets();
		$('#tagcloud').hide();
		$('#exhibitfacets').show();
	} else {
		$('#tagcloudtab').attr('class', 'SecondaryContentTabTopActive');
		$('#exhibitfacetstab').attr('class', 'SecondaryContentTabTop');
		$('#mainContentIDDiv').show();
		$('#exhibitdocuments').hide();
		getTagCloud();
		$('#tagcloud').show();
		$('#exhibitfacets').hide();
	}
}


getTagCloud = function(sVariable, sValue) {
	var sUrl = 'getTagCloud.php?selectedTags=' + aSelectedTags;
	if (sVariable != null && sValue != null) {
		sUrl += '&' + sVariable + '=' + sValue;
	}
	$.get(sUrl, function (data) {
		$('#tagcloud').html(data);
	});
	return false;
}

getExhibitFacets = function () {
	var sUrl = 'getExhibitFacets.php';
	$.get(sUrl);
	return false;
}



listFacet_onSelect = function () {
	// EMT-181
	// wird in list-facet.js aufgerufen, wenn eine facet ausgewählt wird
	
	// alle Hauptnavigationspunkte deselectieren
	$('#mainnav .active').removeClass("active");
	return true;
}


// restrictions fuer faceted search per querystring setzen (unfertig)

/*

applyRestrictionsToFacetedSearch = function(restrictionString) {
// siehe auch http://osdir.com/ml/web.simile.general/2008-02/msg00222.html
	//alert("restriction: "+restrictionString);
	var facets = parseRestrictionString(restrictionString);
	for (facetName in facets) {
		//alert( facetName + " = " + facets[facetName] );
		var facetId = 'exhibitFacet' + facetName.replace(/\s/g, '_');
	
		var facet = exhibit.getComponent(facetId);
		var restrictions = { selection: facets[facetName], selectMissing: false } ;
		//facet.applyRestrictions(restrictions);
		facet.restrict(restrictions);
		//SimileAjax.History.addLengthyAction( function() { facet.applyRestrictions(restrictions); }, "restriction applied to facet '"+facetName+"'");


//		// click simulieren
//		var facetLines = $('#'+facetId+' .exhibit-facet-value');
//		for (f=0; f<facetLines.length; f++) {
//			var title = facetLines[f].getAttribute('title');
//			var p = title.indexOf(' (');
//			if (p>2) {
//				title = title.substring(0,p);
//				for (v=0; v<facets[facetName].length; v++) {
//					var t = facets[facetName][v];
//					if (title == facets[facetName][v]) {
//						facetLines[f].click();
//					}
//				}
//			}
//		}
	
	}
	var view = exhibit.getComponent('exhibitView1');
	view._reconstruct();
	//view.update();
	//view.refresh();
	//view.repaint();
}

parseRestrictionString = function(restrictionString) {
	var facets = Array();
	var facetRSs = restrictionString.split(';');
	for (var f=0; f<facetRSs.length; f++) {
		var fs = facetRSs[f].split('=');
		if (fs!=null && fs.length==2) {
			var name = stripQuotes(fs[0]);
			if (facets[name]==null) {
				facets[name] = Array();
			}
			var values = fs[1].split(',');
			for (var v=0; v<values.length; v++) {
				facets[name].push(stripQuotes(values[v]));
			}
		}
	}
	return facets;
}

stripQuotes = function(s) {
	if (s==null)
		return null
	else {
		if (s.charAt(0)=="'") 
			s = s.substring(1);
		if (s.charAt(s.length-1)=="'") 
			s = s.substring(0,s.length-1);
		return s;
	}
}
*/

// setTimeout("applyRestrictionsToFacetedSearch(\"'time period'='2007','2009';'research area'='Systems on Chip'\")", 5000);


