jQuery.noConflict();

curvyCornersVerbose = false; 

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}



function del(){
    jQuery("#progress").removeClass('step2').addClass('step3');
}

function skipStep(){
    if(jQuery('input[name=change_use_for_billing]').checked == true || jQuery('input[name=change_use_for_billing]').attr('checked') == 'checked'){
        billing.save();
    }else{
        billing.save();
        /*setTimeout('renewForm()', 10000);*/
        setTimeout('del()', 10000);
        
    }
}

function skipStep2(){
    shipping.save()
    //setTimeout('renewForm()', 3000);
}

function changeAddressRadio(this_el){
    if(jQuery(this_el).attr('checked') || jQuery(this_el).checked == true)
    {
        jQuery('.ship_no').removeAttr('checked');
        jQuery('.ship_yes').attr('checked', 'checked');
        $('shipping:same_as_billing').checked = true;        
    }else{
        jQuery('.ship_no').attr('checked', 'checked');
        jQuery('.ship_yes').removeAttr('checked');
        $('shipping:same_as_billing').checked = false;
    }
}

var Identconfig = {    
     over: menuIn, // function = onMouseOver callback (REQUIRED)    
     timeout: 250, // number = milliseconds delay before onMouseOut    
     out: menuOut // function = onMouseOut callback (REQUIRED)    
};
function clearCompany(){ 
    jQuery('.firma').val('');
    
}
function changeDate(dir, this_el)
{
    if(dir == false){
        jQuery(this_el).parent().parent().parent().parent().parent().parent().parent().find(".hide_date").slideUp();
        return false;
    }
    
    jQuery(this_el).parent().parent().parent().parent().parent().parent().parent().find(".hide_date").slideDown(500);
}

function menuIn()
{
    //jQuery(this).find('ul').animate( { height: 'toggle' }, 700, 'easeOutQuad');
    jQuery(this).find('ul').fadeIn();
}

function menuOut()
{
    //jQuery(this).find('ul').animate( { height: 'toggle' }, 300, 'easeInQuad');
    jQuery(this).find('ul').fadeOut();
}

function step2(this_el)
{
    jQuery('#shipping-new-address-form').hide();
    jQuery('#select_address').stop(true,true).animate({'height' : 'toggle'}, 500);
}

// ** Backend Object for SMW Editor
function Backend(){
    // __Constructor
    var self = this;
    this.isBackend;
    this.timer;
    
    try
    {
        // If page in iFrame (backend)
        var length = window.parent.document.getElementById('ext-gen3').length;
        
        // Set status isBackend to true
        this.isBackend = true; 
    }catch(e)
    {
        this.isBackend = false;
        
        // Remove Backend Divs
        jQuery('.backend-border').removeClass('backend-border');
    }
    
    // Method :: Timeoutfunctions
    this.intervalFunctions = function(){
        
        // Page Part :: Shadowbox -> Calculate height.
        try{
            jQuery('.sidebox_right').each(function(){
                if(jQuery(this).find('img').length > 0){
                    var this_height = jQuery(this).find('img').height();   
                    jQuery(this).css({'max-height' : (this_height + 35)});
                }else{
                    jQuery(this).css({'max-height' : '900px'});
                    if(jQuery(this).find('.text').length == 0){
                        jQuery(this).css({'min-height' : '100px'}).append('<div class="text" style="min-height:120px;"></div>');
                    }
                }
            });
        }catch (e){
        }
        
        // Page PArt :: Two Col Text -> Add Borders
        try{
            jQuery('.col_left').addClass('backend-border');
            jQuery('.col_right').addClass('backend-border');       
        }catch (e){
        }
    }
    
    // Method :: Initialize Interval
    this.initIntervalFunctions = function(){
        this.timer = window.setInterval(self.intervalFunctions, 1000);
    }
    
}

