
// ************BEGIN GLOBAL VARIABLES ****************
var $currentMonthYear = $('#currentMonthYear');
var $currentMonthYear_swap = $('#currentMonthYear_swap');
var $caMenu = $('#caMenu');
var $caTextBox =$('#caTextBox');
var menuHeader = '#caMenu .caMenu_header';

//************* END VARIABLES ****************
//*******************************************


// ************ BEGIN FUNCTIONS ***************

//Expandable menu (without plugin)//
function menuExpand() {
		var $this = $(this)
		var $hiddenMenu = $this.next('ul:hidden');
			
	$hiddenMenu.slideDown(80).siblings('ul:visible').slideUp(80);
	$this.children('div').removeClass('icon_plus').addClass('icon_empty');
	$this.siblings(menuHeader).children('div').removeClass('icon_empty').addClass('icon_plus');
}

function menuMouseOut() {
	//empty function, required for hoverIntent
}

// Menu items hoverIntent //
function shift (){
	$(this).animate({marginLeft: "+=10px"}, 500);
	$(this).append('<span id="doubleArrowsRight">&nbsp;&raquo;</span>');
}
function shiftBack (){
	$(this).animate({marginLeft: "-=10px"}, 700);
	$('#doubleArrowsRight').remove();
}

// logo hoverIntent //	
function logoOver(){
	$('#underline').animate({opacity: "0"}, 400);
	$currentMonthYear.animate({opacity: "0"}, 1000);
	$currentMonthYear_swap.fadeIn(1000);
	setTimeout('$("#doubleArrowsRight1").animate({opacity: ".5", marginLeft: "+=12px"}, 400)', 10);
	setTimeout('$("#doubleArrowsRight2").animate({opacity: ".7", marginLeft: "+=15px"}, 500)', 110);
	setTimeout('$("#doubleArrowsRight3").animate({opacity: "1", marginLeft: "+=25px"}, 625)', 210);
	setTimeout('$("#homeText").animate({opacity: "1"}, 600)', 310);
	$("#akLogo_Sub, #akLogo_noSub_195px, #akLogo_noSub").animate({marginLeft: "+=13px"}, 400).css({cursor: "pointer"});
}
function logoOut(){
	$("#akLogo_Sub, #akLogo_noSub_195px, #akLogo_noSub").animate({marginLeft: "-=13px"}, 600);
	$("#doubleArrowsRight1").animate({opacity: ".25", marginLeft: "-=12px"}, 300);
	$("#doubleArrowsRight2").animate({marginLeft: "-=15px", opacity: "0"}, 600);
	$("#doubleArrowsRight3").animate({marginLeft: "-=25px", opacity: "0"}, 600);
	$("#homeText").animate({opacity: "0"}, 400);
	$currentMonthYear_swap.fadeOut(1000);
	$currentMonthYear.animate({opacity: "1"}, 1000);
	setTimeout('$("#underline").animate({opacity: "1"}, 500)', 400);
}

function contentFade() {
	$('.pageContent, #caBanner, #caSubBanner, .subBanner, #topLogo, #homeWrapper').fadeOut();
}
// ********* END FUNCTIONS ***************
//*****************************************


// ********* BEGIN DOCUMENT READY CODE ************
	
$(document).ready(function(){
	setTimeout('$("html, body").animate({scrollTop: 20},1000)',300);
	setTimeout('$caMenu.fadeIn(350)', 100);
	setTimeout('$caTextBox.fadeIn(500)', 500);
	$('#caMenu ul:gt(0)').hide();

//Expandable menu hover//
	$(menuHeader).hoverIntent({
		sensitivity: 3,
		interval: 150,
		over: menuExpand,
		out: menuMouseOut
	});

//Menu items hover//
	$('a.hoverLink').hoverIntent({
		sensitivity: 3,
		interval: 120,
		over: shift,
		out: shiftBack
	});
	
//menu clicks//
	$('#caMenu_retouchingLink a').click(function () {
			contentFade();
		$('#retouchWrapper').fadeIn();
	});
				
	$('#caMenu_webDesignLink a').click(function () {
			contentFade();
		$("#webDesignWrapper").fadeIn();
	});
});

// ************ END DOCUMENT CODE ****************
// ********************************************

//****** NOTES

//logoOver and logoOut functions are called on each individual page's js file, to avoid occurance on the Home page.