/* common js tasks */

function miniPane(url,w,h)
{
	var width = 0;
	var height = 0;
	if (document.all || document.layers) {
		width = screen.availWidth;
		height = screen.availHeight;
	} else {
		width = screen.width;
		height = screen.height;
	}

	var leftPos = (width-w)/2, topPos = (height-h)/2;

	var win = window.open(url,'smallwindow','width='+w+',height='+h+',toolbar=no,scrollbars=yes,resizable=yes,menubar=no,location=no,left='+leftPos+',top='+topPos);
	win.moveTo(leftPos,topPos);
	if (!win)
	{
		alert('A popup blocker may have blocked this link, please allow popups on this site');
	}
}

function timer(elemId,seconds)
{
	document.getElementById(elemId).innerHTML=seconds;
	updateTimer(elemId,seconds);
}

function updateTimer(elemId,seconds)
{ 
	seconds-=1 
    document.getElementById(elemId).innerHTML=seconds; 
    setTimeout(function(){updateTimer(elemId,seconds)},1000);
}