

/* !Everyday Subpage */
/* ---------------------------------------------------------------------- */

function showDetail(myLayerID) {
/*
    tmp = document.getElementById(myLayerID);
    tmp.style.display = 'block';
*/

    $('#varianteBildKlein').live("click", function(){

        $('.varianteBildKleinDark').removeClass();
        $(this).addClass('varianteBildKleinDark');

        $('.varianteBlock').hide();     
        $(this).next('div').show();
   
    });

    $('#varianteBildKlein').live("mouseover", function(){
        $(this).addClass('varianteBildKleinDarkOver');
    });

    $('#varianteBildKlein').live("mouseout", function(){
        $(this).removeClass('varianteBildKleinDarkOver');
    });

}




/* !showArrows */
/* ---------------------------------------------------------------------- */
function showArrows (activPosition, sliderWidth, anzahlSliderPos) {     
    
    var activPosition = parseFloat($('#overview').css('left'));
    
    if (activPosition == '0') { 
        $('#subMenuLeftArrowLeft').css({ display : 'none'});
    } else {
        $('#subMenuLeftArrowLeft').css({ display : 'block'});
    }

    if (activPosition == -(sliderWidth*(anzahlSliderPos-1))) {  
        $('#subMenuLeftArrowRight').css({ display : 'none'});
    } else {
        $('#subMenuLeftArrowRight').css({ display : 'block'});
    }

}



