tog = new Array();

$(document).ready(function()
{
	bigwidth = $('#img-container').width();

	bigwidth = (bigwidth == null) ?
		1 : parseInt(bigwidth) - 18;

	//$('#img-container').css('width', bigwidth);
});

function toggleImg(id,width,height,thwidth)
{
	$('div').remove('#once');
	var thiswidth = 0;

	if ((!tog[id]) || (tog[id] == false))
	{
		o = document.getElementById('img'+id);
		var yo = o.id;

		if (o)
		{
			tog[id] = true;

			// IE wants these

			o.getElementsByTagName('div')[0].style.width = width + 'px';
			o.getElementsByTagName('div')[0].style.height = height + 10 + 'px';

			o.style.marginBottom = '20px';
			o.style.marginRight = '20px';

			o.getElementsByTagName('a')[0].style.width = width + 'px';
			o.getElementsByTagName('a')[0].style.height = height + 10 + 'px';

			o.getElementsByTagName('img')[0].style.width = width + 'px';
			o.getElementsByTagName('img')[0].style.height = height + 'px';

			preloadImage(path + o.getElementsByTagName('img')[0].alt);

			//$("#tid"+id).animate(	{width: width+'px', height: height+'px'}, 400, 'swing',preloadImage(path + o.getElementsByTagName('img')[0].alt));
			//$("#img"+id).animate(	{width: width+'px', height: height+10+'px'}, 400, 'swing');
			o.getElementsByTagName('strong')[0].style.width = width + 'px';

			o.getElementsByTagName('strong')[0].style.display = 'block';
			o.getElementsByTagName('em')[0].style.display = 'block';

		}

	}
	else
	{
		o = document.getElementById('img'+id);
		var yo = o.id;

		if (o)
		{
			tog[id] = false;
			o = document.getElementById('img'+id);
			var yo = o.id;
			// IE wants these


			o.getElementsByTagName('a')[0].style.width = '';
			o.getElementsByTagName('a')[0].style.height = '';

			//d = path + 'th-' + o.getElementsByTagName('img')[0].alt;
			//nheight = parseInt(height / 3);
			//nwidth = parseInt(width / 3);


			d = path + 'th-' + o.getElementsByTagName('img')[0].alt;
			o.style.marginBottom = '';
			o.style.marginRight = '';

			o.getElementsByTagName('div')[0].style.width = thwidth + 20 + 'px';
			o.getElementsByTagName('div')[0].style.height = thwidth + 20 + 'px';

			o.getElementsByTagName('img')[0].style.width = '';
			o.getElementsByTagName('img')[0].style.height = '';

			o.getElementsByTagName('img')[0].src = d;

			o.getElementsByTagName('em')[0].style.display = 'none';
			o.getElementsByTagName('strong')[0].style.display = 'none';
			/*
			$("#tid"+id).animate(	{width: nwidth+'px', height: nheight+'px'}, 300, 'swing',
										function() {
											o = document.getElementById('img'+id);
											var yo = o.id;

											d = path + 'th-' + o.getElementsByTagName('img')[0].alt;
											o.style.marginBottom = '';

											//o.getElementsByTagName('div')[0].style.width = thwidth + 20 + 'px';
											//o.getElementsByTagName('div')[0].style.height = thwidth + 20 + 'px';

											//o.getElementsByTagName('img')[0].style.width = '';
											//o.getElementsByTagName('img')[0].style.height = '';

											o.getElementsByTagName('img')[0].src = d;


										});
										*/

			// back to the thumbnail - use natural size



		}
	}

	$('div.grow').each(function()
	{
		var thewidth = $(this).width();
		thiswidth = parseInt(thiswidth) + parseInt(thewidth);

		if (thiswidth > bigwidth)
		{
			var help = $(this).prev('div.grow').attr('id');
			$(this).prev('div.grow').after("<div id='once'><!-- --></div>");
			thiswidth = thewidth;
		}
	});
}
function getback(id,thwidth) {



}

function preloadImage(image)
{
	preload = new Image();
	preload.src = image;
	o.getElementsByTagName('img')[0].src = preload.src;
}