//------------------------------------------------------------------------------------------
//implementation newWindow('this.href', '', 500, 400, 0, 0, 0, 0, 0, 0, 0);

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) 
{
  var twidth=owidth=a_int_windowWidth;
  var theight=oheight=a_int_windowHeight;
  
  /*if(twidth>=screen.availWidth)
  {
    twidth=Math.round(screen.availWidth);
	theight=Math.round((twidth/owidth)*oheight);
  }
  
  if(theight>=(screen.availHeight-30))
  {
    theight=Math.round(screen.availHeight-30);
	twidth=Math.round((theight/oheight)*owidth);
  }
  
  a_int_windowWidth=twidth;
  a_int_windowHeight=theight;
  */

  var int_windowLeft = (screen.availWidth - a_int_windowWidth) / 2;
  var int_windowTop = (screen.availHeight - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)

    if (parseInt(navigator.appVersion) >= 4)
	{
      obj_window.window.focus();
    }
}//
//------------------------------------------------------------------------------------------
function newWindow_1(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) 
{
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  //var a_int_windowWidth_1=parseInt(a_int_windowWidth) + 4;    
  //var a_int_windowHeight_1=parseInt(a_int_windowHeight) + 3;
  //int_windowTop=0;

  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
//alert(str_windowProperties);
//return;
  var obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4)
	{
      obj_window.window.focus();
    }
}//


//------------------------------------------------------------------------------------------
//requires view_large_image.php

function newWindow_ls(filepath,owidth,oheight)
{
  var twidth=owidth;
  var theight=oheight;
  //alert(twidth + " " + theight);
  if(twidth>screen.availWidth)
  {
    twidth=screen.availWidth;
	theight=(twidth/owidth)*oheight;
  }

  if(theight>screen.availHeight)
  {
    theight=screen.availHeight;
	twidth=(theight/oheight)*owidth;
  }

  //alert(twidth + " " + theight);
 //return;
  eval("newWindow('view_large_image.php?filepath="+filepath+"&width="+twidth+"&height="+theight+"', '', "+twidth+", "+theight+", 0, 0, 0, 0, 0, 0, 0)");
}


//------------------------------------------------------------------------------------------

function newWindow_2s(filepath2,owidth,oheight)
{
  var twidth=owidth;
  var theight=oheight;
 //alert(twidth + " " + theight);
  if(twidth>screen.availWidth)
  {
    twidth=screen.availWidth;
	theight=(twidth/owidth)*oheight;
  }

  if(theight>screen.availHeight)
  {
    theight=screen.availHeight;
	twidth=(theight/oheight)*owidth;
  }

  //alert(twidth + " " + theight);
 //return;

  eval("newWindow('view_large_image.php?filepath="+filepath+"&width="+twidth+"&height="+theight+"', '', "+twidth+", "+theight+", 0, 0, 0, 0, 0, 0, 0)");
}


//------------------------------------------------------------------------------------------
//requires view_large_image_enc.php for encoded content
function newWindow_ls_enc(id,fileno,width,height)
{
  var twidth=width;
  var theight=height;
  //alert(twidth + " " + theight);
  if(twidth>screen.availWidth)
  {
    twidth=screen.availWidth;
	theight=(twidth/width)*height;
  }

  if(theight>screen.availHeight)
  {
    theight=screen.availHeight;
	twidth=(theight/height)*width;
  }

  //alert(twidth + " " + theight);
  //return;

  eval("newWindow('view_large_image_enc.php?id="+id+"&fileno="+fileno+"&width="+twidth+"&height="+theight+"', '', "+twidth+", "+theight+", 0, 0, 0, 0, 0, 0, 0)");
}
