var newwindow = null;

function closeWin(){
  if (newwindow != null){
    if(!newwindow.closed)
      newwindow.close();
  }
}

function popitup2(url,width,height) {
	if (!newwindow.closed && newwindow.location) {
		newwindow.location.href = url;
	}
	else {
		var top=(screen.height/2)-(height/2);
		var left=(screen.width/2)-(width/2);
		newwindow=window.open(url,'name','scrollbars, height='+height+',width='+width+',top='+top+',left='+left);
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}


// var features= 'height='+hauteur+',width='+largeur+',top='+Dessus +',left='+Gauche+",scrollbars=yes";
function popup(strURL,strType,strHeight,strWidth) {
  //var strType = (strType == null) ? "console" : strType;
  closeWin();
  var strOptions="";
  var Dessus=(screen.height/2)-(strHeight/2);
  var Gauche=(screen.width/2)-(strWidth/2);
  if (strType=="console") strOptions="resizable,height="+strHeight+",width="+strWidth+',top='+Dessus +',left='+Gauche;
  if (strType=="fixed") strOptions="status,height="+strHeight+",width="+strWidth+',top='+Dessus +',left='+Gauche;
  if (strType=="elastic") strOptions="toolbar,menubar,scrollbars,resizable,location"+',top='+Dessus+ ',left='+Gauche+",height="+strHeight+",width="+strWidth;

  newwindow = window.open(strURL, 'newwindow', strOptions);
  newwindow.focus();
} 

