var win=null;
var wnews=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if (win!=null) win.close();
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=yes,resizable=yes';
win=window.open(mypage,myname,settings);
win.focus();
}

function NewWindow_p(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

function showNewsSmall( id_news )
{
 //
 var wname = 'news_' + id_news;
 var wnews = window.open( 'lenta-small.html?id='+id_news, wname, 'width=630,height=400,status=yes,directories=no,location=no,menubar=yes,toolbar=yes,top=100,left=200,titlebar=yes,resizable=yes,scrollbars=yes');
 wnews.focus();
 //
}
function windowOpener(windowWidth,windowHeight,windowName,windowUri,body,r){
//Открывает окно по центру экрана. r=1 - resize. windowOpener(800,600,'wwww','','textsss',1) 
//Dryagin 5sep2005
	if(r==null){r=1;}
	var centerWidth = (window.screen.width - windowWidth) / 2;
	var centerHeight = (window.screen.height - windowHeight) / 2;
   newWindow = window.open(windowUri,windowName,'fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,resizable='+r+',scrollbars=1,width=' + windowWidth + 
',height=' + windowHeight);
   newWindow.moveTo(centerWidth, centerHeight);
   newWindow.blur();
   newWindow.focus();
   if(body!=""){newWindow.document.write(body);}
  //return newWindow.name;
}

