function open_window(url, win_width, win_height, pos_left, pos_top)
{
        var h = win_height;
	newWindow = window.open(url,"ins","width="+win_width+",height="+
	h+",left="+pos_left+",top="+pos_top+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}

function open_win3(url, win_width, win_height, pos_left, pos_top)
{
        var h = win_height;
	newWindow3 = window.open(url,"ins3","width="+win_width+",height="+
	h+",left="+pos_left+",top="+pos_top+",scrollbars=yes,resizable=yes");
	newWindow3.focus();
}

function windowSize() {
  var myWidth = 0, myHeight = 0;
  var myPosX = 0, myPosY = 0;
  var myArray= new Array();
  var w = window;
  if (parent) w = parent;

  if( typeof( w.outerWidth ) == 'number' ) {
    //Non-IE
    myWidth = w.outerWidth;
    myHeight = w.outerHeight;
  } else if( w.document.documentElement &&
      ( w.document.documentElement.clientWidth || w.document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = w.document.documentElement.clientWidth;
    myHeight = w.document.documentElement.clientHeight;
  } else if( w.document.body && ( w.document.body.clientWidth || w.document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = w.document.body.clientWidth;
    myHeight = w.document.body.clientHeight;
  }

  if (w.screenX)
  {
    myPosX = w.screenX;
    myPosY = w.screenY;
  }
  else if (w.screenLeft)
  {
    myPosX = w.screenLeft;
    myPosY = w.screenTop;
  }

  myArray[0]=myPosX;
  myArray[1]=myPosY;
  myArray[2]=myWidth;
  myArray[3]=myHeight;

  return myArray;
}


function open_win_name(url, name, style)
{
        var posX=0, posY=0;
        var posArray = windowSize();
        var offset=40;

        switch (style)
        {
           case 'msgbox':
             width=320;
             height=200;
             posX=posArray[0] + (posArray[2]-width)/2;
             posY=posArray[1] + (posArray[3]-height)/2;
           break;

           case 'small_form':
             width=320;
             height=200;
             posX=posArray[0] + (posArray[2]-width)/2;
             posY=posArray[1] + (posArray[3]-height)/2;
           break;

           case 'form':
             width=640;
             height=480;
             posX=posArray[0] + (posArray[2]-width)/2;
             posY=posArray[1] + (posArray[3]-height)/2;
           break;

           case 'large_form':
             width=800;
             height=600;
             posX=posArray[0] + (posArray[2]-width)/2;
             posY=posArray[1] + (posArray[3]-height)/2;
           break;


           case 'preview':
             width=640;
             height=480;
             posX=posArray[0] + offset;
             posY=posArray[1] + offset;
           break;

           case 'check_form':
             width=320;
             height=480;
             posX=posArray[0] + (posArray[2]-width)/2;
             posY=posArray[1] + (posArray[3]-height)/2;
           break;


           default:
             width=640;
             height=480;
             posX=posArray[0] + (posArray[2]-width)/2;
             posY=posArray[1] + (posArray[3]-height)/2;
           break;
        }

	newWindow = window.open(url,name,"width="+width+",height="+
	height+",left="+posX+",top="+posY+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}

function open_win_name_size(url, name, width, height)
{
  var posX=0, posY=0;
  var posArray = windowSize();
  var offset=40;

  posX=posArray[0] + (posArray[2]-width)/2;
  posY=posArray[1] + (posArray[3]-height)/2;

	newWindow = window.open(url,name,"width="+width+",height="+
	height+",left="+posX+",top="+posY+",scrollbars=yes,resizable=yes");
	newWindow.focus();
}


function close_window()
{
  window.close();
  return true;
} 

function js_confirm (msg, txt)
{                                                                                 
  return confirm(msg+"\n"+txt);
}                   

