// facebook
FB.init("f17e9b5686a1294bfa0de3c5e84e103e", "/facebook/xd_receiver.htm"); 

function update_user_box() { 
	var user_box = document.getElementById("user"); 
	// add in some XFBML. note that we set useyou=false so it doesn't display "you" 
	user_box.innerHTML = "<span>" + "<fb:profile-pic uid='loggedinuser' size='square' facebook-logo='true'></fb:profile-pic>" + "Hallo <fb:name uid='loggedinuser' useyou='false' linked='false'></fb:name>!" + "<br />Sie sind nun eingeloggt mit Ihrem Facebook-Account." + "</span>"; 
	// because this is XFBML, we need to tell Facebook to re-process the document 
	FB.XFBML.Host.parseDomTree(); 
} 

function callPublish(msg, attachment, action_link) {
	 FB.ensureInit(function () {
	 FB.Connect.streamPublish('', attachment, action_link);
	 });
}

// Suchvorschlagsliste

// wenn ein item gewaehlt wird, soll das formular gleich abgeschickt werden
function itemSelect (li) {
	if( li == null ) return;

	var sValue = li.selectValue;
//	var sBaseurl = window.location.href;
//	if(sBaseurl.indexOf('action=extendedsearch') != -1) window.location.href='/index.cfm?pid=930&action=extendedsearch&query='+sValue;
//	else window.location.href='/index.cfm?pid=930&query='+sValue;

	document.headersearch.submit();
}

// wenn das dokument geladen wurde
jQuery(document).ready(function() {
// an alle suchformulare die autocomplete-funktion binden
jQuery("input.suchbegriff").each(function() {
	jQuery(this).autocomplete(
		"/_misc/suggest/autocomplete.cfm",
		{
			delay:10,
			width:280,
			minChars:2,
			maxItemsToShow:15,
			matchSubset:1,
			matchContains:1,
			onItemSelect: itemSelect,
			cacheLength:10,
			autoFill:false
		}
	);

});
});