﻿/// <reference path="jquery-1.4.1-vsdoc.js" />
/// <reference path="jquery.cycle.all.min.js" />
/// <reference path="color.js" />
/// <reference path="jquery.corner.js" />


(function ($) {
	// VERTICALLY ALIGN FUNCTION
	$.fn.valign = function () {
		return this.each(function (i) {
			var ah = $(this).height();
			var ph = $(this).parent().height();
			var mh = (ph - ah) / 2;
			$(this).css('margin-top', mh);
		});
	};
})(jQuery);

var animationSpeed = 300;

$(function () {
	$('#slideshow').cycle({
		fx: 'fade',
		speed: 2000
	});

	$('.menuInfo').valign();
	$('.menuItem a span').valign();

	$('#bottomLinks a').hover(function () {
		$(this).next()
			   .stop()
			   .removeClass('visibleBox')
			   .addClass('hiddenBox')
			   .removeClass('hiddenBox')
			   .addClass('visibleBox')
			   .animate({ opacity: 1 }, animationSpeed);
	}, function () {
		$(this).next().animate({ opacity: 0 }, animationSpeed, function () {
			$(this).removeClass('visibleBox').addClass('hiddenBox');
		});
	});

	$('div.menu a').hover(function () {
		$(this).next()
			   .stop()
			   .removeClass('visibleBox')
			   .addClass('hiddenBox')
			   .css('opacity', 0)
			   .removeClass('hiddenBox')
			   .addClass('visibleBox')
			   .animate({ opacity: 1 }, animationSpeed);

		$(this).parent().stop().css('background-color', '#000').animate({ backgroundColor: '#005eea' }, animationSpeed);
	}, function () {
		$(this).next().animate({ opacity: 0 }, animationSpeed, function () {
			$(this).removeClass('visibleBox').addClass('hiddenBox');
		});
		$(this).parent().animate({ backgroundColor: 'black' }, animationSpeed);
	});
});