function copyFelder(){ 
    currentTime = new Date();
    month_o = currentTime.getMonth() + 1;
    day_o = currentTime.getDate() +2;
    year_o = currentTime.getFullYear();    
    
    jQuery('#checkout-payment-method-load').each(function(){
       jQuery(this).find('fieldset').each(function(){
            jQuery(this).append('<input class="itmCheckout_delivery" type="hidden" value="'+ year_o +'-'+ month_o +'-'+ day_o +'" name="itmCheckout[deliveryDate]" autocomplete="off"><input class="itmCheckout_bemerkung" type="hidden" name="itmCheckout[bemerkung]" autocomplete="off"><input class="itmCheckout_card" type="hidden" name="itmCheckout[card]" autocomplete="off"><input class="itmCheckout_firstpackage" type="hidden" name="itmCheckout[firstPackage]" value="1000" autocomplete="off"><input class="itmCheckout_payment" type="hidden" name="itmCheckout[payment]" autocomplete="off" value="1001">');
       });
      
    });
}

function postData(){
    var url = "/abo/ajax/index";
       
    var gift_input = jQuery('#gift-message-whole-message').val();
    if(jQuery("#year").val() != '' && jQuery("#year").val() != 'J J J J' && jQuery("#month").val() != '' 
    && jQuery("#month").val() != 'M M' 
    && jQuery("#day").val() != '' && jQuery("#day").val() != 'T T')
    {
        var delivery = jQuery("#year").val() + '-' + jQuery("#month").val() +'-'+ jQuery("#day").val();   
    }

    var welcome = jQuery(".welcome_radio:checked").val();
    var bermerkung_input = jQuery('#p_method_bemerkung').val();
    var payment = jQuery(".payment_radio:checked").val();    
    
    jQuery.post( url, {'itmCheckout[card]': gift_input, 'itmCheckout[deliveryDate]': delivery, 'itmCheckout[bemerkung]': bermerkung_input, 'itmCheckout[firstPackage]' : welcome, 'itmCheckout[payment]' : payment});
}


function removeRabatt(){
    jQuery(".remove_me").val('1');
    document.discount.submit();
}

function infoBoxOver(){
    jQuery('#infoBoxDisplay').fadeIn();
}    

function infoBoxOut(){
    jQuery('#infoBoxDisplay').fadeOut();
}

function infoBoxOver2(){
    jQuery(this).children().fadeIn(500);
}    

function infoBoxOut2(){
    jQuery(this).children().fadeOut(500);
}
function toolTipIn(){
    jQuery('#tool-tip-content').fadeIn();
}    

function toolTipOut(){
    jQuery('#tool-tip-content').fadeOut();
}


var infoConfig = {    
        over: infoBoxOver2, // function = onMouseOver callback (REQUIRED)    
        timeout: 2000, // number = milliseconds delay before onMouseOut    
        out: infoBoxOut2 // function = onMouseOut callback (REQUIRED)    
    };

var infoConf = {    
     over: infoBoxOver, // function = onMouseOver callback (REQUIRED)    
     timeout: 2000, // number = milliseconds delay before onMouseOut    
     out: infoBoxOut // function = onMouseOut callback (REQUIRED)    
};
var infoConf3 = {    
     over: toolTipIn, // function = onMouseOver callback (REQUIRED)    
     timeout: 2000, // number = milliseconds delay before onMouseOut    
     out: toolTipOut // function = onMouseOut callback (REQUIRED)    
};

function checkDate(){
    
    
    if(jQuery('.date-pick').length > 0)
    {
        var curDate = jQuery('.date-pick').val();
        var split = curDate.split("-");

        var day = split[2];
        var month = split[1];
        var year = split[0];
        
        jQuery('#gift-day').val(day);
        jQuery('#gift-month').val(month);
        jQuery('#gift-year').val(year);
    }
}

function successDateCheck(data)
{
    if(data.status == 'fail')
    {
        jQuery('.itmCheckout_delivery').val(''+ data.year + '-' + data.month + '-' + data.day +'');
        jQuery('#year').val(data.year);
        jQuery('#month').val(data.month);
        jQuery('#day').val(data.day);
        jQuery('#notice').fadeIn(500);
    } else {
        jQuery('#notice').fadeOut(500);
    }
}

