// Base HREF
var basehref = "http://forum.metalrage.com";

// Small Images array
var verkleinde_afbeeldingen = new Array();

// Max size of image
var maxSize = 550;

// define function for big picture
function WareGrootte(e)
{
		if (window.event)
		{
			e = window.event;
		}
		var oSource = e.srcElement ? e.srcElement.src : e.target.src;
		tempvar = verkleinde_afbeeldingen[oSource];
		ViewLarge = window.open("", "_grootPlaatje","toolbar=no,location=no,menubar=no,scrollbars=no,status=no,left=0,top=0" + tempvar);
		ViewLarge.document.writeln("<html><head><title>Metalrage.com Forum: Normal Image</title>");
		ViewLarge.document.writeln("</head><body bgcolor=\"#ababab\" topmargin=\"0\" leftmargin=\"0\" marginheight=\"0\" marginwidth=\"0\">");
		ViewLarge.document.writeln("<img style=\"cursor:hand\" src=\"" + oSource + "\" onclick=\"window.close()\" title=\"Click to close window.\">");
		ViewLarge.document.writeln("</body></html>");
		ViewLarge.document.close();
	}

// Define function for resizing
function verklein(afbeelding)
{
	if (window.event)
	{
		e = window.event;
	}
	
	if (typeof afbeelding != 'object')
	{
		var afbeelding = e.srcElement ? e.srcElement : e.target;
	}
	
	var width = afbeelding.width;
	var height = afbeelding.height;
	var url = afbeelding.src;

	if (width > maxSize)
	{
		verkleinde_afbeeldingen[url] = ",width=" + width + ",height=" + height;
		afbeelding.width = maxSize;
		afbeelding.title = "Click here to view image.";
		afbeelding.style.border = "dotted 2px #FFFFFF";
		afbeelding.style.cursor = "hand";
		afbeelding.onclick = WareGrootte;
		afbeelding.height = Math.floor(height/(width/maxSize));
	}
}

// ddefine function for searching images
function search_images()
{
	aantal = document.images.length;
	i = 0;

	while (aantal > i)
	{
		imgurl = document.images[i].src;

		if (!imgurl.match(basehref))
		{
			if (document.images[i].complete)
			{
				verklein(document.images[i]);
			}
			else
			{
				document.images[i].onload = verklein;
			}
		}
		
		i++;
	}
}
