function bitteWarten() { 
    $.blockUI({ message: '<div style="height:110px;font-size:22px;margin-top:30px;">Bitte warten...<br><img src="/js/highslide/graphics/loader.white.gif" /><br>Zahlarten werden aktualisiert...</div>' }); 
	 setTimeout($.unblockUI, 3500);
}; 

function dhPreviewDetails(oxid, farbe, bild, preis, vorkasse, kreditkarte, sofortueber, nachnahme, ersparnis, uvp){
	$("#aid").attr('value',oxid);
    $("#preistitel").text("Preisberechnung: " + farbe)
    $("#previewbild").attr("src", bild);
    $("#preis").text(preis);
    $("#preisvorkasse").text(vorkasse);
    $("#preiskreditkarte").text(kreditkarte);
    $("#preissofortueber").text(sofortueber);
    $("#preisnachnahme").text(nachnahme);
    if (uvp == preis) {
        $("#uvppreis").hide();
    }
    else {
        $("#uvppreis").show();
    }
    $("#siesparen").text(ersparnis);
};	
function dhPreview(bildid, bild){
	  var bildid="#img"+bildid;
	  $(bildid).attr("src",bild);
};

function dhPreviewMerkmal(bild){
	  $('#merkmalepreview').attr("src",bild);
	  $('#merkmalepreview').fadeIn('fast');
};
function dhFadeOut(id){
	$(id).fadeOut('fast');
};
function dhPreviewDetailsImage(bild){
	$('#previewbild').attr("src",bild);
};


function dhPreviewReset(bildid, bild){
	var bildid="#img"+bildid;
	$(bildid).attr("src",bild);
};
function findValue(li) {
	if( li == null ) return alert("Kein Suchergebnis");
	if( !!li.extra ) var sValue = '/' +li.extra[0];
	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,
        delay:         500,
        autoArrows:  false  
    });
  $(':checkbox').click(function() { 
     $.blockUI({ message: '<div style="height:80px;font-size:22px;margin-top:30px;"><img src="/js/highslide/graphics/loader.white.gif" /> Bitte warten...</div>' }); 
	 setTimeout($.unblockUI, 4000);
  });
  $('a.merkmale').cluetip({width: '151px', showTitle: false});
  $('a.farbvariante').cluetip({width: '121px', showTitle: false});
  $('a.bildvorschau').cluetip({width: '301px', showTitle: false,positionBy: 'fixed'});
  $('a.meinkonto').cluetip({width: '400px', showTitle: false});
  $('#meinkonto').cluetip({
	  cluezIndex: 999999,
	  width: 150,
	  arrows: false,
	  positionBy: 'bottomTop',
	  showTitle: false,
	  local: true, 
	  hideLocal: false,
	  dropShadow: true,
	  hoverIntent: false,
	  sticky: true,
	  mouseOutClose: true,
	  closePosition:    'title',
	  closeText: '<img src="/php/cross.png" alt="close" />'
	});
  
  $('#detailsnotavailable').cluetip({
	  width: 250,
	  arrows: false,
	  positionBy: 'auto',
	  showTitle: false,
	  local: true, 
	  hideLocal: false,
	  dropShadow: true,
	  hoverIntent: false,
	  sticky: true,
	  mouseOutClose: true,
	  closePosition:    'title',
	  closeText: '<img src="/php/cross.png" alt="close" />'

	});
$('img.bildvorschauvariant').cluetip({width: '121px', showTitle: false});
$("#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
});

});
