﻿/* -------------------------------------------------
Document JavaScript
Author : IEB - Kahiloa Solutions & communications
------------------------------------------------- */
$(function() {
    $('.left img').hover(function() {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('data-hover'));
        $(this).attr('data-hover', currentImg);
		
    }, function() {
        var currentImg = $(this).attr('src');
        $(this).attr('src', $(this).attr('data-hover'));
        $(this).attr('data-hover', currentImg);
		
    });
}) 

if ($("#slideShowReferences").get(0)) {
	var theInt = null;
	var $crosslink, $navthumb;
	var curclicked = 0;

	theInterval = function(cur){
		clearInterval(theInt);
		
		if( typeof cur != 'undefined' )
			curclicked = cur;
		
		$crosslink.removeClass("active");
		$navthumb.eq(curclicked).parent().addClass("active");
		$(".stripNav ul li a").eq(curclicked).trigger('click');
		
		theInt = setInterval(function(){
			$crosslink.removeClass("active");
			$navthumb.eq(curclicked).parent().addClass("active");
			$(".stripNav ul li a").eq(curclicked).trigger('click');
			curclicked++;
			if( 6 == curclicked )
				curclicked = 0;
			
		}, 10000);
	};

	$(function(){
		
		$("#slideShowReferences").codaSlider();
		
		$navthumb = $(".navigationReferences img");
		$crosslink = $(".navigationReferences a");
		
		$navthumb
		.click(function() {
			var $this = $(this);
			theInterval($this.parent().attr('href').slice(1) - 1);
			return false;
		});
		
		theInterval();
	});
}