var set='';
var i;
var sx;
var sy;
function openwindow(src,win_name,width,height,features)
{
 //  alert(src+'\n'+win_name+'\n'+width+'\n'+height);
 var this_win = null;
 sx  = (screen.width)  ? (screen.width-width)/2 : 10;
 sy  = (screen.height) ? (screen.height-height)/2 : 10;
 var d_set = 'scrollbars=no,dependent=yes,resizable=no,status=no,toolbar=no,location=no,menubar=no,top='+sy+',left='+sx+',height='+height+',width='+width;

 if(features)
 {
  var tmp_array = new Array();
  if(features.match(/,/))
   tmp_array = features.split(",");
  else
   tmp_array[0] = features;
  for(i=0;i<tmp_array.length;i++)
  {
   var k = tmp_array[i].split("=");
   var ptn = new RegExp("("+k[0]+")=\\w+");
   d_set = d_set.replace(ptn,'$1='+k[1]);
  }
 }
 var url = "";
 if(typeof(src) != 'undefined')
  url=src;
 set = d_set;
 this_win = window.open(url,win_name,set);
 if(this_win==null)
 {
  self.location.href='/php/javascript_window_failed.php?title=window did not open!';
  return this_win;
 }
 this_win.moveTo(sx,sy);
 // accoding to my research == doing it IE and FIREFOX disagree in the final dimension!
 // DO NOT INCLUDE THIS< IT FUCKS UP EVERYTHING!!!!!!!!!!!
 // this_win.resizeTo(width,height);
 return this_win;
}
