var pics = new Array();
var stat = new Array();
var pic = new Array();

function changepic(i, code,id)
{
	var loop = 0;

	if (stat[code])
	{
		while ((pics[code][i] == 0 || i >= 9) && loop < 100)
		{if (i >= 5){i = 0;}
			else
			{i++;
			}
			loop++;
		}

		if (pic[code][i].complete)
		{
			document.getElementById(id).src = pic[code][i].src;
			setTimeout(function(){
				changepic(i+1,code,id);
			},500);
			
		}
		else
		{
			setTimeout(function(){
				changepic(i,code,id);
				},20);
				
		}
	}


}

function loadpic(url, code, j)
{
	if (stat[code]){pic[code][j].src = url;}
}

function startm(id,code, ta, te)
{
	if (!stat[code]){
		stat[code] = 0;
		pic[code] = [];
		pics[code] = [1,1,1,1,1,1,1,1,1,1];
	}

	stat[code] = 1;
	var jj, jjj;
	var first = 1;

	for (var j = 0; j < 10; j++)
	{
		if (pics[code][j] == 1)
		{
			pic[code][j] = new Image();
			jj = j + 1;
			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,id);
}

function endm(code)
{
	stat[code] = 0;
}


function validateStep()
{
	var showContinue = true;
	if (document.forms.stepform.title.value == ''){
		var showContinue = false;
	}
	if (document.forms.stepform.description.value == ''){
		var showContinue = false;
	}
	if (document.forms.stepform.keywords.value == ''){
		var showContinue = false;
	}
	if (showContinue){
		document.getElementById('submitb').disabled = false;
	}
	else{
		document.getElementById('submitb').disabled = true;
	}
}

function bookmarksite(title, url)
{
	if (window.sidebar)
		window.sidebar.addPanel(title, url, "");
	else if (window.opera && window.print){
		var elem = document.createElement('a');
		elem.setAttribute('href', url);
		elem.setAttribute('title', title);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	}
	else if (document.all)
		window.external.AddFavorite(url, title);
}
