$(document).ready(function(){
  function rcRemove(el) {
    $('.b-preview_pic .rocon',el).remove();
  }
  
  $('.b-carousel_item').hover(function(){
    $this = $(this);
    rcRemove($this);
    $($this).find('.b-preview_pic').append($('.b-rc-wrap .b-rc-active-5 .rc5 span').clone());
    $this.find('.b-preview_pic .rocon').css('background-image', $('.b-rc-wrap .b-rc-active-5 .rocon').css('background-image'));
		if($($this).find('.b-actions').length) {
			$($this).find('.b-action.delete').append($('.b-rc-wrap .b-rc-active-5 .rc5 span').clone());
	    $this.find('.b-action.delete .rocon').css('background-image', $('.b-rc-wrap .b-rc-active-5 .rocon').css('background-image'));
			$($this).find('.b-action-small').append($('.b-rc-wrap .b-rc-active-8 .rc8 span').clone());
	    $this.find('.b-action-small .rocon').css('background-image', $('.b-rc-wrap .b-rc-active-8 .rocon').css('background-image'));
		}
//    $this.addClass('active');
  }, function(){
    $this = $(this);
    rcRemove($this);
    $($this).find('.b-preview_pic').append($('.b-rc-wrap .b-rc-5 .rc5 span').clone());
    $this.find('.b-preview_pic .rocon').css('background-image', $('.b-rc-wrap .b-rc-5 .rocon').css('background-image'));
		if($($this).find('.b-actions').length) {
			$($this).find('.b-action.delete').append($('.b-rc-wrap .b-rc-5 .rc5 span').clone());
	    $this.find('.b-action.delete .rocon').css('background-image', $('.b-rc-wrap .b-rc-5 .rocon').css('background-image'));
			$($this).find('.b-action-small').append($('.b-rc-wrap .b-rc-8 .rc8 span').clone());
	    $this.find('.b-action-small .rocon').css('background-image', $('.b-rc-wrap .b-rc-8 .rocon').css('background-image'));
		}
//    $this.removeClass('active');
  });



	$('.b-abuse-title a').toggle(function(){
		$('.b-form-abuse').fadeIn();
	}, function(){
		$('.b-form-abuse').fadeOut();
	});
	
	
	if($.browser.opera || $.browser.msie) {
		function fixHtml(cl) {
			return '<div class="rc_fix-' + cl + '"><div class="rc_fix-wrap"><i class="one"></i><i class="two"></i></div></div>';
		}
		$('.b-block_units').append(fixHtml('units'));
		$('.b-block').eq(0).addClass('b-block-fix').append(fixHtml('block'));
		$('.b-block').eq(3).addClass('b-block-fix b-block-right').append(fixHtml('block'));
		$('head').append('<link rel="stylesheet" href="css/cyberbrothers-fix.css" type="text/css" media="screen" charset="utf-8">');
	}
	
});
