jQuery(function($) {

	// handle landing page
	if ($('body').hasClass('landing-page')) {

		// set-up onresize handler
		$(window).resize(function() {

			var w, h;


			for (var i = 0; i < 2; i++) {

				w = Math.max(1200, $(window).width());
				h = Math.max(575, $(window).height() - $('#header').height());

				$('#content-banners').css('width', w);
				$('#content-banners').css('height', h);

				$('#content-banners li').css('padding-left', (w - 1100) / 2);
				$('#content-banners img.theme').css('left', (w - 1920) / 2);

				$('#content-toolbox').css('top', $('#header').height() + ((h / 3) - 190) / 2 + (h / 3) * 2);
				$('#content-toolbox').css('width', w);

				$('#content-banner-prev,#content-banner-next').css('width', (w - 552) / 2);

				$('#content-feedback').css('top', (h - 112) / 2);

				$('#footer').css('width', w);
			} // for
		});

		// handle banner navigation
		$('#content-banner-prev,#content-banner-next').hover(function() {

			$(this).animate({ opacity: 0.75 }, 250);
		}, function() {

			$(this).animate({ opacity: 0.35 }, 500);
		});

		// handle banner loading and cycling
		$('#content-banners').append('<li style="display: block; width:auto;"><img class="theme" src="images/layout/neutral/background-loader.gif" width="1920" height="1200" alt=""/></li>');
		$(window).resize();

		$('#content-banners img').imagemonitor({

			onComplete:	function(loadedImages) {

						// show first banner
						$('#content-banners li:first').fadeIn(350, function() {

							// remove banner placeholder
							$('#content-banners li:last').remove();

							// show feedback button & footer
							$('#content-feedback').delay(3000).animate({ left: 0}, 250);
							$('#footer').delay(1500).animate({ bottom: 0}, 350);

							// start cycling
							$('#content-banners').cycle({

								speed:			1000,
								timeout:		10000,
								delay:			-5000,

								next:			'#content-banner-next',
								prev:			'#content-banner-prev',

								containerResize:	0,
								slideResize:		0,
								fit:			1,
								width:			'auto'
							});
						});
					}
		});
	} // if

	// handle menu
	$('#header-menu-home-handle').parent().hover(function() {

		$('#header-menu-home-handle').addClass('hover');
	}, function() {

		$('#header-menu-home-handle').removeClass('hover');
	});

	$('#header-menu-products-handle').parent().hover(function() {

		$('#header-menu-products-handle').addClass('hover');
		$('#header-menu-products').css('display', 'block').animate({ opacity: 0.95 }, 100);
	}, function() {

		$('#header-menu-products').fadeOut(250);
		$('#header-menu-products-handle').removeClass('hover');
	});

	$('#header-menu-support-handle').parent().hover(function() {

		$('#header-menu-support-handle').addClass('hover');
		$('#header-menu-support').css('display', 'block').animate({ opacity: 0.95 }, 100);
	}, function() {

		$('#header-menu-support').fadeOut(250);
		$('#header-menu-support-handle').removeClass('hover');
	});

	$('#header-menu-products div.category .wrapper').css('height', $('#header-menu-products').height() - 50);
	$('#header-menu-support div.category .wrapper').css('height', $('#header-menu-support').height() - 50);
});