/* !Document Ready */
/* ---------------------------------------------------------------------- */
$(document).ready(function(){   

    if ( $('.varianteBlock').length > 0 ) {
        
        $('.varianteBlock:first').show();

        $('.myProduktLinieImage').each(function () {
        
            // $(this).html('alksdfjadklsfjadklsfj');
            var imageExist = $(this).children().size();
        
            if (imageExist == '0') { 
                $(this).html('alksdfjadklsfjadklsfj');
                $(this).parent().parent().remove();
            } 
        });
    }
    
    /* !ProduktLinie Animation */
    /* ---------------------------------------------------------------------- */    
    
    if ( $('.myProduktLinieImage').length > 0 ) {
    
        var sliderWidth = 784;
        var anzahlLadys = $('.myProduktLinieImage').size();
        
        var anzahlSliderPos = Math.ceil(anzahlLadys / 4);
        var gesamtWidth = -(sliderWidth*anzahlSliderPos)+sliderWidth;
        
        var activPosition = parseFloat($('#overview').css('left'));
    
        var run = 1;
        var blockAnimation = false;     
    
    /*  
        alert(anzahlSliderPos);
        alert(gesamtWidth);
    */
    
        /* !Hide Paginator */
        $(".subMenuLeftTextA").slice(0, anzahlSliderPos).css("display" , "inline");
    
        /* !Hide Submenu */
        if(anzahlLadys <= 4) {
            $('#subMenuLeftArrowLeft').css({ display : "none"});
            $('#subMenuLeftText').css({ display : "none"});
            $('#subMenuLeftArrowRight').css({ display : "none"});
        }
        
        
        /* !arrow Hover */      
        $('#subMenuLeftArrowLeft').hover(
            function () {
                $(this).css("background-image" , "url(/fileadmin/images/subMenuArrowLeftHover.png)");
            }, 
            function () {
                $(this).css( "background-image" , "url(/fileadmin/images/subMenuArrowLeft.png)");
            }
        );
    
        $('#subMenuLeftArrowRight').hover(
            function () {
                $(this).css( "background-image" , "url(/fileadmin/images/subMenuArrowRightHover.png)");
            }, 
            function () {
                $(this).css( "background-image" , "url(/fileadmin/images/subMenuArrowRight.png)");
            }
        );
    
        
        /* !Paginator Functions */
        $('#subMenuLeftText1').click(function(){
            if(blockAnimation != true){
                blockAnimation = true;
                $('#overview').animate({left: "0px"}, 1500, function() { 
                    blockAnimation=false;
                    showArrows (activPosition, sliderWidth, anzahlSliderPos);
                });
                $('#subMenuLeftText > *').removeClass('subMenuSelected');
                $(this).addClass("subMenuSelected");
            }
        });
        
        $('#subMenuLeftText2').click(function(){
            if(blockAnimation != true){
                blockAnimation = true;      
                $('#overview').animate({left: -sliderWidth*1}, 1500, function() { 
                    blockAnimation=false;
                    showArrows (activPosition, sliderWidth, anzahlSliderPos);
                });
                $('#subMenuLeftText > *').removeClass('subMenuSelected');
                $(this).addClass("subMenuSelected");
            }
        });
    
        $('#subMenuLeftText3').click(function(){
            if(blockAnimation != true){
                blockAnimation = true;      
                $('#overview').animate({left: -sliderWidth*2}, 1500, function() { 
                    blockAnimation=false;
                    showArrows (activPosition, sliderWidth, anzahlSliderPos);
                });
                $('#subMenuLeftText > *').removeClass('subMenuSelected');
                $(this).addClass("subMenuSelected");
            }
        });
        
        $('#subMenuLeftText4').click(function(){
            if(blockAnimation != true){
                blockAnimation = true;      
                $('#overview').animate({left: -sliderWidth*3}, 1500, function() { 
                    blockAnimation=false;
                    showArrows (activPosition, sliderWidth, anzahlSliderPos);
                });
                $('#subMenuLeftText > *').removeClass('subMenuSelected');
                $(this).addClass("subMenuSelected");
            }
        });     
    
        $('#subMenuLeftText5').click(function(){
            if(blockAnimation != true){
                blockAnimation = true; 
                $('#overview').animate({left: -sliderWidth*4}, 1500, function() { 
                    blockAnimation=false;
                    var activPosition = parseFloat($('#overview').css('left'));
                    showArrows (activPosition, sliderWidth, anzahlSliderPos);
                });
                $('#subMenuLeftText > *').removeClass('subMenuSelected');
                $(this).addClass("subMenuSelected");
            }
        });     
        
        
        /* !Arrow Functions */
        
        if (run = 1) {
            $('#subMenuLeftArrowRight').bind("click", function(){
                if(blockAnimation != true){
                    blockAnimation = true;
                    var run = 0;
                    var actualPos = parseFloat($('#overview').css("left"));
                
                    if (actualPos > gesamtWidth) {
                        $('.subMenuSelected').removeClass('subMenuSelected').next().addClass('subMenuSelected');
                        $('#overview').animate({left: actualPos - sliderWidth}, 1500, function() { 
                            var run = 1;
                            blockAnimation=false;
                            showArrows (activPosition, sliderWidth, anzahlSliderPos);
                        });
                    } else {
                        var run = 1;
                        blockAnimation=false;
                        return;
                    }
                }
            });
        }
        
            
        $('#subMenuLeftArrowLeft').bind("click", function(){
            if(blockAnimation != true){
                blockAnimation = true;
                var actualPos = parseFloat($('#overview').css("left"));
                if (actualPos < 0) {
                    $('.subMenuSelected').removeClass('subMenuSelected').prev().addClass('subMenuSelected');
                    $('#overview').animate({left: actualPos + sliderWidth}, 1500, function() {
                        blockAnimation=false;
                        showArrows (activPosition, sliderWidth, anzahlSliderPos);
                    });
                } else {
                    blockAnimation=false;
                    return;
                }
            }
        });
            
        
    
        
    
        showArrows (activPosition, sliderWidth, anzahlSliderPos);
            
            
            
            
        /* !number Highlighting */
        $('.subMenuLeftTextA:first').addClass('subMenuSelected');
    }

    /* ============================================ Farben ============================================ */

    var myColors = new Array();

    myColors['1-Weiss'               ] = ['1 Weiss'             , '1 White'                    ];
    myColors['2-Schwarz'             ] = ['2 Schwarz'           , '2 Black'                    ];
    myColors['4-Haut'                ] = ['4 Haut'              , '4 Skin'                     ];
    myColors['8-Haut'                ] = ['8 Haut'              , '8 Skin'                     ];
    myColors['23-Rot'                ] = ['23 Rot'              , '23 Red'                     ];
    myColors['28-Skin'               ] = ['28 Skin'             , '28 Skin'                    ];
    myColors['44-Sand'               ] = ['44 Sand'             , '44 Sand'                    ];
    myColors['58-Nougat'             ] = ['58 Nougat'           , '58 Nougat'                  ];
    myColors['110-Seidenweiss'       ] = ['110 Seidenweiss'     , '110 Silkwhite'              ];
    myColors['138-Dunkelblau'        ] = ['138 Dunkelblau'      , '138 Darkblue'               ];
    myColors['666-Bordeauxrot'       ] = ['666 Bordeauxrot'     , '666 Bordeauxred'            ];
    myColors['9-Tuerkis'             ] = ['9 Tuerkis'           , '9 Turquise'                 ];
    myColors['19-Pfirsich'           ] = ['19 Pfirsich'         , '19 Peach'                   ];
    myColors['24-Rosso'              ] = ['24 Rosso'            , '24 Rosso'                   ];
    myColors['50-Braun-Blau'         ] = ['50 Braun Blau'       , '50 Brown-Blue'              ];
    myColors['70-Blumen'             ] = ['70 Blumen'           , '70 Flowers'                 ];
    myColors['72-Mint-Weiss'         ] = ['72 Mint Weiss'       , '72 Mint-White'              ];
    myColors['73-Gold-Seide'         ] = ['73 Gold Seide'       , '73 Gold-Silk'               ];
    myColors['610-Antrazith'         ] = ['610 Antrazith'       , '610 Antrazith'              ];
    myColors['6-Lavendel'            ] = ['6 Lavendel'          , '6 Lavender'                 ];
    myColors['51-Karodruck-Flieder'  ] = ['51 Karodruck Flieder', '51 Square-Printed Lilac'    ];
    
    if ( $('.colorSelectFarbe').length > 0 )
    {
        /* !showColor */
        $('.colorSelectFarbe').live("mouseover", function(){

            var myColorName = $(this).children().attr('class');
            myColorName = myColorName.substr(6);

            var myLang = document.getElementById("sys_language_uid").innerHTML;          
            
//            myLang = 0;           
//            alert('myColorName: ' + myColorName + ' | myLang: ' + myLang + ' | ' + myColors[myColorName][myLang]);
            
//            alert(myColors[myColorName][myLang]);
            $(this).parent().next().children(':last').html(myColors[myColorName][myLang]);

//            myColorName = replaceAll(myColorName, '-', ' ');           
//            $(this).parent().next().children(':last').html(myColorName);
       
        });
    }
    
});







