

$(document).ready(function(){


	$(this).countdown(new Date(2012, 2, 31, 23, 59, 59));


	var numBanners = $('#bg_top div').size();
	var banner = 0;

    if (numBanners > 0) {

	var showBanner = function(newbann) {
		if (banner > 0) {
			$('#bg_top div:eq('+(banner-1)+')').fadeOut('slow');
			$('#li'+(banner)).removeClass('active');
		}
		banner = newbann;
		if (banner > numBanners) {
			banner = 1;
		}
		$('#li'+(banner)).addClass('active');
		var img = $('#bg_top div:eq('+(banner-1)+')');
		if (img.offset().top < 0) {
			img.hide().css('top', 0);
		}
		img.fadeIn('slow');
	};

	var interval = null;

	$('.h_pages li').click(function() {
		if (interval) {
			clearInterval(interval);
			interval = null;
		}
		showBanner(parseInt($(this).attr('id').substring(2)));
	});

	showBanner(1);
	if (numBanners > 1) {
		interval = setInterval(function() { showBanner(banner+1); }, 6000);
	}

    }

    
    jQuery("#mycarousel").jcarousel({
        scroll: 1,
		visible: 3,
        initCallback: mycarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null
    });




    $('#image a').lightBox({
	    imageBtnClose: '../templates/default/images/lightbox-btn-close.gif'
	});



    $('#mycarousel ul a').lightBox({
		imageBtnClose: '../templates/default/images/lightbox-btn-close.gif'
    });






});









$(function(){
    $(".tiptip").tipTip({ defaultPosition: "right"});
});




function mycarousel_initCallback(carousel) {

    jQuery('.jcarousel-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('.jcarousel-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};
     
