var currentTimeout;
var currentURL;

function simpleQuickSearch(searchValue, url) {
	clearTimeout( currentTimeout );
	if (searchValue.strip().length > 2) { // erst ab mind. 3 Zeichen suchen
		var ph = $('popup-suche');
		Element.update(ph, '<img style="top: 15px; position: relative;" src="/hsp/img/spinner.gif"/>');
		Element.show(ph);
		
		if(url == null)	{
			currentTimeout = setTimeout( 'doSQS()', 250 );
		}
		else {
			currentURL = url;
			currentTimeout = setTimeout( 'doSQS(currentURL);', 250 );
		} 
	} else {
		Element.hide('popup-suche');
	}
}

function simpleQuickSearchFehl(searchValue) {
	clearTimeout( currentTimeout );
	if (searchValue.strip().length > 2) { // erst ab mind. 3 Zeichen suchen
		var ph = $('popup-suche-fehl');
		Element.update(ph, '<img style="top: 15px; position: relative;" src="/hsp/img/spinner.gif"/>');
		Element.show(ph);
		
		currentTimeout = setTimeout( 'doSQSFehl()', 250 );
		
	} else {
		Element.hide('popup-suche-fehl');
	}
}

function simpleQuickSearch1(searchValue, url) {
	clearTimeout( currentTimeout );
	if (searchValue.strip().length > 0) { // erst ab mind. 3 Zeichen suchen
		var ph = $('popup-suche');
		Element.update(ph, '<img style="top: 15px; position: relative;" src="/hsp/img/spinner.gif"/>');
		Element.show(ph);
		
		if(url == null)	{
			currentTimeout = setTimeout( 'doSQS()', 250 );
		}
		else {
			currentTimeout = setTimeout( 'doSQS("'+url+'")', 250 );
		} 
	} else {
		Element.hide('popup-suche');
	}
}

function simpleQuickSearchAll(searchValue, url) {
    if (currentTimeout) {
         clearTimeout( currentTimeout );
    }

        var ph = $('popup-suche');
        ph.insert('<img style="top: 15px; position: relative;" src="/hsp/img/spinner.gif"/>').show();

		if (url == null) {
			currentTimeout = setTimeout( 'doSQS()', 250 );
		}
		else {
			currentTimeout = setTimeout( 'doSQS("'+url+'")', 250 );
		} 
}

function simpleQuickSearchAllFehl(searchValue) {
	clearTimeout( currentTimeout );

		var ph = $('popup-suche-fehl');
		Element.update(ph, '<img style="top: 15px; position: relative;" src="/hsp/img/spinner.gif"/>');
		Element.show(ph);
		
		currentTimeout = setTimeout( 'doSQSFehl()', 250 );
}


function doSQS(url) {
	if(url == null) {
		saveForm('/hsp/backoffice/worte_panel_quick.html', 'searchForm', 'popup-suche');
	}
	else {
		saveForm(url, 'searchForm', 'popup-suche');
	}
}

function doSQSFehl() {
		saveForm('/hsp/backoffice/worte_fehl_panel_quick.html', 'searchFormFehl', 'popup-suche-fehl');
}


function editEbene(id) {
	location.href='editEbene.html?id=' + id;
}

function editSondertext(id) {
	location.href='editSondertext.html?id=' + id;
}



var showDetails = true;

function toggleDetails() {
	showDetails = !showDetails;
	
	if(showDetails) {
		document.getElementById('details').style.visibility = 'visible';
	}
	else {
		document.getElementById('details').style.visibility = 'hidden';
	}
}


