/* peter assenov- AIP Solutions Ltd.' 2003
 * version: 2.1.0.0/27.07.2003 */
/* positions the active window in the middle of the screen */ 
page.pos='center';															
page.setPos=function(cont)
{	this.w=parseInt(this.css.attr('#'+cont,'width',null));					
	this.h=parseInt(this.css.attr('#'+cont,'height',null));
	this.winw=(ns6)? window.innerWidth:document.body.offsetWidth;			
	this.winh=(ns6)? window.innerHeight:document.body.offsetHeight;
	this.x=parseInt((this.winw-this.w)/2);									
	this.y=(this.pos=="center")? parseInt((this.winh-this.h)/2) : 0;			
	if(!ns6) this.x-=8;
	this.css.attr('#'+cont,'left',(this.x>0)?this.x:0);							
	this.css.attr('#'+cont,'top',(this.y>0)?this.y:0);
log.add((this.x)?'- page positioned to: x->'+this.x+' y->'+this.y:'! fail to calculate page position');
}
/* centers the window on size changes */
onresize=function(){page.setPos('content')}
/* popup window managing */
page.popupWin=0;
page.popupOpen=function(file,w,h) 
{	this.popupW=w||350;
	this.popupH=h||500;
	this.popupX=parseInt(((ns6)? window.innerWidth:document.body.offsetWidth)/2-this.popupW/2)||100;			
	this.popupY=parseInt(((ns6)? window.innerHeight:document.body.offsetHeight)/2-this.popupH/2)||50;
	if(this.popupWin)
	{	this.popupWin.close();
		this.popupWin=0;
	} 
	this.popupWin=window.open(file,'popupWindow','left='+this.popupX+',top='+this.popupY+',width='+this.popupW+',height='+this.popupH+',scrollbars=0');
	this.popupWin.focus();
};
