var carousel_count = 0;
var selected_carousel_id = 1;
var timer;

$(document).ready(function(){ 
	$(".lavalamp").lavaLamp({ fx: "backout", speed: 700 });
	
	jQuery('#mycarousel').jcarousel({
		scroll:1,
		wrap: null,
		easing:null
		
	});

	timer = window.setTimeout(function() {
				carousel_scroll();
			}, 7000);

	$("#menu").accordion({
		alwaysOpen: false,
		autoheight: false,
		header: 'h3',
		clearStyle: true,
		active: false
	});
	
	$('.blink')
		.focus(function(){
			if( $(this).attr('value') == $(this).attr('title') ) {
				$(this).attr({ 'value': '' });
			}
		})
		.blur(function(){
			if( $(this).attr('value') == '' ) {
				$(this).attr({ 'value': $(this).attr('title') });
			}
		});
} 
);  
  
function carousel_scroll() {
	if (selected_carousel_id == carousel_count)
		selected_carousel_id = 1;
	else
		selected_carousel_id = selected_carousel_id + 1;
	
	load_carousel_item('slide-' + selected_carousel_id);
	
	timer = window.setTimeout(function() {
				carousel_scroll();
			}, 7000);
	
	return false;
} 

function load_carousel_item(itm) {
	selected_carousel_id = parseInt(itm.replace('slide-',''));
	
	$('.image').hide();
	$('#' + itm).fadeIn();
}

//setCurr(document.getElementById('nav-projects'));
