/*
Ken McCormack : GravityMax (c) 2003
http://www.gravitymax.com.au 

*/
function popUp(url,winScroll,winStatus,width,height,name,xpos,ypos,toolBar,winLocation,menuBar,reSizable,reDirect)
{ //function popUp(url,winScroll,winStatus,width,height,winName,xpos,ypos){ 
  var winFeatures = "";
  if (winLocation == "yes") winFeatures += ",location=yes";  // default
  if (menuBar == "yes") winFeatures += ",menubar=yes";
  if (toolBar == "yes") winFeatures += ",toolbar=yes";
  if (reSizable != "no") winFeatures += ",resizable=yes";  // default
  if (winScroll != "no") winFeatures += ",scrollbars=yes";
  if (winStatus == "yes") winFeatures += ",status=yes";

  var screenh=640;  var screenw=480; var heightgap = 100;
  if (typeof(name) == "undefined") var name = "";
  if (width == "") var width = 490;
  
  if (typeof(screen)!="undefined"){ 
    screenh=screen.height - 25;
    screenw=screen.width - 18;
  }
  
  if (height == "") { var height = 250; }
  else if (height < 0) { height = screenh+height; } // -ve height
  
  if (width == "")  var width = 490 
  else if (width < 0) { width = screenw+width; } // -ve width
  
  if (xpos != "") 
  {
    if (xpos == "center") xpos = (screenw-width)/2;
     
  } else { var xpos = Math.round((screenw-width)/2)-18; }
  
  if (ypos != "") 
  {
    if (ypos == "center") ypos = (screenh-height-50)/2; 
  } 
  else 
  { var ypos = 25; }
  
  
  winFeatures += ',width=' + width + ',height=' + height + ',left=' + xpos+',top=' + ypos + ',screenX=' + xpos + ',screenY=' + ypos.toString();
  // remove leading comma
  winFeatures = winFeatures.substring(1,winFeatures.length);
  var popup = window.open (url, name, winFeatures);
  //alert (url + "," + name + "," + winFeatures );
  
  if (reDirect != "" && reDirect !="undefined") 
  {
    //window.location = reDirect;
  } 
    
  popup.focus();
  //maxwindow();
}


