    /*if (typeof fancyCheck == 'undefined') {
        var fancyCheck = true;
    }*/
    
    $(function() {
        if ($('#slider').find('li').length > 1) {
            $('#slider').easySlider({
                auto: true, 
                continuous: true,
                numeric: true,
                pause: 4000
            });
        }
        if ($('#product_slider').children().length > 2) {
            $('#product_slider').movingBoxes({
                startPanel  : 2,     // start with this panel
                wrap        : true,  // psuedo wrapping - it just runs to the other end
                width       : 770,   // overall width of movingBoxes
                panelWidth  : 3/8,   // current panel width adjusted to 50% of overall width
                imageRatio  : 1,     // Image ration set to 1:1 (square image)
                buildNav    : false, // if true, navigation links will be added
                hashTags    : true
            });
        } else {
            $('#product_slider').movingBoxes({
                startPanel  : 2,     // start with this panel
                wrap        : true,  // psuedo wrapping - it just runs to the other end
                width       : 560,   // overall width of movingBoxes
                imageRatio  : 1,     // Image ration set to 1:1 (square image)
                buildNav    : false, // if true, navigation links will be added
                hashTags    : true
            });
        }
        
        //if (typeof parent.fancyCheck == 'undefined') {
            $('.fancybox').fancybox({
                'height'    : 530,
                'type'      : 'iframe',
                'padding'   : 0,
                'width'     : 810,
                'onStart'   : function() {
                    $('#fancybox-outer').css('background', '#FFFFFF url(fileadmin/templates/images/ajax-loader.gif) no-repeat center');
                },
                'onCleanup' : function() {
                    $('#fancybox-outer').css('background', '#FFFFFF');
                }
            });
            
            $('.fancyboxIframe').click(function(event) {
                event.preventDefault();
                parent.$('#fancyboxIframeA').attr('href', $(this).attr('href')).trigger('click');
            });
        //}
        
        if ($('#locator-search-container form')) {
            var city = $('#tx_locator_pi1_city');
            city.click(function() {
                if (city.val() == 'PLZ oder Stadt') {
                    city.val('');
                }
            });
            var cityLabel = city.val();
            
            if (city.val() == '' || city.val() == 'PLZ oder Stadt') {
                /*if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(function(position) {
                        var positionCheck = position.coords.latitude;
                        
                        if (typeof positionCheck == 'undefined') {
                            city.val('Nordhausen');
                        } else {
                            var geo = google.gears.factory.create("beta.geolocation");
                            geo.getCurrentPosition(function() {
                                lat = position.coords.latitude;
                                lon = position.coords.longitude;
                                console.log(position.gearsAddress.city);
                            }, function() {}, { gearsRequestAddress: true });
                            city.val(position);
                        }
                    });
                } else {
                    city.val('Nordhausen');
                }*/
            }
            /*$('.selectCountry').val('de');
            $('#locator-search-radius select').val('100 km');
            $('#locator-search-container form').submit();
            city.val(cityLabel);
            $('.selectCountry').val('de');
            $('#locator-search-radius select').val('20 km');*/
        }
        
        if ($('#locator-map-container') && $('#locator-map-container').length == 0) {
            $('#locator-map-container').ready(function() {
                var mapAll = $('#mapAll', this);
                mapAll.ready(function() {
                    if ($('body', this)[0].childElementCount > 6) {
                        mapAll.height(0);
                        
                        if ($('.routev-inner').length >= 1) {
                            $('.routev-inner').each(function() {
                                if ($(this).html() == '###ROUTEV###') {
                                    $(this).html('');
                                }
                            });
                        }
                        
                        var haendlerList = $('.haendler-list-item');
                        if (haendlerList.length > 1) {
                            $(haendlerList[1]).hide();
                        }
                    }
                });
                $('.tx-locator-pi1 .formHeader', this).hide();
                $('.tx-locator-pi1 form', this).hide();
                $('.tx-locator-pi1 .searchResultHeader', this).slice(1).hide();
                
                if ($('.routev-inner').length >= 1) {
                    $('.routev-inner').each(function() {
                        if ($(this).html() == '###ROUTEV###') {
                            $(this).html('');
                        }
                    });
                }
            });
        }
        
        
        listItemCounterMin = 0;
        listItemCounterMax = 10;
        listUpdate($('.haendler-list-item'), listItemCounterMin, listItemCounterMax);

        $('.haendler-list-next-site').click(function() {
            if (listItemCounterMax < $('.haendler-list-item').length) {
                listItemCounterMin += 10;
                listItemCounterMax += 10;
                listUpdate($('.haendler-list-item'), listItemCounterMin, listItemCounterMax);
            }
        });
        $('.haendler-list-prev-site').click(function() {
            if (listItemCounterMin != 0) {
                listItemCounterMin -= 10;
                listItemCounterMax -= 10;
                listUpdate($('.haendler-list-item'), listItemCounterMin, listItemCounterMax);
            }
        });
    });
    
    function listUpdate(listObj, listItemCounterMin, listItemCounterMax) {
        listItemCounter = 0;
        
        listObj.hide();
        listObj.each(function() {
            if (listItemCounter >= listItemCounterMin && listItemCounter < listItemCounterMax) {
                $(this).show();
            }
            
            listItemCounter++;
        });
    }
    
    function checkFields() {
    }
