$(document).ready(function(){ 
	$('.arrowRight').click(function(){
		$(this).parent().parent().hide();

		if($(this).parent().parent().next(".largeImage").length > 0){
			//$(this).parent().parent().next(".largeImage").css("display", "block");
			$(this).parent().parent().next(".largeImage").fadeIn("fast");
		}
		else{
			//reset to the first guy
			//$('.largeImage:first').css("display", "block");
			$('.largeImage:first').fadeIn("fast");
		}

	});
	$('.arrowLeft').click(function(){
		$(this).parent().parent().hide();

		if($(this).parent().parent().prev(".largeImage").length > 0){
			//$(this).parent().parent().prev(".largeImage").css("display", "block");
			$(this).parent().parent().prev(".largeImage").fadeIn("fast");
		}
		else{
			//reset to the first guy
			//$('.largeImage:last').css("display", "block");
			$('.largeImage:last').fadeIn("fast");
		}
	});

	//NAV DROP-DOWN
	$('.nav .left a').hover(function(){
		//show the drop down
		/*var bg = $(this).children("div").css('background-image');
		bg = bg.replace("_normal.jpg", "_hover.jpg");
		$(this).css('background-image', bg);*/
		var className = $(this).children('div').attr("class");
		$(this).children('div').removeClass(className);
		$(this).children('div').addClass(className + "Hover");
		$(this).parent().children('.floatingMenu').fadeIn('fast');
	}, function(){
		var className = $(this).children('div').attr("class");
		$(this).children('div').removeClass(className);
		className = className.replace("Hover", "");
		$(this).children('div').addClass(className);
		//show the drop down
		$(this).parent().children('.floatingMenu').hide();
	});

	$('.nav .left .floatingMenu').hover(function(){
		$(this).show();
		//var bg = $(this).parent().children('a').children('div').css('background-image');
		//bg = bg.replace("_normal.jpg", "_hover.jpg");
		var className = $(this).parent().children('a').children('div').attr("class");
		$(this).parent().children('a').children('div').removeClass(className);
		$(this).parent().children('a').children('div').addClass(className + "Hover");
		
		
		//$(this).parent().children('a').children('div').css('background-image', bg);
	},
	function(){
		$(this).hide();
		//var bg = $(this).parent().children('a').children('div').css('background-image');
		//bg = bg.replace("_hover.jpg", "_normal.jpg");

		//$(this).parent().children('a').children('div').css('background-image', bg);
		var className = $(this).parent().children('a').children('div').attr("class");
		//alert(className);
		$(this).parent().children('a').children('div').removeClass(className);
		className = className.replace("Hover", "");
		$(this).parent().children('a').children('div').addClass(className);
	});

	//NAV HIGHLIGHT HOVER
	$('.nav .left .floatingMenu a').hover(function(){
		$(this).css("background-color", "#D9F3FF");
	},
	function(){
		$(this).css("background-color", "white");
	});

	//Testimonial SlideShow
	var tests = new Array();
	var myTimer;
	
	tests[0] = "Frank, you promised me I would not be disappointed in your company’s service and you have delivered. We look forward to any dealings with your company with the utmost confidence<br /><i>The Fairmont Empress</i>";
	tests[1] = "We are thrilled that Unity Business Systems stepped up to do its part, in helping the less fortunate in our community, by donating an expensive copier machine to Street link. On behalf of the clients, staff and Society, I thank you for your generous and desperately needed donation. Your efforts and thoughtfulness have not gone unnoticed<br />Victoria Cool Aid Society";

	//$('.testimonialText').html(tests[0]);
	//StartTimer();

	//start a loop
	$(function() {
	  setInterval(startTimer, 10000);
	});

	var current;
	function startTimer(){
		//alert($('.testimonialText.show').next().html());
		if($('.testimonialText.show').next('.testimonialText').length > 0){
			//alert($(this).prev('.testimonialText').html());
			current = $('.testimonialText.show');
			current.removeClass('show').addClass('hide');
			current.next('.testimonialText').removeClass('hide').addClass('show');
		}
		else{
			//i'm going back to the start
			current = $('.testimonialText.show');
			current.removeClass('show').addClass('hide');
			$('.testimonialText:first').removeClass('hide').addClass('show');
		}
		//myTimer = setTimeout(StartTimer(),3000);
	}

});
