var pics=new Array();
var stat=new Array();
var pic=new Array();

function changepic(i,code)
{ var loop=0;

	if (stat[code])
	{
		while ((pics[code][i]==0 || i>=16) && loop<100)
		{ if (i>=16) { i=0; }
			else
			{ i++;
			}
			loop++;
		}

		if (pic[code][i].complete)
		{	document.getElementById(code).src=pic[code][i].src;
			setTimeout("changepic("+(i+1)+",'"+code+"')",500);
		}
		else
		{	setTimeout("changepic("+i+",'"+code+"')",20);
		}
	}


}

function loadpic(url,code,j)
{	if (stat[code]) { pic[code][j].src=url; }
}

function startm(code,ta,te){
	stat[code]=1;
	var jj, jjj;
	var first=1;

	for(var j=0;j<16;j++){		if(pics[code][j]==1){			pic[code][j] = new Image();
			jj=j;
			//if (jj>=100) { jjj=""+jj; }
			//if (jj<100 && jj>=10) { jjj="0"+jj; }
			if (jj<10) { jjj=jj; }
			if (first) { first=0; loadpic(ta+jjj+te,code,j); }
			else { setTimeout("loadpic('"+ta+jjj+te+"','"+code+"',"+j+")",j*50); }
		}
	}
	changepic(0,code);
}

function endm(code){	stat[code]=0;
}

function getDate() {

	var months=new Array(13);
	months[1]="January";
	months[2]="February";
	months[3]="March";
	months[4]="April";
	months[5]="May";
	months[6]="June";
	months[7]="July";
	months[8]="August";
	months[9]="September";
	months[10]="October";
	months[11]="November";
	months[12]="December";
	var time=new Date();
	var lmonth=months[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year < 2000)
	year = year + 1900;
	var currentDate = lmonth + " " + date + ", " + year;
	return currentDate;
}
