$(document).ready(function(){



windowheight = $(document).height() + 20;
contentheight = $('#content').height();

difference = windowheight - contentheight;

if (windowheight > contentheight){

	$('#footer').css('marginTop', difference + 'px');

}


// CAROUSEL TIMER

timer = 1;
slideshow = setInterval(function(){

timer = timer + 1;

if (timer == 5){
	timer = 1;
}

	$('#carousel').css('background-color', '#fff');
	$('#carousel #nav div').removeClass('selected');
	$('.item').hide();
	$('#roundel' + timer).addClass('selected');
	$('#c' + timer).fadeIn(function(){
		$('#carousel').css('background-color', 'transparent');								  
	});




}, 5000);



// CAROUSEL

init = 'c1';
$('#' + init).show();

$('.roundel').click(function(){
	
	clearInterval(slideshow);
							 
	$('#carousel').css('background-color', '#fff');
	$('#carousel #nav div').removeClass('selected');
	$('.item').hide();
	show = $(this).attr('item');
	$(this).addClass('selected');
	$('#' + show).fadeIn(function(){
		$('#carousel').css('background-color', 'transparent');								  
	});
});


// PROJECT IMAGE HOVER
$('.overlay').live('mouseover mouseout', function(event) {
  if (event.type == 'mouseover') {
    $('.overlay').removeClass('selected');
	$(this).addClass('selected');
  } else {
    $('.overlay').removeClass('selected');
  }
});

// PROJECT IMAGE HOVER
$('.poverlay').live('mouseover mouseout', function(event) {
  if (event.type == 'mouseover') {
    $('.poverlay').removeClass('selected');
	$(this).addClass('selected');
  } else {
    $('.poverlay').removeClass('selected');
  }
});

// FAQ SELECT
$('#questions li').click(function(){
								  
	$('#questions li').removeClass('selected');
	$(this).addClass('selected');

	$('.answer-contain').hide();

	faq = $(this).attr('faq');

	$('#faq_' + faq).show();

});


});
