$(function() {
	$('.blink').focus(function(){
  		var defVal = $(this)[0].defaultValue;
	  	if ($(this).val() == defVal) {
		$(this).val("");
		}
	})
	
	$('.blink').blur(function(){
	  	if ($(this).val() == "") {
		var defVal = $(this)[0].defaultValue;
		$(this).val(defVal);
		}
	})
	
	$('#subhead .slider ul').jcarousel({
		auto:10,
		buttonNextHTML: null,
        buttonPrevHTML: null,
        scroll:1,
        visible:1,
        wrap:'both'
	});

    $('#subhead .entry').each(function(){
        var p = (173 - $(this).height())/2
        $(this).css('padding-top', p)
    })

    $('.header-top ul').jcarousel({
        auto:5,
        buttonNextHTML: null,
        buttonPrevHTML: null,
        scroll:1,
        visible:1,
        wrap:'both'
    });

    $('.home-article a.more-btn').click(function(){
        $(this).parent().find('p.hidden').show();
        $(this).hide();
        return false;
    }) 

    $('#home-slider .slider-i ul.slider').jcarousel({
        auto:5,
        buttonNextHTML: null,
        buttonPrevHTML: null,
        scroll:1,
        animation: 'fast',
        visible:1,
        wrap:'both',
        itemFirstInCallback: {
            onBeforeAnimation: function(carousel, li, idx){
                $('#home-slider .nav a').removeClass('active');
                $('#home-slider .nav a').eq(idx-1).addClass('active').animate({top: -10},200).animate({ top: 0 }, 200);
            },
            onAfterAnimation: function(carousel, li, idx){
                $(li).find('.title').animate({ left : 0}, 300);
            }
        },
        itemFirstOutCallback: function(carousel, li, idx){
            $(li).find('.title').css('left','-100%');
        },
        initCallback: function(carousel){
            var lock = 0;
            $('#home-slider .nav a').hover(function() {
           
                if(lock==0){
                    var idx = $(this).index() + 1;
                    carousel.scroll(idx);
                    lock = 1;
                }
            },function(){
                lock = 0;
            });
        }
    });

    // pictures section addition
     $('.pictures-section .item').hover(function(){
        $(this).find('.triggered').animate({height: 'toggle'}, 300, "linear")
    })
});




