//var div_search = 'nrw_search';
var div_search = 'unternehmen_searchbox';

var div_companylist = 'nrw_company_list';

/**
 * Start einer Suchanfrage per Ajax
 */
function searchUrl(url) {
  var listDiv = $(div_companylist).empty().addClass('ajax-loading');
	new Ajax(url, {
		method: 'get',
		update: $(div_companylist),
		evalScripts: true,
		onComplete: function() {listDiv.removeClass('ajax-loading');}
	}).request();
//			$('nrw_debug').setText(item.getValue());
//			alert(item.getValue() + ' - ' + $('nrw_company_list'));
}

/**
 * Anzeige von Details eines Unternehmens
 */
function showCompany(url, currDiv) {
//  var detailDiv = $('contentbox_left').empty().addClass('ajax-loading');
  // Jetzt den AjaxCall starten
	new Ajax(url, {
		method: 'get',
		update: $('contentbox_left'),
		evalScripts: true,
		onComplete: function() {
//		 detailDiv.removeClass('ajax-loading');
    }
	}).request();
// Alle Div der Meldungen holen
  divs = $('contentbox_right').getElements('div[id^=company_]');
  divs.each(function(div) {
//    div.setStyle('background-color','#E1E1E1');
    div.removeClass('active');
  });
  $(currDiv).addClass('active');

}
/** Show a string in debug div */
function debug(msg) {
 $('nrw_debug').setText(msg);
}
/** Hide/show Searchbox and Resultlist */
function showSearch(showForm) {
// alert('Zeige Liste: ' + showForm);

 if(showForm) slideList.slideOut();
 else slideList.slideIn()
 if(showForm) slideSearch.slideIn();
 else slideSearch.slideOut();
}
