/******* Photo Gallery Scroll Function ***********/
function scrollphoto(div)
{
	var thumnails_con = $(div).parent();
	var cnt = $(thumnails_con).find('.thumb').size();
 
	if($(div).hasClass('next')){
		if(cnt > 5 && img_pos < (cnt-5)){
			img_move=img_move+84;
			img_pos++;
			$(thumnails_con).find('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
		}
	}else{
		if(img_pos > 0 ){
			img_move=img_move-84;
			img_pos--; 
			$(thumnails_con).find('.photo_scroll').animate( {marginLeft:'-'+String(img_move)+'px'},'slow');
		} 
	}

} 

/*-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*/

function countdown(){
		var time=$('#countdown').attr('title');
		$('.counter').countdown({
				until: +time, 
				format: 'DHMS',
				layout: '<!--start days-->'+
						'<span class="time">{dnnn}</span>'+			
						
						'<span class="time">{hnn} </span>'+
												
						'<span class="time">{mnn} </span>'+
					
						'<span class="time">{snn}</span>'
		});
}

function slideSwitch() {
    var $active = $('.banner img.active');

    if ( $active.length == 0 ) $active = $('.banner img:last');

    var $next =  $active.next().length ? $active.next()
        : $('.banner img:first');
		
		
		

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });
}

$(function() {
    setInterval( "slideSwitch()", 8000 );
});