function checkCurDate(this_el) {
    
    if(jQuery(this_el).length > 0)
    {
        var entryTime = jQuery('.itmCheckout_delivery').val();
        var split = entryTime.split("-");

        var year = split[0];
        var month = split[1];
        var day = split[2];
        
        if(year > 0 && month > 0 && day > 0)
        {
            jQuery.ajax({
              type: 'POST',
              url: '/checken.php',
              data: {'year': year, 'month': month, 'day': day},
              success: successDateCheck,
              dataType: 'JSON'
            });
        }
        
        
        /*if( year < curYear){
            jQuery('.itmCheckout_delivery').val(''+ curYear + '-' + curMonth + '-' + curDay +'');
            jQuery(this_el).val(curYear);
            jQuery('#month').val(curMonth);
            jQuery('#day').val(curDay);
            jQuery('#notice').fadeIn(500);
        }else if( month < curMonth && year >= curYear){ 
            jQuery('.itmCheckout_delivery').val(''+ year + '-' + curMonth + '-' + curDay +'');
            jQuery('#month').val(curMonth);
            jQuery('#day').val(curDay);
            jQuery('#notice').fadeIn(500);
        }else if( day < curDay && year >= curYear && month >= curMonth){
            jQuery('.itmCheckout_delivery').val(''+ year + '-' + month + '-' + curDay +'');
            jQuery('#day').val(curDay);
            jQuery('#notice').fadeIn(500);
        }else{
            jQuery('#notice').fadeOut(500);
        }*/
    }
}

function checkGebDate(this_el){
    if(jQuery(this_el).length > 0)
    {
        var year = jQuery(this_el).val();
        
        var d = new Date();
        var curYear = d.getFullYear() - 18;
        
        if(year > curYear){
            jQuery('#notice').slideDown(500);
            jQuery(this_el).val(curYear);
        }else{
            jQuery('#notice').slideUp(500);
        }
    }
}

function step_three() {
    jQuery("#progress").removeClass('step4').addClass('step3');
}

function changeDateCal()
{
    var this_val = jQuery(".itmCheckout_delivery").val();
    /*if(this_val.length == 10 && jQuery("#month").val() == "M M")
    {*/
        var this_split = this_val.split("-");
        var this_year = this_split[0];
        var this_month = this_split[1];
        var this_day = this_split[2];
        
        jQuery("#year").val(this_year);
        jQuery("#year").css({'color' : 'rgb(92, 26, 18)'});
        
        jQuery("#month").val(this_month);
        jQuery("#month").css({'color' : 'rgb(92, 26, 18)'});
        
        jQuery("#day").val(this_day);
        jQuery("#day").css({'color' : 'rgb(92, 26, 18)'});
    /*}*/
}

