kWindow = new Object();
kWindowDefaultName = 'newWin' ;
// width=size,height=size,
// resizable=yes|no,scrollbars=yes|no,
// toolbar=yes|no,location=yes|no,
// directories=yes|no,status=yes|no,
// menubar=yes|no,copyhistory=yes|no
kWindowDefaultsAttrs = 'resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,status=yes,menubar=no,copyhistory=no' ;
kWindowScreenWidth = 0 ;
kWindowScreenHeight = 0 ;
kWindowDefaultWidth = 760 ;
kWindowDefaultHeight = 400 ;

function kWindowClose()
{
	window.close();
}

function kWindowOpen( sUrl , sName , sAttrs )
{
	oObject = new Object();
	oObject[sName] = window.open( sUrl , sName , sAttrs );
	oObject[sName].moveTo(0,0);
	oObject[sName].focus();
	return oObject[sName];
}

function kWindowOpenNamedSized( sUrl , sName , iWidth , iHeight )
{
	var sAttrs = kWindowDefaultsAttrs + ',width=' + iWidth + ',height=' + iHeight;
	return kWindowOpen( sUrl , sName , sAttrs )	;
}

function kWindowOpenSized( sUrl , iWidth , iHeight )
{
	var sAttrs = kWindowDefaultsAttrs + ',width=' + iWidth + ',height=' + iHeight;
	kWindowOpen( sUrl , kWindowDefaultName , sAttrs )	;
}

function kWindowOpenDefault( sUrl )
{
	var sAttrs = kWindowDefaultsAttrs + ',width=' + kWindowDefaultWidth + ',height=' + kWindowDefaultHeight;
	alert(sAttrs);
	kWindowOpen( sUrl , kWindowDefaultName , sAttrs )	;
}


function kWindowMoveBy( x , y )
{
	window.moveBy( x , y );
}

function kWindowMoveTo( x , y )
{
	window.moveTo( x , y );
}

function kWindowResizeBy( x , y )
{
	window.resizeBy( x , y );
}

function kWindowResizeTo( x , y )
{
	window.resizeTo( x , y );
}

function kWindowOpenFitPicture( x , y )
{ 
	var agt=navigator.userAgent.toLowerCase();
	var NS  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
        && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
        && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	var iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
	var iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
	var iWidth = document.images[0].width + 26; //-iWidth
	if( iHeight > 740) iHeight = 740;
	iHeight = document.images[0].height + 31; // -iHeight+30
	if( iHeight > 400) iHeight = 400;
	window.resizeTo(iWidth, iHeight); 
	window.moveTo( x , y );
	self.focus(); 
}