// Простое окно без меню и инструментов
function EasyWind(AWind, NWind){

  InfoWin=window.open(AWind,"Inform",
  "toolbar=no,scrollbars=yes,resizable=1");

  InfoWin.document.title=NWind;
  
  InfoWin.focus();
  
}

// Открыть окно с известными размерами
function SizeWind(NPict, whs, hgs){
// Размеры окна передаются параметрами whs и hgs
  
  l=(screen.width-whs) / 2;
  t=(screen.height-hgs) / 2;

  PicWin=window.open(NPict,"Code",
  "toolbar=no, menubar=no, scrollbars=no,resizable=no,width="+whs+",height="+hgs+",left="+l+",top="+t);
  
  PicWin.focus();

  }

// Открыть окно с известными размерами справа
function SizeWindR(NPict, whs, hgs){
// Размеры окна передаются параметрами whs и hgs
  
  l=(screen.width-whs-10);
  t=0;

  PicWin=window.open(NPict,"Code",
  "toolbar=no, menubar=no, scrollbars=yes,resizable=yes,width="+whs+",height="+hgs+",left="+l+",top="+t);
  
  PicWin.focus();

  }

function ifScrPict (NPict, whs, hgs, TName){

  if (screen.width<1100) 
//  alert ('Ширина экрана: '+screen.width)
  ShowPictR (NPict, whs, hgs, TName)
  else MM_swapImage('SwpImg','',NPict,0)
	
}
	
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// Показ картинки с известными размерами справа вверху
function ShowPictR (NPict, whs, hgs, TName){
// Размеры окна передаются параметрами whs и hgs
 
  l=(screen.width-whs);
  t=1;

  PicWin=window.open("","Pict",
  "toolbar=no, menubar=no, scrollbars=no,resizable=no,width="+whs+",height="+hgs+",left="+l+",top="+t);

// Здесь нужна поправка на рамки
  wi = whs+8;
  hi = hgs+35;
  PicWin.resizeTo (wi, hi);

  PicWin.document.open ();

  PicWin.document.write ("<img src="+ NPict +" alt='" + TName + "'>");

  PicWin.document.body.topMargin = 0;
  PicWin.document.body.leftMargin = 0;

  PicWin.document.body.bgColor='#003366';
  PicWin.document.title = TName;


  PicWin.document.close ();	

  PicWin.focus();
}


// Показ картинки с известными размерами слева вверху
function ShowPictN (NPict, whs, hgs, TName){
// Размеры окна передаются параметрами whs и hgs
 
//  l=2;
//  t=2;

  
  PicWin=window.open("","Pict",
  "toolbar=no, menubar=no, scrollbars=no,resizable=yes,width="+whs+",height="+hgs+",left=2,top=2");

// Здесь нужна поправка на рамки
  wi = whs+8;
  hi = hgs+35;
  PicWin.resizeTo (wi, hi);

  PicWin.document.open ();

//  PicWin.document.write ("<img src="+ NPict +">");

  PicWin.document.write ("<img src="+ NPict +" alt='" + TName + "'>");

  PicWin.document.body.topMargin = 0;
  PicWin.document.body.leftMargin = 0;

  PicWin.document.body.bgColor='#003366';
  PicWin.document.title = TName;


  PicWin.document.close ();	

  PicWin.focus();

}

function ShowPict (ImgToOpen,W,H,TName)
{

l=(screen.width-W) / 2;
t=(screen.height-H) / 2;	

W+=2;H+=2;
tmp=window.open('','','scrollbars=no,resizable=no,top=10, left=10, width='+W+',height='+H);

tmp.document.write('<html><head><title>'+TName+'</title></head><body leftmargin=2 topmargin=2><img src='+ImgToOpen+'></body></html>');

void(0);
}

// Показ картинки с известными размерами слева вверху c фоном
function ShowPictF (NPict, whs, hgs, TName, Canvas){
// Размеры окна передаются параметрами whs и hgs
 
  PicWin=window.open("","Pict",
  "toolbar=no, menubar=no, scrollbars=no,resizable=no,width="+whs+",height="+hgs+",left=2,top=2");


// Здесь нужна поправка на рамки
  wi = whs+29;
  hi = hgs+60;
  PicWin.resizeTo (wi, hi);

  PicWin.document.open ();

  PicWin.document.write ("<img src="+ NPict +">");

//  PicWin.document.body.topMargin = 0;
//  PicWin.document.body.leftMargin = 0;

  PicWin.document.body.bgColor='#002244';
  PicWin.document.body.background=Canvas;
  PicWin.document.title = TName;


  PicWin.document.close ();	

  PicWin.focus();
}



