var newWin = null;

function picpopup(url, width, height)
{
    if(newWin != null && !newWin.closed)
    {
        newWin.close();
    }
    
    var l = (((screen.availWidth)/2)-(width/2));
    var t = (((screen.availHeight)/2)-(height/2));

    var options = "location=0, menubar=0, toolbar=0, scrollbars=no, personalbar=0, status=0, height = "+height+", width = "+width+", left = "+l+", top = "+t;
    
    newWin = window.open('templates/picpopup.html?'+url, 'newWin', options);
    
    newWin.focus();
}

function winpopup(url, windowname, width, height, scroll)
{
	var winpopup;

	if(winpopup != null)
	{
		if(!winpopup.closed)
		{
			winpopup.window.close()
		}
	}
	winpopup = window.open(url,windowname,"location=0,menubar=0,toolbar=0,hotkeys=no,scrollbars="+ scroll +",resizable=no,personalbar=0,status=0,left="+ (((screen.availWidth)/2)-(width/2)) +",top="+ (((screen.availHeight)/2)-(height/2)) +",width="+ width +",height="+ height);
}