$(document).ready(function(){
						   
	if($('.box-content').length > 0){
		$('.box-content .csc-textpic-intext-left-nowrap .csc-textpic-text').each(function(){
			width = 228 - ($(this).parent('div').outerWidth(true) - $(this).parent('div').width());
			$(this).css({
				'position'	:	'absolute',
				'bottom'	:	5,
				'right'		:	0,
				'width'		:	width,
				'font-size'	:	'11px'
			});
		});
		
		$('.start-full-box .box-content .csc-textpic-above .csc-textpic-text').each(function(){
			$(this).css({
				'position'	:	'absolute',
				'bottom'	:	5,
				'right'		:	0,
				'width'		:	180,
				'font-size'	:	'11px'
			});
		});
		
		$('.left-box .box-content .csc-textpic-above .csc-textpic-text').each(function(){
			$(this).css({
				'position'	:	'absolute',
				'bottom'	:	5,
				'right'		:	5,
				'width'		:	110,
				'font-size'	:	'11px',
				'text-align':	'right'
			});
		});
	}
	
	
	$('#nav-main li').hover(function(){
		$(this).find('ul').fadeIn(300);
	},
	function(){
		$(this).find('ul').hide();
	});
	
	
	$('.faq-acc').click(function(){
		$(this).find('.faq-acc-content').fadeToggle(300);
	});
	
	
// Brochures Download start	/////////////////////////////////////////////
	brochureCount = 1;
	$('.brochures-element').each(function(){
		$(this).find('input').attr('id', 'brochure-'+brochureCount);
		$(this).find('label').attr('for', 'brochure-'+brochureCount);
		brochureCount++;
	});
	
	$('.brochures-checkbox input').click(function(){
		var value = $(this).parent().parent().find('img').attr('alt');
		var id = $(this).attr('id');
		var selected = $(this).is(':checked');
		if(selected){
			$(this).attr('checked', true);
			$('#brochures-form fieldset').append('<input type="hidden" value="'+value+'" class="hiddenfield '+id+'" />');
		}
		else{
			$(this).attr('checked', false);
			$('.'+id).remove();
		}
		var count = 1;
		$('.hiddenfield').each(function(){
			$(this).attr('name', 'Broschyrer '+count);
			count++;
		});
	});
// Brochures Download end	\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
						   
	rotationItems = $('.rotation-wrap .csc-textpic-imagerow');

	$('.rotation-wrap .csc-textpic-imagerow:first').show().css('position', 'relative');
	if($.browser.msie)
		$('.rotation-wrap div').css('filter', 'inherit');
	
	if(rotationItems.length > 1){
		
		$('.rotation-wrap').after('<div id="rotation-nav"><span id="rotation-nav-left"></span></div>');
		
		ri_inc = 0;
		rotationItems.each(function(){
			$(this).attr('id', 'rotation-item-'+ri_inc);
			$(this).css('margin', 0);
			$('#rotation-nav').append('<span id="rotation-nav-'+ri_inc+'" class="rotation-nav-item"></span>');
			$('#rotation-nav-'+ri_inc).click(function(){
				index = $('.rotation-nav-item').index($(this));
				imageRotation(index);
			});
			ri_inc++;
		});
		
		$('#rotation-nav').append('<span id="rotation-nav-right"></span>');
		
		$('#rotation-nav-left').click(function(){
			click_new = rotation_active - 1;
			if(click_new < 0)
				click_new = rotationItems.length - 1;
			imageRotation(click_new);
		});
		
		$('#rotation-nav-right').click(function(){
			click_new = rotation_active + 1;
			if(click_new >= rotationItems.length)
				click_new = 0;
			imageRotation(click_new);
		});
		
		$('#rotation-nav-0').css('background-color', '#ffffff');
		
		rotation = window.setInterval('imageRotation()', 10000);
	}
	
	$('.start-full-box:first').css('margin', 0);
	xx = 1;
	$('.left-box').each(function(){
		if(xx % 3 == 0)
			$(this).css('margin-right', 0);
		xx++;
	});

});

rotation_active = 0;

function imageRotation(rotation_click){
	
	if(rotation_click == undefined)
		rotation_new = rotation_active + 1;
	else
		rotation_new = rotation_click;
	
	if($('#rotation-item-'+rotation_new).length==0)
		rotation_new = 0;
	
	$('#rotation-item-'+rotation_active).fadeOut(1500).css('position', 'absolute');
	$('#rotation-item-'+rotation_new).fadeIn(1500).css('position', 'relative');

	$('.rotation-nav').css('background-color', '#0099FF');
	$('#rotation-nav-'+rotation_new).css('background-color', '#ffffff');

	rotation_active = rotation_new;

	window.clearInterval(rotation);
	rotation = window.setInterval('imageRotation()', 10000);
}
