Shadowbox.init();



var current_dots = 1;
var max_dots = 0;
var dots_interval = null;
var dots_interval_time = 15000;
$(document).ready(function(){
//---------- START DOCUMENT READY -------------//   
	 
	 $('#news li').each(function()
	 {
	 	max_dots++;	 	
	 });
	
	 for ( var i = 0; i < max_dots; i++ )
	 {	 
	 	$('.dots').append('<li class="li_dots_'+i+'"></li>');
	 };
	 $('.dots li').css('cursor','pointer');
	 $('.dots li:first').addClass('selected');
	 
	 dots_interval  = setInterval('changeDots()',dots_interval_time);
	 
	 $('.dots li').click(function()
	 {
	 	 clearInterval(dots_interval);
	 	 current_dots = $(this).attr('class').replace('li_dots_','');
	 	 changeDots();
	 	 dots_interval  = setInterval('changeDots()',dots_interval_time);
	 });
	 
	 var box_height = 0;
	 $('#second .box').each(function()
	 {
	 	if ( $(this).height() > box_height ) box_height = $(this).height();
	 });
	  $('#second .box').css('height',box_height+'px') 
	 
//---------- STOP DOCUMENT READY -------------//  	 
 });

 function moveNews(i)
 {
 	var c = 1;
 	$('#news .news').each(function()
 	{
 		$(this).fadeOut(1000);
 		if ( c == i )
 		{
 			$(this).fadeIn(2000);
 		}
 		c++;
 	});
 	/*
 	var margin_left = - (i-1) * $('.news').width();
 	$('#news').animate({  
    opacity: 1
  }, 2500, function() {
    // Animation complete.
  });
  */
 }

 function changeDots()
 {
 	var i = 1;
 	current_dots++;
 	if ( current_dots > max_dots ) { current_dots = 1; }
 	moveNews(current_dots);
 	$('.dots li').each(function()
	 {
	 	if ( i == current_dots )
	 	{
	 		$(this).addClass('selected');
	 	}
	 	else
	 	{
	 		$(this).removeClass('selected');
	 	}
	 	i++;
	 });
 };
 
 
 
 
 
 
 $(document).ready(function(){
//---------- START DOCUMENT READY -------------//   
	 
	 
	 
	 
	 
//---------- STOP DOCUMENT READY -------------//  	 
 });
