function shop_ajax(url,pars,target, callback) {
    var myAjax = new Ajax.Updater( target,
    url,
    {
    method: 'get',
    asynchronous: true,
    parameters: pars,
    onComplete: callback,
    evalScripts: false
    });

}

function inWarenkorbAjax(url, pars, callback) {

         if ( $( '#zylindertabelle' ).size() ) {
            no_main_article = 0;
            zylinderanzahl = 1;
            gasanzahl = 1;
            url_parameter = pars.split ( '&' );
            for ( i in url_parameter ) {
                if ( url_parameter[ i ].substr ( 0 , 7 ) == 'anzahl=' ) {
                    gasanzahl = url_parameter[ i ].substr ( 7 );
                    if ( gasanzahl < 1 ) {
                        gasanzahl = 1;
                    }
                }
            }
            check_url = document.location.href.split( '&' );
            for ( i in check_url ) {
                if ( check_url[ i ] == 'hauptrubrik=10000' ) {
                    no_main_article = 1;
                }
            }
            if ( no_main_article == 1 ) {
                gasanzahl = 1;
            }
            $( '#zylindertabelle .zylinder' ).each( function ( ) {
                                                            if ( $( this).val() != '') {
                                                                zylinderanzahl = ( $( this).val() * gasanzahl );
                                                                pars = pars+"&zylinder["+this.name+']='+ zylinderanzahl;
                                                            }
                                                        }
                                                    );
            if ( no_main_article == 1 ) {
                zylinderanzahl = 1;
            }
            $( '#zylindertabelle .befestigungen' ).each( function ( ) {
                                                            if ( $( this).val() != '') {
                                                                pars = pars+"&befestigungen["+this.name+']='+ ( $( this).val() * gasanzahl );
                                                            }
                                                        }
                                                    );
         }

         $("#warenkorb_klein").load(url+"?"+pars, {
            werte: pars},function(){
            //show_wkhinweis('asddsa');
            }
            );
}
function check_rubrik3 ( url , pars , gewaehlt , vergleich , confirmtext ) {
    make_ajax = true;
    if ( gewaehlt == vergleich ) {
        check = confirm ( confirmtext );
        if ( check == false ) {
            make_ajax = false;
        }
    }
    if ( make_ajax == true ) {
        inWarenkorbAjax( url , pars );
    }
}


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 '';

}

function show_wkhinweis ( meldung , zusatz  ) {
    if ( document.getElementById ( 'warenkorbmeldung' ) ) {
        document.getElementById ( 'warenkorbmeldung' ).innerHTML = meldung;
        $( '#warenkorbmeldung' ).slideToggle(0);
        setTimeout ( 'hide_wkhinweis()' , 2000 );
    } else if ( document.getElementById ( 'warenkorbmeldung_'+zusatz ) ) {
        document.getElementById ( 'warenkorbmeldung_'+zusatz ).innerHTML = meldung;
        $( '#warenkorbmeldung_'+zusatz ).slideToggle(0);
        setTimeout ( 'hide_wkhinweis('+zusatz+')' , 2000 );
    }
}
function hide_wkhinweis ( zusatz ) {
    if ( zusatz != '' ) {
        $( '#warenkorbmeldung_'+zusatz ).slideToggle(0);
    } else {
        $( '#warenkorbmeldung' ).slideToggle(0);
    }

}

function change_artikelid ( id , nr , kraft ) {

    if ( kraft < 1000 ) {
        kraft = '0'+kraft;
    }

    new_nr = nr.substr( 0 , ( nr.length - 4 ) )+kraft;

    document.getElementById( 'artikel_id_anzeige' ).innerHTML = new_nr;
    document.getElementById( 'artikelid_'+id ).value = new_nr;
}

