//HTML5 fix for IE... hopefully!
document.createElement("header");
document.createElement("nav");
document.createElement("footer");
document.createElement("article");
document.createElement("section");
document.createElement("aside");
document.createElement("hgroup");

//**********************************************Slideshow
function slideSwitch() {
    var $active = $('#slideshow a.active');

	if ($active.length == 0) $active = $('#slideshow a:last');
	
    var $next = $active.next().length ? $active.next() : $('#slideshow a:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval("slideSwitch()", 6000);
});



$(function() {
	$('#slideshow a div').hover(function() {
		$(this).children('.front').stop().animate({"top":'240px'}, {duration: 500, easing:'easeOutExpo'});
		
//vvvvvvv   mouseOff  vvvvvvv
	}, function() {
		$(this).children('.front').stop().animate({"top":'320'}, {duration: 800, easing:'easeOutBounce'});
	});
});


//**********************************************INPUT
$(function() {
	$('#s').example('type and hit "ENTER"');
	$('#author').example('required');
	$('#email').example('required');
	$('#comment').example('comment');

	
	//**********************************************TOP menu buttons
	$('nav ul li a').animate({
		color: 'rgb(245,245,245)'
	});
	$('nav ul li a').hover(function() {
		$(this).stop().animate({
			color: 'rgb(102,102,102)'
		}, 1);
	}, function() {
		$(this).stop().animate({
			color: 'rgb(245,245,245)'
		}, 700);
	});
	$('nav ul li a').click(function() {
		$(this).stop().animate({
			color: 'rgb(245,245,245)'
		});
	});
	
	//**********************************************FOOTER menu buttons
	$('footer a').animate({
		color: 'rgb(213,213,213)'
	});
	$('footer a').hover(function() {
		$(this).stop().animate({
			color: 'rgb(102,102,102)'
		}, 1);
	}, function() {
		$(this).stop().animate({
			color: 'rgb(213,213,213)'
		}, 700);
	});
	$('footer a').click(function() {
		$(this).stop().animate({
			color: 'rgb(213,213,213)'
		});
	});
	
	//**********************************************other buttons
	$('.darkFader a, .entry a').animate({
		color: 'rgb(51,51,51)'
	});
	$('.darkFader a, .entry a').hover(function() {
		$(this).stop().animate({
			color: 'rgb(0,255,196)'
		}, 1);
	}, function() {
		$(this).stop().animate({
			color: 'rgb(51,51,51)'
		}, 700);
	});
	$('.darkFader a, .entry a').click(function() {
		$(this).stop().animate({
			color: 'rgb(51,51,51)'
		});
	});
	
	
	//**********************************************meta buttons
	$('.postMetaData a').animate({
		color: 'rgb(0,166,127)'
	});
	$('.postMetaData a').hover(function() {
		$(this).stop().animate({
			color: 'rgb(0,255,196)'
		}, 1);
	}, function() {
		$(this).stop().animate({
			color: 'rgb(0,166,127)'
		}, 700);
	});
	$('.postMetaData a').click(function() {
		$(this).stop().animate({
			color: 'rgb(0,166,127)'
		});
	});
	
	
	//**********************************************thumbnails
	$('#portfolio-list .portfolioHomePost').animate({
		opacity: '0.6'
	});
	$('#portfolio-list .portfolioHomePost').hover(function() {
		$(this).stop(false, true).animate({
			opacity: '1.0'
		}, 50);
	}, function() {
		$(this).stop(false, true).animate({
			opacity: '0.6'
		}, 700);
	});
	$('#portfolio-list .portfolioHomePost').click(function() {
		$(this).stop(false, true).animate({
			opacity: '0.6'
		});
	});
	
	//*************************************************scroll to the top
	$('a.top').click(function() {
		$('html, body').animate({
			scrollTop: '0px'
			}, {duration: 1000, easing:'easeOutExpo'});
		return false;
	});
});
