
$(document).ready(function() {
		$('#coin-slider').coinslider({ width: 1000, height: 511, navigation: false, delay: 5000, effect: 'rain', sDelay: 30 });

                 
        if ($('.imageElement').lenght > 0) {
            randomizeContent("imageElement");
        }
  
        if ($('.animatedhome').length > 0) {
            preparation();
        }
        
        if ($('.animatedproductpage').length > 0) {
            preparation_ap();
        }
        
        $("#inhalt .news").autobrowse(
                {
                    url: function (offset)
                    {
                        return '/news/moreitems/?format=json&offset=' + offset;
                    },
                    template: function (response)
                    {
                        var markup='';
                        for (var i=0; i<response.items.length; i++)
                        {
                            markup += response.items[i].source;
                        };
                        return markup;
                    },
                    itemsReturned: function (response) { return response.items.length; },
                    complete: function (response) { doajaxsifir();  },
                    finished: function (response) {  },
                    offset: 0,
                    max: 100,
                    loader: '<div class="loader"></div>',
                    useCache: false,
                    expiration: 1
                }
      );
          
      $("#inhalt .downloads").autobrowse(
                {
                    url: function (offset)
                    {
                        return '/pressmoreitems/?format=json&cat_id=1&offset=' + offset;
                    },
                    template: function (response)
                    {
                        var markup='';
                        for (var i=0; i<response.items.length; i++)
                        {
                            markup += response.items[i].source;
                        };
                        return markup;
                    },
                    itemsReturned: function (response) { return response.items.length; },
                    complete: function (response) { doajaxsifir();  },
                    finished: function (response) {  },
                    offset: 0,
                    max: 100,
                    loader: '<div class="loader"></div>',
                    useCache: false,
                    expiration: 1
                }
      );
});

function doajaxsifir(){
    sIFR.replaceElement(named({sSelector:"h2.replace", sFlashSrc:"/00_scripte/sIFR-2.0.7/serif.swf", sColor:"#ffffff", sLinkColor:"#ffffff", sBgColor:"#FFFFFF", sHoverColor:"#9aaea1", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=0", sWmode: "transparent"}));
	sIFR.replaceElement(named({sSelector:"h2.replace2", sFlashSrc:"/00_scripte/sIFR-2.0.7/serif.swf", sColor:"#073b17", sLinkColor:"#073b17", sBgColor:"#073b17", sHoverColor:"#073b17", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=5", sWmode: "transparent"}));
	// sIFR.replaceElement(named({sSelector:"h2.replace3", sFlashSrc:"/00_scripte/sIFR-2.0.7/serif.swf", sColor:"#073b17", sLinkColor:"#073b17", sBgColor:"#073b17", sHoverColor:"#073b17", nPaddingTop:0, nPaddingBottom:0, sFlashVars:"textalign=left&offsetTop=5", sWmode: "transparent"}));

}

function preparation_ap(){

    $(".image").css({
        "opacity": 0 /*,
        "marginLeft" : 20
        display": "none",
        "fontSize": "11px" */
    });
    $(".text h1").css({
        "opacity": 0,
        "marginLeft" : 20
    });
    $(".text h2").css({
        "opacity": 0,
        "marginLeft" : 20
    });
    $(".text p, .text table").css({
        "opacity": 0,
        "marginLeft" : 20
    });
    setTimeout(animation_ap, 100); 
}

function animation_ap(){

    /* - H1 - */
    $(".text h1").animate({
        "opacity": 1,
        "marginLeft" : 0
        },
        1000,

        /* - H2- */
        function (){
            $(".text h2").animate({
                "opacity": 1,
                "marginLeft" : 0
                },
                1000,

            /* - p und image - */
            function (){
                $(".text p, .text table").animate({
                    "opacity": 1,
                    "marginLeft" : 0
                    },
                    1000,

                    function() {
                        $(".image").animate({
                            "opacity": 1
                            },
                            1500
                        )
                    }

                    );
            }
            /* - /H2 - */

            );
        }
        /* - /H1 - */
    );

}



function preparation(){

    $(".box_left").css({
        "opacity": 0,
        "marginTop" : 20
    });
    $(".box_right").css({
        "opacity": 0,
        "marginTop" : 20
    });
    $(".box_middle").css({
        "opacity": 0,
        "marginTop" : 20
    });
    setTimeout(animation, 100); 
}

function animation(){

    /* - H1 - */
    $(".box_left").animate({
        "opacity": 1,
        "marginTop" : 0
        },
        1000,

        /* - H2- */
        function (){
            $(".box_middle").animate({
                "opacity": 1,
                "marginTop" : 0
                },
                1000,

            /* - p und image - */
            function (){
                $(".box_right").animate({
                    "opacity": 1,
                    "marginTop" : 0
                    },
                    1000

                    );
            }
            /* - /H2 - */

            );
        }
        /* - /H1 - */
    );

}

