jQuery(document).ready(function($) {	
	// Back to top
	$('.panel-backtotop a').click(function() {
		$('html,body').animate({ scrollTop: 0 }, 1000);
		
		return false;
	});
	
	
	// Searchbar input
	$('.input-searchdata').focus(function() {
		if ($(this).val() == 'search') $(this).val('');
	}).blur(function() {
		if ($(this).val() == '') $(this).val('search');
	});
	
	
	// Subscribe input
	$('#subscribe-email').focus(function() {
		if ($(this).val() == 'e-mail') $(this).val('');
	}).blur(function() {
		if ($(this).val() == '') $(this).val('e-mail');
	});
	
	$('#subscribe-name').focus(function() {
		if ($(this).val() == 'name') $(this).val('');
	}).blur(function() {
		if ($(this).val() == '') $(this).val('name');
	});
	
	$('#email').focus(function() {
		if ($(this).val() == 'enter email address') $(this).val('');
	}).blur(function() {
		if ($(this).val() == '') $(this).val('enter email address');
	});
	
	$('#name').focus(function() {
		if ($(this).val() == 'enter your name') $(this).val('');
	}).blur(function() {
		if ($(this).val() == '') $(this).val('enter your name');
	});
	
	// Headline
	var headlineTimer = null;
	
	$('.layer-showcase a[href$=#next]').click(function() {
		clearInterval(headlineTimer);
		
		if ($('.layer-showcase li:visible').is(':last-child')) 
			$('.layer-showcase li:visible').fadeOut('fast', function() {
				$('.layer-showcase li:first-child').fadeIn('fast');
			});
		else
			$('.layer-showcase li:visible').fadeOut('fast', function() {
				$(this).next().fadeIn('fast');
			});
			
		headlineTimer = setInterval(function() {
			$('.layer-showcase a[href$=#next]').trigger('click');
		}, 6000);
		
		return false;
	});
	
	headlineTimer = setInterval(function() {
		$('.layer-showcase a[href$=#next]').trigger('click');
	}, 6000);
});


	
