var opened=false;
var win;
function openWin(str,nm,width,height,noCtrWin){
	if(opened == false){
		win = open(str,nm,"status=0,scrollbars=1,menubar=0,toolbar=0,location=0,resizeable=0,width="+width+",height="+height);
	}
	else if(opened == true){
		if(win.closed == false)
		win.close();
		win = window.open(str,nm,"status=0,scrollbars=1,menubar=0,toolbar=0,location=0,resizeable=0,width="+width+",height="+height);
	}
	opened = true;
	win.focus();

  // center win
  if(!noCtrWin) {
    var w = (screen.availWidth/2) - (width/2);
    var h = (screen.availHeight/2) - (height/2);
    win.moveTo(w,h);
  }
}

