
var as = [];
var curr_index = 0;
var as2 = [];
var curr_index2 = 0;
var duration = 1500;
var stop_duration = 4000;
var start_o = 0;
var end_o = 1;
var _slideshowTimeout = false;
var _slideshowTimeout2 = false;
var _mediumA = false
var pas = [];
var scrollTimeout = false;
var scrollTimeout2 = false;



function getCookie(name) {
  var nameq = name + "=";
  var c_ar = document.cookie.split(';');
  for (var i=0; i<c_ar.length; i++) {
    var c = c_ar[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameq) == 0) return unescape( c.substring(nameq.length, c.length) );
  }
  return null;
}



var news_span_array=false;
var news_span_activ_index=0;
function propertic_news()
{
	var res = parseFloat(getCookie("index_c"));
	
	
	
	var conteiner=document.getElementById('news');
	if(conteiner)
	{
		var clicer=conteiner.getElementsByTagName('a')[0];
		if(clicer)
		{
			clicer.onclick=function()
			{
				_switch2(false,curr_index);
				return false;
			}
		}
initSlideShow2();

	}
}

function initSlideShow2(){	
	as2 = [];
	curr_index2 = 0;	
	var _box = document.getElementById('news');
	if(_box)
	{	
		var _as = _box.getElementsByTagName('span');
		var cnt = 0;
		var total_cnt = 0;
		for(i = 0; i < _as.length; i++)
		{
			total_cnt++;
		}		
		for(i = 0; i < _as.length; i++)
		{
				as2[cnt] = _as[i];
				as2[cnt]._index = cnt;
                        
				if(cnt == 0)
				{
					as2[cnt].style.display = 'block';
				}
				else
				{
					as2[cnt].style.display = 'none';					
				}
				cnt++;
		}
		curr_index = 0;		
		_switch2(true);		
	}
}
function _switch2(_start,_next_index){
	clearTimeout(_slideshowTimeout2);
	var as_cnt = as2.length;
	if(as_cnt > 1)
	{
		
		if(!_start)
		{
			var next_index2 = curr_index2 + 1;
			if(typeof(_next_index2) != 'undefined')
			{
				var next_index = _next_index;
			}
			if(next_index2 >= as_cnt)
			{
				next_index2 = 0;
			}
			else if(next_index2 < 0)
			{
				next_index2 = as_cnt - 1;
			}
                        if(next_index2 != curr_index2)
                        {
                                    var _opacity1 = new Fx.Tween( as2[curr_index2], {duration: duration,
                                                onStart: function(){
                                                      this.element.style.display = 'block';
                                                },
                                                onComplete: function(){this.element.style.display = 'none';}	
                                          
                                    });
                                    _opacity1.start('opacity', end_o, start_o);
                                    var _opacity2 = new Fx.Tween( as2[next_index2], {duration: duration,		
                                                onStart: function(){
                                                      this.element.style.display = 'block';
                                                },
                                                onComplete: function(){this.element.style.display = 'block';}		
                                          
                                    });
                                    _opacity2.set('opacity', start_o);
                                    _opacity2.start('opacity', start_o, end_o);
                                    curr_index2 = next_index2;
                        }
		}
		_slideshowTimeout2 = setTimeout('_switch2(false)',duration + stop_duration);
	}
}






if (window.addEventListener)
	window.addEventListener("load", propertic_news, false);
else if (window.attachEvent)
	window.attachEvent("onload", propertic_news);