var isIE = /*@cc_on!@*/false;

$(document).ready(function() {
    $('#topnav li a img').parents('li').css('border-left', '0 none');
    
    $('#search input, #search_again input')
        .focus(function() {
            if (this.value=='Suche') { 
                this.value=''; 
            } else { 
                var me = this; 
                window.setTimeout(function() { me.select(); }, 100); 
            }
        })
        .blur(function() {
            if (this.value=='') { 
                this.value='Suche'; 
            }
        });
       
    if ($('body').attr('id') == 'page1') {
        var pos = $('#right').position();
        /*$('<div id="fashionnails_menu" style="background:black;width:200px;height:100px;position:absolute;top:' + (+pos.top+375) + 'px;left:' + (+pos.left+535) + 'px;"/>')
            .appendTo('#index li');
            
        $('<div id="fashionlashes_menu" style="background:black;width:200px;height:100px;position:absolute;top:' + (+pos.top+375) + 'px;left:' + (+pos.left+765) + 'px;"/>')
            .appendTo('#index li');
        
        $('#fashionnails, #fashionlashes').mouseover(function() {
            $('#' + this.id + '_menu').fadeOut('slow');
        }).mouseout(function() {
            var id = this.id;
            
            var timer = setTimeout(function() {
                $('#' + id + '_menu').fadeIn('slow');
            }, 1000);
            
            $('area.submenu').mouseover(function() {
                clearTimeout(timer);
                timer = null;
            }).mouseout(function() {
                //$('#' + id + '_menu').fadeIn('slow');
            });
        });*/

        /*$('#start').css({
            'top': (+pos.top+331) + 'px',
            'left': (+pos.left+545) + 'px'
        });*/

        var $parent_lis = $('#fashionnails, #fashionlashes').parent('li');
        var timer = null;
        $parent_lis.bind('mouseenter', function() {
            clearTimeout(timer); timer = null;
            $('li', this).slideDown();
        })
        
        $parent_lis.bind('mouseleave', function() {
            if (!isIE) {
                $('li', this).slideUp();  
            } else {
                var that = this;
                timer = setTimeout(function() {
                    $('li', that).slideUp(); 
                }, 200);
            }
        });

        /*$('<div id="five-fotos"/>').css({
            'top': (+pos.top+81) + 'px',
            'left': (+pos.left+145) + 'px'
        }).appendTo('#index > li');
        
        var $fotos = $('#five-fotos');
        var w = $fotos.width();*/
        
        $(window).resize(function() {
            /*var pos = $('img').position();
            $('#five-fotos').css({
                'top': (+pos.top+81) + 'px',
                'left': (+pos.left+145) + 'px'
            });*/
            location.href = location.href;
        });
        
        var x = 0;
        /*window.setInterval(function() {
            if (x <= -1380) {
                x = w;
            }
            
            $fotos.fadeOut(2000, function() {
                x -= (w + 4);
                $fotos.css({'background-position': x + 'px 0px'});
                $fotos.fadeIn(2000);
            });
        }, 6000);*/
    }
});