// Показ картинки с известными размерами в центре экрана
function ShowPictC (NPict, whs, hgs, TName){
// Размеры окна передаются параметрами whs и hgs
 
  l=(screen.width-whs) / 2;
  t=(screen.height-hgs) / 2;

  PicWin=window.open("","Pict",
  "toolbar=no, menubar=no, scrollbars=no,resizable=no,width="+whs+",height="+hgs+",left="+l+",top="+t);

// Здесь нужна поправка на рамки
  wi = whs+8;
  hi = hgs+35;
  PicWin.resizeTo (wi, hi);

  PicWin.document.open ();

  PicWin.document.write ("<img src="+ NPict +">");

  PicWin.document.body.topMargin = 0;
  PicWin.document.body.leftMargin = 0;

  PicWin.document.body.bgColor='#003366';
  PicWin.document.title = TName;


  PicWin.document.close ();	

  PicWin.focus();
}

// Показ картинки с известными размерами в центре экрана - 2 вариант
function ShowPict0 (ImgToOpen,W,H,TName)
{

l=(screen.width-W) / 2;
t=(screen.height-H) / 2;	

W+=2;H+=2;
tmp=window.open('','','scrollbars=no,resizable=no,top='+t+', left='+l+', width='+W+',height='+H);

tmp.document.write('<html><head><title>'+TName+'</title></head><body leftmargin=2 topmargin=2><img src='+ImgToOpen+'></body></html>');

void(0);
}

// Показ картинки с известными размерами слева посредине
function ShowPictLC (NPict, whs, hgs, TName){
// Размеры окна передаются параметрами whs и hgs
 
  l=2;
  t=(screen.height-hgs)/2-2;

  PicWin=window.open("","Pict",
  "toolbar=no, menubar=no, scrollbars=no,resizable=no,width="+whs+",height="+hgs+",left="+l+",top="+t);

// Здесь нужна поправка на рамки
  wi = whs+8;
  hi = hgs+35;
  PicWin.resizeTo (wi, hi);

  PicWin.document.open ();

  PicWin.document.write ("<img src="+ NPict +">");

  PicWin.document.body.topMargin = 0;
  PicWin.document.body.leftMargin = 0;

  PicWin.document.body.bgColor='#003366';
  PicWin.document.title = TName;


  PicWin.document.close ();	

  PicWin.focus();
}


// Показ картинки с известными размерами слева внизу
function ShowPictLB (NPict, whs, hgs, TName){
// Размеры окна передаются параметрами whs и hgs
 
  l=2;
  t=screen.height-hgs-2;

  PicWin=window.open("","Pict",
  "toolbar=no, menubar=no, scrollbars=no,resizable=no,width="+whs+",height="+hgs+",left="+l+",top="+t);

// Здесь нужна поправка на рамки
  wi = whs+8;
  hi = hgs+35;
  PicWin.resizeTo (wi, hi);

  PicWin.document.open ();

  PicWin.document.write ("<img src="+ NPict +">");

  PicWin.document.body.topMargin = 0;
  PicWin.document.body.leftMargin = 0;

  PicWin.document.body.bgColor='#003366';
  PicWin.document.title = TName;


  PicWin.document.close ();	

  PicWin.focus();
}



// Показ картинки с автоматическим определением размеров
// в левом верхнем углу
function AutoPict (NPict, TName){

//  l=screen.width / 2;
//  t=screen.height / 2;


  PicWin=window.open("","Pict", "toolbar=no, menubar=no, scrollbars=no,resizable=yes, width=200, height=200, left=1, top=1");
  
  PicWin.document.open ();

  PicWin.document.write ("<img src="+ NPict +">");

  PicWin.document.body.topMargin = 0;
  PicWin.document.body.leftMargin = 0;

  wi = PicWin.document.images[0].width+8;
  hi = PicWin.document.images[0].height+35;

  PicWin.resizeTo (wi, hi);

// Для показа в центре экрана
//  l=(screen.width-wi) / 2;
//  t=(screen.height-hi) / 2;
//  PicWin.moveTo (l, t);

  PicWin.document.body.bgColor='#003366';
  PicWin.document.title = TName;

  PicWin.document.close;

//  PicWin.resizeTo (wi, hi);
  
  PicWin.focus();

}

// Окно разворачивается на экран-100 по высоте 
// и на 0.7 экрана по ширине
function DetWind(AWind, NWind){

var whs=screen.height-100;
var hgs=screen.width * 0.7;

  InfoWin=window.open(AWind,"Inform",
  "toolbar=no,scrollbars=yes,resizable=1,width="+hgs+",height="+whs+",top=1,left=1");

  InfoWin.document.title=NWind;
  
  InfoWin.focus();
  
}

// Замена содержимого псевдофрейма <iframe>
function chframe (NewLink){
	
    document.all.mframe.src = NewLink;
	document.all.mydoc.scrollTop = 0;

}

function ShowPictN (ImgToOpen,W,H,TName)
{
W+=4;H+=4;
tmp=window.open('','','scrollbars=no,resizable=no,top=80, left=180, width='+W+',height='+H);
tmp.document.write('<html><head><title>'+TName+'</title></head><body leftmargin=2 topmargin=2><img src='+ImgToOpen+'></body></html>');
void(0);
}
