$(document).ready(function(){

	$('.sz-newsletter > div > div').addClass('sz-newsticker-outer');
	$('.sz-newsletter > div > div > div > div:nth(0)').addClass('sz-newsticker-header');
	$('.sz-newsletter > div > div > div > div:nth(0) > span:nth(0)').addClass('sz-newsticker-header-text');
	$('.sz-newsletter > div > div > div > div:nth(0) > span:nth(1)').addClass('sz-newsticker-header-source');
	$('.sz-newsletter > div > div > div > div').not('.sz-newsticker-header').addClass('sz-newsticker-children');	
	
	
   $("#mailformformtype_mail").wrap("<div class='sliding-door'></div>");
   $element = $('#mailformemail');
   $element.addClass('behavior-clearonfocus-active');
   $('#mailformemail').val('xyz@provider.de');

   var form = $element.parents('form');
   form.bind('submit', function(ev){
      form.find('.behavior-clearonfocus-active').val('');
   });

   $element.one('focus', function(){
      $(this).val('').removeClass('behavior-clearonfocus-active');
   });

    // add clearer in 2-column-layout
    if($.browser.msie){
        $('#content .filelinks li.even').after("<br class='clear' />");
        $('.blog-single-prevlink:empty').hide();
        $('.blog-single-nextlink:empty').hide();
    }

    $('.blog-item-image .thickbox:not(:first)').hide();
    


    mycarousel_itemList = [];
    $('#mycarousel li').each(function(){
        mycarousel_itemList.push($(this).html());
    });
    
    jQuery('#mycarousel').jcarousel({
        wrap: 'circular',
        scroll: 1,
        auto: 0,
        start: 3,
        offset: 1,
        visible: 1,
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback},
        initCallback: mycarousel_initCallback
    });

    $('.jcarousel-next').text("»");
    $('.jcarousel-prev').text("«");

});

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_itemList[idx-1]);
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i); 
};

function mycarousel_initCallback(carousel)
{
	$('#mycarousel').height($('#mycarousel').height());
	
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
    
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
    
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
}; 
