$(document).ready(function() { 
	
	//Carousel

$('.carousel-panes').cycle({
		fx: 'scrollHorz',
		speed: 500,
		timeout: 5000,
		delay: 1000,
		easing: 'easeInOutQuint',
		pause: true,
		prev:    '.backward',
		next:    '.forward'
	  });


	
//parking pager	
	$('.panes').cycle({
        fx: 'fade',
        speed: 500,
        timeout: 0,
        easing: 'easeOutQuint',
        pager: '.tabs',
        pagerEvent: 'click',
        pauseOnPagerHover: true,
        pagerAnchorBuilder: function (idx, slide) {
          // return sel string for existing anchor
          return '.tabs li:eq(' + (idx) + ') a';
        }

      });

//frontpage promo popup
	$("a.modal-popup").colorbox({transition:"none", width:"500px", opacity:.5, inline:true, href:"#promo-popup"});
	



//add automatic textfield labelling using title attribute
	$('input[title]').each(function() {
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));
		}
	
		$(this).focus(function() {
			if($(this).val() === $(this).attr('title')) {
				$(this).val('').addClass('focused');
			}
		});
	
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');
			}
		});
	});

	//add last child class to footer nav
	$('#footer-nav ul li:last-child').addClass('last');

});


