// misc javascript functions

// openLink
// opens url in new window
function openLink (url) {
	var newWin = window.open("","","location,menubar,resizable,scrollbars,toolbar,status");
	newWin.location.href = url;
}

// openLinkHW
// opens url in new window with given height and width without any fancy stuff
function openLinkHW (url, h, w)
{
	var newWin = window.open ("","","scrollbars,height="+h+",width="+w);
	newWin.location.href = url;
}

// imgSrcFromIdForClass
function imgSrcFromIdForClassName(className, width, height)
{
	var imgs = document.getElementsByTagName('img');
	var okImgs = new Array();
	for(var i=0; i<imgs.length; i++)
	{
		if(imgs[i].className == className)
		{
			okImgs.push(imgs[i]);
		}
	}
	for(var j=0; j<okImgs.length; j++)
	{
		if(width != "")
		{
			okImgs[j].style.maxWidth = width;
		}
		if(height != "")
		{
			okImgs[j].style.maxHeight = height;
		}
		var img = new Image();
		img.src = okImgs[j].id;
		img.id = okImgs[j].id;
		img.onload = function () {
			document.getElementById(this.id).src = this.src;
			};
	}
	return true;
}
