var G__Navigator = navigator.userAgent.toUpperCase();
var G__PopupWindow = '';
var G__ToJestemJaMain = '';


/// wycina wszystkie spacje
// ****************************************
function KillAllSpace( Text_ )
{
var Zwrot_ = '';

Zwrot_ = Text_.replace( / /g , '' );

return Zwrot_;
} // koniec KillAllSpace()



//  blokada prawego klawisza
// *****************************************
function LoadAndRun( Text_ )
{

try
  {
  AfterLoad();
  }
 catch (e)
  {
  }
 finally
  {
}     

return true;
} // koniec LoadAndRun()




//*******************************
function  GetCssStyle( Param_ )
{    
var Return_ = '';

if ( Param_ == 'TR' )
  {
  Return_ = ( G__Navigator.indexOf( 'MSIE' ) > 0 && G__Navigator.indexOf( 'OPERA' ) == -1 ) ? 'block' : 'table-row';
}

return Return_;
} // koniec GetCssStyle()



//  zaokrąglenie do x miejsc po przecinku
// ****************************************************
function Round( Liczba_ , DoIlu_ )
{
var Zwrot_ = 0;
DoIlu_ = ( typeof(DoIlu_) != 'number' ) ? 2 : DoIlu_;
Pomocnik_ = Math.pow( 10 , DoIlu_ ); 

Zwrot_ = Liczba_.replace( /,/g, '.' );
Zwrot_ = Zwrot_.replace( / /g, '' );
Zwrot_ = ( Math.round( Zwrot_ * Pomocnik_ ) / Pomocnik_ ); 

return Zwrot_;
} // Round()



// ******************************************
function OpenPopup( Plik_ , Szer_ , Wys_, DodParam_, ZmienRozm_ )
{
DodParam_  = ( typeof(DodParam_) != 'string' ) ? "" : DodParam_;
ZmienRozm_ = ( typeof(ZmienRozm_) != 'boolean' ) ? true : ZmienRozm_;

if ( ZmienRozm_ )
  {
  if ( Wys_>600 )
    {
    Szer_ += 16;
    Wys_   = 600;  
    DodParam_ += ',scrollbars=yes';  
  }
  if ( Szer_>800 )
    {
    Wys_ += 16;
    Szer_   = 800;  
    DodParam_ += ',scrollbars=yes';  
  }
}  

PozTop_  = Math.ceil( ( screen.height - Wys_ ) / 2 );
PozLeft_ = Math.ceil( ( screen.width - Szer_ ) / 2 );

if ( G__PopupWindow )
  {
  G__PopupWindow.close();
}
//alert( Plik_ );
G__PopupWindow = window.open( Plik_+';windowID='+G__ToJestemJaMain, 'WindowPopup','width='+Szer_+',height='+Wys_+',top='+PozTop_+',left='+PozLeft_+',scrollbars=yes,resizable=yes'+DodParam_);


return false;
} // koniec OpenPopup()




/// testowanie poprawności maila
// ****************************************
function MailTest( Mail_ )
{

return ( KillAllSpace(Mail_).length > 0 && (/^[^? ]{1,}[@]{1}[^? ]{1,}[.]{1}[^? ]{1,}$/.test(Mail_) ) )
} // koniec MailTest()

