$(document).ready(function(){

	$('#slider ul').jcarousel({
		wrap: 'both',
		scroll: 1,
		auto: 4,
		visible: 1,
		initCallback: init_carousel,
		itemFirstInCallback: function(carousel, item, idx, state) {
			$('#slider .nav a').removeClass('active');
			$('#slider .nav a').eq(idx-1).addClass('active');
		}
	});
	
	$('.flexslider').flexslider({
      	animation: 'fade',
      	controlsContainer: '.flex-container',
      	controlNav: false,
		slideshowSpeed: 9000
    });
	
	$('.field').focus(function(){
		if( $(this).attr('title') == $(this).val() ) {
			$(this).val('');
		}
	}).blur(function(){
		if( $(this).val() == '' ) {
			$(this).val( $(this).attr('title') );
		}
	});
	
	$(".video a img").css('opacity', '0.7');
	$(".video").hover(function () {
		$(this).find('a img').fadeTo(300, 1);
		$(this).find('span').addClass('play-hover');
	},
	function(){ 
		$(this).find('a img').fadeTo(300, 0.7);
		$(this).find('span').removeClass('play-hover');
	});


      $(".rollover").hover(
         function(){this.src = this.src.replace("_off","_on");},
         function(){this.src = this.src.replace("_on","_off");});


	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		DD_belatedPNG.fix('h1#logo a, #slider, .debbie-face, #slider .cnt a.more-link, #slider .nav li a, #slider .nav li a:hover, #slider .nav li a.active, #contact, #contact a.red-btn, #contact a.green-btn, #contact .signup-form, #contact .signup-form input.submit-btn, #main, #main-cnt, .main-cols .col a.more-link, .post .image, .videos .video, .videos .play, .play-hover, .social a img, .flex-direction-nav li a.next, .flex-direction-nav li a.next:hover, .flex-direction-nav li a.prev, .flex-direction-nav li a.prev:hover, #footer, #footer a.logo img');
	};

});

function init_carousel(carousel, idx) {
	$('#slider .nav a').bind('click', function() {
		carousel.scroll($.jcarousel.intval($(this).parents('#slider .nav').find('a').index(this)+1));
		return false;
	
	});
}
