	gPhotos = new Array();
	gLinks = new Array();
	
	var col_div=3;

	var width=0;
	var height;
	var speed;
	var interval;
	var sleep_interval;
	
	
	
	var left_div=1;
	var right_div=2;
	
	
	gDiv = new Array();

	var empty=0;
	var work=true;

	var width_div_right;
	var width_div_left=0;
	
	function SetFloat(element,stfloat)
	{
		element.style.styleFloat=stfloat;
		element.style.cssFloat=stfloat;
	}
	
	function change_foto()
	{
		var div_left=gDiv[left_div];
		SetFloat(div_left,"right");
		
		left_div+=col_div-1;
		if(left_div>col_div)
		{
			left_div=left_div-col_div;
		}
		
		var new_div_left=gDiv[left_div];
		new_div_left.style.display="block";
		new_div_left.style.width="0px";
		SetFloat(new_div_left,"left");
		width_div_left=0;
		width_div_right=width;
		
		
		
		right_div+=col_div-1;
		if(right_div>col_div)
		{
			right_div=right_div-col_div;
		}
	}

	function move()
	{
	
		if(empty==sleep_interval)
		{
			work=true;
			empty=0;
		}
		
		if(work==true)
		{	
			if(width_div_left>width-speed)
			{
				work=false;
				epty=0;
				change_foto();
				
			}
			else
			{
				var div_left=gDiv[left_div];
				var div_right=gDiv[right_div];
			
				width_div_left=width_div_left+speed;
				width_div_right=width_div_right-speed;
						
				div_left.style.width=width_div_left+"px";
				div_right.style.width=width_div_right+ "px";
			}
		}
		else
		{
			empty++;
		}

	}
	
function begin(element, w, h, arrPhotos, arrLinks, _speed, _interval, _sleep_interval, back_color)
{
	
	width=w;
	width_div_right=width;
	height=h;
	gPhotos=arrPhotos;
	gLinks=arrLinks;
	col_div=gPhotos.length-1;
	speed=_speed;
	interval=_interval;
	sleep_interval=_sleep_interval;
	
	var content=document.getElementById(element);
	content.style.width=width+"px";
	content.style.height=height+"px";
	content.style.backgroundColor=back_color;
	content.cursor="pointer";
	
	var div_s="";
	
	for(j=1;j<=col_div;j++)
	{
		div_s+="<a id=\"a_"+j+"\" href=\"#\" target=\"_blank\"><div id=\"div_"+j+"\"></div></a>";
	}
	content.innerHTML=div_s;
	
	
	for(y=1;y<=col_div; y++)
	{
		gDiv[y] = document.getElementById("div_"+y);
	}
	
		
	var div_left=gDiv[1];
	var div_right=gDiv[2];
	
	div_left.style.backgroundImage="url("+gPhotos[left_div]+")";
	SetFloat(div_left, "left");
	div_left.style.width="0px";
	div_left.style.height=height+"px";
	div_left.cursor="pointer";
	
	div_right.style.backgroundImage="url("+gPhotos[right_div]+")";
	SetFloat(div_right, "right");
	div_right.style.width=width+"px";
	div_right.style.height=height+"px";
	
	var left_link=document.getElementById("a_"+left_div);
	left_link.href=gLinks[left_div];
	
	var right_link=document.getElementById("a_"+right_div);
	right_link.href=gLinks[right_div];
	
	for( i=3; i<=col_div; i++)
	{
		temp_link=document.getElementById("a_"+i);
		temp_link.href=gLinks[i];
		
		
		temp=document.getElementById("div_"+i);
		temp.style.display="none";
		temp.style.backgroundImage="url("+gPhotos[i]+")";
		temp.style.width="0px";
		temp.style.height=height+"px";
		
	}
	setInterval("move()", interval);
}
