var ie = document.all;
var nn6 = document.getElementById&&!document.all;

var dirpath = '';

function processImages(thumb_w, num)
{
	for (var i=0; i < num; i++)
	{
		var icont = document.getElementById('icont-' + i);
		
		for (var j=0; j < icont.childNodes.length; j++)
		{
			if (icont.childNodes[j].tagName == 'DIV')	
			{
				var ishdw = icont.childNodes[j];
			}
			else if (icont.childNodes[j].tagName == 'A')	
			{
				for (var k=0; k < icont.childNodes[j].childNodes.length; k++)
				{
					if (icont.childNodes[j].childNodes[k].tagName == 'IMG')
					{
						var img = icont.childNodes[j].childNodes[k];
						break;
					}
				}
				break;
			}
		}
		if (img)
		{
			var w = img.offsetWidth;
			var h = img.offsetHeight;
			
			var new_w = w;
			var new_h = h;
			
			if (w > thumb_w)
			{
				var w_ratio = w / 100;
				var h_ratio = h / 100;
				new_w = thumb_w;
				new_h = (thumb_w / w_ratio) * h_ratio;
			}
			
			img.style.width = nn6 
				? new_w + 'px'
				: new_w;
			img.style.height = nn6 
				? new_h + 'px'
				: new_h;
			icont.style.width = nn6 
				? (new_w + 14) + 'px'
				: (new_w + 14);
			icont.style.height = nn6 
				? (new_h + 4) + 'px'
				: (new_h + 4);
			ishdw.style.width = nn6 
				? new_w + 'px'
				: new_w;
			ishdw.style.height = nn6 
				? new_h + 'px'
				: new_h;
			
			img.style.visibility = 'visible';
		}
	}
}

// Form submission onclick anchor tag;
// e.g. 
// <form name="postlink" action="<?= $_SERVER["PHP_SELF"] ?>?section=<?= $_TID ?>" method="post">
// <input type="hidden" name="year" value="">
// <a onclick="postLink('year', <?= $years[$i] ?>);" href="#"><?= $years[$i] ?></a>
// </form>
//
function postLink(form, v, val)
{
	document[form][v].value = val;
	document[form].submit();
}
