/********************* Lexware Umsetzung LexLive Startseite script *****/
/************************************** Copyright (c) 2010 Lexware *****/
/***********************************************************************/
/*********************************************** individual script *****/
/***********************************************************************/
/************************************** author virtual identity AG *****/
/* $LastChangedDate: 2010-06-02 17:15:12 +0200 (Mi, 02 Jun 2010) $ *****/

$.fn.wait = function(time, type){
    time = time || 6000;
    type = type || "fx";
    return this.queue(type, function(){
        var self = this;
        setTimeout(function(){
            $(self).dequeue();
        }, time);
    });
};

$(document).ready(function(){
    // add a 1px outline div to all selectboxes in IE 7
    if (vi.Info.os.isWin && vi.Info.browser.isIEpre8) {
        divToSelectsForIe("select");
        $("#primNav li").hover(function(){
            $(this).addClass("hover").siblings().hide().show();
        }, function(){
            $(this).removeClass("hover");
        });
        
        if (vi.Info.browser.isIEpre7) {
            $("#customerGroup, #stageZone img.stencil").ie6PngFix();
        }
    }
    
    $("fieldset#login label").click(function(){
        $(this).hide();
    });
    $("fieldset#login input.text").focusout(function(){
        if ($(this).val() == "") {
            var target = $(this).attr("id");
            $("fieldset#login label[for=" + target + "]").show();
        }
    }).focusin(function(){
        var target = $(this).attr("id");
        $("fieldset#login label[for=" + target + "]").hide();
    }).attr("value", "");
    
    var numberOfElements = $(".fadingElement").size();
    var element = 1;
    
    function fadeElement(element){
        $("#element" + element).fadeIn(1500).wait().fadeOut(1500, function(){
            element++;
            if (element > numberOfElements) {
                element = 1;
            }
            fadeElement(element);
        });
    }
    
    fadeElement(element);
    
});
