var G__Navigator   = navigator.userAgent.toUpperCase();
var StatusUchwyt   = 0;
var StatusAktualny = "";
var OknoPopupu;


//  wst�pne �adowanie obrazk�w itp
// ********************************
function Preloader( Text_ )
{
var TabImg_ = new Array();
var TabObr_ = new Array();

TabImg_[ 0] = 'images/w3c/anybrowser.jpg';
TabImg_[ 1] = 'images/w3c/css_valid.jpg';
TabImg_[ 2] = 'images/w3c/xhtml_valid.jpg'

PodmieniajStatus( Text_ );

for ( Kolejny_=0 ; Kolejny_ < TabImg_.length ; Kolejny_ ++ )
  {
  TabObr_[Kolejny_] = new Image();
  TabObr_[Kolejny_].src = TabImg_[Kolejny_];    
}   

return false;
} // koniec Preloader()



//  podmieniamy status
// *****************************************
function PodmieniajStatus( Text_ )
{
window.status = Text_;
StatusUchwyt  = setTimeout( "PodmieniajStatus( '"+Text_+"' )", 100 );
return true;
} // koniec PodmieniajStatus()




//  zaraz po za�adowaniu .....
// *****************************************
function LoadAndRun( Text_ )
{
document.body.ondragstart = NieRoobNic;
clearTimeout( StatusUchwyt );
window.status = ""+Text_;


return true;
} // koniec LoadAndRun()




//  zwraca nic
// *****************************************
function NieRoobNic()
{
return false;
} // koniec NieRoobNic()



//  podmienia status
// *****************************************
function StatusZmiana( Text_ )
{
if ( Text_ != "" )
  {
  StatusAktualny = window.status;
	window.status = ""+Text_;
	}
 else
  {
  window.status = StatusAktualny;
}	

return true;
} // koniec StatusZmiana()




//  nowe okno z serwisem .....
// *****************************************
function NoweOkno( URL_ )
{
window.open( 'http://'+URL_ );
return false;
} // koniec NoweOkno()



//  nowe okno lokalne z serwisem .....
// *****************************************
function NoweOknoLok( URL_ ,Nazwa_,Param_)
{
Nazwa_ = ( Nazwa_==null ) ? "" : Nazwa_;
Param_ = ( Param_==null ) ? "" : Param_;

window.open( URL_ , Nazwa_ , Param_ );

return false;
} // koniec NoweOknoLok()






// ******************************************
function OtworzPopup( Plik_ , Szer_ , Wys_, DodParam_ )
{
DodParam_ = ( DodParam_ == null ) ? "" : DodParam_;
if ( Wys_>600 )
  {
  Szer_ += 16;
  Wys_   = 600;  
  DodParam_ += ',scrollbars=yes';  
}
if ( Szer_>800 )
  {
  Wys_ += 16;
  Szer_   = 800;  
  DodParam_ += ',scrollbars=yes';  
}

//Szer_ += 20;
//Wys_  += 20;  

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

if ( OknoPopupu )
  {
  OknoPopupu.close();
}
OknoPopupu = window.open( Plik_, 'popup','width='+Szer_+',height='+Wys_+',top='+PozTop_+',left='+PozLeft_+''+DodParam_);

return false;
} // koniec OtworzPopup()





//  testowanie ramek
//  jak kto� odpala serwis w ramce to wy�azi na wierzch :))
// ******************************************************
function TestRamek( DNS_ )
{
if ( top.window.location != self.window.location )  
  {
	top.window.location.replace( 'http://'+DNS_ );
}
return true;
} // koniec TestRamek()




//  sprawdza czy nie otworzyno popupu w nowym oknie
// ****************************************************
function SprImgWindow( DNS_ )
{
if ( window.name == '' )
  {
	window.location.replace( 'http://'+DNS_ );
}
} // koniec SprImgWindow()



//  wycina wszystkie spacje
// *****************************
function KillAllSpace( Ciag_ )
{

while ( Ciag_.indexOf( " " ) >= 0 )
  {
	Ciag_ = Ciag_.replace( ' ' , '' );	
}	

return Ciag_
} // koniec KillAllSpace()



//  wydruk okienka
// ****************************************************
function Drukuj()
{

window.print();

} // koniec Drukuj()




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

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



//************************************************************
//************************************************************






//  ob�uga panelu wyszukiwania
function FormSeek_Insert( Text_, Action_ )
{
if ( Action_ == 'in' && document.getElementById('seekPhrase').value == Text_ )
  {
  document.getElementById('seekPhrase').value = '';  
}  
if ( Action_ == 'out' && document.getElementById('seekPhrase').value == '' )
  {
  document.getElementById('seekPhrase').value = Text_;  
}  

return true;
} // FormSeek_Insert()






//  ob�uga panelu wyszukiwania
function FormLogon_Insert( Text1_, Text2_, Action_ )
{
if ( Action_ == 'in' && document.getElementById('login').value == Text1_ )
  {
  document.getElementById('login').value = '';  
}  
if ( Action_ == 'in' && document.getElementById('password').value == Text2_ )
  {
  if ( G__Navigator.indexOf('MSIE') == -1 )
    {
    document.getElementById('password').type = 'password';
  }    
  document.getElementById('password').value = '';  
}
  
if ( Action_ == 'out' && ( document.getElementById('login').value == '' && document.getElementById('password').value == '' ) )
  {
  if ( G__Navigator.indexOf('MSIE') == -1 )
    {
    document.getElementById('password').type = 'text';
  }    
  document.getElementById('login').value = Text1_;  
  document.getElementById('password').value = Text2_;
}  

return true;
} // FormLogon_Insert()


function closeLayer(id){
    
    document.getElementById(id).style.display = "none";
}

