// JavaScript Document
//Animate the appointment title	
var CharIndex = 1;
function StepScale() {
	var TitleSize = $('#AppointmentTitle h2 span').length;
	if (CharIndex < TitleSize) {
		$('#AppointmentTitle h2 span').eq(CharIndex).animate({marginLeft:0}, 30, StepScale).animate({fontSize:'23px'}, 'fast', 
			function () {
				$(this).delay(100).animate({fontSize:'18px'},'fast');
			}
		);
		CharIndex ++;
	}
	else {
		CharIndex = 1;
	}
}
function StartScale() {
	$('#AppointmentTitle h2 span').eq(0).animate({marginLeft:0}, 30, StepScale).animate({fontSize:'23px'}, 'fast', 
		function () {
			$(this).delay(100).animate({fontSize:'18px'},'fast');
		}
	);
}
var ScaleInterval = self.setInterval('StartScale()', 5000);


//On Page Load
$(function() {	
	StartScale();
	
	//Funn Rollover text
	$('#AppointmentTitle h2 span').hover(
		function () {
			$(this).animate({fontSize:'23px'},'fast');
			clearInterval(ScaleInterval);
		},
		function () {
			$(this).animate({fontSize:'18px'},'fast');
			ScaleInterval = self.setInterval('StartScale()', 5000);
		}
	);
	
	//Assign Classes to navigation
	$('#ClientCorner #NavigationCustom > ul > li:odd').addClass('rightButton');
	$('#ClientCorner #NavigationCustom > ul > li:even').addClass('leftButton');
	$('#ClientCorner #NavigationCustom > ul > li > a, #ClientCorner #NavigationCustom > ul > li > span').mouseenter(
		function() {
			$('#ClientCorner #NavigationCustom > ul > li > a, #ClientCorner #NavigationCustom > ul > li > span').removeClass('active');
			$(this).addClass('active');
		}
	);
	$('#ClientCorner #NavigationCustom > ul > li.ParentCurrentPage > *, #ClientCorner #NavigationCustom > ul > li.CurrentPage > *').addClass('active');
	
	//Load Initial Gallery Info
	$('#GalRight > div').html($('#GalLeft > ul > li:first-child > div').html());
	//Set onclick for gallery list
	$('#GalLeft > ul > li').click(function() {
		$('#GalLeft > ul > li').removeClass('selected');
		$(this).addClass('selected');
		$('#GalRight > div').html($(this).children('div').html());
		
	});
	
});
