function RRRresizeGallery(size)
{
	var browserName=navigator.appName; 
	if (browserName=="Netscape") { 
		document.getElementById('gallery').style.height = size +"px"; //ff
	} else { 
		if (browserName=="Microsoft Internet Explorer") {
			document.getElementById('gallery').style.height = size; //others
		} else {
			document.getElementById('gallery').style.height = size; //others
		}
	}
}

function resizeGallery(height)
{
	var elementId = 'gallery';
	//var element = document.getElementById(elementId);
		animate(elementId, height, 250, null);
}

function resizeElementId(height, elem)
{
	var elementId = elem+'';
	animate(elementId, height, 500, null);
}

function slideElement(elementId, height)
{
	var element = document.getElementById(elementId);
	if(element.up == null || element.down)
	{
		animate(elementId, height, 250, null);
		element.up = true;
		element.down = false;
	} else {
		animate(elementId, height, 250, null);
		//setTimeout('animate("'+elementId+'",' +height+','+250+','+null+')', 500);
		element.down = true;
		element.up = false;
	}
}

function animate(elementID, newHeight, time, callback)
{
	var el = document.getElementById(elementID);
	if(el == null)
		return;

	var cHeight = parseInt(el.style.height);

	var totalFrames = 1;
	if(time> 0)
		totalFrames = time/40;

	var fHeight = newHeight - cHeight;
	if(fHeight != 0)
		fHeight /= totalFrames;

	doFrame(elementID, cHeight, newHeight, fHeight, callback);
}

function doFrame(eID, cHeight, nHeight, fHeight, callback)
{
	var el = document.getElementById(eID);
	if(el == null)
		return;

	cHeight = moveSingleVal(cHeight, nHeight, fHeight);

	el.style.height = Math.round(cHeight) + 'px';

	if(cHeight == nHeight)
	{
		if(callback != null)
			callback();
		return;
	}

	setTimeout( 'doFrame("'+eID+'",' +cHeight+','+nHeight+','+fHeight+','+callback+')', 40);
}

function moveSingleVal(currentVal, finalVal, frameAmt)
{
	if(frameAmt == 0 || currentVal == finalVal)
		return finalVal;

	currentVal += frameAmt;
	if((frameAmt> 0 && currentVal>= finalVal) || (frameAmt <0 && currentVal <= finalVal))
		return finalVal;
	return currentVal;
}

function GroupDelegate(id) {
	var objLink = document.getElementById(id);
	Lightbox.prototype.start(objLink);
}