
function search_kunde ( value ) {
    if ( value.length > 3 ) {
        $( '#kundensearch' ).load( 'content.php?seite=shop/kundensearch.php&navigation=0&pattern='+value );
    }
}

function shop_ajax(url,pars,target, callback) {
    $( '#'+target ).load(url+"?"+pars);
}

function inWarenkorbAjax(url, pars, callback) {
    
         $("#warenkorb_klein").load(url+"?"+pars, {
            werte: pars},function(){
            //show_wkhinweis('asddsa');
            }
            );
}

        function tauschen(name){
            if (document.getElementById(name).style.display == "none"){
                document.getElementById(name).style.display = "block";
                return;
                }
            if (document.getElementById(name).style.display == "block"){
            document.getElementById(name).style.display = "none";
                return;
            }
        }
        function verstecken(name){
            document.getElementById(name).style.display = "none";
            return;
         }
        function zeigen(name){
            document.getElementById(name).style.display = "block";
            return;
         }
      


        function produkt_name ( artikel ) {

            var feld = document.getElementById(artikel);

            if ( feld.nodeName == 'INPUT' && feld.name != '' )
                return '- ' + feld.name;
            else if ( feld.nodeName == 'SELECT' )
                return '- ' + feld.options[feld.selectedIndex].text.substring(0,feld.options[feld.selectedIndex].text.lastIndexOf('-') - 1 );
            else return '';

        }

var angezeigt = false;
var meldungaktiv;
function show_wkhinweis ( meldung ) {

    window.clearTimeout(meldungaktiv);
    document.getElementById ( 'warenkorbmeldung' ).innerHTML = meldung;
    meldungaktiv = window.setTimeout ( 'hide_wkhinweis()' , 2000 );
    $( '#warenkorbmeldung' ).slideToggle(0);
    angezeigt = true;

}
function hide_wkhinweis (  ) {
    $( '#warenkorbmeldung' ).slideToggle(0);
    window.setTimeout ( 'noshow()' , 2000 );
    
}
function noshow() {
    angezeigt = false;
}


wmtt = null;

document.onmousemove = updateWMTT;

function updateWMTT(e) {
    if ( angezeigt == false ) {
        x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
        y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
        if ( document.all ) {
            x = x + 240;
            y = y + 200;
        }
        if (wmtt != null) {
            document.getElementById( 'warenkorbmeldung' ).style.left = x + "px";
            document.getElementById( 'warenkorbmeldung' ).style.top  = y  + "px";
        }
    }
}

function showWMTT(id) {
    wmtt = document.getElementById(id);
//     wmtt.style.display = "block";
    
}



/*
	Baut aus Produkt-ID, Staffelung und dem ausgewaehlten Feature
	den Link um das Produkt in den Warenkorb zu legen
	und ruft den Link  auf
*/
function addToBasekt ( produktId, produktStaffelung) {
	
	url = 'content.php?seite=shop/warenkorb.php&navigation=1&anzahl=1&artikel=' + produktId + '-' + produktStaffelung;
	
	// Welches Feature wurde ausgewaehlt
	featureId = 'produkte_features[' + produktId + ']';

	
	if ( !(objFeature = document.getElementById(featureId))) {
		// Kein Feature fuer das Produkt definiert	
		featureValue = ''; 
	} else {
		
		if ((featureIdx = objFeature.selectedIndex) == -1) {
			// Kein Feature ausgewaehlt
			alert ( 'Bitte wählen sie eine Variante aus.');
			return;
		}
		
		featureValue = objFeature.options[featureIdx].value;
	}

	
	// ausgewaehltes Feature an die url haengen
	url += '&produkte_features[' + produktId + '-' + produktStaffelung + ']=' + featureValue;
	
	// url aufrufen
	document.location.href = url;
	
	return;
}
