
	
	
function clearGalleryBrowserSelectedItem()
{
    getInputByPartialID('valueField').value = '';
    AjaxHandler.FollowMenuLink('60');
}

var imagesToLoad = new Array();

function loadImage1(src, place, lightboxstr)
{
	var x = imagesToLoad.length;
	imagesToLoad[x] = new Array();
	imagesToLoad[x][0] = src;
	imagesToLoad[x][1] = place;
	imagesToLoad[x][2] = 1;
	imagesToLoad[x][3] = lightboxstr;
	
	
	$(place).style.background = "url(/spinner.gif)"
	$(place).style.backgroundRepeat = "no-repeat";
	$(place).style.backgroundPosition = "center center";
	
	if (ajaxSupported) 
	{
		Effect.Appear(place, {duration: 0.3});
	}
	else 
	{
		$(place).style.display = "";
	}
	//alert("requested: " + src);
	
}

function loadImage2(src, place)
{
	var x = imagesToLoad.length;
	imagesToLoad[x] = new Array();
	imagesToLoad[x][0] = src;
	imagesToLoad[x][1] = place;
	imagesToLoad[x][2] = 2;
}

var cImage = 0;

function performLoadActions()
{
	//alert(cImage);
	if (cImage < imagesToLoad.length)
	{
		var img = new Image();
	    img.src = imagesToLoad[cImage][0];
		img.border = '0';
	    img.alt = imagesToLoad[cImage][1];
		img.style.border = '0px';
		img.style.paddingBottom = '0px';
		img.style.marginBottom = '0px';
		img.style.width = '100%';
		img.id = cImage;
		if (imagesToLoad[cImage][2] == 1) 
		{
			img.onload = imageLoad1;
		}
		else
		{
			img.onload = imageLoad2;
		}
		
		setTimeout("if (cImage == " + cImage + ") { performLoadActions() }", 4000);
		db.value += "Requested: " + imagesToLoad[cImage][0] + "\n";
	}
	else
	{
		db.value += "Updating Lightboxes\n";
		myLightbox.updateImageList();
	}
}
	
function imageLoad1() 
{
	try 
	{  
		//alert("loaded: " + this.src);
		if (ajaxSupported) 
		{
			//alert(this.alt + ": " + $(this.alt));
			Effect.Fade(this.alt, {duration: 0.1});
		
			setTimeout("$('" + this.alt + "').style.background = 'url(" + this.src + ")'; Effect.Appear('" + this.alt + "');", 250);
		
		} 
		else 
		{
			if (imagesToLoad[this.id][3] != "") {
				var a = document.createElement("a");
				$(this.alt).style.display = '';
				$(this.alt).appendChild(a); 
				a.appendChild(this);
				a.rel = "lightbox[artists]";
				a.href = imagesToLoad[this.id][3];
				a.onclick = function() { myLightbox.start(this); return false; }
				this.alt = "";
			}
			else
			{
				$(this.alt).appendChild(this); 
				this.alt = "";
				db.value += "loaded2: " + this.src + "\n";
				cImage++;
			}
			cImage++;
		}
		
		db.value += "loaded1: " + this.src + "\n";
		cImage++;
		setTimeout("performLoadActions()", 0);
	}
	catch(err)
	{
		alert('0: ' + err.message); 
	}
}

function imageLoad2()
{
	try
	{ 
		if (ajaxSupported) 
		{
			$(this.alt).appendChild(this); 
			this.alt = "";
			db.value += "loaded2: " + this.src + "\n";
			cImage++;
		}
		setTimeout("performLoadActions()", 250);
	} 
	catch(err) 
	{
		alert('0: ' + err.message); 
	}
}