src_arr=new Array();
img_arr=new Array();
state_arr=new Array();
t_cnt=new Array();

function rstart()
{
	if(arguments.length==1 || arguments[1]=='')
		return;
	var id;
	id=typeof(arguments[0])=='object'?arguments[0].id:arguments[0];
	if(typeof(src_arr[id])=='undefined')
	{
		src_arr[id]=new Array();
		img_arr[id]=new Array();
		src_arr[id][0]=document.getElementById(id).src;
		for(n=1;n<arguments.length;n++)
			src_arr[id][n]=arguments[n];
		t_cnt[id]=0;
	}
	state_arr[id]=1;
	rnext(id,1);
}

function rstop(id)
{
	state_arr[id]=0;
	if(typeof(src_arr[id])!='undefined')
		document.getElementById(id).src=src_arr[id][0];
}

function rwork(id,n,waiting)
{
	t_cnt[id]--;
	if(state_arr[id]==0)
		return;
	if(!img_arr[id][n].complete)
	{
		if(t_cnt[id]>0)
			return;
		t_cnt[id]++;
		setTimeout("rwork("+id+","+n+",1)",10);
		return;
	}
	document.getElementById(id).src=src_arr[id][n];
	n=typeof(src_arr[id][n+1])=='undefined'?0:n+1;
	rnext(id,n);
}

function rnext(id,n)
{
	if(t_cnt[id]>0)
	{
		
		return;
	}
	t_cnt[id]++;
	if(typeof(img_arr[id][n])=='undefined')
	{
		img_arr[id][n]=new Image();
		img_arr[id][n].src=src_arr[id][n];
		setTimeout("rwork("+id+","+n+",1)",500);
	}
	else
		setTimeout("rwork("+id+","+n+",0)",500);
}


function im_close() {
	if (obj) {
		obj.style.display = "none";
/*
		var plus_hr = new Date();
		plus_hr.setTime(plus_hr.getTime()+(10*60*1000));
		var expires = "expires="+plus_hr.toGMTString();
		document.cookie = "w_closed=true;"+expires+"; path=/";
*/
		document.getElementById('slide_up').style.display='none';
	}
}
function im_open() {
	var currPos = parseInt(obj.style.top);
	if (currPos > 0) {
	 obj.style.top = (currPos - 4) + "px";
	 setTimeout("im_open()",20);
	}
}

function popup_reposition() {
 var popupdiv = document.getElementById("slide_up");
 if (popupdiv) {
	popuptop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	popuptop += (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight);
	popuptop -= (popupdiv.clientHeight + 2);
	popupdiv.style.top = popuptop + "px";
 }
}