jQuery(document).ready(function()
{
    jQuery(".top").click(function(){
        jQuery(".top").addClass('opened');
        jQuery(".hidden_wrap").animate({'height' : 'toggle'});            
    });
    
    jQuery("#language_menu").hover(function(){}, function(){
        jQuery(".hidden_wrap").slideUp(500, function(){
            jQuery(".top").removeClass('opened');
        }); 
    });    
    
    if(jQuery(".infoHover").length > 0)
    {
        jQuery(".infoHover").hover(function(){
            jQuery(this).find('.tooltip').fadeIn(200);
        }, function(){
            jQuery(this).find('.tooltip').fadeOut(200);
        });
    }
    
    if( jQuery.browser.msie && jQuery.browser.version == 7.0)
        {
            jQuery("#ie7-warning").show();
        }
    
    if(jQuery("#dob").length > 0 )
    {
        jQuery("#year").blur(function(){
            var year = jQuery("#year").val();
            var month = jQuery("#month").val();
            var day = jQuery("#day").val();
            if(year.length == 4)
            {
                year = year.substr(2,2);
            }

            var stri = day + "." + month + "." + year;

            jQuery("#dob").val(stri);
        });
        
        jQuery("#month").blur(function(){
            var year = jQuery("#year").val();
            var month = jQuery("#month").val();
            var day = jQuery("#day").val();
            if(year.length == 4)
            {
                year = year.substr(2,2);
            }

            var stri = day + "." + month + "." + year;

            jQuery("#dob").val(stri);            
        });
        
        jQuery("#day").blur(function(){
            var year = jQuery("#year").val();
            var month = jQuery("#month").val();
            var day = jQuery("#day").val();
            if(year.length == 4)
            {
                year = year.substr(2,2);
            }

            var stri = day + "." + month + "." + year;

            jQuery("#dob").val(stri);            
        });
        
        var year = jQuery("#year").val();
        var month = jQuery("#month").val();
        var day = jQuery("#day").val();
        if(year.length == 4)
        {
            year = year.substr(2,2);
        }
        
        var stri = day + "." + month + "." + year;
        
        jQuery("#dob").val(stri);
    }
    
    jQuery(".itmCheckout_delivery").change(function(){
            changeDateCal();
    });     
    
    jQuery(".cat_browser").click(function(){
        jQuery(this).find('.cat_sub_expand').slideDown(500); 
    });
    
    jQuery(".cat_browser").hover(function(){}, function(){
        jQuery(this).find('.cat_sub_expand').slideUp(500);
    });
    
    
    if(jQuery("#billing-new-address-form").length > 0 || jQuery(".account-create").length > 0)
    {
        var maxLength = 40;
        
        jQuery(".maxL").each(function(){
            
            jQuery(this).blur(function(){
                var curLength = 0;
                
                if(jQuery("input[name=firma]:checked").val() == 0)
                {
                    curLength += parseInt(jQuery(".length_2").val().length);
                    curLength += parseInt(jQuery(".length_3").val().length);
                    curLength += parseInt(jQuery(".length_5").val().length);
                    
                    if(curLength > maxLength)
                    {
                        alert('ACHTUNG: Ihr Name überschreitet das Maximum von 50 Zeichen!');
                        
                    }
                }else if(jQuery(".account-create").length > 0)
                {
                    maxLength = 50;
                    
                    curLength += parseInt(jQuery(".length_2").val().length);
                    curLength += parseInt(jQuery(".length_3").val().length);
                    curLength += parseInt(jQuery(".length_5").val().length);
                    curLength += parseInt(jQuery("#company").val().length);
                    curLength += parseInt(jQuery("#prefix").val().length);
                    
                    if(curLength > maxLength)
                    {
                        alert('ACHTUNG: Ihr Name überschreitet das Maximum von 50 Zeichen!');
                    }                                        
                }else
                {
                    curLength += parseInt(jQuery(".length_1").val().length);
                    curLength += parseInt(jQuery(".length_2").val().length);
                    curLength += parseInt(jQuery(".length_3").val().length);
                    curLength += parseInt(jQuery(".length_5").val().length);
                    
                    if(curLength > maxLength)
                    {
                        alert('ACHTUNG: Ihr Name überschreitet das Maximum von 50 Zeichen!');
                    }                    
                }
                
            });
        });
    }
    
    if(jQuery(".text_box_middle").length > 0)
    {
        jQuery(".text_box_middle").each(function()
        {               
            if(jQuery(this).parent().find(".text_box_top").length == 0)
            {
                jQuery(this).parent().prepend('<div class="text_box_top"></div>');
            }
            
            if(jQuery(this).parent().find(".text_box_bottom").length == 0)
            {
                jQuery(this).parent().append('<div class="text_box_bottom"></div>');
            }
        });
    }
    
    if(jQuery("#shipping-new-address-form").length > 0)
    {
        var maxLength = 50;
        
        jQuery("#shipping-new-address-form .maxL").each(function(){
            
            jQuery(this).blur(function(){
                var curLength = 0;
                
                if(jQuery("input[name=firma_shipping]:checked").val() == 0)
                {
                    curLength += parseInt(jQuery(".length_2").val().length);
                    curLength += parseInt(jQuery(".length_3").val().length);
                    curLength += parseInt(jQuery(".length_5").val().length);
                    curLength += parseInt(jQuery(".length_6").val().length);
                    
                    if(curLength > maxLength)
                    {
                        alert('ACHTUNG: Ihr Name überschreitet das Maximum von 50 Zeichen!');
                        
                    }
                }else if(jQuery("input[name=firma_shipping]:checked").val() == 1)
                {
                    curLength += parseInt(jQuery(".length_1").val().length);
                    curLength += parseInt(jQuery(".length_2").val().length);
                    curLength += parseInt(jQuery(".length_3").val().length);
                    curLength += parseInt(jQuery(".length_5").val().length);
                    curLength += parseInt(jQuery(".length_6").val().length);                    
                    
                    if(curLength > maxLength)
                    {
                        alert('ACHTUNG: Ihr Name überschreitet das Maximum von 50 Zeichen!');
                    }                    
                }else
                {
                    curLength += parseInt(jQuery(".length_2").val().length);
                    curLength += parseInt(jQuery(".length_3").val().length);
                    curLength += parseInt(jQuery(".length_5").val().length);
                    curLength += parseInt(jQuery(".length_6").val().length);
                    
                    if(curLength > maxLength)
                    {
                        alert('ACHTUNG: Ihr Name überschreitet das Maximum von 50 Zeichen!');
                    }                     
                }
                
            });
        });
    }    
    
    if(jQuery("#billing-address-select option").length > 0)
    {
        
        jQuery("#billing-address-select option").each(function(){
            var split = new Array();
            
            var cur_address = jQuery(this).html();
            split = cur_address.split(',');
            
            if(split.length > 3)
            {
                jQuery(this).html('');
                
                for(i=0;i < split.length; i++)
                {
                    if(i != 3 && i != 4)
                    {
                        if(i + 3 == split.length)
                        {
                            jQuery(this).append(split[i]);
                        }else
                        {
                            jQuery(this).append(split[i] + ', ');
                        }
                        
                    }
                    
                }                
            }
        });        
    }    
    
    
    if(jQuery("#checkout-step-shipping option").length > 0)
    {
        
        jQuery("#checkout-step-shipping option").each(function(){
            var split = new Array();
            
            var cur_address = jQuery(this).html();
            split = cur_address.split(',');
            
            if(split.length > 3)
            {
                jQuery(this).html('');
                
                for(i=0;i < split.length; i++)
                {
                    if(i != 3 && i != 4)
                    {
                        if(i + 3 == split.length)
                        {
                            jQuery(this).append(split[i]);
                        }else
                        {
                            jQuery(this).append(split[i] + ', ');
                        }
                        
                    }
                    
                }                
            }
        });        
    }        

    jQuery('#infoBoxDisplay').hide();
    jQuery('.infoBox').hoverIntent(infoConf);            
    jQuery('#tool-tip-content').hide();
    jQuery('.showtooltip').hoverIntent(infoConf3);

    // Menüpunkte aktiv setzen
        var s = new String();
        s = window.location.href;
        
        jQuery("#navigation a").each(function(){
            var b = new String();
            b = jQuery(this).attr('href');
            
            if(s.indexOf(jQuery(this).attr('href')) != -1)
            {
                jQuery(this).parent().addClass('active');
                if(jQuery(this).parent().parent().hasClass('level2')){
                    jQuery(this).parent().parent().parent().addClass('active');
                }
            }
            
            if(s.indexOf('mitgliedschaften') != -1 && b.indexOf('mitgliedschaften') != -1)
            {
                jQuery(this).parent().addClass('active');
            }
            
            if(s.indexOf('abonnement') != -1 && b.indexOf('abonnement') != -1)
            {
                jQuery(this).parent().addClass('active');
            }
        
        });
        
        jQuery("#right_block a").each(function(){
            if(s.indexOf(jQuery(this).attr('href')) != -1)
            {
                jQuery(this).parent().addClass('active');
                if(jQuery(this).parent().parent().hasClass('level2')){
                    jQuery(this).parent().parent().parent().addClass('active');
                }
            }
        });
        
        jQuery('#navigation li.active').find('ul').addClass('active');
        
    // R Hochstellen
        jQuery('h2').each(function(){   
            if(jQuery(this).parent().hasClass('item') == false){
                var replace = new String();
                replace = jQuery(this).html();
                replace = replace.replace('®', '<sup style="font-size:10px;">®</sup>');

                jQuery(this).html(replace);                
            }
        });  

        jQuery('h1').each(function(){   
            var replace = new String();
            replace = jQuery(this).html();
            replace = replace.replace('®', '<sup style="font-size:10px;">®</sup>');

            jQuery(this).html(replace);
        });      

        jQuery('.row_wrap').each(function(){   
            var replace = new String();
            replace = jQuery(this).html();
            replace = replace.replace('®', '<sup style="font-size:10px;">®</sup>');

            jQuery(this).html(replace);
        });      

        jQuery('b').each(function(){   
            var replace = new String();
            replace = jQuery(this).html();
            replace = replace.replace('®', '<sup style="font-size:10px;">®</sup>');

            jQuery(this).html(replace);
        });          


        jQuery('.sidebox_right').each(function(){   
            var replace = new String();
            replace = jQuery(this).html();
            replace = replace.replace('®', '<sup style="font-size:10px;">®</sup>');

            jQuery(this).html(replace);
        });          
    
    // Init backend object
    var backend_obj = new Backend();
    var this_link;
    
    if(backend_obj.isBackend == false)
    {
        // Page Part :: Shadowbox
        jQuery(".sidebox_right").each(function(){
           // Add shadow overlay to all sideboxes
           // Work-around for SMW-CMS        
           jQuery(this).prepend('<div class="mask_overlay_bg"></div>');
           if(jQuery(this).find('.mask_overlay').length == 0)
           {
                jQuery(this).append('<div class="mask_overlay"></div>');
           }
           
           // Set Height for Dynamic shadow box
           if(jQuery(this).find('img').length > 0){ 
               var this_height = jQuery(this).find('img').height();   
               jQuery(this).css({'max-height' : (this_height + 35)});
               jQuery(this).find('.mask_overlay_bg').css({'height' : (this_height+35)});
               
               if(jQuery(this).find('a').length > 0)
               {                    
                    jQuery(this).click(function(){
                        this_link = jQuery(this).find('a').attr('href');                                                                        
                        window.location = this_link;
                    });                
                    
                    jQuery(this).css({'cursor' : 'pointer'});                                        
               }
               
               if(jQuery(this).find('.mask_overlay').length == 0){
                   jQuery(this).append('<div class="mask_overlay"></div>');
               }
               
           }else{
               jQuery(this).css({'max-height' : '2000px'});
               this_height = jQuery(".sidebox_right").height();
               jQuery(this).find('.mask_overlay_bg').css({'height' : (this_height+85)});
           }
        });
        
        // Add Padding
        if(jQuery("#boxes").length > 0)
        {
            jQuery("#content_wrap").css({'padding-bottom' : '170px'});
        }
        
        // Remove SMW-Title-Tags
        jQuery(".auit-edit-block").each(function(){
            jQuery(this).attr('title','');                  
        });
                     
    }else{
        backend_obj.initIntervalFunctions();
    }
    
    // Level 1 Hoverintent
    jQuery("ul.level1 li").hoverIntent(Identconfig);
    
    var first = window.location.href;
    if(first == undefined || first == '' || first == 'fragen' || first.indexOf('/faq/index/index') > -1 )
    {
        first = '[Fragen Interessenten]';
    } else if(first.indexOf('/faq/index/mitglieder') > -1)
    {
        first = '[Fragen Mitglieder]';
        jQuery('.faq-skin h2').html('Häufige Fragen von Mitgliedern und Abonnenten');
    }else if(first.indexOf('/faq/index/kunden') > -1)
    {
        first = '[Fragen Kunden]';
        jQuery('.faq-skin h2').html('Häufige Fragen von Kunden');
    }
    
    // FAQ
    if(jQuery(".yui-accordion-panel").length > 0 ){
        jQuery(".yui-accordion-panel").each(
        function()
        {
           var cont = jQuery(this).find('.yui-accordion-toggle').html();
           if(cont.indexOf(first) > -1)
           {
                cont = cont.replace(first, '');
                jQuery(this).find('.yui-accordion-toggle').html(cont);
           } else {
            jQuery(this).css({'display' : 'none'});
           }
        });
    }
    
    // Coupon
    if(jQuery('#shopping-cart-table').length > 0){
        jQuery("#shopping-cart-table #coupon_code").keyup(function(e){
            var code = (e.keyCode ? e.keyCode : e.which);
            if(code == 13)
            {
                document.discount.submit(false);
                return false;
            }
            var this_val = jQuery(this).val();
            jQuery(".discount-form #coupon_code").val(this_val);
        });
        
        jQuery('.discount .button_itm').click(function(){
            var this_val = jQuery('#shopping-cart-table #coupon_code').val();
            jQuery(".discount-form #coupon_code").val(this_val);            
        });
    }
    
    // progress
    if(jQuery("#opc-login").length > 0 && jQuery("#opc-login").hasClass('active'))
    {
        jQuery("#progress").hide();     
    }

    // Step1 -> Step2
    jQuery("#billing-buttons-container .button_itm").click(function()
    {
        jQuery("#progress").addClass('step2');
    });

    // Step1 <- Step2
    jQuery("#shipping-buttons-container .button_white_back").click(function(){
         jQuery("#progress").removeClass('step2');
    });
    
    // Step2 -> Step3
    jQuery("#shipping-method-buttons-container div.button_white").click(function(){
         jQuery("#progress").removeClass('step2').addClass('step3');
         setTimeout('copyFelder()', 3000);
    });
    
    // Step2 <- Step3
    jQuery("#payment-buttons-container .button_white_back").click(function(){
         jQuery("#progress").removeClass('step3').addClass('step2');
    });  
    
    // Step3 -> Step4
    jQuery("#payment-buttons-container div.button_white").click(function(){
         postData();
         jQuery("#progress").removeClass('step3').addClass('step4');
    });
    
    // Step3 <- Step4
    //jQuery("#payment-buttons-container .button_white_back").click(function(){
    //   jQuery("#progress").removeClass('step4').addClass('step3'); 
    //});
    
    Date.format = 'dd.mm.yyyy';
    jQuery('.date-pick').datePicker().attr("readonly","true");
    
    //Date.format = 'yyyy-mm-dd';
    jQuery('.date-pick2').datePicker().attr("readonly","true");
    
    jQuery('.info_box').hoverIntent(infoConfig);

    jQuery("a.jQueryBookmark").click(function(e){
	e.preventDefault();
	var bookmarkUrl = this.href;
	var bookmarkTitle = this.title.replace('GmbH', '');
 
	if (window.sidebar) { // Firefox 
            window.sidebar.addPanel(bookmarkTitle, bookmarkUrl,"");
	} else if( window.external || document.all) { // IE
            window.external.AddFavorite( bookmarkUrl, bookmarkTitle);
	} else if(window.opera) { // Opera
            jQuery("a.jQueryBookmark").attr("href",bookmarkUrl);
            jQuery("a.jQueryBookmark").attr("title",bookmarkTitle);
            jQuery("a.jQueryBookmark").attr("rel","sidebar");
	} else { 
            alert('Ihr Browser unterstützt diese Funktion leider nicht.');
            return false;
	}
    });
});

