var WidthOfLi = 166;
var HeightOfLi = 125;

function Rotate_left() 
{
	var ToTheLeft = parseFloat(jQuery('#scrollcontent').css('margin-left')) - WidthOfLi;
	var AantalLis = jQuery('#scrollcontent li').size();
	var afwijking = ToTheLeft % WidthOfLi;
		
	ToTheLeft = ToTheLeft - afwijking;

	var maxAnimate = (AantalLis-2) * -1 * WidthOfLi;
		
	if (ToTheLeft >= maxAnimate)
	{
		jQuery('#scrollcontent').animate({marginLeft: ToTheLeft},"slow");
		jQuery('#scroll_right').css('visibility','visible');
		if (ToTheLeft <= maxAnimate)
		{
			jQuery('#scroll_left').css('visibility','hidden');
		}
	}            
}

function Rotate_right() {
	var ToTheRight= parseFloat(jQuery('#scrollcontent').css('margin-left')) + WidthOfLi; 
	var afwijking = 0;
	
	afwijking = ToTheRight % WidthOfLi;
	ToTheRight = ToTheRight - afwijking;
	
	if(ToTheRight<=0)
	{
		jQuery('#scrollcontent').animate({marginLeft: ToTheRight},"slow");
		jQuery('#scroll_left').css('visibility','visible');
		if (ToTheRight >= 0)
		{
			jQuery('#scroll_right').css('visibility','hidden');
		}
	}
}

function Rotate_down() 
{
	var ToTheBottom = parseFloat(jQuery('#scrollcontent').css('margin-top')) - HeightOfLi;
	var AantalLis = jQuery('#scrollcontent li').size();
	var afwijking = ToTheBottom % HeightOfLi;
		
	ToTheBottom = ToTheBottom - afwijking;

	var maxAnimate = (AantalLis - 2) * -1 * HeightOfLi;
		
	if (ToTheBottom >= maxAnimate)
	{
		jQuery('#scrollcontent').animate({marginTop: ToTheBottom},"slow");
		jQuery('#scroll_up').css('visibility','visible');
		if (ToTheBottom <= maxAnimate)
		{
			jQuery('#scroll_down').css('visibility','hidden');
		}
	}            
}

function Rotate_up() {
	var ToTheTop = parseFloat(jQuery('#scrollcontent').css('margin-top')) + HeightOfLi; 
	var afwijking = 0;
	
	afwijking = ToTheTop % HeightOfLi;
	ToTheTop = ToTheTop - afwijking;
	
	if(ToTheTop<=0)
	{
		jQuery('#scrollcontent').animate({marginTop: ToTheTop},"slow");
		jQuery('#scroll_down').css('visibility','visible');
		if (ToTheTop >= 0)
		{
			jQuery('#scroll_up').css('visibility','hidden');
		}
	}
}

function articleHover()
{
	jQuery('#ltv_content .articlelistblock li, #ltv_content .searchresultsblock li').
		mouseover(function()
		{
			jQuery(this).addClass('hover')
		})
		.mouseout(function()
		{
			jQuery(this).removeClass('hover')
		}
	);
}

function ChangeImage(width)
{
    jQuery('.displayforumblock .post .content img').each( function() {
        var t = this;
        var imgWidth = t.width;
        var imgHeight = t.height;
        
        if(imgWidth >width)
        {
            var multipleFactor = width / imgWidth;
            var newHeight = imgHeight * multipleFactor;

            jQuery(t).css('width',width + 'px');
            jQuery(t).css('height', newHeight + 'px');
        }
    });
}

jQuery(document).ready(function() {
	ChangeImage();
	articleHover();
	jQuery('.button-container input, .button-container a, .buttons a').each(function() {
		var newdivleft = jQuery('<div class="button_pict_left">');
		var newdivright = jQuery('<div class="button_pict_right">');
		if(this.value!="-1"){
			jQuery(this).before(newdivleft);                                
			jQuery(this).after(newdivright);                                
		}
	});
	jQuery('#left_top .forgotpasswordblock').each(function() {
			var newdivleft = jQuery('<div class="pict_top">');
			var newdivright = jQuery('<div class="pict_bottom">');
			jQuery(this).parent().addClass('DivTeveel');    
			jQuery(this).before(newdivleft);                                
			jQuery(this).after(newdivright);                                
			
	});
	jQuery('#left_top .editprofile_block').each(function() {
			var newdivleft = jQuery('<div class="pict_top">');
			var newdivright = jQuery('<div class="pict_bottom">');
			jQuery(this).parent().addClass('DivTeveel');    
			jQuery(this).before(newdivleft);                                
			jQuery(this).after(newdivright);                                
			
	});	
	jQuery('#left_top .addreactionblock').each(function() {
			var newdivleft = jQuery('<div class="pict_top">');
			var newdivright = jQuery('<div class="pict_bottom">');
			jQuery(this).parent().addClass('DivTeveel');    
			jQuery(this).before(newdivleft);                                
			jQuery(this).after(newdivright);                                
			
	});
	jQuery('#left_top .searchblock').each(function() {
			var newdivleft = jQuery('<div class="pict_top">');
			var newdivright = jQuery('<div class="pict_bottom">');
			jQuery(this).before(newdivleft);                                
			jQuery(this).after(newdivright);                                
	});
	jQuery('#left_top .addeventblock').each(function() {
		var newdivleft = jQuery('<div class="pict_top">');
		var newdivright = jQuery('<div class="pict_bottom">');
		jQuery(this).before(newdivleft);                                
		jQuery(this).after(newdivright);                                
	});
	jQuery('#left_top .securitymodule').each(function() {
		var newdivleft = jQuery('<div class="pict_top">');
		var newdivright = jQuery('<div class="pict_bottom">');
		jQuery(this).before(newdivleft);                                
		jQuery(this).after(newdivright);                                
	});
	jQuery('#left_top .surveycontainer').each(function() {
		var newdivleft = jQuery('<div class="pict_top">');
		var newdivright = jQuery('<div class="pict_bottom">');
		jQuery(this).before(newdivleft);                                
		jQuery(this).after(newdivright);                                
	});
	
	jQuery('.blogholderblock ul.tabs li:eq(0)').addClass('fc');
});        

