function findValue(li) {
	if( li == null ) return alert("Kein Suchergebnis");
	if( !!li.extra ) var sValue = '/' +li.extra[0] + '.html';
	document.location.href = sValue ;
	
}

function selectItem(li) {
	findValue(li);
}

function formatItem(row) {
	//
	return "<a href=/"+row[1]+">" + row[0] + "</a>";
}
$(document).ready(function() {
	$("ul.sf-menu").superfish({ 
        speed:       'fast', 
        theme: null,
        autoArrows:  false  
    });
	
  	$('a.merkmale').cluetip({width: '151px', showTitle: false});
  	$('a.farbvariante').cluetip({width: '121px', showTitle: false});
  	$('a.bildvorschau').cluetip({width: '301px', showTitle: false});
  	$('img.bildvorschauvariant').cluetip({width: '121px', showTitle: false});
  	$('div.attribute').hide();
    $('h4.attributtitel').click(function() {
      $(this).next('div.attribute').slideToggle('fast');
    });

$(':checkbox:checked.filtermarken').each(
      function() {
        $('#attrmarken').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filtergroessen').each(
      function() {
        $('#attrgroessen').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filterart').each(
      function() {
        $('#attrart').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filtermaterial').each(
      function() {
        $('#attrmaterial').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filterinnenaustattung').each(
      function() {
        $('#attrinnenaustattung').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filteraussenaustattung').each(
      function() {
        $('#attraussenaustattung').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filterschlossart').each(
      function() {
        $('#attrschlossart').show();
       //alert("OK - checked");
      }
    );
$(':checkbox:checked.filtertragart').each(
      function() {
        $('#attrtragart').show();
       //alert("OK - checked");
      }
    );
$("#autocomplete").autocomplete("/modules/suggest/artikel.php", 		{
		delay:40,
		minChars:3,
		matchSubset:1,
		matchContains:1,
		cacheLength:10,
		onItemSelect:selectItem,
		onFindValue:findValue,
		formatItem:formatItem,
		autoFill:false,
		width:410,
		maxItemsToShow:20,
		scroll: true
});

});