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/layout/zakladka2_lewa_on.gif';
TabImg_[ 1] = 'images/layout/zakladka2_lewa_ov.gif';
TabImg_[ 2] = 'images/layout/zakladka2_prawa_on.gif';
TabImg_[ 3] = 'images/layout/zakladka2_prawa_ov.gif';
TabImg_[ 4] = 'images/layout/zakladka2_sep.gif';
TabImg_[ 5] = 'images/layout/zakladka2_srodek_on.gif';
TabImg_[ 6] = 'images/layout/zakladka2_srodek_ov.gif';
TabImg_[ 7] = 'images/layout/background.jpg';
TabImg_[ 8] = 'images/layout/header.jpg';
TabImg_[ 9] = 'images/layout/header_bottom.jpg';
TabImg_[10] = 'images/layout/header_bottom_l.jpg';
TabImg_[11] = 'images/layout/header_bottom_r.jpg';
TabImg_[12] = 'images/w3c/anybrowser.jpg';
TabImg_[13] = 'images/w3c/css_valid.jpg';
TabImg_[14] = '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()



//  otwiera okno popapu
// *************************************************
function OtworzPopup_( Plik_ , Wys_, Szer_, DodParam_  )
{

okienko = window.open( Plik_ , 'szczegoly_'+Wys_+Szer_, 'top=50,left=50,width='+Wys_+',height='+Szer_+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()


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




//  ustawia zdarzenia z podświetlaniem
// *****************************************
function AnimateTopMenu( Name_ )
{
Obj_ = document.getElementById(Name_);

if ( Obj_ )
  {
  Obj_.onmouseover = TopMenuOver;
  Obj_.onmouseout  = TopMenuOut;
}  
}
// koniec AnimateTopMenu()




//  podswietla przycisk przy najechaniu myszką
// *****************************************
function TopMenuOver()
{

ObjPozL_ = document.getElementById( this.id+'_poz_L' );
if ( ObjPozL_ )
  {
  ObjPozL_.src = ObjPozL_.src.replace( /_on./ , '_ov.' );    
}

ObjPozC_ = document.getElementById( this.id+'_poz_C' );
if ( ObjPozC_ )
  {
  ObjPozC_.style.backgroundImage = ObjPozC_.style.backgroundImage.replace( /_on./ , '_ov.' );
  ObjPozC_.style.color = '#032de2';
}

ObjPozP_ = document.getElementById( this.id+'_poz_P' );
if ( ObjPozP_ )
  {
  ObjPozP_.src = ObjPozP_.src.replace( /_on./ , '_ov.' );    
}


ObjSub_ = document.getElementById( this.id+'_sub' );
if ( ObjSub_ )
  {
  ObjSub_.style.visibility = 'visible';
}

} // koniec TopMenuOver()




//  podswietla przycisk przy najechaniu myszką
// *****************************************
function TopMenuOut()
{

ObjPozL_ = document.getElementById( this.id+'_poz_L' );
if ( ObjPozL_ )
  {
  ObjPozL_.src = ObjPozL_.src.replace( /_ov./ , '_on.' );    
}

ObjPozC_ = document.getElementById( this.id+'_poz_C' );
if ( ObjPozC_ )
  {
  ObjPozC_.style.backgroundImage = ObjPozC_.style.backgroundImage.replace( /_ov./ , '_on.' );
  ObjPozC_.style.color = '#0a5e3f';
}

ObjPozP_ = document.getElementById( this.id+'_poz_P' );
if ( ObjPozP_ )
  {
  ObjPozP_.src = ObjPozP_.src.replace( /_ov./ , '_on.' );    
}


ObjSub_ = document.getElementById( this.id+'_sub' );
if ( ObjSub_ )
  {
  ObjSub_.style.visibility = 'hidden';
}

} // koniec TopMenuOut()





//  ustawia zdarzenia z podświetlaniem
// *****************************************
function AnimateSubMenu( Name_ )
{
Obj_ = document.getElementById(Name_);

if ( Obj_ )
  {
  Obj_.onmouseover = SubMenuOver;
  Obj_.onmouseout  = SubMenuOut;
}  
}
// koniec AnimateSubMenu()



//  podswietla pozycję przy najechaniu myszką
// *****************************************
function SubMenuOver()
{
this.style.backgroundColor = '#b6fff9';
this.style.color = '#032de2';

ObjSub_ = document.getElementById( this.id+'_sub2' );
if ( ObjSub_ )
  {
  ObjSub_.style.visibility = 'visible';
}

} // koniec SubMenuOver()




//  podswietla pozycję przy najechaniu myszką
// *****************************************
function SubMenuOut()
{
this.style.backgroundColor = '#05e9d6';
this.style.color = '#0a5e3f';

ObjSub_ = document.getElementById( this.id+'_sub2' );
if ( ObjSub_ )
  {
  ObjSub_.style.visibility = 'hidden';
}

} // koniec SubMenuOut()




//  ustawia zdarzenia z podświetlaniem
// *****************************************
function AnimateSubMenu2( Name_ )
{
Obj_ = document.getElementById(Name_);

if ( Obj_ )
  {
  Obj_.onmouseover = SubMenu2Over;
  Obj_.onmouseout  = SubMenu2Out;
}  
}
// koniec AnimateSubMenu2()




//  podswietla pozycję przy najechaniu myszką
// *****************************************
function SubMenu2Over()
{
this.style.backgroundColor = '#b6fff9';
this.style.color = '#032de2';
} // koniec SubMenu2Over()



//  podswietla pozycję przy najechaniu myszką
// *****************************************
function SubMenu2Out()
{
this.style.backgroundColor = '#05e9d6';
this.style.color = '#0a5e3f';
} // koniec SubMenu2Out()














/// poprawno¶ć formularza kontaktowego
// **********************************************
function SprFormContect()
{
Ok_ = true;

if ( Ok_ && KillAllSpace(document.getElementById('tresc').value).length == 0 )
  {
  alert( 'wprowadĽ tre¶ć wiadomo¶ci' );
  Ok_ = false;
  document.getElementById('tresc').focus();
}  

if ( Ok_ && ( KillAllSpace(document.getElementById('osoba').value).length == 0 && KillAllSpace(document.getElementById('firma').value).length == 0 ) )
  {
  alert( 'podpisz wiadomo¶ć' );
  Ok_ = false;
  document.getElementById('osoba').focus();
}  

if ( Ok_ && KillAllSpace(document.getElementById('email').value).length == 0 )
  {
  alert( 'podaj kontaktowy adres e-mail' );
  Ok_ = false;
  document.getElementById('email').focus();
}  

if ( Ok_ && (!(/^[^? ]{1,}[@]{1}[^? ]{1,}[.]{1}[^? ]{1,}$/.test(document.getElementById('email').value))))
  {
	alert( 'format adresu e-mail nie jest poprawny' );
	document.getElementById('email').focus();
  Ok_ = false; 
}

if ( Ok_ && confirm( 'chcesz wysłać wiadomo¶ć' ) )
  {
	document.getElementById('formContact').submit();
}  

return false;
}  // koniec SprFormContect()




