/// <reference path="js/jquery.js" />
/// <reference path="js/jquery.preloadCssImages.js" />
/// <reference path="js/jquery.js" />
/// <reference path="js/jquery.js" />

$(document).ready(function () {
//	var t = '';
//	t = $.preloadCssImages();
	setTimeout('showContent()', 2);
	$('.slideshow').cycle({
	    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	    timeout: 8000
	});
	//$('#container').fadeIn(5000);
	//$('#boxAccordion').animate({'width':'960px'},1000)
	//                $('.bg2').fadeIn(500);
	//                $('.bg1').fadeIn(1000);
	//                $('.bg3').fadeIn(1500);
	//                $('.bg5').fadeIn(2000);
	//                $('.bg6').fadeIn(2500);
	//                $('.bg4').fadeIn(3000);
	//$('#boxAccordion').show();

});

function showContent() {
    $('#container').fadeIn(3000);
    maximizeFirstMenu();
    return 'OK';
}

function maximizeFirstMenu() {
    //startRotator = true;
    $('.slideshow').cycle('resume');
    var $this = $('#openMenu');
    $this.stop().animate({ 'width': '480px' }, 500);
    $('.heading', $this).stop(true, true).fadeOut();
    $('.bgDescription', $this).stop(true, true).slideUp(500);
    $('.description', $this).stop(true, true).fadeIn();
}

function minimizeFirstMenu() {
    //startRotator = false;
    $('.slideshow').cycle('pause');
    var $this = $('#openMenu');
    $this.stop().animate({ 'width': '90px' }, 1000);
    $('.heading', $this).stop(true, true).fadeIn();
    $('.description', $this).stop(true, true).fadeOut(500);
    $('.bgDescription', $this).stop(true, true).slideUp(700);
}

$(function () {
    $('#accordion > li').hover(
				function () {
				    var $this = $(this);
				    var currentId = $this.attr('id');
				    if (currentId !== 'openMenu') {
				        minimizeFirstMenu();

				        $this.stop().animate({ 'width': '480px' }, 500);
				        $('.heading', $this).stop(true, true).fadeOut();
				        $('.bgDescription', $this).stop(true, true).slideDown(500);
				        $('.description', $this).stop(true, true).fadeIn();
				    }
				},
				function () {
				    var $this = $(this);
				    var currentId = $this.attr('id');
				    if (currentId !== 'openMenu') {
				        $this.stop().animate({ 'width': '90px' }, 1000);
				        $('.heading', $this).stop(true, true).fadeIn();
				        $('.description', $this).stop(true, true).fadeOut(500);
				        $('.bgDescription', $this).stop(true, true).slideUp(700);
				        maximizeFirstMenu();
				    }
				}
			);
});

