$(document).ready(function(){

	/* Drop Down Menu */
	
	$('#navigation ul li')
		.hover(function(){
			$("a:eq(0)", this).addClass("hvr");
			$(this).find('.level2:eq(0)').show();
		}, function(){
			$("a:eq(0)", this).removeClass("hvr");
			$(this).find('.level2:eq(0)').hide();
		}
	);	

	/* End Drop Down Menu */

	$('.footer-navigation li').not(':last').each(function() {
		$(this).after('<li class="divider"> | </li>');
	});

	if ($('#sidebar .element .textElement ul').length) {
		$('#sidebar').wrapInner('<div class="box" />');
	}
	$('#sidebar .element .textElement ul').each(function() {
		$('li:first', this).addClass('first');
	});

	$('.formTitle:empty').remove();

	$('#sidebar > div').each(function() {
		if (!$('img', this).length && !$(this).hasClass('cl') && $('h3', this).length) {
			$(this).addClass('news');
		}
	});

	$(window).load(function() {
		if (!$('body.lcms_AdminView').length) {

			var slider_label=$('#htmlcaption .textElement').text();
			$('#htmlcaption').html('<span>' + slider_label + '</span>');

			$('#slider-nivo .element img').each(function() {
				$(this).attr('title', '#htmlcaption');
				$(this).prependTo($('#slider-nivo'));
			});
			$('#slider-nivo .element').remove(); 

			$('#slider-nivo').nivoSlider({
		    	effect: 'fade',
		    	directionNav: false,
		    	directionNavHide: false,
		    	controlNav: false,
		    	captionOpacity: 0.8,
		    	animSpeed: 500
		    });

		}

		if (window.PIE) {
	        $('#navigation ul li a').each(function() {
	            PIE.attach(this);
	        });
	    }

	});
	
});

